/* Diva AI panel. Brand tokens from the Diva eSIM design system. */
:root {
  --bg: #F7FBF2;
  --surface: #FFFFFF;
  --ink: #13261A;
  --muted: #5D6E62;
  --line: #DCE7D8;
  --forest: #1B5E35;
  --forest-deep: #10301D;
  --leaf: #5DD87A;
  --leaf-soft: #E4F7E8;
  --danger: #B42318;
  --danger-soft: #FDECEA;
  --radius-sm: 6px;
  --radius: 10px;
  --display: "Space Grotesk", system-ui, sans-serif;
  --body: "Plus Jakarta Sans", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 400 15px/1.55 var(--body);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--display); line-height: 1.2; margin: 0 0 .5rem; letter-spacing: -.01em; }
h1 { font-size: 1.9rem; font-weight: 600; }
h2 { font-size: 1.15rem; font-weight: 600; }
h3 { font-size: .95rem; font-weight: 600; margin-top: 1.1rem; }
p { margin: 0 0 .75rem; }
a { color: var(--forest); text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--leaf); outline-offset: 2px; border-radius: 4px; }
.muted { color: var(--muted); }
.small { font-size: .84rem; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Layout ---------- */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--forest-deep);
  color: #D5E8DA;
  padding: 1.4rem 1rem;
  display: flex; flex-direction: column; gap: 1.6rem;
  position: sticky; top: 0; height: 100vh;
}
.main { padding: 2.2rem clamp(1.2rem, 4vw, 3rem); max-width: 1040px; width: 100%; }

.brand {
  display: inline-flex; align-items: center; gap: .6rem;
  font: 700 1.2rem var(--display); color: #fff; text-decoration: none; letter-spacing: -.02em;
}
.brand-dark { color: var(--ink); margin-bottom: 1.6rem; }
.brand-mark {
  width: 22px; height: 22px; border-radius: 7px;
  background: linear-gradient(135deg, #2da84e, var(--leaf));
  box-shadow: inset 0 0 0 5px rgba(255,255,255,.18);
}

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a, .nav-soon {
  color: #D5E8DA; text-decoration: none; padding: .5rem .7rem; border-radius: var(--radius-sm);
  font-weight: 500;
}
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a[aria-current="page"] { background: rgba(93,216,122,.14); color: #fff; box-shadow: inset 3px 0 0 var(--leaf); }
.nav-soon { color: #7E9A86; cursor: default; display: flex; justify-content: space-between; align-items: center; }
.soon { font-size: .72rem; border: 1px solid #3A5A45; border-radius: 99px; padding: 0 .5rem; }
.nav-heading { margin: 1rem .7rem .3rem; font-size: .78rem; color: #7E9A86; font-weight: 600; }

.me { margin-top: auto; border-top: 1px solid rgba(255,255,255,.1); padding: 1rem .7rem 0; font-size: .88rem; }
.me-name { color: #fff; font-weight: 600; margin: 0; }
.me-role { color: #7E9A86; margin: 0 0 .7rem; }
.me a, .me .link { color: #D5E8DA; display: block; margin-bottom: .3rem; }

/* ---------- Blocks ---------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 1.6rem; }
.back { display: inline-block; font-size: .86rem; margin-bottom: .3rem; }
.back::before { content: "‹ "; }

.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.4rem 1.5rem; margin-bottom: 1.1rem;
}
.panel-flush { padding: 0; overflow-x: auto; }
.panel-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.panel-row p { margin: 0; }
.narrow { max-width: 440px; }
.plain { margin: .2rem 0 0; padding-left: 1.1rem; }

.status { display: inline-block; font-size: .78rem; font-weight: 600; padding: .15rem .6rem; border-radius: 99px; white-space: nowrap; }
.status-off { background: #EEF2EC; color: var(--muted); }
.status-on { background: var(--leaf-soft); color: var(--forest); }

.flash { border-radius: var(--radius-sm); padding: .75rem 1rem; margin-bottom: 1rem; border: 1px solid; }
.flash p { margin: 0; }
.flash-ok { background: var(--leaf-soft); border-color: #B7E7C3; color: var(--forest); }
.flash-error { background: var(--danger-soft); border-color: #F3C4BE; color: var(--danger); }

/* ---------- Forms ---------- */
.stack { display: flex; flex-direction: column; gap: 1rem; }
label { display: flex; flex-direction: column; gap: .35rem; font-weight: 600; font-size: .9rem; }
input:not([type="checkbox"]) {
  font: 400 15px var(--body); color: var(--ink);
  padding: .65rem .8rem; border: 1px solid #C9D8C5; border-radius: var(--radius-sm); background: #fff;
}
input:not([type="checkbox"]):focus { outline: none; border-color: var(--forest); box-shadow: 0 0 0 3px rgba(93,216,122,.35); }
input:disabled { background: #F2F5F0; color: var(--muted); }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--forest); margin: .15rem 0 0; flex: none; }
.hint { display: block; font-weight: 400; font-size: .82rem; color: var(--muted); }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem 1.2rem; }

.switches { display: flex; flex-direction: column; gap: .8rem; margin-top: 1.3rem; padding-top: 1.2rem; border-top: 1px solid var(--line); }
.check { flex-direction: row; align-items: flex-start; gap: .7rem; font-weight: 400; cursor: pointer; }

/* Access list: one row per tool, delete-capable tools marked in red. */
.perms fieldset { border: 0; padding: 0; margin: 1.2rem 0 0; }
.perms legend { font: 600 .95rem var(--display); margin-bottom: .4rem; }
.perm {
  flex-direction: row; align-items: flex-start; gap: .75rem; font-weight: 400; cursor: pointer;
  padding: .7rem .9rem; border-top: 1px solid var(--line);
}
.perm:hover { background: #FAFCF8; }
.perm-danger { box-shadow: inset 3px 0 0 var(--danger); }
.tag-danger { font-size: .74rem; font-weight: 600; color: var(--danger); margin-left: .4rem; }
.admin-note { display: none; }
.perms.is-admin .admin-note { display: block; }
.perms.is-admin fieldset { opacity: .45; }

.actions { display: flex; gap: .6rem; margin-top: .4rem; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  font: 600 .92rem var(--body); text-decoration: none; cursor: pointer;
  padding: .62rem 1.1rem; border-radius: var(--radius-sm);
  border: 1px solid #C9D8C5; background: #fff; color: var(--ink);
}
.btn:hover { border-color: var(--forest); }
.btn-primary { background: var(--forest); border-color: var(--forest); color: #fff; }
.btn-primary:hover { background: #164D2C; }
.btn-wide { width: 100%; padding: .75rem; }
.link { background: none; border: 0; padding: 0; font: inherit; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

/* ---------- Tables ---------- */
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: left; font-weight: 600; font-size: .8rem; color: var(--muted); padding: .8rem 1.1rem; border-bottom: 1px solid var(--line); background: #FAFCF8; }
.table td { padding: .85rem 1.1rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table td strong { display: block; }
.row-off td { color: var(--muted); }
.kv { display: block; }
.action { font-weight: 600; }
.action-bad { color: var(--danger); }

/* ---------- Sign-in ---------- */
.login {
  min-height: 100vh; display: grid; place-items: center; padding: 1.5rem;
  background-color: var(--bg);
  background-image: radial-gradient(rgba(27,94,53,.16) 1.2px, transparent 1.2px);
  background-size: 22px 22px;
}
.login-card {
  width: 100%; max-width: 400px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 14px; padding: 2.2rem 2rem;
  box-shadow: 0 1px 0 var(--line), 0 18px 40px -24px rgba(16,48,29,.35);
}
.login-card h1 { font-size: 1.6rem; margin-bottom: 1.2rem; }
.login-card .hint { margin-top: 1.2rem; }

/* ---------- Small screens ---------- */
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: .8rem; padding: .9rem 1rem; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .nav-heading { display: none; }
  .me { margin: 0; border: 0; padding: 0; display: flex; gap: .8rem; align-items: center; width: 100%; }
  .me-name, .me-role { display: none; }
  .me a, .me .link { margin: 0; }
  .page-head { flex-direction: column; align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
