/* Wood Cal Control Panel - design tokens first, components after. */

/* Brand tokens mirror the Android app (res/values/colors.xml):
   colorBrand #14833E, colorBrandBright #0EB451, premiumGold #C79200,
   and the night palette's deep navy glass + #34D399 green. */
:root {
  --brand-bright: #0EB451;
  --brand-500:    #14833E;
  --brand-600:    #106B33;
  --brand-700:    #0B5227;
  --brand-tint:   rgba(20, 131, 62, .12);
  --gold:         #C79200;

  --ok:    #14833E;
  /* The app's premium gold #C79200 only reaches 2.8:1 on white, so warning TEXT
     uses the dark end of the app's own gold gradient. --gold stays for accents. */
  --warn:  #7A5E10;
  --error: #c0392b;
  --info:  #2b6cb0;

  --ok-tint:    rgba(20, 131, 62, .10);
  --warn-tint:  rgba(199, 146, 0, .14);
  --error-tint: rgba(192, 57, 43, .10);
  --info-tint:  rgba(43, 108, 176, .10);
  --on-brand:   #ffffff;

  --bg:        #F2F6F3;
  --surface:   #ffffff;
  --surface-2: #E9F1EB;
  --border:    #DCE6DE;
  --text:      #1E293B;
  --text-dim:  #64748B;
  --shadow:    0 1px 2px rgba(15,23,42,.05), 0 4px 14px rgba(15,23,42,.06);

  --radius: 10px;
  --radius-sm: 7px;
  --sidebar-w: 248px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

:root[data-theme="dark"] {
  /* Night = the app's "glass" navy; #14833E is unreadable there, so the
     brand shifts to the same #34D399 the app's night nav uses. */
  --bg:        #0D141C;
  --surface:   #121D27;
  --surface-2: #1A2836;
  --border:    #26343F;
  --text:      #F1F5F9;
  --text-dim:  #94A3B8;

  --brand-bright: #34D399;
  --brand-500:    #34D399;
  --brand-600:    #2BBE88;
  --brand-700:    #22A576;
  --brand-tint:   rgba(52, 211, 153, .14);
  --gold:         #FFC64B;

  --ok:    #34D399;
  --warn:  #FFC64B;
  --error: #F08A7A;
  --info:  #7AB3E8;

  --ok-tint:    rgba(52, 211, 153, .14);
  --warn-tint:  rgba(255, 198, 75, .14);
  --error-tint: rgba(240, 138, 122, .14);
  --info-tint:  rgba(122, 179, 232, .14);
  --on-brand:   #0B1B14;

  --shadow: 0 1px 2px rgba(0,0,0,.35), 0 4px 16px rgba(0,0,0,.3);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand-600); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.25; font-weight: 650; }

/* ---------------------------------------------------------------- sign-in */

.auth-body {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px 16px;
  background:
    radial-gradient(1100px 500px at 50% -10%, var(--brand-tint), transparent 70%),
    var(--bg);
}

.auth-wrap { width: 100%; max-width: 460px; }

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 30px 30px 26px;
  box-shadow: var(--shadow);
}

.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.auth-brand h1 { font-size: 19px; margin: 0; letter-spacing: -.2px; }
.auth-brand p  { margin: 0; font-size: 12px; color: var(--text-dim); letter-spacing: .5px; text-transform: uppercase; }

.auth-hint { margin: 16px 0 0; font-size: 12.5px; color: var(--text-dim); text-align: center; }
.auth-foot { margin: 16px 0 0; font-size: 12px; color: var(--text-dim); text-align: center; }

/* ----------------------------------------------------------------- forms */

.field { display: block; margin-bottom: 14px; }
.field-label { display: block; margin-bottom: 5px; font-size: 12.5px; font-weight: 600; color: var(--text-dim); }

input[type=text], input[type=password], input[type=number], input[type=url],
input[type=email], input[type=search], select, textarea {
  width: 100%;
  padding: 9px 11px;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color .15s, box-shadow .15s;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px var(--brand-tint);
}

textarea { min-height: 90px; resize: vertical; }

.code-input {
  font-family: var(--mono);
  font-size: 26px;
  letter-spacing: 10px;
  text-align: center;
  padding: 12px;
}

/* --------------------------------------------------------------- buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 16px;
  font: inherit;
  font-weight: 600;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .15s, border-color .15s, opacity .15s;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary {
  color: var(--on-brand);
  background: var(--brand-600);
  border-color: var(--brand-600);
}
.btn-primary:hover { background: var(--brand-700); border-color: var(--brand-700); }

.btn-danger { color: #fff; background: var(--error); border-color: var(--error); }
.btn-danger:hover { filter: brightness(.92); background: var(--error); }

.btn-block { width: 100%; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }

/* --------------------------------------------------------------- alerts */

.alert {
  padding: 10px 13px;
  margin-bottom: 16px;
  border: 1px solid;
  border-left-width: 3px;
  border-radius: var(--radius-sm);
  font-size: 13px;
}
.alert-success { color: var(--ok);    border-color: var(--ok);    background: var(--ok-tint); }
.alert-error   { color: var(--error); border-color: var(--error); background: var(--error-tint); }
.alert-warning { color: var(--warn);  border-color: var(--warn);  background: var(--warn-tint); }
.alert-info    { color: var(--info);  border-color: var(--info);  background: var(--info-tint); }

.env-badge {
  display: block;
  padding: 6px 10px;
  margin-bottom: 16px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .6px;
  text-align: center;
  border-radius: var(--radius-sm);
}
.env-local { color: var(--info); background: var(--info-tint); border: 1px dashed var(--info); }

.loc-status {
  padding: 8px 11px;
  margin-bottom: 14px;
  font-size: 12.5px;
  color: var(--text-dim);
  background: var(--surface-2);
  border-radius: var(--radius-sm);
}
.loc-status.ok   { color: var(--ok);    background: var(--ok-tint); }
.loc-status.fail { color: var(--error); background: var(--error-tint); }

/* ------------------------------------------------------------ 2FA set-up */

.enrol { padding-bottom: 18px; margin-bottom: 18px; border-bottom: 1px solid var(--border); }
.enrol-title { font-size: 15px; }
.enrol-step  { margin: 0 0 8px; font-size: 13px; }
.enrol-warn  { margin: 12px 0 0; padding: 9px 11px; font-size: 12.5px; color: var(--warn);
               background: var(--warn-tint); border-radius: var(--radius-sm); }

/* The QR must sit on white to stay scannable, whatever the theme. */
.qr-box { display: grid; place-items: center; padding: 14px; margin: 10px 0;
          background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm); }
/* image-rendering: pixelated keeps the modules square when the browser scales
   the bitmap down; smoothing blurs module edges and scanners then struggle. */
.qr-box img { display: block; width: 240px; max-width: 100%; height: auto; aspect-ratio: 1;
              image-rendering: pixelated; }

.secret-box {
  padding: 9px 11px;
  font-family: var(--mono);
  font-size: 13px;
  word-break: break-all;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

/* --------------------------------------------------------------- tooltip */

.hint {
  display: inline-grid;
  place-items: center;
  width: 15px; height: 15px;
  font-size: 10px;
  font-weight: 700;
  color: var(--surface);
  background: var(--text-dim);
  border-radius: 50%;
  cursor: help;
  position: relative;
  vertical-align: middle;
  border: none;
  padding: 0;
}
/* :focus as well as :hover, so a tap opens the tooltip on touch screens. */
.hint:hover::after,
.hint:focus::after,
.hint:focus-visible::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 7px);
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: 270px;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.5;
  color: var(--text);
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  z-index: 50;
}

/* ------------------------------------------------------------ app layout */

.shell { display: flex; min-height: 100vh; }

.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  z-index: 40;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.sidebar::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb {
  background: var(--border);
  border: 2px solid var(--surface);
  border-radius: 10px;
}
.sidebar:hover::-webkit-scrollbar-thumb { background: var(--text-dim); }

/* The same treatment anywhere else that scrolls */
.table-wrap, .modal-body, .picker-list, .content {
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.table-wrap::-webkit-scrollbar, .modal-body::-webkit-scrollbar,
.picker-list::-webkit-scrollbar { width: 8px; height: 8px; }
.table-wrap::-webkit-scrollbar-thumb, .modal-body::-webkit-scrollbar-thumb,
.picker-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }
.table-wrap::-webkit-scrollbar-track, .modal-body::-webkit-scrollbar-track,
.picker-list::-webkit-scrollbar-track { background: transparent; }

.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--border);
}
.sidebar-brand strong { font-size: 15px; }
.sidebar-brand span { display: block; font-size: 10.5px; letter-spacing: .5px;
                      text-transform: uppercase; color: var(--text-dim); }

.nav { flex: 1; padding: 10px 10px 18px; }
.nav-group { margin-top: 14px; padding: 0 8px 5px; font-size: 10.5px; font-weight: 700;
             letter-spacing: .7px; text-transform: uppercase; color: var(--text-dim); }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  margin-bottom: 1px;
  font-size: 13.5px;
  color: var(--text);
  border-radius: var(--radius-sm);
}
.nav-item:hover { background: var(--surface-2); text-decoration: none; }
.nav-item.active { color: var(--on-brand); background: var(--brand-600); font-weight: 600; }
.nav-item svg { width: 17px; height: 17px; flex: none; }
.nav-badge { margin-left: auto; padding: 1px 6px; font-size: 11px; font-weight: 700;
             background: var(--surface-2); border-radius: 20px; }
.nav-item.active .nav-badge { background: rgba(0,0,0,.18); color: var(--on-brand); }

.main { flex: 1; min-width: 0; margin-left: var(--sidebar-w); display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 22px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.topbar h1 { margin: 0; font-size: 16px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.topbar-user { font-size: 12.5px; color: var(--text-dim); }

.icon-btn {
  display: grid; place-items: center;
  width: 32px; height: 32px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); }

.content { flex: 1; padding: 22px; }

.menu-toggle { display: none; }

/* --------------------------------------------------------------- content */

.card {
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
/* Everything stacked directly in the page (or in a page-level form) gets the
   same gap. Relying on .card + .card missed a card after a grid, and a submit
   button after a card, which is why things looked glued together. */
.content > * + *,
.content > form > * + * { margin-top: 16px; }
.card-title { display: flex; align-items: center; gap: 7px; margin-bottom: 14px; font-size: 14px; }

.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }

.stat-label { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-dim); }
.stat-value { font-size: 27px; font-weight: 700; letter-spacing: -.5px; }
.stat-note  { font-size: 12px; color: var(--text-dim); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 9px 11px; text-align: left; border-bottom: 1px solid var(--border); }
th { font-size: 11.5px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase;
     color: var(--text-dim); white-space: nowrap; }
tbody tr:hover { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: none; }

.pill { display: inline-block; padding: 2px 8px; font-size: 11.5px; font-weight: 600; border-radius: 20px; }
.pill-ok    { color: var(--ok);    background: var(--ok-tint); }
.pill-warn  { color: var(--warn);  background: var(--warn-tint); }
.pill-error { color: var(--error); background: var(--error-tint); }
.pill-dim   { color: var(--text-dim); background: var(--surface-2); }

.empty { padding: 34px 18px; text-align: center; color: var(--text-dim); }

/* ------------------------------------------------------------ responsive */

/* Phones: the sign-in card fills the screen instead of floating in the middle. */
@media (max-width: 520px) {
  .auth-body { padding: 0; align-items: stretch; }
  .auth-wrap { max-width: none; display: flex; flex-direction: column; min-height: 100vh; }
  .auth-card {
    flex: 1;
    border: none;
    border-radius: 0;
    padding: 26px 18px 30px;
    box-shadow: none;
    background: var(--bg);
  }
  .auth-foot { padding: 0 18px 18px; }
  .code-input { font-size: 22px; letter-spacing: 7px; }
  .qr-box img { width: 100%; max-width: 260px; }
  .hint:hover::after { max-width: min(270px, calc(100vw - 48px)); }
}

@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; }
  body.nav-open .sidebar { transform: none; box-shadow: var(--shadow); }
  .main { margin-left: 0; }
  .menu-toggle { display: grid; }
  .content { padding: 16px; }
  .topbar { padding: 11px 16px; }
  body.nav-open::after {
    content: ''; position: fixed; inset: 0; z-index: 35; background: rgba(0,0,0,.4);
  }
}

/* ==========================================================================
   List furniture: headers, filters, pro tables, modals
   ========================================================================== */

/* ---- page header with the brand accent bar ---- */
.page-head { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head-bar { width: 4px; align-self: stretch; min-height: 34px; border-radius: 3px;
                 background: linear-gradient(to bottom, var(--brand-bright), var(--brand-500)); }
.page-head h2 { margin: 0; font-size: 18px; letter-spacing: -.2px; }
.page-head p  { margin: 2px 0 0; font-size: 12.5px; color: var(--text-dim); }
.page-head-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---- stat chips above a list ---- */
.badge-strip { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 14px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px;
  font-size: 12px; font-weight: 600;
  color: var(--text-dim);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
}
.chip b { color: var(--text); font-variant-numeric: tabular-nums; }
.chip-ok    { color: var(--ok);    border-color: var(--ok);    background: var(--ok-tint); }
.chip-warn  { color: var(--warn);  border-color: var(--warn);  background: var(--warn-tint); }
.chip-error { color: var(--error); border-color: var(--error); background: var(--error-tint); }
.chip-ok b, .chip-warn b, .chip-error b { color: inherit; }

/* ---- segmented sub-filters: the "tabs" above a list ---- */
.seg { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px;
       background: var(--surface-2); border-radius: 9px; }
.seg a {
  padding: 6px 12px;
  font-size: 12.5px; font-weight: 600;
  color: var(--text-dim);
  border-radius: 6px;
  white-space: nowrap;
}
.seg a:hover { color: var(--text); text-decoration: none; background: var(--surface); }
.seg a.on { color: var(--on-brand); background: var(--brand-600); }
.seg a .n { opacity: .72; font-weight: 500; }

/* ---- the table ---- */
table.pro { border-collapse: separate; border-spacing: 0; }
/* One flat colour across the whole header row: a gradient shows visible
   bands where cells meet, which reads as a rendering fault rather than design. */
table.pro thead th {
  padding: 12px 11px;
  color: #fff;
  background: #14472B;
  border: none;
  font-size: 11px; letter-spacing: .5px;
}
:root[data-theme="dark"] table.pro thead th { background: #17342A; }
table.pro thead th:first-child { border-radius: 9px 0 0 9px; }
table.pro thead th:last-child  { border-radius: 0 9px 9px 0; text-align: right; }
table.pro tbody tr:nth-child(even) { background: var(--surface-2); }
table.pro tbody tr:hover { background: var(--brand-tint); }
table.pro td { padding: 10px 11px; white-space: nowrap; }
table.pro .wrap { white-space: normal; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* sortable header buttons */
.th-sort { display: inline-flex; align-items: center; gap: 5px; padding: 0; font: inherit;
           color: inherit; background: none; border: none; cursor: pointer; }
.th-sort:hover { opacity: .82; text-decoration: none; }
.th-sort svg { width: 12px; height: 12px; opacity: .6; }
.th-sort.act svg { opacity: 1; }

/* ---- identity cell ---- */
.who { display: flex; align-items: center; gap: 10px; }
.avatar {
  display: grid; place-items: center;
  width: 36px; height: 36px; flex: none;
  font-size: 12.5px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, var(--brand-bright), var(--brand-700));
  border-radius: 50%;
  overflow: hidden;
}
:root[data-theme="dark"] .avatar { color: var(--on-brand); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.who-name { font-weight: 600; display: flex; align-items: center; gap: 6px; }
.who-sub  { font-size: 11.5px; color: var(--text-dim); }
.mono { font-family: var(--mono); font-size: 12px; }

.dot { width: 7px; height: 7px; border-radius: 50%; flex: none; display: inline-block; }
.dot-on { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-tint); }

/* ---- colour-coded row actions ---- */
.row-actions { display: flex; gap: 5px; justify-content: flex-end; }
.iact {
  display: grid; place-items: center;
  width: 30px; height: 30px;
  border: 1px solid transparent; border-radius: 7px;
  cursor: pointer; background: var(--surface-2); color: var(--text-dim);
  transition: transform .12s, filter .12s;
}
.iact:hover { transform: translateY(-1px); filter: brightness(1.08); text-decoration: none; }
.iact svg { width: 15px; height: 15px; }
.iact-view { color: var(--info);       background: var(--info-tint); }
.iact-edit { color: var(--warn);       background: var(--warn-tint); }
.iact-note { color: var(--brand-500);  background: var(--brand-tint); }
.iact-del  { color: var(--error);      background: var(--error-tint); }

/* ---- pagination ---- */
.pg { display: flex; align-items: center; justify-content: space-between;
      gap: 12px; flex-wrap: wrap; margin-top: 14px; }
.pg-info { font-size: 12.5px; color: var(--text-dim); }
.pg-info b { color: var(--text); }
.pg-pages { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.pg-btn {
  min-width: 30px; height: 30px; padding: 0 9px;
  display: inline-grid; place-items: center;
  font-size: 12.5px; font-weight: 600;
  color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 7px;
}
.pg-btn:hover { background: var(--surface-2); text-decoration: none; }
.pg-btn.on { color: var(--on-brand); background: var(--brand-600); border-color: var(--brand-600); }
.pg-btn.off { opacity: .4; pointer-events: none; }
.pg-gap { padding: 0 3px; color: var(--text-dim); }

/* ---- modal ---- */
.modal-back {
  position: fixed; inset: 0; z-index: 90;
  display: grid; place-items: center;
  padding: 18px;
  background: rgba(0,0,0,.55);
  overflow-y: auto;
}
.modal-back[hidden] { display: none; }
.modal {
  width: 100%; max-width: 620px;
  max-height: calc(100vh - 36px);
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 13px;
  box-shadow: 0 18px 50px rgba(0,0,0,.35);
}
.modal-head {
  display: flex; align-items: center; gap: 10px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--border);
}
.modal-head h3 { margin: 0; font-size: 15.5px; }
.modal-x {
  margin-left: auto; width: 28px; height: 28px;
  display: grid; place-items: center;
  color: var(--text-dim); background: none;
  border: none; border-radius: 6px; cursor: pointer; font-size: 18px; line-height: 1;
}
.modal-x:hover { background: var(--surface-2); color: var(--text); }
.modal-body { padding: 18px; overflow-y: auto; }
.modal-foot {
  display: flex; gap: 8px; justify-content: flex-end;
  padding: 13px 18px;
  border-top: 1px solid var(--border);
}

/* label/value grid inside a modal */
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(185px, 1fr)); gap: 14px 20px; }
.kv-k { font-size: 10.5px; font-weight: 700; letter-spacing: .5px;
        text-transform: uppercase; color: var(--text-dim); }
.kv-v { font-size: 13.5px; margin-top: 2px; word-break: break-word; }

.hero { display: flex; align-items: center; gap: 13px;
        padding-bottom: 15px; margin-bottom: 15px; border-bottom: 1px solid var(--border); }
.hero .avatar { width: 52px; height: 52px; font-size: 17px; }
.hero h4 { margin: 0; font-size: 16px; }

/* spells out what a destructive action actually does */
.danger-box {
  padding: 11px 13px; margin-bottom: 14px;
  font-size: 12.5px; line-height: 1.6;
  color: var(--error); background: var(--error-tint);
  border: 1px solid var(--error); border-left-width: 3px;
  border-radius: var(--radius-sm);
}
.danger-box ul { margin: 7px 0 0; padding-left: 18px; }

/* ---- sidebar submenus ---- */
.nav-group-btn {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 10px; margin-bottom: 1px;
  font: inherit; font-size: 13.5px; color: var(--text);
  background: none; border: none; border-radius: var(--radius-sm);
  cursor: pointer; text-align: left;
}
.nav-group-btn:hover { background: var(--surface-2); }
.nav-group-btn.open { color: var(--brand-500); font-weight: 600; }
.nav-group-btn svg.ico { width: 17px; height: 17px; flex: none; }
.nav-caret { margin-left: auto; width: 13px; height: 13px; transition: transform .2s; }
.nav-group-btn.open .nav-caret { transform: rotate(180deg); }
.nav-sub { margin: 2px 0 6px 15px; padding-left: 11px; border-left: 2px solid var(--border); }
.nav-sub a {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 9px; margin-bottom: 1px;
  font-size: 12.5px; color: var(--text-dim); border-radius: 6px;
}
.nav-sub a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.nav-sub a.active { color: var(--on-brand); background: var(--brand-600); font-weight: 600; }
.nav-sub .n { margin-left: auto; font-size: 11px; opacity: .7; }

@media (max-width: 720px) {
  .modal { max-width: none; }
  .row-actions { justify-content: flex-start; }
  table.pro thead th { font-size: 10.5px; padding: 10px 8px; }
  table.pro td { padding: 9px 8px; }
}

/* ---- image picker: upload a file or paste a URL, with a live preview ---- */
.imgpick { display: flex; gap: 13px; align-items: flex-start; flex-wrap: wrap; }
.imgpick-prev {
  width: 74px; height: 74px; flex: none;
  display: grid; place-items: center;
  font-size: 11px; color: var(--text-dim); text-align: center;
  background: var(--surface-2);
  border: 1px dashed var(--border);
  border-radius: 9px;
  overflow: hidden;
}
.imgpick-prev img { width: 100%; height: 100%; object-fit: cover; }
.imgpick-main { flex: 1; min-width: 210px; }
.imgpick-tabs { display: inline-flex; gap: 3px; padding: 3px; margin-bottom: 8px;
                background: var(--surface-2); border-radius: 7px; }
.imgpick-tabs button {
  padding: 4px 11px; font: inherit; font-size: 12px; font-weight: 600;
  color: var(--text-dim); background: none; border: none; border-radius: 5px; cursor: pointer;
}
.imgpick-tabs button.on { color: var(--on-brand); background: var(--brand-600); }
.imgpick-hint { margin: 6px 0 0; font-size: 11.5px; color: var(--text-dim); }

/* ---- video thumbnail in a list row ---- */
.vthumb {
  position: relative; display: block;
  width: 86px; height: 48px; flex: none;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px; overflow: hidden;
}
.vthumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vthumb::after {
  content: ''; position: absolute; inset: 0; margin: auto;
  width: 0; height: 0;
  border-left: 11px solid rgba(255,255,255,.92);
  border-top: 7px solid transparent; border-bottom: 7px solid transparent;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,.6));
}
.vthumb:hover { border-color: var(--brand-500); }

/* 16:9 preview inside a form or modal */
.vframe { position: relative; width: 100%; max-width: 420px; aspect-ratio: 16/9;
          background: #000; border-radius: 9px; overflow: hidden; border: 1px solid var(--border); }
.vframe img { width: 100%; height: 100%; object-fit: cover; }
.vframe iframe { width: 100%; height: 100%; border: 0; }

/* ---- user picker (push notification) ---- */
.picker { position: relative; }
.picker-list {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 60;
  max-height: 260px; overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 9px;
  box-shadow: var(--shadow);
}
.picker-list[hidden] { display: none; }
.picker-item {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 8px 11px; font: inherit; text-align: left;
  color: var(--text); background: none; border: none; cursor: pointer;
}
.picker-item:hover, .picker-item.sel { background: var(--brand-tint); }
.picker-item .avatar { width: 30px; height: 30px; font-size: 11px; }
.picker-empty { padding: 14px; font-size: 12.5px; color: var(--text-dim); text-align: center; }
.picked {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 11px;
  background: var(--brand-tint);
  border: 1px solid var(--brand-500);
  border-radius: var(--radius-sm);
}

/* ---- placeholder for a missing picture ---- */
.img-ph {
  display: grid; place-items: center;
  color: var(--text-dim);
  background: var(--surface-2);
  border: 1px dashed var(--border);
  border-radius: 7px;
}
.img-ph svg { width: 45%; height: 45%; opacity: .55; }

.thumb {
  width: 38px; height: 38px; flex: none;
  object-fit: cover; border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--surface-2);
}

/* ---- link rows (App Links) ---- */
.linkrow { display: flex; align-items: center; gap: 11px; }
.linkrow-ico {
  display: grid; place-items: center;
  width: 34px; height: 34px; flex: none;
  color: var(--brand-500);
  background: var(--brand-tint);
  border-radius: 9px;
}
.linkrow-ico svg { width: 17px; height: 17px; }
.linkrow-ico.unused { color: var(--text-dim); background: var(--surface-2); }
.linkrow-main { min-width: 0; }
.linkrow-url {
  display: inline-block; max-width: 320px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  vertical-align: bottom;
  font-size: 12px; color: var(--text-dim);
}

/* ---- notification bell ---- */
.bell { position: relative; }
.bell-count {
  position: absolute; top: -3px; right: -3px;
  min-width: 16px; height: 16px; padding: 0 4px;
  display: grid; place-items: center;
  font-size: 10px; font-weight: 700; line-height: 1;
  color: #fff; background: var(--error);
  border: 2px solid var(--surface);
  border-radius: 10px;
}
.bell-panel {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 70;
  width: min(92vw, 360px);
  max-height: 420px; overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 11px;
  box-shadow: var(--shadow);
}
.bell-panel[hidden] { display: none; }
.bell-head {
  display: flex; align-items: center; gap: 8px;
  padding: 11px 14px;
  font-size: 12.5px; font-weight: 700;
  border-bottom: 1px solid var(--border);
}
.bell-item {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
}
.bell-item:last-child { border-bottom: none; }
.bell-item:hover { background: var(--surface-2); text-decoration: none; }
.bell-ico {
  display: grid; place-items: center;
  width: 28px; height: 28px; flex: none;
  border-radius: 8px;
}
.bell-ico svg { width: 14px; height: 14px; }
.bell-when { font-size: 11px; color: var(--text-dim); margin-top: 2px; }

/* ---- admin profile ---- */
.profile-hero {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding-bottom: 17px; margin-bottom: 17px;
  border-bottom: 1px solid var(--border);
}
.profile-hero .avatar { width: 74px; height: 74px; font-size: 25px; }
.profile-hero h3 { margin: 0 0 3px; font-size: 18px; }

.topbar .who .avatar { width: 28px; height: 28px; font-size: 11px; }
.topbar .who:hover { text-decoration: none; opacity: .85; }
@media (max-width: 720px) { .topbar .who .topbar-user { display: none; } }

.iact-gift { color: var(--gold); background: var(--warn-tint); }
