/* MK Admin website: the design system of the MK Admin app (mkadmin/.../ui/theme/Theme.kt, ui/common/Components.kt) on the web.
   Charcoal surfaces, ember orange for actions, lime for live state, tinted status badges and banners, rounded cards.
   Always dark, like the app. Computer: sidebar. Tablet: navigation rail. Phone: top bar + the app's bottom bar. */
:root {
  color-scheme: dark;
  --bg: #0d0e12; --bg-low: #111319; --bg-lowest: #0a0b0e;
  --card: #15171d; --card-2: #1b1d24; --card-3: #23262e;
  --stroke: #262932; --stroke-2: #3a3d47;
  --text: #f1ede8; --muted: #b2ada6; --dim: #6e6b66;
  --ember: #ff7a1a; --ember-soft: #ffb067; --ember-ink: #1a0e05; --ember-tint: rgba(255, 122, 26, .15);
  --lime: #a6f55a; --warn: #ffc553; --err: #ff6b6b; --err-ink: #2b0808; --info: #7cc4ff;
  --r-xs: 8px; --r-s: 12px; --r-m: 16px; --r-l: 22px; --r-xl: 28px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace;
  --shadow: 0 16px 48px rgba(0, 0, 0, .5);
  --side-w: 264px;
}
*, *::before, *::after { box-sizing: border-box; }
html { scrollbar-color: var(--stroke-2) transparent; -webkit-text-size-adjust: 100%; }
/* a sideways swipe moves between MK Admin's sections (shell.js): the browser's own swipe-to-go-back/forward would move the
   history at the same time, so it is off here (vertical scrolling and pull-to-refresh are not affected) */
html, body { overscroll-behavior-x: none; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font: 400 14px/1.5 var(--font); }
body { min-height: 100vh; min-height: 100dvh; }
[hidden] { display: none !important; }
a { color: var(--ember-soft); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
h1 { font-size: 24px; line-height: 1.25; font-weight: 700; letter-spacing: -.2px; }
h2 { font-size: 16px; line-height: 1.35; font-weight: 600; }
h3 { font-size: 14px; font-weight: 600; }
p { margin: 0 0 8px; } p:last-child { margin-bottom: 0; }
.muted { color: var(--muted); } .dim { color: var(--dim); } .small { font-size: 12.5px; } .center { text-align: center; } .nowrap { white-space: nowrap; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.t-ok { color: var(--lime); } .t-warn { color: var(--warn); } .t-err { color: var(--err); } .t-info { color: var(--info); } .t-accent { color: var(--ember); } .t-soft { color: var(--ember-soft); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible { outline: 2px solid var(--ember); outline-offset: 2px; }
.input:focus-visible, .select:focus-visible { outline: none; }
.ico { width: 20px; height: 20px; flex: none; }
.boot { min-height: 100vh; display: grid; place-items: center; color: var(--muted); }

/* ------------------------------------------------------------------ layout */
.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }
.side { position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto; background: var(--bg-low); border-right: 1px solid var(--stroke); display: flex; flex-direction: column; gap: 2px; padding: 18px 14px 14px; }
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 10px 20px; color: inherit; }
.brand:hover { text-decoration: none; }
.brand-logo { width: 36px; height: 36px; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name { font-weight: 800; font-size: 17px; letter-spacing: -.2px; }
.brand-role { font-size: 12px; color: var(--ember-soft); font-weight: 600; margin-top: 2px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item { position: relative; display: flex; align-items: center; gap: 12px; height: 44px; padding: 0 14px; border-radius: 999px; color: var(--muted); font-weight: 600; transition: background .15s, color .15s; }
.nav-item:hover { background: var(--card-2); color: var(--text); text-decoration: none; }
.nav-item[aria-current="page"] { background: var(--ember-tint); color: var(--ember-soft); }
.nav-item[aria-current="page"] .ico { color: var(--ember); }
.nav-label { display: block; margin: 16px 14px 6px; font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); }
.nav-label:hover { color: var(--muted); text-decoration: none; }
.nav-label[aria-current="page"] { color: var(--ember-soft); }
.nav-count { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--err); color: var(--err-ink); font-size: 11px; font-weight: 800; display: inline-grid; place-items: center; font-style: normal; }
.nav-dot { position: absolute; width: 9px; height: 9px; border-radius: 50%; background: var(--err); box-shadow: 0 0 0 2px var(--bg-low); left: 28px; top: 10px; }
.side-foot { margin-top: auto; padding-top: 16px; }
.me { background: var(--card); border: 1px solid var(--stroke); border-radius: var(--r-l); padding: 14px; display: grid; gap: 2px; }
.me-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-user { font-size: 12px; color: var(--muted); margin-bottom: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shell-main { min-width: 0; display: flex; flex-direction: column; }
.page-head { display: flex; align-items: center; gap: 12px; width: 100%; max-width: 1320px; margin: 0 auto; padding: 26px 32px 18px; }
.page-head .titles { min-width: 0; flex: 1; }
.page-head h1 { overflow-wrap: anywhere; }
.page-head .sub { color: var(--muted); font-size: 13px; margin-top: 2px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.head-actions:empty { display: none; }
.head-logo { display: none; }
.lbl-short, .phone-only { display: none !important; }
.head-back.narrow-only { display: none; }
#view { width: 100%; max-width: 1320px; margin: 0 auto; padding: 0 32px 64px; outline: none; }
.rail, .bottom-nav { display: none; }
.bell { position: relative; }
.bell-count { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--err); color: var(--err-ink); font-size: 11px; font-weight: 800; display: grid; place-items: center; }

/* tablet: navigation rail with the five sections */
@media (max-width: 1023px) {
  .shell { grid-template-columns: 88px minmax(0, 1fr); }
  .side { display: none; }
  .rail { display: flex; flex-direction: column; align-items: center; gap: 6px; position: sticky; top: 0; height: 100vh; height: 100dvh; background: var(--bg-low); border-right: 1px solid var(--stroke); padding: 16px 0; }
  .rail-logo { margin-bottom: 14px; display: block; }
  .rail-item { width: 80px; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 4px 0 6px; color: var(--muted); font-size: 12px; font-weight: 600; text-align: center; }
  .head-back.narrow-only:not([hidden]) { display: inline-flex; }
  .page-head { padding: 22px 24px 16px; }
  #view { padding: 0 24px 56px; }
}
.rail-item:hover, .bn-item:hover { text-decoration: none; color: var(--text); }
.pill { position: relative; width: 56px; height: 32px; border-radius: 16px; display: grid; place-items: center; transition: background .15s; }
.rail-item[aria-current="page"], .bn-item[aria-current="page"] { color: var(--ember-soft); }
.rail-item[aria-current="page"] .pill, .bn-item[aria-current="page"] .pill { background: var(--ember-tint); color: var(--ember); }
.pill .nav-dot { left: auto; right: 12px; top: 3px; box-shadow: 0 0 0 2px var(--card); }
.pill .nav-count { position: absolute; top: -2px; right: 4px; margin: 0; }
.bar-label { line-height: 1.2; }

/* phone: a top bar and the app's bottom bar */
@media (max-width: 720px) {
  .shell { display: block; }
  .rail { display: none; }
  .page-head { position: sticky; top: 0; z-index: 20; background: rgba(13, 14, 18, .94); backdrop-filter: blur(10px); padding: 10px 12px 10px 16px; min-height: 60px; border-bottom: 1px solid var(--stroke); }
  .page-head:not(.has-back) .head-logo { display: block; }
  .head-logo .brand-logo { width: 30px; height: 30px; display: block; }
  .page-head h1 { font-size: 19px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .page-head .sub { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
  .head-actions .btn:not(.btn-icon) { padding: 0 14px; }
  .lbl-long, .hide-phone { display: none !important; }
  .lbl-short { display: inline !important; }
  .phone-only { display: inline-flex !important; }
  #view { padding: 14px 16px calc(96px + env(safe-area-inset-bottom)); }
  .bottom-nav { display: grid; grid-template-columns: repeat(var(--tabs, 5), minmax(0, 1fr)); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--card); border-top: 1px solid var(--stroke); padding: 8px 4px calc(10px + env(safe-area-inset-bottom)); }
  .bn-item { display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--muted); font-size: 12px; font-weight: 600; min-width: 0; }
  .bn-item .bar-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
}

/* ------------------------------------------------------------------ cards, grids, tiles */
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; align-content: start; min-width: 0; }
.stack-md { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.stack-sm { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.narrow { max-width: 760px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: start; }
.dash { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 14px; align-items: start; }
@media (max-width: 1180px) { .dash, .detail-grid { grid-template-columns: 1fr; } }
@media (max-width: 960px) { .grid-2 { grid-template-columns: 1fr; } }
.card { background: var(--card); border: 1px solid var(--stroke); border-radius: var(--r-l); padding: 18px; min-width: 0; }
.card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.card-head h2 { flex: 1; min-width: 0; }
.card-head .btn-text { margin: -8px -8px -8px 0; }
.card > .btn-text { margin: 6px 0 -6px -10px; }
.row-gap { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row-gap.end { justify-content: flex-end; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.tiles.six { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (min-width: 1400px) { .tiles.six { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.tile { display: block; background: var(--card); border: 1px solid var(--stroke); border-radius: var(--r-l); padding: 14px 16px; color: inherit; min-width: 0; transition: background .15s, border-color .15s; }
a.tile:hover { background: var(--card-2); border-color: var(--stroke-2); text-decoration: none; }
.tile-label { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-value { font-size: 24px; font-weight: 700; margin-top: 6px; letter-spacing: -.2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.tile-hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.progress { height: 5px; border-radius: 99px; background: var(--card-3); margin-top: 8px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--ember); border-radius: inherit; }
@media (max-width: 720px) { .tiles, .tiles.six { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } .tile-value { font-size: 21px; } .card { padding: 16px; } }

/* lists inside cards (dashboard) */
.list, .plain-list { list-style: none; margin: 0; padding: 0; }
.list li + li { border-top: 1px solid var(--stroke); }
.list-row { display: flex; align-items: center; gap: 12px; padding: 10px 2px; color: inherit; }
a.list-row:hover { text-decoration: none; background: var(--card-2); border-radius: var(--r-s); }
.lr-icon { color: var(--ember); }
.lr-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.lr-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lr-sub { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lr-end { flex: none; text-align: right; }
.plain-list { display: grid; gap: 8px; }

/* ------------------------------------------------------------------ badges, banners, key / value */
.badge { --tone: var(--muted); display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 18px; white-space: nowrap; vertical-align: middle;
  color: var(--tone); background: color-mix(in srgb, var(--tone) 13%, transparent); border: 1px solid color-mix(in srgb, var(--tone) 30%, transparent); }
.badge.t-ok { --tone: var(--lime); } .badge.t-warn { --tone: var(--warn); } .badge.t-err { --tone: var(--err); } .badge.t-info { --tone: var(--info); } .badge.t-accent { --tone: var(--ember); } .badge.t-neutral { --tone: var(--muted); }
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.banner { --tone: var(--info); display: flex; gap: 10px; align-items: flex-start; padding: 14px; border-radius: var(--r-m); background: color-mix(in srgb, var(--tone) 9%, transparent); border: 1px solid color-mix(in srgb, var(--tone) 28%, transparent); }
.banner.t-ok { --tone: var(--lime); } .banner.t-warn { --tone: var(--warn); } .banner.t-err { --tone: var(--err); } .banner.t-info { --tone: var(--info); }
.banner { color: var(--text); }
.banner > .ico { color: var(--tone); margin-top: 1px; }
.banner-body { min-width: 0; flex: 1; }
.banner-title { font-weight: 600; }
.banner-title + .banner-text { color: var(--muted); }
.banner-action { display: inline-block; margin-top: 8px; padding: 0; border: 0; background: none; color: var(--tone); font-weight: 600; font-size: 14px; cursor: pointer; }
.banner-action:hover { text-decoration: underline; }
.kv { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 10px 16px; align-items: center; margin: 0 0 6px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 520px) { .kv { grid-template-columns: 118px minmax(0, 1fr); } }
code.pill { white-space: nowrap; background: var(--card-3); padding: 2px 7px; border-radius: 6px; font-family: var(--mono); font-size: 12.5px; }
.quote { margin: 8px 0 4px; padding: 10px 14px; border-left: 3px solid var(--ember); background: var(--bg-low); border-radius: 8px; }
.field-label-sm { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); }

/* ------------------------------------------------------------------ buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 18px; border-radius: var(--r-m); border: 1px solid transparent; background: transparent; color: var(--text);
  font: 600 14px/1 var(--font); letter-spacing: .2px; cursor: pointer; white-space: nowrap; text-decoration: none; transition: background .15s, border-color .15s, filter .15s; }
.btn:hover { text-decoration: none; }
.btn .ico { width: 18px; height: 18px; }
.btn-primary { background: var(--ember); color: var(--ember-ink); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-secondary { border-color: var(--stroke-2); }
.btn-secondary:hover { background: var(--card-2); }
.btn-danger { background: var(--err); color: var(--err-ink); }
.btn-danger:hover { filter: brightness(1.06); }
.btn-danger-outline { border-color: color-mix(in srgb, var(--err) 55%, transparent); color: var(--err); }
.btn-danger-outline:hover { background: color-mix(in srgb, var(--err) 10%, transparent); }
.btn-text { color: var(--ember-soft); padding: 0 10px; }
.btn-text:hover { background: var(--ember-tint); }
.btn-text.muted { color: var(--muted); }
.btn-text.muted:hover { background: var(--card-3); color: var(--text); }
.btn-sm { height: 32px; padding: 0 12px; border-radius: var(--r-s); font-size: 13px; }
.btn-lg { height: 48px; }
.btn-block { width: 100%; }
.btn-icon { width: 40px; padding: 0; border-radius: 50%; color: var(--muted); }
.btn-icon:hover { background: var(--card-2); color: var(--text); }
.btn-icon.btn-sm { width: 32px; height: 32px; }
.btn-icon.btn-secondary { color: var(--text); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; filter: none; }
.btn[aria-busy="true"] { cursor: progress; }
@media (pointer: coarse) { .btn { height: 44px; } .btn-sm { height: 38px; } .btn-icon.btn-sm { width: 38px; height: 38px; } .btn-lg { height: 50px; } }

/* ------------------------------------------------------------------ fields */
.field { display: grid; gap: 6px; min-width: 0; align-content: start; }
.field-label { font-size: 13px; font-weight: 600; color: var(--muted); }
.field-row { display: flex; gap: 8px; align-items: center; }
.field-row > :first-child { flex: 1; min-width: 0; }
.field-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 520px) { .field-pair { grid-template-columns: 1fr; } }
.input, .select { width: 100%; height: 46px; padding: 0 14px; border-radius: var(--r-m); background: var(--card); border: 1px solid var(--stroke-2); color: var(--text); font: 400 15px var(--font); outline: none; transition: border-color .15s, box-shadow .15s; }
textarea.input { height: auto; min-height: 150px; padding: 12px 14px; font: 13px/1.5 var(--mono); resize: vertical; }
textarea.input[data-plain] { font: 14px/1.5 var(--font); min-height: 96px; }
.input::placeholder { color: var(--dim); }
.input:focus, .select:focus { border-color: var(--ember); box-shadow: 0 0 0 1px var(--ember); }
.input[aria-invalid="true"], .select[aria-invalid="true"] { border-color: var(--err); box-shadow: 0 0 0 1px var(--err); }
.input:disabled { opacity: .45; }
.input[type=number]::-webkit-inner-spin-button { opacity: .4; }
.input[type=date] { color-scheme: dark; }
.select { appearance: none; padding-right: 40px; cursor: pointer; background-repeat: no-repeat; background-position: right 14px center;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='18' height='18' fill='none' stroke='%23b2ada6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); }
.select option { background: var(--card-2); }
.select-sm { height: 40px; border-radius: var(--r-s); font-size: 14px; }
.help { font-size: 12px; color: var(--muted); }
.field-error { font-size: 13px; color: var(--err); }
.field-error:empty { display: none; }
.pw-wrap { position: relative; display: flex; align-items: center; width: 100%; }
.pw-wrap .input { padding-right: 50px; }
.pw-eye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; display: grid; place-items: center; border: 0; background: transparent; color: var(--muted); border-radius: 50%; cursor: pointer; }
.pw-eye:hover { color: var(--text); background: var(--card-2); }
.pw-eye[aria-pressed="true"] { color: var(--ember); }
.pw-eye .ico { width: 20px; height: 20px; }
.pw-cell { display: inline-flex; align-items: center; gap: 4px; }
.switch-row { display: flex; align-items: center; gap: 14px; padding: 6px 0; cursor: pointer; }
.sw-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sw-title { font-size: 15px; }
.sw-sub { font-size: 12px; color: var(--muted); }
.switch { appearance: none; flex: none; width: 52px; height: 32px; margin: 0; border-radius: 16px; background: var(--card-3); border: 2px solid var(--stroke-2); position: relative; cursor: pointer; transition: background .15s, border-color .15s; }
.switch::after { content: ''; position: absolute; top: 50%; left: 6px; width: 16px; height: 16px; border-radius: 50%; background: var(--muted); transform: translateY(-50%); transition: left .15s, width .15s, height .15s, background .15s; }
.switch:checked { background: var(--ember); border-color: var(--ember); }
.switch:checked::after { left: 22px; width: 24px; height: 24px; background: #fff; }
.switch:focus-visible { outline: 2px solid var(--ember); outline-offset: 2px; }
.subcard { margin: 0; padding: 14px 16px 16px; border: 1px solid var(--stroke); border-radius: var(--r-m); background: var(--bg-low); display: grid; gap: 12px; min-width: 0; }
.subcard legend { padding: 0 6px; margin-left: -6px; font-size: 16px; font-weight: 600; }
.pick-list { max-height: 260px; overflow-y: auto; gap: 4px; }
.pick-list[hidden] { display: none; }

/* search, chips, toolbars */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.toolbar .search { flex: 1 1 260px; max-width: 380px; }
.search { position: relative; }
.search > .ico { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search .input { height: 42px; padding-left: 44px; border-radius: 999px; }
.sort { position: relative; display: inline-flex; align-items: center; margin-left: auto; }
.sort > .ico { position: absolute; left: 12px; color: var(--muted); pointer-events: none; }
.sort .ico + .sr-only + .select, .sort .ico + .select { padding-left: 40px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { height: 32px; padding: 0 14px; border-radius: var(--r-xs); border: 1px solid var(--stroke-2); background: var(--card); color: var(--muted); font: 600 13px var(--font); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; transition: background .15s, color .15s, border-color .15s; }
.chip:hover { color: var(--text); }
.chip[aria-pressed="true"] { background: rgba(255, 122, 26, .18); color: var(--ember-soft); border-color: rgba(255, 122, 26, .5); }
@media (max-width: 720px) {
  .toolbar .search { max-width: none; flex-basis: 100%; }
  .chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px 2px; flex: 1 1 100%; }
  .chips.scroll::-webkit-scrollbar { display: none; }
  .sort { margin-left: 0; flex: 1 1 100%; } .sort .select { width: 100%; }
}

/* ------------------------------------------------------------------ tables (cards on narrow screens) */
.table-card { padding: 0; overflow: hidden; }
.table-wrap { overflow-x: auto; }
table.dt { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.dt th { text-align: left; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); padding: 12px 14px; border-bottom: 1px solid var(--stroke); white-space: nowrap; }
.dt td { padding: 12px 14px; border-bottom: 1px solid var(--stroke); vertical-align: middle; }
.dt tbody tr:last-child td { border-bottom: 0; }
.dt tr.row-link { cursor: pointer; }
.dt tr.row-link:hover td { background: var(--card-2); }
.dt td.actions { text-align: right; white-space: nowrap; width: 1%; }
.dt td.actions .row-gap { flex-wrap: nowrap; }
.dt.compact th, .dt.compact td { padding: 9px 10px; }
.dt.compact th:first-child, .dt.compact td:first-child { padding-left: 0; }
.cell-main { display: flex; align-items: center; gap: 10px; }
.cell-grow { flex: 1; min-width: 0; }
.cell-title { font-weight: 600; color: var(--text); font-size: 14.5px; }
a.cell-title:hover { color: var(--ember-soft); }
.cell-sub { font-size: 12px; color: var(--muted); }
.sm-only, .dt td.sm-only-cell { display: none; }
.remain { font-weight: 600; font-variant-numeric: tabular-nums; }
.remain.big { font-size: 26px; font-weight: 700; display: inline-block; margin-top: 2px; }
.remain-note { font-size: 12px; color: var(--dim); }
@media (max-width: 760px) {
  .dt td.actions .row-gap { flex-wrap: wrap; }
  .table-card { background: none; border: 0; border-radius: 0; overflow: visible; }
  .table-card .table-wrap { overflow: visible; }
  table.dt, .dt tbody { display: block; }
  .dt thead { display: none; }
  .dt tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; background: var(--card); border: 1px solid var(--stroke); border-radius: var(--r-l); padding: 14px; margin-bottom: 10px; }
  .dt tr.row-link:hover td { background: none; }
  .dt td { display: block; padding: 0; border: 0; min-width: 0; }
  .dt td[data-label]::before { content: attr(data-label); display: block; font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); margin-bottom: 2px; }
  .dt td.main, .dt td.wide, .dt td.actions { grid-column: 1 / -1; }
  .dt td.actions { text-align: left; width: auto; }
  .dt td.actions .row-gap.end { justify-content: flex-start; }
  .dt td.main + td.actions, .dt td.actions:last-child { border-top: 1px solid var(--stroke); padding-top: 10px; }
  .dt td.hide-sm { display: none; }
  .dt td.sm-only-cell { display: block; }
  .sm-only { display: inline-flex; }
  .dt.compact tr { background: var(--bg-low); }
  .dt.compact th:first-child, .dt.compact td:first-child { padding-left: 0; }
}

/* ------------------------------------------------------------------ dialogs, menus, snackbar */
.dialog-bg { position: fixed; inset: 0; z-index: 50; background: rgba(5, 6, 8, .68); display: grid; place-items: center; padding: 16px; animation: fade .12s ease-out; }
.dialog { width: 100%; max-width: 480px; max-height: calc(100dvh - 32px); overflow: auto; background: var(--card-2); border: 1px solid var(--stroke); border-radius: var(--r-xl); padding: 24px; box-shadow: var(--shadow); outline: none; }
.dialog.wide { max-width: 680px; }
.dialog-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.dialog-head h2 { flex: 1; font-size: 20px; font-weight: 600; }
.dialog-text { color: var(--muted); }
.dialog .kv { margin: 12px 0; }
.dialog form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.dialog .stack-sm { margin-top: 12px; }
.dialog-actions { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin-top: 20px; flex-wrap: wrap; }
.dialog-actions.spread { justify-content: space-between; }
.dialog form .dialog-actions { margin-top: 6px; }
.qr-box { background: #fff; border-radius: 14px; padding: 10px; margin: 12px auto; max-width: 280px; }
.qr-box img { width: 100%; display: block; }
@media (max-width: 520px) { .dialog { padding: 20px; border-radius: 24px; } .dialog-actions.spread { justify-content: flex-end; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
/* a page of another main section slides in from its side of the menu (swipe, bottom bar, Back / Forward); short and subtle */
@keyframes view-from-right { from { opacity: .35; transform: translateX(28px); } to { opacity: 1; transform: none; } }
@keyframes view-from-left { from { opacity: .35; transform: translateX(-28px); } to { opacity: 1; transform: none; } }
#view.enter-next { animation: view-from-right .2s cubic-bezier(.2, .7, .2, 1) both; }
#view.enter-prev { animation: view-from-left .2s cubic-bezier(.2, .7, .2, 1) both; }
.shell-main { overflow-x: clip; }
.menu { position: fixed; z-index: 60; min-width: 210px; background: var(--card-2); border: 1px solid var(--stroke-2); border-radius: var(--r-s); padding: 6px; box-shadow: var(--shadow); }
.menu button { display: flex; align-items: center; gap: 10px; width: 100%; height: 40px; padding: 0 12px; border: 0; border-radius: 8px; background: none; color: var(--text); font: 500 14px var(--font); cursor: pointer; text-align: left; }
.menu button .ico { width: 18px; height: 18px; color: var(--muted); }
.menu button:hover, .menu button:focus-visible { background: var(--card-3); outline: none; }
.menu button.danger, .menu button.danger .ico { color: var(--err); }
.snack { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 80; width: max-content; max-width: min(560px, calc(100vw - 32px)); background: var(--text); color: var(--card); padding: 13px 18px; border-radius: 10px; font-size: 14px; font-weight: 500; box-shadow: var(--shadow); }
.snack.err { border-left: 5px solid var(--err); }
.snack.ok { border-left: 5px solid #3e7d0a; }
@media (max-width: 720px) { .snack { bottom: calc(92px + env(safe-area-inset-bottom)); } }
/* a new notification on screen (alerts.js): top right on computers, across the top on phones; never blocks the page */
.nt-stack { position: fixed; top: 16px; right: 16px; z-index: 75; display: grid; gap: 10px; width: min(380px, calc(100vw - 32px)); pointer-events: none; }
.nt { pointer-events: auto; display: flex; align-items: flex-start; background: var(--card-2); border: 1px solid var(--stroke-2); border-radius: var(--r-m); box-shadow: var(--shadow); padding: 4px 4px 4px 0; animation: nt-in .2s ease-out; }
.nt.out { animation: nt-out .18s ease-in forwards; }
.nt-open { flex: 1; min-width: 0; display: flex; align-items: flex-start; gap: 12px; padding: 10px 4px 10px 14px; background: none; border: 0; border-radius: var(--r-s); color: inherit; font: inherit; text-align: left; cursor: pointer; }
.nt-open:hover .nt-title { color: var(--ember-soft); }
.nt-main { min-width: 0; display: grid; gap: 2px; }
.nt-title { font-weight: 600; font-size: 14.5px; overflow-wrap: anywhere; }
.nt-text { color: var(--muted); font-size: 13.5px; white-space: pre-line; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.nt-time { color: var(--dim); font-size: 12px; margin-top: 2px; }
.nt-close { flex: none; }
@keyframes nt-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@keyframes nt-out { to { opacity: 0; transform: translateY(-8px); } }
@media (max-width: 720px) { .nt-stack { top: calc(8px + env(safe-area-inset-top)); left: 12px; right: 12px; width: auto; } }
@media (prefers-reduced-motion: reduce) { .nt, .nt.out { animation: none; } }
/* the one-time offer to turn on notifications (js/push.js): bottom right, above the phone's bottom bar */
.nt-ask { position: fixed; right: 16px; bottom: 16px; z-index: 74; display: flex; gap: 12px; align-items: flex-start; width: min(400px, calc(100vw - 32px)); background: var(--card-2); border: 1px solid var(--stroke-2); border-radius: var(--r-m); box-shadow: var(--shadow); padding: 14px; animation: nt-in .2s ease-out; }
.nt-ask-main { min-width: 0; display: grid; gap: 4px; }
.nt-ask-actions { margin-top: 8px; }
@media (max-width: 720px) { .nt-ask { left: 12px; right: 12px; width: auto; bottom: calc(84px + env(safe-area-inset-bottom)); } }

/* ------------------------------------------------------------------ empty, error, loading */
.empty { text-align: center; padding: 36px 20px; }
.empty .ico { width: 40px; height: 40px; color: var(--dim); }
.empty-title { font-size: 16px; font-weight: 600; margin-top: 10px; }
.empty-text { color: var(--muted); margin-top: 4px; }
.state-error { text-align: center; padding: 56px 20px; display: grid; justify-items: center; gap: 14px; }
.state-error .ico { width: 44px; height: 44px; color: var(--dim); }
.state-error p { font-size: 16px; max-width: 520px; margin: 0; }
.loading { display: grid; place-items: center; padding: 72px 0; }
.spinner { display: inline-block; width: 34px; height: 34px; border: 3px solid var(--card-3); border-top-color: var(--ember); border-radius: 50%; animation: spin .8s linear infinite; }
.spinner.sm { width: 16px; height: 16px; border-width: 2px; border-color: currentColor; border-right-color: transparent; }
@keyframes spin { to { transform: rotate(360deg); } }
body.is-loading::before { content: ''; position: fixed; left: 0; top: 0; height: 3px; width: 100%; z-index: 100; background: linear-gradient(90deg, transparent, var(--ember), transparent) no-repeat; background-size: 40% 100%; animation: loadbar 1s linear infinite; }
@keyframes loadbar { from { background-position: -40% 0; } to { background-position: 140% 0; } }

/* ------------------------------------------------------------------ pages */
.remain-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.remain-expiry { margin: 6px 0 8px; }
.action-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.action-grid .btn { height: 48px; justify-content: flex-start; padding: 0 16px; }
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
@media (max-width: 720px) { .file-grid { grid-template-columns: 1fr; } }
.file-card { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; padding: 16px; }
.file-lock { color: var(--ember); width: 24px; height: 24px; }
.file-name { font-size: 16px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-badges { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.file-actions { grid-column: 1 / -1; display: flex; gap: 8px; justify-content: flex-end; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--stroke); }
.menu-rows { display: grid; gap: 10px; }
.menu-row { display: flex; align-items: center; gap: 14px; padding: 14px 16px; background: var(--card); border: 1px solid var(--stroke); border-radius: var(--r-l); color: inherit; width: 100%; text-align: left; cursor: pointer; font: inherit; }
.menu-row:hover { background: var(--card-2); text-decoration: none; }
.menu-row > .ico { color: var(--ember); width: 24px; height: 24px; }
.mr-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mr-title { font-size: 16px; font-weight: 600; }
.mr-sub { font-size: 12px; color: var(--muted); }
.mr-chev { color: var(--dim); }
.menu-row.danger > .ico, .menu-row.danger .mr-title { color: var(--err); }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--stroke); overflow-x: auto; scrollbar-width: none; margin-bottom: 16px; }
.tabs::-webkit-scrollbar { display: none; }
.tab { position: relative; height: 46px; padding: 0 16px; border: 0; background: none; color: var(--muted); font: 600 14px var(--font); cursor: pointer; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--ember-soft); }
.tab[aria-selected="true"]::after { content: ''; position: absolute; left: 12px; right: 12px; bottom: 0; height: 3px; border-radius: 3px 3px 0 0; background: var(--ember); }
.log-list { list-style: none; margin: 0 0 6px; padding: 0; display: grid; }
.log { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 10px; padding: 9px 0; border-top: 1px solid var(--stroke); }
.log:first-child { border-top: 0; padding-top: 0; }
.log-time { font-size: 12px; color: var(--dim); padding-top: 2px; }
.log-list .log-time:only-child { white-space: nowrap; }
.log-action { font-weight: 600; }
.log-who { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.log-detail { font-size: 12px; color: var(--dim); overflow-wrap: anywhere; }
.card .log-list .log { grid-template-columns: 76px minmax(0, 1fr); }
#tabpanel .log { grid-template-columns: 170px minmax(0, 1fr); }
@media (max-width: 520px) { #tabpanel .log { grid-template-columns: 1fr; gap: 2px; } }
.filters { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)) auto; gap: 12px; align-items: end; }
.filter-buttons { display: flex; gap: 8px; }
@media (max-width: 1180px) { .filters { grid-template-columns: repeat(3, minmax(0, 1fr)); } .filter-buttons { grid-column: 1 / -1; } }
@media (max-width: 600px) { .filters { grid-template-columns: 1fr 1fr; } }
.pager { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; margin-bottom: 16px; }
.settings-grid .span-2 { grid-column: 1 / -1; }
@media (max-width: 760px) { .settings-grid { grid-template-columns: 1fr; } }
.notice.unread { border-color: color-mix(in srgb, var(--info) 45%, transparent); }
.notice { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; align-items: start; }
.notice-ico { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, currentColor 14%, transparent); }
.notice-main { min-width: 0; }
.notice-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.notice-title h2 { font-size: 15px; }
.notice-text { white-space: pre-line; margin: 4px 0 0; overflow-wrap: anywhere; }

/* ---- subscription plans: cards grouped by users, one choice per duration ---- */
.plans { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.plan-card { background: var(--bg-low); border: 1px solid var(--stroke); border-radius: var(--r-l); padding: 14px; display: grid; gap: 10px; align-content: start; min-width: 0; transition: border-color .15s, box-shadow .15s; }
.plan-card.has-selected { border-color: color-mix(in srgb, var(--ember) 65%, transparent); box-shadow: 0 0 0 1px color-mix(in srgb, var(--ember) 45%, transparent); }
.plan-card.free { background: color-mix(in srgb, var(--lime) 5%, var(--bg-low)); }
.plan-head { display: flex; align-items: baseline; gap: 6px; }
.plan-users { font-size: 26px; font-weight: 800; letter-spacing: -.4px; line-height: 1; }
.plan-users-word { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.plan-head .badge { margin-left: auto; align-self: center; }
.plan-opts { display: grid; gap: 6px; }
.plan-opt { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 0 8px; width: 100%; min-height: 44px; padding: 8px 12px; border-radius: var(--r-s); border: 1px solid var(--stroke-2); background: var(--card); color: var(--text); font: inherit; text-align: left; cursor: pointer; transition: background .15s, border-color .15s; }
.plan-opt:hover { border-color: color-mix(in srgb, var(--ember) 50%, var(--stroke-2)); background: var(--card-2); }
.plan-opt[aria-checked="true"] { background: var(--ember-tint); border-color: var(--ember); }
.plan-opt:disabled { cursor: not-allowed; opacity: .55; }
.po-dur { font-weight: 600; }
.po-price { font-weight: 700; font-variant-numeric: tabular-nums; }
.plan-opt[aria-checked="true"] .po-price { color: var(--ember-soft); }
.po-sub { grid-column: 1 / -1; font-size: 11.5px; color: var(--muted); }
.plan-summary { margin-top: 14px; }
.plan-summary .kv { margin-bottom: 0; }
.plan-chosen:empty { display: none; }
.plan-field[aria-invalid="true"] { border-color: var(--err); }
.more-fields summary { cursor: pointer; color: var(--ember-soft); font-weight: 600; font-size: 13px; padding: 4px 0; }
.more-fields[open] summary { margin-bottom: 10px; }
.plan-admin { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; align-items: start; }
.plan-row.off .lr-title { color: var(--muted); }
.list-row.static { cursor: default; }
.auth-panel.wide { max-width: 760px; }
@media (max-width: 520px) { .plans { grid-template-columns: 1fr; } .plan-admin { grid-template-columns: 1fr; } }
.notice-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.help-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 14px; align-items: start; }
.help-index { position: sticky; top: 20px; }
.help-index ol { margin: 10px 0 0; padding-left: 20px; display: grid; gap: 6px; }
@media (max-width: 960px) { .help-layout { grid-template-columns: 1fr; } .help-index { position: static; } }
.help-item { background: var(--card); border: 1px solid var(--stroke); border-radius: var(--r-l); }
.help-item summary { display: flex; align-items: center; gap: 12px; padding: 16px 18px; cursor: pointer; list-style: none; font-size: 16px; font-weight: 600; border-radius: var(--r-l); }
.help-item summary::-webkit-details-marker { display: none; }
.help-item summary > span { flex: 1; }
.help-chev { color: var(--muted); transition: transform .15s; }
.help-item[open] .help-chev { transform: rotate(180deg); }
.help-body { padding: 0 18px 16px; color: var(--muted); }
.help-body b { color: var(--text); font-weight: 600; }
.help-body p, .help-body ul, .help-body ol { margin: 0 0 10px; }
.help-body li { margin: 4px 0; }
.support { border-color: color-mix(in srgb, var(--ember) 45%, transparent); }
.about { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.about-logo { width: 48px; height: 48px; flex: none; }
.about-name { font-size: 16px; font-weight: 600; }

/* ------------------------------------------------------------------ sign-in (MK Admin's sign-in screen) */
.auth { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; padding: 40px 20px 24px;
  background: radial-gradient(720px 420px at 50% -10%, rgba(255, 122, 26, .14), transparent 70%), var(--bg); }
.auth-top { display: flex; flex-direction: column; align-items: center; margin: 12px 0 26px; }
.auth-logo { width: 88px; height: 88px; }
.auth h1 { font-size: 28px; font-weight: 800; letter-spacing: -.4px; margin-top: 16px; }
.auth-panel { width: 100%; max-width: 460px; display: grid; gap: 14px; }
.auth-tabs .chip { flex: 1; justify-content: center; height: 36px; }
.auth-foot { margin-top: auto; padding-top: 32px; color: var(--dim); font-size: 12px; letter-spacing: .02em; display: grid; gap: 4px; justify-items: center; text-align: center; }
.auth-contact a { color: var(--muted); text-decoration: underline; text-underline-offset: 2px; padding: 6px 2px; }
/* About / Terms / Privacy links, Forgot password?, the temporary password, the legal pages */
.auth-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 14px; margin-top: 4px; }
.auth-links a { color: var(--muted); padding: 8px 2px; }
.auth-links a:hover, .auth-links a:focus-visible { color: var(--ember-soft); }
.auth-forgot { display: flex; justify-content: flex-end; margin-top: -8px; }
.about-nav { margin-bottom: 8px; }
.legal h3 { margin: 18px 0 6px; font-size: 15px; }
.legal p { margin: 0 0 8px; line-height: 1.6; }
.temp-pw { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 12px 0; }
.temp-pw code { font-size: 20px; letter-spacing: .06em; padding: 8px 12px; background: var(--card-3); border-radius: var(--r-s); user-select: all; }
.auth-contact a:hover, .auth-contact a:focus-visible { color: var(--ember-soft); }
@media (min-width: 721px) {
  .auth { padding-top: 56px; }
  .auth-panel { background: var(--card); border: 1px solid var(--stroke); border-radius: var(--r-xl); padding: 26px; box-shadow: 0 24px 60px rgba(0, 0, 0, .35); }
}

/* ------------------------------------------------------------------ inactivity warning (visible, not blocking the page) */
.idle-warn { position: fixed; left: 0; right: 0; bottom: 24px; z-index: 70; display: flex; justify-content: center; padding: 0 16px; pointer-events: none; }
.idle-warn .dialog { pointer-events: auto; max-width: 460px; border-color: color-mix(in srgb, var(--warn) 55%, transparent); }
.idle-count { font-family: var(--mono); margin: 10px 0 0; }
@media (max-width: 720px) { .idle-warn { bottom: calc(92px + env(safe-area-inset-bottom)); } }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition: none !important; scroll-behavior: auto !important; } }

/* ------------------------------------------------------------------ MK Team connection management (monitor.js) */
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: start; }
@media (max-width: 1180px) { .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) { .grid-3 { grid-template-columns: 1fr; } }
.monitor-cards, .diag-section { margin-top: 14px; }
.usage-bars { display: flex; align-items: flex-end; gap: 3px; height: 64px; margin: 12px 0 4px; padding: 0 2px; border-bottom: 1px solid var(--stroke); }
.usage-bar { flex: 1 1 0; min-width: 2px; height: max(2px, var(--h)); background: color-mix(in srgb, var(--ember) 70%, transparent); border-radius: 3px 3px 0 0; }
.usage-bar:hover { background: var(--ember); }
.io { color: var(--muted); }
dd > .io, b + .io { margin-left: 8px; }
.diag-checks { margin-top: 12px; display: grid; gap: 2px; }
.diag-checks .list-row, [data-diag-result] .list-row { align-items: flex-start; padding: 8px 2px; }
[data-diag-result]:not(:empty) { margin-top: 12px; border-top: 1px solid var(--stroke); padding-top: 4px; }
/* remote control and library (panel 1.14.0): small headings inside a card */
.card-sub { margin: 16px 0 6px; font-size: 14px; font-weight: 600; color: var(--text, inherit); }
