
:root {
  --brand:        #2563eb;
  --brand-dark:   #1e40af;
  --brand-light:  #dbeafe;
  --brand-fg:     #ffffff;
  --bg:           #f1f5f9;
  --surface:      #ffffff;
  --surface-2:    #f8fafc;
  --border:       #e2e8f0;
  --text:         #0f172a;
  --text-2:       #475569;
  --text-3:       #94a3b8;
  --ok:           #16a34a;
  --ok-bg:        #f0fdf4;
  --warn:         #d97706;
  --warn-bg:      #fffbeb;
  --bad:          #dc2626;
  --bad-bg:       #fef2f2;

  --appbar-h:     64px;
  --bottomnav-h:  62px;
  --sidebar-w:    248px;
  --safe-b:       env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

a { color: var(--brand); text-decoration: none; }
h1, h2, h3, h4 { margin: 0; line-height: 1.3; }
img { max-width: 100%; display: block; }

/* Inline SVGs carry no intrinsic size, and inside a flex row an unsized icon
   stretches to fill the container. This is the safety net; the component rules
   further down override it. */
svg { width: 20px; height: 20px; flex: 0 0 auto; }

/* Hide focus rings for pointer users, keep them for keyboards. */
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ---------------------------------------------------------------- app bar */

/* White strip on mobile: the brand colour stays as an accent on the icons and
   the active tab, and the status bar above it is themed white to match. */
.appbar {
  position: sticky; top: 0; z-index: 40;
  height: var(--appbar-h);
  display: flex; align-items: center; gap: 12px;
  padding: 0 14px;
  background: var(--surface); color: var(--text);
  border-bottom: 1px solid var(--border);
}
.appbar-brand { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.appbar-logo {
  width: 38px; height: 38px; flex: 0 0 auto;
  background: var(--brand-light); color: var(--brand-dark);
  display: grid; place-items: center;
  font-weight: 700; font-size: 16px; overflow: hidden;
}
.appbar-logo img { width: 100%; height: 100%; object-fit: cover; }

/* Uploaded artwork is never cropped — it scales to fit the bar height.
   Bounds are absolute rather than percentage: `height: 100%` does not resolve
   against a grid/flex parent here, and the image would fall back to its own
   aspect ratio and spill out below the bar. */
.appbar-logo.has-logo {
  width: auto; max-width: 170px; height: 46px;
  background: none; overflow: hidden;
  display: flex; align-items: center; justify-content: flex-start;
}
.appbar-logo.has-logo img {
  width: auto; height: auto;
  max-width: 100%; max-height: 46px;
  object-fit: contain;
}

/* Page title sits on the right, opposite the logo, ahead of the actions. */
.appbar-titles { min-width: 0; margin-left: auto; text-align: right; }
.appbar-title {
  font-size: 16px; font-weight: 650; letter-spacing: -.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.appbar-sub { font-size: 11px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appbar-actions { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.appbar-btn {
  width: 38px; height: 38px; border: 0;
  background: var(--surface-2); color: var(--brand);
  display: grid; place-items: center; cursor: pointer;
}
.appbar-btn:active { background: var(--brand-light); }
.appbar-btn svg { width: 19px; height: 19px; }

/* ------------------------------------------------------------ page layout */

.shell { display: block; }

.main { padding-bottom: calc(var(--bottomnav-h) + var(--safe-b) + 16px); }

.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 16px 14px 0; }

.page-head { margin: 4px 0 14px; }
.page-head h1 { font-size: 20px; letter-spacing: -.02em; }
.page-head p { margin: 4px 0 0; color: var(--text-2); font-size: 13px; }
.page-head-row { display: flex; align-items: flex-start; gap: 12px; justify-content: space-between; flex-wrap: wrap; }

/* -------------------------------------------------------------- bottom nav */

.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
  height: calc(var(--bottomnav-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  display: flex; align-items: stretch;
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.bottom-nav a {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px;
  color: var(--text-3); font-size: 10.5px; font-weight: 600;
  padding-top: 6px; position: relative;
}
.bottom-nav a svg { width: 22px; height: 22px; }
.bottom-nav a.active { color: var(--brand); }
.bottom-nav a.active::before {
  content: ''; position: absolute; top: 0; width: 26px; height: 3px;
  background: var(--brand);
}

/* ---------------------------------------------------------------- sidebar */

.sidebar { display: none; }

/* ------------------------------------------------------------------ cards */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  margin-bottom: 14px;
  overflow: hidden;
}
.card-head {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.card-head > svg { width: 17px; height: 17px; color: var(--brand); }
.card-head h2, .card-head h3 { font-size: 14px; font-weight: 700; letter-spacing: -.01em; flex: 1; }
.card-head .badge { flex: 0 0 auto; }
.card-body { padding: 16px; }
.card-body.tight { padding: 8px 16px 16px; }
.card-foot {
  padding: 12px 16px; border-top: 1px solid var(--border);
  background: var(--surface-2); display: flex; gap: 8px; flex-wrap: wrap;
}

/* Section label above a group of cards (Section-I, Section-II …) */
.section-title {
  display: flex; align-items: center; gap: 8px;
  margin: 22px 0 10px; font-size: 12px; font-weight: 800;
  letter-spacing: .07em; text-transform: uppercase; color: var(--text-2);
}
.section-title::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.section-title .n svg { width: 13px; height: 13px; }
.section-title .n {
  display: grid; place-items: center;
  width: 22px; height: 22px;
  background: var(--brand-light); color: var(--brand-dark);
  font-size: 11px; font-weight: 800; letter-spacing: 0;
}

/* ------------------------------------------------------------------ stats */

.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 4px; }
.stat {
  background: var(--surface); border: 1px solid var(--border);
  padding: 14px;
}
.stat .stat-ico {
  width: 34px; height: 34px; margin-bottom: 10px;
  background: var(--brand-light); color: var(--brand-dark);
  display: grid; place-items: center;
}
.stat .stat-ico svg { width: 18px; height: 18px; }
.stat .stat-val { font-size: 24px; font-weight: 750; letter-spacing: -.03em; }
.stat .stat-lbl { font-size: 11.5px; color: var(--text-2); font-weight: 600; margin-top: 2px; }

/* ---------------------------------------------------------- profile header */

.profile-hero {
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #fff;
  padding: 18px; margin-bottom: 14px;
  display: flex; align-items: center; gap: 14px;
}
.profile-hero .avatar-lg {
  width: 66px; height: 66px; flex: 0 0 auto;
  background: rgba(255,255,255,.2); overflow: hidden;
  display: grid; place-items: center;
  font-size: 24px; font-weight: 700;
  border: 2px solid rgba(255,255,255,.4);
}
.profile-hero .avatar-lg img { width: 100%; height: 100%; object-fit: cover; }
.profile-hero .who { min-width: 0; flex: 1; }
.profile-hero .who h2 { font-size: 18px; letter-spacing: -.02em; }
.profile-hero .who .meta { font-size: 12.5px; opacity: .9; margin-top: 3px; }
.profile-hero .chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.profile-hero .chip {
  background: rgba(255,255,255,.18);
  padding: 3px 9px; font-size: 11px; font-weight: 600;
}

/* ------------------------------------------------------- key/value display */

/* Grid lines come from a ring on each cell rather than the container's
   background, so a half-filled last row stays white instead of showing
   grey gaps where cells are missing. */
.kv { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--surface); }
.kv > div { background: var(--surface); outline: 1px solid var(--border); padding: 11px 14px; min-width: 0; }
.kv .k { font-size: 11px; color: var(--text-3); font-weight: 700; letter-spacing: .03em; text-transform: uppercase; }
.kv .v { font-size: 14px; margin-top: 3px; word-break: break-word; }
.kv > div.span-2 { grid-column: 1 / -1; }

/* ------------------------------------------------------------------- lists */

.list { list-style: none; margin: 0; padding: 0; }
.list-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  color: inherit;
}
.list-item:last-child { border-bottom: 0; }
.list-item:active { background: var(--surface-2); }
.avatar {
  width: 42px; height: 42px; flex: 0 0 auto;
  background: var(--brand-light); color: var(--brand-dark);
  display: grid; place-items: center; overflow: hidden;
  font-weight: 700; font-size: 15px;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar svg { width: 20px; height: 20px; }
.list-item .li-body { flex: 1; min-width: 0; }
.list-item .li-title {
  font-weight: 650; font-size: 14.5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.list-item .li-sub {
  font-size: 12px; color: var(--text-2); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.list-item .li-end { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; }
.chev { color: var(--text-3); }
.chev svg { width: 18px; height: 18px; }

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

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 11px 16px; border: 1px solid transparent;
  font-size: 14px; font-weight: 650; cursor: pointer;
  background: var(--brand); color: var(--brand-fg);
  transition: filter .15s, background .15s;
  white-space: nowrap;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { filter: brightness(.94); }
.btn svg { width: 17px; height: 17px; }
.btn.ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn.ghost:hover { background: var(--surface-2); filter: none; }
.btn.soft { background: var(--brand-light); color: var(--brand-dark); }
.btn.danger { background: var(--bad); color: #fff; }
.btn.sm { padding: 7px 11px; font-size: 12.5px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-icon {
  width: 32px; height: 32px; flex: 0 0 auto;
  border: 1px solid var(--border);
  background: var(--surface); color: var(--text-2);
  display: grid; place-items: center; cursor: pointer;
  font-size: 17px; line-height: 1;
}
.btn-icon svg { width: 16px; height: 16px; }
.btn-icon:hover { background: var(--surface-2); }
.btn-icon.danger { color: var(--bad); border-color: #fecaca; background: var(--bad-bg); }

.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* Floating action button (mobile) */
.fab {
  position: fixed; right: 16px; z-index: 44;
  bottom: calc(var(--bottomnav-h) + var(--safe-b) + 16px);
  width: 54px; height: 54px; border: 0;
  background: var(--brand); color: var(--brand-fg);
  display: grid; place-items: center; cursor: pointer;
}
.fab svg { width: 24px; height: 24px; }

/* ------------------------------------------------------------------ badges */

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px;
  font-size: 11px; font-weight: 700; letter-spacing: .01em;
  background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border);
}
.badge.ok    { background: var(--ok-bg);   color: var(--ok);   border-color: #bbf7d0; }
.badge.warn  { background: var(--warn-bg); color: var(--warn); border-color: #fde68a; }
.badge.bad   { background: var(--bad-bg);  color: var(--bad);  border-color: #fecaca; }
.badge.brand { background: var(--brand-light); color: var(--brand-dark); border-color: transparent; }

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

.alert {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px;
  font-size: 13.5px; margin-bottom: 14px; border: 1px solid transparent;
}
.alert.success { background: var(--ok-bg);   color: #166534; border-color: #bbf7d0; }
.alert.error   { background: var(--bad-bg);  color: #991b1b; border-color: #fecaca; }
.alert.warning { background: var(--warn-bg); color: #92400e; border-color: #fde68a; }
.alert.info    { background: var(--brand-light); color: var(--brand-dark); border-color: transparent; }
.alert > svg { width: 19px; height: 19px; margin-top: 1px; }
.alert ul { margin: 4px 0 0; padding-left: 18px; }

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

.form-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
.field { min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field label {
  display: block; font-size: 12px; font-weight: 700;
  color: var(--text-2); margin-bottom: 6px; letter-spacing: .01em;
}
.field .req { color: var(--bad); }
.hint { display: block; margin-top: 5px; font-size: 11.5px; color: var(--text-3); }

input[type=text], input[type=email], input[type=tel], input[type=number],
input[type=date], input[type=password], input[type=search], select, textarea {
  width: 100%; padding: 11px 12px;
  border: 1px solid #d5dce5;
  background: var(--surface); color: var(--text);
  font: inherit; font-size: 15px;   /* 15px avoids iOS zoom-on-focus */
  transition: border-color .15s;
  -webkit-appearance: none; appearance: none;
}
textarea { resize: vertical; }
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 16px;
  padding-right: 34px;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--brand);
  outline: 2px solid var(--brand); outline-offset: -2px;
}
input[readonly] { background: var(--surface-2); color: var(--text-2); }
input[type=color] { width: 100%; height: 46px; padding: 4px; border: 1px solid #d5dce5; background: var(--surface); }
input[type=file] {
  width: 100%; font-size: 13px; padding: 9px;
  border: 1px dashed #cbd5e1; background: var(--surface-2);
}

fieldset { border: 0; margin: 0; padding: 0; }

/* Sticky save bar at the bottom of long forms */
.form-actions {
  position: sticky; bottom: calc(var(--bottomnav-h) + var(--safe-b));
  z-index: 30; margin: 16px -14px 0;
  padding: 12px 14px calc(12px + var(--safe-b));
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex; gap: 10px;
}
.form-actions .btn { flex: 1; }

/* -------------------------------------------------------------------- tabs */

.tabs {
  display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none;
  padding: 4px; margin-bottom: 14px;
  background: var(--surface); border: 1px solid var(--border);
  -webkit-overflow-scrolling: touch;
}
.tabs::-webkit-scrollbar { display: none; }
.tab-btn {
  flex: 0 0 auto; border: 0; cursor: pointer;
  padding: 9px 15px;
  background: transparent; color: var(--text-2);
  font-size: 13px; font-weight: 650; white-space: nowrap;
}
.tab-btn[aria-selected="true"] { background: var(--brand); color: var(--brand-fg); }
.tab-panel[hidden] { display: none; }

/* --------------------------------------------------------- accordions (v2) */

details.acc {
  background: var(--surface); border: 1px solid var(--border);
  margin-bottom: 12px; overflow: hidden;
}
details.acc > summary {
  padding: 13px 16px; cursor: pointer; list-style: none;
  display: flex; align-items: center; gap: 10px;
  font-size: 14px; font-weight: 700; background: var(--surface-2);
}
details.acc > summary::-webkit-details-marker { display: none; }
details.acc > summary .sum-ico {
  width: 28px; height: 28px; flex: 0 0 auto;
  background: var(--brand-light); color: var(--brand-dark);
  display: grid; place-items: center;
}
details.acc > summary .sum-ico svg { width: 15px; height: 15px; }
details.acc > summary .sum-t { flex: 1; min-width: 0; }
details.acc > summary .caret { color: var(--text-3); transition: transform .2s; }
details.acc > summary .caret svg { width: 18px; height: 18px; }
details.acc[open] > summary .caret { transform: rotate(180deg); }
details.acc[open] > summary { border-bottom: 1px solid var(--border); }
.acc-body { padding: 0; }

/* ------------------------------------------------------------------ tables */

.table-wrap {
  overflow-x: auto; -webkit-overflow-scrolling: touch;
}
table.data {
  width: 100%; border-collapse: collapse; font-size: 13.5px;
  min-width: 620px;
}
table.data th, table.data td {
  padding: 10px 12px; text-align: left; vertical-align: middle;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
table.data th {
  background: var(--surface-2); color: var(--text-2);
  font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em;
  position: sticky; top: 0; z-index: 1;
}
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data td.wrap, table.data th.wrap { white-space: normal; min-width: 160px; }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; }

/* Editable repeatable tables inside the admin form */
table.grid-edit { width: 100%; border-collapse: separate; border-spacing: 0 6px; min-width: 720px; }
table.grid-edit th {
  padding: 4px 8px; text-align: left; font-size: 11px; font-weight: 800;
  color: var(--text-2); text-transform: uppercase; letter-spacing: .05em; white-space: nowrap;
}
table.grid-edit td { padding: 0 4px; vertical-align: top; }
table.grid-edit input, table.grid-edit select, table.grid-edit textarea {
  padding: 8px 9px; font-size: 13.5px; min-width: 110px;
}
table.grid-edit td.row-actions { width: 40px; padding-top: 3px; }
table.grid-edit tbody tr.tpl { display: none; }

.grid-edit-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-top: 10px; flex-wrap: wrap;
}
.empty-rows { font-size: 13px; color: var(--text-3); }

/* -------------------------------------------------------------- empty state */

.empty {
  text-align: center; padding: 34px 20px; color: var(--text-2);
}
.empty .empty-ico {
  width: 54px; height: 54px; margin: 0 auto 12px;
  background: var(--brand-light); color: var(--brand-dark);
  display: grid; place-items: center;
}
.empty .empty-ico svg { width: 26px; height: 26px; }
.empty h3 { font-size: 15px; margin-bottom: 4px; }
.empty p { margin: 0 0 14px; font-size: 13px; }
.nil { color: var(--text-3); font-size: 13px; padding: 14px 16px; }

/* ------------------------------------------------------------ search / bar */

.toolbar { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.toolbar form { display: flex; gap: 8px; flex: 1; min-width: 0; flex-wrap: wrap; }
.search-wrap { position: relative; flex: 1; min-width: 170px; }
.search-wrap svg {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  width: 17px; height: 17px; color: var(--text-3); pointer-events: none;
}
.search-wrap input { padding-left: 34px; }
.toolbar select { width: auto; min-width: 130px; }

/* ------------------------------------------------------------- pagination */

.pager { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 14px 0 4px; flex-wrap: wrap; }
.pager a, .pager span {
  min-width: 36px; padding: 8px 10px; text-align: center;
  font-size: 13px; font-weight: 650;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
}
.pager .cur { background: var(--brand); color: var(--brand-fg); border-color: transparent; }
.pager .off { opacity: .45; pointer-events: none; }

/* ------------------------------------------------------------ photo picker */

.photo-picker { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.photo-preview {
  width: 84px; height: 84px; flex: 0 0 auto;
  background: var(--surface-2); border: 1px solid var(--border);
  overflow: hidden; display: grid; place-items: center; color: var(--text-3);
}
.photo-preview img { width: 100%; height: 100%; object-fit: cover; }
.photo-picker .pp-controls { flex: 1; min-width: 180px; }

/* ------------------------------------------------------------------ login */

.auth-page {
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column;
  background:
    radial-gradient(1100px 460px at 50% -160px, color-mix(in srgb, var(--brand) 26%, transparent), transparent),
    var(--bg);
  padding: 0 16px calc(20px + var(--safe-b));
}
.auth-wrap { width: 100%; max-width: 400px; margin: auto; padding: 28px 0 8px; }
.auth-brand { text-align: center; margin-bottom: 20px; }
.auth-logo {
  width: 74px; height: 74px; margin: 0 auto 14px;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #fff; display: grid; place-items: center; overflow: hidden;
  font-size: 28px; font-weight: 750;
}
.auth-logo img { width: 100%; height: 100%; object-fit: cover; }

/* With real artwork, drop the gradient tile and show the logo at its own
   aspect ratio — wide wordmarks are no longer cropped to a square. */
.auth-logo.has-logo {
  width: auto; max-width: 260px; height: auto; max-height: 96px;
  background: none;
  display: block; overflow: visible;
}
.auth-logo.has-logo img {
  width: auto; max-width: 100%; height: auto; max-height: 96px;
  object-fit: contain; margin: 0 auto;
}

.auth-brand h1 { font-size: 22px; letter-spacing: -.02em; }
.auth-brand p { margin: 5px 0 0; color: var(--text-2); font-size: 13px; }

.auth-card {
  background: var(--surface); border: 1px solid var(--border);
  padding: 20px;
}
.auth-card .form-grid { gap: 13px; }

/* Checkbox + explanatory text, used for the OTP on/off switch */
.toggle-row {
  display: flex; align-items: flex-start; gap: 11px;
  padding: 12px; border: 1px solid var(--border); background: var(--surface-2);
  cursor: pointer;
}
.toggle-row input[type=checkbox] { width: 18px; height: 18px; margin-top: 2px; flex: 0 0 auto; accent-color: var(--brand); }
.toggle-row > span { display: block; font-size: 13.5px; }
.toggle-row strong { display: block; margin-bottom: 3px; font-size: 14px; }
.toggle-row .muted { font-size: 12.5px; }

/* Header for the second step of sign-in, once the password is accepted */
.step-head {
  display: flex; align-items: flex-start; gap: 11px;
  margin: 0 0 18px; padding: 12px;
  border: 1px solid var(--border); background: var(--surface-2);
}
.step-badge {
  width: 32px; height: 32px; flex: 0 0 auto;
  background: var(--brand-light); color: var(--brand-dark);
  display: grid; place-items: center;
}
.step-badge svg { width: 17px; height: 17px; }
.step-head strong { display: block; font-size: 14px; margin-bottom: 2px; }
.step-head .muted { font-size: 12.5px; }

/* One-time code entry — wide tracking so digits are easy to check */
.otp-input {
  text-align: center;
  font: 700 26px/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 10px; text-indent: 10px;
  padding: 12px 10px !important;
}
.otp-input::placeholder { color: var(--text-3); letter-spacing: 10px; }

.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 44px; }
.pw-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 34px; height: 34px; border: 0;
  background: transparent; color: var(--text-3);
  display: grid; place-items: center; cursor: pointer;
}
.pw-toggle svg { width: 18px; height: 18px; }

.auth-divider {
  display: flex; align-items: center; gap: 10px;
  margin: 22px 0 14px; color: var(--text-3);
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
}
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ------------------------------------------------------------ install CTA */

/* Anything that offers to install the app is pointless once it *is* installed.
   The media query covers browsers that report display-mode; the .is-installed
   class (set before first paint) covers iOS Safari's navigator.standalone. */
@media (display-mode: standalone), (display-mode: minimal-ui), (display-mode: fullscreen) {
  .install-cta { display: none !important; }
}
.is-installed .install-cta { display: none !important; }

/* Store badges */
.store-badges { display: flex; gap: 10px; justify-content: center; }
.store-badge {
  flex: 1; max-width: 168px;
  display: flex; align-items: center; gap: 9px;
  padding: 9px 13px; cursor: pointer;
  background: #111827; color: #fff; border: 1px solid #111827;
  text-align: left;
}
.store-badge:hover { background: #1f2937; }
.store-badge svg { width: 24px; height: 24px; flex: 0 0 auto; }
.store-badge .sb-t { min-width: 0; line-height: 1.15; }
.store-badge .sb-small { font-size: 8.5px; text-transform: uppercase; letter-spacing: .07em; opacity: .8; }
.store-badge .sb-big { font-size: 13.5px; font-weight: 650; white-space: nowrap; }

.auth-foot { text-align: center; margin-top: 18px; font-size: 12px; color: var(--text-3); }
.auth-foot a { font-weight: 600; }

/* --------------------------------------------------------------- modal/sheet */

.sheet-backdrop {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(15,23,42,.5);
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.sheet-backdrop.open { opacity: 1; pointer-events: auto; }
.sheet {
  width: 100%; max-width: 480px;
  background: var(--surface);
  padding: 8px 18px calc(20px + var(--safe-b));
  transform: translateY(14px); transition: transform .22s;
  max-height: 86vh; overflow-y: auto;
}
.sheet-backdrop.open .sheet { transform: translateY(0); }
.sheet-grip { width: 42px; height: 4px; background: var(--border); margin: 6px auto 14px; }
.sheet h3 { font-size: 16px; margin-bottom: 8px; }
.sheet p { color: var(--text-2); font-size: 13.5px; margin: 0 0 12px; }
.sheet ol { margin: 0 0 16px; padding-left: 20px; color: var(--text-2); font-size: 13.5px; }
.sheet ol li { margin: 6px 0; }
.sheet .sheet-actions { display: flex; gap: 10px; }
.sheet .sheet-actions .btn { flex: 1; }

/* ------------------------------------------------------------ misc helpers */

.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; }
.mb-0 { margin-bottom: 0; } .mb-2 { margin-bottom: 16px; }
.muted { color: var(--text-2); }
.small { font-size: 12.5px; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.hide-mobile { display: none; }
.spacer { flex: 1; }
.print-only { display: none; }

/* ==========================================================================
   Tablet and up
   ========================================================================== */

@media (min-width: 600px) {
  .form-grid { grid-template-columns: 1fr 1fr; }
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
  .container { padding: 20px 20px 0; }
  .kv { grid-template-columns: repeat(3, 1fr); }
  .hide-mobile { display: initial; }
  .profile-hero { padding: 22px; }
  .profile-hero .avatar-lg { width: 84px; height: 84px; font-size: 30px; }
  .profile-hero .who h2 { font-size: 22px; }
}

/* ==========================================================================
   Desktop — swap the bottom tab bar for a sidebar
   ========================================================================== */

@media (min-width: 1024px) {
  :root { --appbar-h: 62px; }

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

  .sidebar {
    display: flex; flex-direction: column;
    position: sticky; top: 0; align-self: flex-start;
    width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
    height: 100vh; padding: 16px 12px;
    background: var(--surface); border-right: 1px solid var(--border);
 }
  .sidebar-brand {
    display: flex; align-items: center; gap: 10px;
    padding: 6px 8px 16px; margin-bottom: 8px;
    border-bottom: 1px solid var(--border);
 }
  .sidebar-logo {
    width: 38px; height: 38px; flex: 0 0 auto; overflow: hidden;
    background: linear-gradient(135deg, var(--brand), var(--brand-dark));
    color: #fff; display: grid; place-items: center; font-weight: 750; font-size: 15px;
 }
  .sidebar-logo img { width: 100%; height: 100%; object-fit: cover; }

  /* An uploaded logo gets the full sidebar width: the brand block stacks and
     the artwork scales to fit instead of being cropped into the 38px tile. */
  .sidebar-brand.has-logo { flex-direction: column; align-items: flex-start; gap: 10px; }
  .sidebar-logo.has-logo {
    width: 100%; max-width: 100%; height: auto; max-height: 56px;
    background: none; overflow: visible;
    display: flex; align-items: center; justify-content: flex-start;
 }
  .sidebar-logo.has-logo img {
    width: auto; max-width: 100%; height: auto; max-height: 56px;
    object-fit: contain;
 }
  .sidebar-brand.has-logo .sb-txt { width: 100%; }
  .sidebar-brand .sb-name { font-size: 14px; font-weight: 750; letter-spacing: -.01em; }
  .sidebar-brand .sb-tag { font-size: 11px; color: var(--text-3); }
  .sidebar-brand .sb-txt { min-width: 0; overflow: hidden; }
  .sidebar-brand .sb-name, .sidebar-brand .sb-tag { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  .sidebar nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
  .sidebar .nav-label {
    font-size: 10px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase;
    color: var(--text-3); padding: 14px 10px 6px;
 }
  .sidebar nav a {
    display: flex; align-items: center; gap: 11px;
    padding: 10px 11px;
    color: var(--text-2); font-size: 13.5px; font-weight: 600;
 }
  .sidebar nav a svg { width: 18px; height: 18px; flex: 0 0 auto; }
  .sidebar nav a:hover { background: var(--surface-2); color: var(--text); }
  .sidebar nav a.active { background: var(--brand); color: var(--brand-fg); }
  .sidebar-foot { border-top: 1px solid var(--border); padding-top: 12px; margin-top: 8px; }
  .sidebar-user { display: flex; align-items: center; gap: 10px; padding: 4px 6px 10px; }
  .sidebar-user .avatar { width: 34px; height: 34px; font-size: 13px; }
  .sidebar-user .su-txt { min-width: 0; flex: 1; }
  .sidebar-user .su-name { font-size: 13px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .sidebar-user .su-role { font-size: 11px; color: var(--text-3); }

  .main { flex: 1; min-width: 0; padding-bottom: 28px; }
  .appbar { display: none; }
  .bottom-nav { display: none; }
  .fab { display: none; }
  .container { padding: 26px 28px 0; }
  .page-head h1 { font-size: 24px; }

  .form-grid { grid-template-columns: repeat(3, 1fr); }
  .form-grid.two { grid-template-columns: repeat(2, 1fr); }
  .kv { grid-template-columns: repeat(4, 1fr); }

  .form-actions {
    position: sticky; bottom: 0; margin-left: 0; margin-right: 0;
  border: 1px solid var(--border);
    padding: 12px 16px; justify-content: flex-end;
 }
  .form-actions .btn { flex: 0 0 auto; min-width: 130px; }

  .sheet-backdrop { align-items: center; }
  .sheet { max-width: 460px; }

  .card-body { padding: 18px; }
  table.data { min-width: 0; }
}

/* ==========================================================================
   Print — the profile doubles as the printable "Executive Profile" sheet
   ========================================================================== */

@media print {
  .appbar, .bottom-nav, .sidebar, .fab, .form-actions, .toolbar,
  .no-print, .tabs { display: none !important; }
  .print-only { display: block; }
  body { background: #fff; font-size: 11px; }
  .container { max-width: none; padding: 0; }
  .card, details.acc {border: 1px solid #999; break-inside: avoid; page-break-inside: avoid; }
  details.acc[open] > summary, .card-head { background: #eee; }
  details.acc:not([open]) > .acc-body { display: block !important; }
  .profile-hero { background: #fff !important; color: #000; border: 1px solid #999; }
  .profile-hero .chip { background: #eee; color: #000; }
  table.data { min-width: 0; font-size: 10px; }
  a { color: #000; }
}
