/* ======================================================================
   Trial Room — CMS
   The same warm near-black, bone and brass as the mirror, set dense and
   calm for an admin tool. One accent. Hairlines, not shadows.
   ====================================================================== */

:root {
  --ink: #0f0e0c;
  --panel: #17150f;
  --panel-2: #1e1b15;
  --panel-3: #262219;
  --line: #2c2820;
  --line-2: #3b352a;
  --bone: #ede8de;
  --bone-2: #cfc7b8;
  --muted: #8b8274;
  --muted-2: #a69d8e;
  --brass: #c6a96b;
  --brass-2: #d9c08a;
  --brass-soft: rgba(198, 169, 107, 0.12);
  --on-brass: #17150f;
  --danger: #b4695c;
  --danger-text: #dc9a8d;
  --danger-soft: rgba(180, 105, 92, 0.14);
  --ok: #7e9478;
  --ok-text: #a9bea2;
  --ok-soft: rgba(126, 148, 120, 0.15);
  --warn: #d8a13f;
  --warn-text: #e3b765;
  --warn-soft: rgba(216, 161, 63, 0.13);

  --display: "Cormorant Garamond", "Iowan Old Style", "Palatino Linotype", Georgia, "Times New Roman", serif;
  --body: "Jost", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;

  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --sidebar: 244px;
  --gutter: 36px;
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-height: 100vh;
  background: var(--ink);
  color: var(--bone);
  font-family: var(--body);
  font-size: 14px;
  line-height: 1.5;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
}

a {
  color: var(--brass);
  text-decoration: none;
}
a:hover {
  color: var(--brass-2);
  text-decoration: underline;
  text-underline-offset: 3px;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

::selection {
  background: rgba(198, 169, 107, 0.35);
}

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.muted {
  color: var(--muted);
}
.small {
  font-size: 12.5px;
}
.mono {
  font-family: var(--mono);
  font-size: 12.5px;
}
.nowrap {
  white-space: nowrap;
}
.ok-text {
  color: var(--ok-text);
}
.warn-text {
  color: var(--warn-text);
}
.danger-text {
  color: var(--danger-text);
}
.brass-text {
  color: var(--brass);
}
.num {
  font-variant-numeric: tabular-nums;
}
.right {
  text-align: right;
}
.grow {
  flex: 1 1 auto;
}
.stack > * + * {
  margin-top: 12px;
}
.row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

/* ---------------------------------------------------------------- icons */

.ic {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: middle;
}
.ic-sm {
  width: 15px;
  height: 15px;
}

/* ---------------------------------------------------------------- wordmark */

.wordmark {
  font-family: var(--display);
  font-weight: 500;
  font-size: 27px;
  line-height: 1;
  letter-spacing: 0.01em;
  color: var(--bone);
  white-space: nowrap;
}
.wordmark span {
  color: var(--brass);
}
a.wordmark:hover {
  text-decoration: none;
  color: var(--bone);
}

/* ---------------------------------------------------------------- shell */

.shell {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar);
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-right: 1px solid var(--line);
  z-index: 40;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 26px 22px 22px;
}
.sidebar .sidebar-close {
  display: none;
}
.nav {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 6px 12px 12px;
}
.nav-group + .nav-group {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 40px;
  padding: 0 12px;
  border-radius: 10px;
  color: var(--muted-2);
  font-size: 14px;
  font-weight: 400;
  text-decoration: none;
}
.nav a:hover {
  color: var(--bone);
  background: var(--panel-2);
}
.nav a[aria-current="page"] {
  color: var(--bone);
  background: var(--panel-3);
}
.nav a[aria-current="page"] .ic {
  color: var(--brass);
}
.nav-count {
  margin-left: auto;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--danger-soft);
  color: var(--danger-text);
  font-size: 11.5px;
  line-height: 20px;
  text-align: center;
}

.sidebar-foot {
  padding: 14px 16px 18px;
  border-top: 1px solid var(--line);
}
.me {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.avatar {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--panel-3);
  border: 1px solid var(--line-2);
  color: var(--brass);
  font-family: var(--display);
  font-size: 17px;
  font-weight: 600;
}
.me-text {
  min-width: 0;
  flex: 1 1 auto;
}
.me-name {
  display: block;
  color: var(--bone);
  font-size: 13.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.me-name:hover {
  color: var(--brass-2);
}
.me-role {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  text-transform: capitalize;
}

.topbar {
  display: none;
}

.main {
  margin-left: var(--sidebar);
  min-height: 100vh;
}
.page {
  max-width: 1360px;
  margin: 0 auto;
  padding: 30px var(--gutter) 64px;
}

.drawer-scrim {
  display: none;
}

@media (max-width: 900px) {
  :root {
    --gutter: 16px;
  }
  .topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    height: 58px;
    padding: 0 8px 0 16px;
    background: rgba(15, 14, 12, 0.92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
  }
  .topbar .wordmark {
    font-size: 24px;
  }
  .sidebar {
    width: min(300px, 86vw);
    transform: translateX(-102%);
    transition: transform 0.22s ease;
    visibility: hidden;
  }
  .shell.drawer-open .sidebar {
    transform: none;
    visibility: visible;
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.6);
  }
  .shell.drawer-open .drawer-scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 35;
    background: rgba(8, 7, 6, 0.6);
  }
  .sidebar .sidebar-close {
    display: inline-flex;
  }
  .main {
    margin-left: 0;
  }
  .page {
    padding-top: 20px;
  }
}

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

/* ---------------------------------------------------------------- page head */

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.page-head .crumbs {
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--muted);
}
.page-head .crumbs a {
  color: var(--muted-2);
}
.page-title {
  font-family: var(--display);
  font-weight: 500;
  font-size: 38px;
  line-height: 1.05;
  letter-spacing: 0.005em;
  color: var(--bone);
  overflow-wrap: anywhere;
}
.page-sub {
  margin-top: 6px;
  color: var(--muted);
  max-width: 70ch;
}
.page-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.page-actions .select,
.page-actions .input {
  width: auto;
  max-width: 100%;
}
@media (max-width: 600px) {
  .page-title {
    font-size: 31px;
  }
  .page-head {
    margin-bottom: 18px;
    align-items: flex-start;
  }
}

.readonly-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  color: var(--muted-2);
  font-size: 11.5px;
  letter-spacing: 0.02em;
  text-transform: none;
}

/* ---------------------------------------------------------------- panels */

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 20px;
  min-width: 0;
}
.panel + .panel {
  margin-top: 18px;
}
.panel-flush {
  padding: 0;
  overflow: hidden;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.panel-flush > .panel-head {
  margin: 0;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.panel-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--bone);
  letter-spacing: 0.01em;
}
.panel-title .muted {
  font-weight: 400;
}
.eyebrow {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.panel-note {
  color: var(--muted);
  font-size: 13px;
}

.grid {
  display: grid;
  gap: 18px;
}
.grid > .panel + .panel {
  margin-top: 0;
}
.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.span-2 {
  grid-column: span 2;
}
@media (max-width: 1100px) {
  .grid-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 760px) {
  .grid-2,
  .grid-3 {
    grid-template-columns: minmax(0, 1fr);
  }
  .span-2 {
    grid-column: auto;
  }
}

.divider {
  height: 1px;
  background: var(--line);
  margin: 16px 0;
  border: 0;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  padding: 0 15px;
  border-radius: var(--r);
  border: 1px solid var(--line-2);
  background: var(--panel-2);
  color: var(--bone);
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover {
  background: var(--panel-3);
  border-color: #4a4336;
  color: var(--bone);
  text-decoration: none;
}
.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
}
.btn-primary {
  background: var(--brass);
  border-color: var(--brass);
  color: var(--on-brass);
}
.btn-primary:hover {
  background: var(--brass-2);
  border-color: var(--brass-2);
  color: var(--on-brass);
}
.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--muted-2);
}
.btn-ghost:hover {
  background: var(--panel-2);
  border-color: transparent;
  color: var(--bone);
}
.btn-outline {
  background: transparent;
}
.btn-danger {
  background: transparent;
  border-color: rgba(180, 105, 92, 0.5);
  color: var(--danger-text);
}
.btn-danger:hover {
  background: var(--danger-soft);
  border-color: var(--danger);
  color: #efb3a6;
}
.btn-danger-solid {
  background: var(--danger);
  border-color: var(--danger);
  color: #1b0f0c;
}
.btn-danger-solid:hover {
  background: #c47a6c;
  border-color: #c47a6c;
  color: #1b0f0c;
}
.btn-sm {
  height: 32px;
  padding: 0 11px;
  font-size: 13px;
  border-radius: 10px;
}
.btn-icon {
  width: 38px;
  padding: 0;
}
.btn-sm.btn-icon {
  width: 32px;
}
.btn-block {
  width: 100%;
}
.btn .spinner {
  width: 14px;
  height: 14px;
}

.link-btn {
  padding: 0;
  border: 0;
  background: none;
  color: var(--brass);
  cursor: pointer;
  font-size: inherit;
}
.link-btn:hover {
  color: var(--brass-2);
  text-decoration: underline;
  text-underline-offset: 3px;
}

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

.field {
  display: block;
  min-width: 0;
}
.field + .field,
.field + .field-row,
.field-row + .field,
.field-row + .field-row {
  margin-top: 16px;
}
.field-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  color: var(--bone-2);
  font-size: 13px;
  font-weight: 500;
}
.field-label .muted {
  font-weight: 400;
}
.hint {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.45;
}
.hint b,
.hint strong {
  color: var(--bone-2);
  font-weight: 500;
}
.field-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.field-row > .field + .field {
  margin-top: 0;
}
.field-row.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
@media (max-width: 600px) {
  .field-row,
  .field-row.three {
    grid-template-columns: minmax(0, 1fr);
  }
}

.input,
.select,
.textarea {
  display: block;
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border-radius: var(--r);
  border: 1px solid var(--line-2);
  background: var(--ink);
  color: var(--bone);
  font-size: 14px;
  transition: border-color 0.15s ease;
}
.input::placeholder,
.textarea::placeholder {
  color: #6e665a;
}
.input:hover,
.select:hover,
.textarea:hover {
  border-color: #4a4336;
}
.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--brass);
  outline: none;
  box-shadow: 0 0 0 3px rgba(198, 169, 107, 0.18);
}
.input:disabled,
.select:disabled,
.textarea:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.textarea {
  height: auto;
  min-height: 84px;
  padding: 10px 12px;
  line-height: 1.5;
  resize: vertical;
}
.select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%238b8274' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
}
.select option {
  background: var(--panel);
  color: var(--bone);
}
.input-sm,
.select-sm {
  height: 34px;
  font-size: 13.5px;
  border-radius: 10px;
}
.input.code {
  font-family: var(--mono);
  font-size: 26px;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  text-align: center;
  height: 60px;
}
.input-group {
  display: flex;
  align-items: stretch;
  gap: 8px;
}
.input-group > .input,
.input-group > .select {
  flex: 1 1 auto;
  min-width: 0;
}
.input-suffix {
  position: relative;
}
.input-suffix > .input {
  padding-right: 3.6em;
}
.input-suffix.tight > .input {
  padding-right: 1.9em;
}
.input-suffix > span {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 13px;
  pointer-events: none;
}
.form-error {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--danger-soft);
  border: 1px solid rgba(180, 105, 92, 0.35);
  color: #efb9ad;
  font-size: 13.5px;
}
.form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 20px;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  user-select: none;
  font-size: 13.5px;
  color: var(--bone-2);
}
.check input {
  width: 17px;
  height: 17px;
  margin: 0;
  accent-color: var(--brass);
  cursor: pointer;
}

/* switch: <label class="switch"><input type="checkbox" role="switch"><span class="track"></span><span>Text</span></label> */
.switch {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  cursor: pointer;
  user-select: none;
  color: var(--bone);
  font-size: 14px;
}
.switch input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}
.switch .track {
  position: relative;
  flex: none;
  width: 38px;
  height: 22px;
  border-radius: 999px;
  background: var(--panel-3);
  border: 1px solid var(--line-2);
  transition: background-color 0.18s ease, border-color 0.18s ease;
}
.switch .track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--muted-2);
  transition: transform 0.18s ease, background-color 0.18s ease;
}
.switch input:checked + .track {
  background: var(--brass);
  border-color: var(--brass);
}
.switch input:checked + .track::after {
  transform: translateX(16px);
  background: var(--on-brass);
}
.switch input:focus-visible + .track {
  outline: 2px solid var(--brass);
  outline-offset: 2px;
}
.switch input:disabled + .track {
  opacity: 0.5;
}
.switch-field {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}
.switch-field:first-child {
  border-top: 0;
  padding-top: 0;
}
.switch-field .hint {
  margin-top: 3px;
}
.switch-field .switch {
  flex: none;
  margin-top: 2px;
}

/* segmented control: radios */
.seg {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 3px;
  padding: 3px;
  border-radius: var(--r);
  background: var(--ink);
  border: 1px solid var(--line-2);
  max-width: 100%;
}
.seg label {
  position: relative;
  cursor: pointer;
}
.seg input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}
.seg span {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 11px;
  border-radius: 9px;
  color: var(--muted-2);
  font-size: 13px;
  white-space: nowrap;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.seg label:hover span {
  color: var(--bone);
}
.seg input:checked + span {
  background: var(--panel-3);
  color: var(--bone);
  box-shadow: inset 0 0 0 1px var(--line-2);
}
.seg input:focus-visible + span {
  outline: 2px solid var(--brass);
  outline-offset: 1px;
}
.seg input:disabled + span {
  opacity: 0.5;
  cursor: not-allowed;
}

input[type="range"] {
  width: 100%;
  height: 22px;
  margin: 0;
  accent-color: var(--brass);
  cursor: pointer;
  background: transparent;
}
.range-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.range-row output {
  min-width: 46px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--bone);
}

/* ---------------------------------------------------------------- chips, dots, badges */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  color: var(--bone-2);
  font-size: 12px;
  font-weight: 400;
  line-height: 1;
  white-space: nowrap;
  vertical-align: middle;
}
.chip .ic {
  width: 13px;
  height: 13px;
}
.chip-ok {
  border-color: transparent;
  background: var(--ok-soft);
  color: var(--ok-text);
}
.chip-warn {
  border-color: transparent;
  background: var(--warn-soft);
  color: var(--warn-text);
}
.chip-danger {
  border-color: transparent;
  background: var(--danger-soft);
  color: var(--danger-text);
}
.chip-brass {
  border-color: rgba(198, 169, 107, 0.4);
  background: var(--brass-soft);
  color: var(--brass-2);
}
.chip-muted {
  color: var(--muted-2);
}
.chip-tag {
  height: 22px;
  padding: 0 9px;
  font-size: 12px;
  background: var(--panel-2);
  border-color: var(--line);
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.dot {
  display: inline-block;
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #5b5448;
  vertical-align: middle;
}
.dot-on {
  background: #93ad8b;
  box-shadow: 0 0 0 3px rgba(126, 148, 120, 0.2);
}
.dot-warn {
  background: var(--warn);
}
.dot-danger {
  background: var(--danger);
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.status-on {
  color: var(--ok-text);
}
.status-off {
  color: var(--muted);
}

.badge-4k {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 7px;
  border-radius: 6px;
  border: 1px solid rgba(198, 169, 107, 0.5);
  color: var(--brass-2);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.stars {
  display: inline-flex;
  gap: 1px;
  color: var(--brass);
  font-size: 14px;
  letter-spacing: 1px;
  white-space: nowrap;
}
.stars .off {
  color: #4a4336;
}

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

.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.table th {
  padding: 10px 14px;
  text-align: left;
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
}
.table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  color: var(--bone-2);
}
.table tbody tr:last-child td {
  border-bottom: 0;
}
.table tbody tr:hover td {
  background: rgba(30, 27, 21, 0.6);
}
.table tr.is-selected td {
  background: var(--brass-soft);
}
.table td.primary {
  color: var(--bone);
}
.table .cell-name {
  color: var(--bone);
  font-weight: 500;
}
.table .cell-name:hover {
  color: var(--brass-2);
}
.table .col-check {
  width: 44px;
  padding-right: 0;
}
.table .col-actions {
  text-align: right;
  white-space: nowrap;
}
.table-compact td {
  padding: 9px 12px;
}
.table-compact th {
  padding: 8px 12px;
}

/* tables that become cards on phones */
@media (max-width: 720px) {
  .table-cards thead {
    display: none;
  }
  .table-cards,
  .table-cards tbody {
    display: block;
  }
  .table-cards tr {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 4px 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
  }
  .table-cards tbody tr:last-child {
    border-bottom: 0;
  }
  .table-cards td {
    display: block;
    padding: 0;
    border: 0;
    grid-column: 2;
    min-width: 0;
  }
  .table-cards tbody tr:hover td {
    background: none;
  }
  .table-cards td[data-label]::before {
    content: attr(data-label) " · ";
    color: var(--muted);
    font-size: 12px;
  }
  .table-cards td.col-check {
    grid-column: 1;
    grid-row: 1 / span 3;
    width: auto;
  }
  .table-cards td.card-title {
    font-size: 15px;
  }
  .table-cards td.col-actions {
    text-align: left;
    margin-top: 6px;
  }
  .table-cards td.hide-sm {
    display: none;
  }
}

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

/* ---------------------------------------------------------------- toolbar / filters */

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.toolbar .input,
.toolbar .select {
  width: auto;
  min-width: 150px;
}
.toolbar .search {
  flex: 1 1 220px;
  max-width: 340px;
}
.search {
  position: relative;
}
.search .ic {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}
.search .input {
  width: 100%;
  padding-left: 38px;
}
@media (max-width: 600px) {
  .toolbar .select,
  .toolbar .input {
    flex: 1 1 140px;
    min-width: 0;
  }
  .toolbar .search {
    flex-basis: 100%;
    max-width: none;
  }
}

.bulkbar {
  position: sticky;
  top: 12px;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding: 10px 12px;
  border-radius: var(--r-lg);
  background: var(--panel-2);
  border: 1px solid rgba(198, 169, 107, 0.35);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}
.bulkbar-label {
  margin-right: 6px;
  color: var(--bone);
  font-size: 13.5px;
}
@media (max-width: 900px) {
  .bulkbar {
    top: 70px;
  }
}

/* ---------------------------------------------------------------- KPI tiles */

.kpis {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
@media (max-width: 1180px) {
  .kpis {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (max-width: 600px) {
  .kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .kpis .kpi:first-child {
    grid-column: span 2;
  }
}
.kpi {
  padding: 16px 18px 15px;
  border-radius: var(--r-lg);
  background: var(--panel);
  border: 1px solid var(--line);
  min-width: 0;
}
.kpi-label {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12.5px;
}
.kpi-value {
  margin-top: 6px;
  font-family: var(--display);
  font-size: 44px;
  font-weight: 500;
  line-height: 1;
  color: var(--bone);
  font-variant-numeric: lining-nums tabular-nums;
}
.kpi-value small {
  font-size: 24px;
  color: var(--muted);
  font-weight: 400;
}
.kpi-foot {
  margin-top: 7px;
  color: var(--muted);
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
@media (max-width: 600px) {
  .kpi {
    padding: 13px 14px;
  }
  .kpi-value {
    font-size: 36px;
  }
}

/* ---------------------------------------------------------------- charts */

.chart {
  position: relative;
}
.chart svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}
.chart .grid-line {
  stroke: var(--line);
  stroke-width: 1;
}
.chart .axis-label {
  fill: var(--muted);
  font-size: 11px;
  font-family: var(--body);
}
.chart .bar {
  fill: var(--brass);
  transition: fill 0.12s ease;
}
.chart .bar-zero {
  fill: var(--line-2);
}
.chart .bar-hit {
  fill: transparent;
  cursor: pointer;
}
.chart .bar-hit:focus {
  outline: none;
}
.chart g.col.is-active .bar {
  fill: var(--brass-2);
}
.chart g.col.is-active .bar-bg {
  fill: rgba(237, 232, 222, 0.04);
}
.chart .bar-bg {
  fill: transparent;
}
.chart .today-label {
  fill: var(--bone-2);
}
.chart-tip {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  padding: 7px 10px;
  border-radius: 10px;
  background: var(--panel-3);
  border: 1px solid var(--line-2);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  font-size: 12.5px;
  color: var(--bone-2);
  white-space: nowrap;
  transform: translate(-50%, calc(-100% - 8px));
  z-index: 5;
}
.chart-tip b {
  display: block;
  color: var(--bone);
  font-weight: 500;
}
.chart-readout {
  min-height: 20px;
  color: var(--muted);
  font-size: 13px;
}
.chart-readout b {
  color: var(--bone);
  font-weight: 500;
}

.hbars {
  display: grid;
  gap: 9px;
}
.hbar {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) 42px;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}
.hbar-track {
  height: 10px;
  border-radius: 999px;
  background: var(--panel-2);
  overflow: hidden;
}
.hbar-fill {
  height: 100%;
  border-radius: 0 4px 4px 0;
  background: var(--brass);
  min-width: 0;
}
.hbar-label {
  color: var(--bone-2);
  white-space: nowrap;
}
.hbar-value {
  text-align: right;
  color: var(--muted-2);
  font-variant-numeric: tabular-nums;
}

.tag-cloud {
  display: grid;
  gap: 8px;
}
.tag-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  font-size: 13.5px;
}
.tag-row .bar-track {
  grid-column: 1 / -1;
  height: 4px;
  border-radius: 999px;
  background: var(--panel-2);
  overflow: hidden;
}
.tag-row .bar-track i {
  display: block;
  height: 100%;
  background: rgba(198, 169, 107, 0.65);
  border-radius: 999px;
}

/* ---------------------------------------------------------------- attention list */

.dash-grid {
  align-items: start;
}
.attention {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 520px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
@media (max-width: 760px) {
  .attention {
    max-height: none;
  }
}
.attention li + li {
  border-top: 1px solid var(--line);
}
.attention a {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  gap: 4px 10px;
  align-items: start;
  padding: 12px 20px;
  color: var(--bone-2);
  text-decoration: none;
}
.attention a:hover {
  background: var(--panel-2);
}
.attention .att-icon {
  margin-top: 1px;
}
.attention .att-title {
  color: var(--bone);
  font-size: 13.5px;
}
.attention .att-device {
  color: var(--muted);
  font-size: 12.5px;
}
.attention .att-detail {
  grid-column: 2 / 3;
  color: var(--muted);
  font-size: 12.5px;
}
.attention .att-chev {
  color: var(--muted);
  margin-top: 2px;
}
.level-danger .att-icon {
  color: var(--danger-text);
}
.level-warn .att-icon {
  color: var(--warn-text);
}
.all-good {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 20px;
  color: var(--ok-text);
}

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

.kv {
  display: grid;
  grid-template-columns: minmax(0, auto) minmax(0, 1fr);
  gap: 8px 16px;
  margin: 0;
  font-size: 13.5px;
}
.kv dt {
  color: var(--muted);
  white-space: nowrap;
}
.kv dd {
  margin: 0;
  color: var(--bone);
  text-align: right;
  overflow-wrap: anywhere;
  min-width: 0;
}
.kv .sub {
  color: var(--muted);
  font-size: 12px;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 14px;
}
.status-card {
  padding: 16px;
  border-radius: var(--r);
  background: var(--panel-2);
  border: 1px solid var(--line);
  min-width: 0;
}
.status-card h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-2);
}
.status-card h3 .ic {
  color: var(--brass);
  width: 16px;
  height: 16px;
}

.meter {
  height: 6px;
  margin-top: 6px;
  border-radius: 999px;
  background: var(--ink);
  overflow: hidden;
}
.meter i {
  display: block;
  height: 100%;
  background: var(--brass);
  border-radius: 999px;
}

/* ---------------------------------------------------------------- verdicts / callouts */

.verdict,
.callout {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--r);
  border: 1px solid var(--line-2);
  background: var(--panel-2);
  font-size: 13.5px;
}
.verdict .ic,
.callout .ic {
  flex: none;
  width: 20px;
  height: 20px;
  margin-top: 1px;
}
.verdict-title {
  color: var(--bone);
  font-weight: 500;
  font-size: 14.5px;
}
.verdict-detail {
  margin-top: 2px;
  color: var(--bone-2);
}
.verdict.ok,
.callout.ok {
  border-color: rgba(126, 148, 120, 0.4);
  background: var(--ok-soft);
}
.verdict.ok .ic,
.callout.ok .ic {
  color: var(--ok-text);
}
.verdict.warn,
.callout.warn {
  border-color: rgba(216, 161, 63, 0.38);
  background: var(--warn-soft);
}
.verdict.warn .ic,
.callout.warn .ic {
  color: var(--warn-text);
}
.verdict.danger,
.callout.danger {
  border-color: rgba(180, 105, 92, 0.45);
  background: var(--danger-soft);
}
.verdict.danger .ic,
.callout.danger .ic {
  color: var(--danger-text);
}
.callout .ic {
  color: var(--brass);
}
.callout p + p {
  margin-top: 6px;
}

.list-plain {
  list-style: none;
  margin: 0;
  padding: 0;
}
.list-plain li {
  padding: 8px 0;
  border-top: 1px solid var(--line);
  font-size: 13.5px;
  overflow-wrap: anywhere;
}
.list-plain li:first-child {
  border-top: 0;
}

/* ---------------------------------------------------------------- empty, loading */

.empty {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 44px 20px;
  text-align: center;
  color: var(--muted);
}
.empty .ic {
  width: 30px;
  height: 30px;
  color: var(--line-2);
  stroke-width: 1.2;
}
.empty-title {
  color: var(--bone);
  font-family: var(--display);
  font-size: 24px;
  font-weight: 500;
}
.empty p {
  max-width: 44ch;
}

.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(198, 169, 107, 0.25);
  border-top-color: var(--brass);
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 60px 20px;
  color: var(--muted);
}

.skeleton {
  border-radius: 8px;
  background: linear-gradient(90deg, var(--panel-2) 0%, var(--panel-3) 50%, var(--panel-2) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}
@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

.progress {
  height: 8px;
  border-radius: 999px;
  background: var(--ink);
  border: 1px solid var(--line);
  overflow: hidden;
}
.progress i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--brass);
  transition: width 0.15s linear;
}

.page-error {
  max-width: 520px;
  margin: 60px auto;
}

/* ---------------------------------------------------------------- toasts */

.toasts {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 1000;
  display: grid;
  gap: 10px;
  width: min(380px, calc(100vw - 32px));
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--r);
  background: var(--panel-3);
  border: 1px solid var(--line-2);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
  color: var(--bone);
  font-size: 13.5px;
  pointer-events: auto;
  animation: toast-in 0.2s ease;
}
.toast .ic {
  margin-top: 1px;
}
.toast-ok .ic {
  color: var(--ok-text);
}
.toast-error {
  border-color: rgba(180, 105, 92, 0.55);
}
.toast-error .ic {
  color: var(--danger-text);
}
.toast-info .ic {
  color: var(--brass);
}
.toast-body {
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
}
.toast-close {
  flex: none;
  margin: -4px -6px -4px 0;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--muted);
  cursor: pointer;
  display: grid;
  place-items: center;
}
.toast-close:hover {
  color: var(--bone);
  background: var(--panel-2);
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}
@media (max-width: 600px) {
  .toasts {
    left: 16px;
    right: 16px;
    bottom: 16px;
    width: auto;
  }
}

/* ---------------------------------------------------------------- dialogs */

dialog.modal {
  width: min(540px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  margin: auto;
  padding: 0;
  border: 1px solid var(--line-2);
  border-radius: var(--r-lg);
  background: var(--panel);
  color: var(--bone);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}
dialog.modal[open] {
  display: flex;
  flex-direction: column;
  animation: modal-in 0.18s ease;
}
dialog.modal.wide {
  width: min(760px, calc(100vw - 32px));
}
dialog.modal.full {
  width: min(1100px, calc(100vw - 32px));
}
dialog.modal::backdrop {
  background: rgba(8, 7, 6, 0.72);
}
@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.99);
  }
}
.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 22px 0;
}
.modal-title {
  font-family: var(--display);
  font-size: 27px;
  font-weight: 500;
  line-height: 1.1;
  overflow-wrap: anywhere;
}
.modal-body {
  padding: 16px 22px 4px;
  overflow-y: auto;
  color: var(--bone-2);
}
.modal-body > p + p {
  margin-top: 10px;
}
.modal-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  padding: 18px 22px 20px;
}
@media (max-width: 600px) {
  dialog.modal,
  dialog.modal.wide {
    width: calc(100vw - 20px);
    max-height: calc(100vh - 20px);
  }
  .modal-foot .btn {
    flex: 1 1 auto;
  }
}

/* ---------------------------------------------------------------- auth screens */

.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 16px;
}
.auth-card {
  width: min(420px, 100%);
}
.auth-brand {
  text-align: center;
  margin-bottom: 26px;
}
.auth-brand .wordmark {
  font-size: 44px;
}
.auth-brand p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.auth .panel {
  padding: 28px;
}
.auth-title {
  font-family: var(--display);
  font-size: 30px;
  font-weight: 500;
  line-height: 1.1;
  margin-bottom: 6px;
}
.auth-sub {
  color: var(--muted);
  margin-bottom: 22px;
}
.auth-foot {
  margin-top: 18px;
  text-align: center;
  color: var(--muted);
  font-size: 12.5px;
}
@media (max-width: 480px) {
  .auth .panel {
    padding: 22px 18px;
  }
}

/* ---------------------------------------------------------------- devices */

.device-name-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.device-sub {
  color: var(--muted);
  font-size: 12.5px;
}
.cam-cell {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}

.code-help {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  margin-bottom: 18px;
  padding: 14px;
  border-radius: var(--r);
  background: var(--panel-2);
  border: 1px solid var(--line);
  font-size: 13px;
  color: var(--bone-2);
}
.code-help svg {
  width: 70px;
  height: 100px;
}

/* device detail */
.device-head {
  display: grid;
  gap: 16px;
  margin-bottom: 18px;
}
.name-edit {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.name-edit .page-title {
  min-width: 0;
}
.name-edit .input {
  font-family: var(--display);
  font-size: 30px;
  height: 52px;
  max-width: 560px;
}
.head-meta {
  display: flex;
  align-items: center;
  gap: 8px 18px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 13.5px;
}
.jump {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}
.jump::-webkit-scrollbar {
  display: none;
}
.jump .btn {
  flex: none;
}

.detail {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  align-items: start;
}
.detail-side {
  display: grid;
  gap: 18px;
  position: sticky;
  top: 20px;
}
.detail-main {
  display: grid;
  gap: 18px;
  min-width: 0;
}
.detail .panel + .panel {
  margin-top: 0;
}
@media (max-width: 1180px) {
  .detail {
    grid-template-columns: minmax(0, 1fr) 300px;
  }
}
@media (max-width: 980px) {
  .detail {
    grid-template-columns: minmax(0, 1fr);
  }
  .detail-side {
    position: static;
  }
}

.controls {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
}
.controls .btn {
  justify-content: flex-start;
  height: 42px;
}
.controls .btn .ic {
  color: var(--brass);
}
.controls .btn-danger .ic {
  color: var(--danger-text);
}
.control-rows {
  display: grid;
  gap: 14px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.control-row {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}
.control-row > label,
.control-row > .control-label {
  color: var(--bone-2);
  font-size: 13.5px;
}
.control-row .inline {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
@media (max-width: 600px) {
  .control-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .control-row > label,
  .control-row > .control-label {
    grid-column: 1 / -1;
  }
}

.shot-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 16;
  max-height: 560px;
  margin: 0 auto;
  border-radius: 14px;
  border: 6px solid #0a0908;
  outline: 1px solid var(--line-2);
  background: var(--ink);
  overflow: hidden;
  display: grid;
  place-items: center;
}
.shot-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.shot-frame button.shot-open {
  position: absolute;
  inset: 0;
  border: 0;
  padding: 0;
  background: none;
  cursor: zoom-in;
}
.shot-empty {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 20px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}
.shot-busy {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 12px;
  background: rgba(15, 14, 12, 0.78);
  color: var(--bone-2);
  font-size: 13px;
  text-align: center;
  padding: 16px;
}
.shot-large {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 170px);
  margin: 0 auto;
  border-radius: 10px;
}

.cmd-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.cmd-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 12px;
  padding: 11px 20px;
  border-top: 1px solid var(--line);
  font-size: 13.5px;
}
.cmd-list li:first-child {
  border-top: 0;
}
.cmd-type {
  color: var(--bone);
  font-weight: 500;
}
.cmd-payload {
  color: var(--muted-2);
  overflow-wrap: anywhere;
}
.cmd-meta {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 12.5px;
}
.cmd-result {
  grid-column: 1 / -1;
  color: var(--bone-2);
  font-size: 12.5px;
  overflow-wrap: anywhere;
}
.chip-status {
  text-transform: capitalize;
}
.chip-pending,
.chip-sent {
  border-color: rgba(198, 169, 107, 0.4);
  color: var(--brass-2);
}
.chip-sent {
  background: var(--brass-soft);
}
.chip-done {
  border-color: transparent;
  background: var(--ok-soft);
  color: var(--ok-text);
}
.chip-failed {
  border-color: transparent;
  background: var(--danger-soft);
  color: var(--danger-text);
}
.chip-expired {
  color: var(--muted);
}

.logs {
  max-height: 460px;
  overflow: auto;
  margin: 0;
  padding: 10px 0;
  background: #0b0a08;
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.55;
}
.log-line {
  display: grid;
  grid-template-columns: 138px 46px minmax(0, 1fr);
  gap: 10px;
  padding: 1px 16px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.log-line:hover {
  background: rgba(237, 232, 222, 0.03);
}
.log-at {
  color: #6c6457;
}
.log-level {
  text-transform: uppercase;
  color: var(--muted);
}
.log-msg {
  color: var(--bone-2);
}
.log-warn .log-level,
.log-warn .log-msg {
  color: var(--warn-text);
}
.log-error .log-level,
.log-error .log-msg {
  color: var(--danger-text);
}
@media (max-width: 600px) {
  .log-line {
    grid-template-columns: 1fr;
    gap: 0;
    padding: 5px 14px;
  }
  .log-at,
  .log-level {
    display: inline;
  }
}

.cam-list {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}
.cam-list h4 {
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-2);
}
.cam-list .hint {
  margin-top: 0;
  margin-bottom: 6px;
}
.cam-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  font-size: 13px;
  overflow-wrap: anywhere;
}
.cam-item + .cam-item {
  margin-top: 6px;
}
.cam-none {
  color: var(--muted);
  font-size: 13px;
  padding: 2px 0;
}

/* ---------------------------------------------------------------- stores */

.store-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 16px;
}
.store-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  border-radius: var(--r-lg);
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--bone-2);
  text-decoration: none;
  transition: border-color 0.15s ease;
}
.store-card:hover {
  border-color: #4a4336;
  text-decoration: none;
  color: var(--bone-2);
}
.store-card-name {
  font-family: var(--display);
  font-size: 25px;
  font-weight: 500;
  line-height: 1.1;
  color: var(--bone);
  overflow-wrap: anywhere;
}
.swatch {
  display: flex;
  height: 54px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.swatch-main {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  padding: 0 14px;
  font-size: 20px;
  overflow: hidden;
  white-space: nowrap;
}
.swatch-accent {
  width: 16px;
}

/* editor */
.editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 28px;
  align-items: start;
}
@media (max-width: 1240px) {
  .editor {
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 22px;
  }
}
.editor-form {
  min-width: 0;
}

.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar {
  display: none;
}
.tab {
  position: relative;
  flex: none;
  height: 44px;
  padding: 0 14px;
  border: 0;
  background: none;
  color: var(--muted-2);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}
.tab:hover {
  color: var(--bone);
}
.tab[aria-selected="true"] {
  color: var(--bone);
}
.tab[aria-selected="true"]::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: -1px;
  height: 2px;
  border-radius: 2px;
  background: var(--brass);
}
.tab .tab-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-left: 6px;
  border-radius: 50%;
  background: var(--brass);
  vertical-align: middle;
}

.section-title {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 500;
  color: var(--bone);
}
.section-sub {
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 13px;
}
.section-title + .field,
.section-title + .field-row {
  margin-top: 14px;
}
.section-title + .switch-field {
  margin-top: 6px;
  border-top: 0;
}

.templates {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
@media (max-width: 1100px) {
  .templates {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.tpl {
  position: relative;
  display: block;
  cursor: pointer;
}
.tpl input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}
.tpl-card {
  display: block;
  border-radius: var(--r);
  border: 1px solid var(--line-2);
  overflow: hidden;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.tpl:hover .tpl-card {
  border-color: #5a5242;
}
.tpl input:checked + .tpl-card {
  border-color: var(--brass);
  box-shadow: 0 0 0 1px var(--brass);
}
.tpl input:focus-visible + .tpl-card {
  outline: 2px solid var(--brass);
  outline-offset: 3px;
}
.tpl-art {
  position: relative;
  display: grid;
  align-content: end;
  gap: 5px;
  height: 118px;
  padding: 12px;
}
.tpl-art .t-brand {
  position: absolute;
  top: 10px;
  left: 12px;
  font-size: 11px;
  letter-spacing: 0.04em;
}
.tpl-art .t-title {
  font-size: 19px;
  line-height: 1.02;
}
.tpl-art .t-btn {
  justify-self: start;
  margin-top: 4px;
  padding: 3px 10px;
  font-size: 10px;
  border-radius: 999px;
}
.tpl-meta {
  display: block;
  padding: 9px 12px 10px;
  background: var(--panel-2);
  border-top: 1px solid var(--line);
}
.tpl-name {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--bone);
  font-size: 13.5px;
  font-weight: 500;
}
.tpl-name .ic {
  color: var(--brass);
  opacity: 0;
}
.tpl input:checked + .tpl-card .tpl-name .ic {
  opacity: 1;
}
.tpl-desc {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.logo-box {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.logo-preview {
  display: grid;
  place-items: center;
  width: 150px;
  height: 64px;
  padding: 8px;
  border-radius: 10px;
  border: 1px dashed var(--line-2);
  background: repeating-conic-gradient(#1a1812 0% 25%, #15130e 0% 50%) 50% / 16px 16px;
  color: var(--muted);
  font-size: 12px;
}
.logo-preview img {
  max-height: 48px;
  max-width: 100%;
  object-fit: contain;
}

.list-editor {
  display: grid;
  gap: 8px;
}
.list-item {
  display: flex;
  align-items: center;
  gap: 6px;
}
.list-item .input {
  flex: 1 1 auto;
  min-width: 0;
}
.list-item .btn-icon {
  flex: none;
}
.list-index {
  flex: none;
  width: 20px;
  color: var(--muted);
  font-size: 12px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.colors {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.color-field {
  padding: 10px 12px;
  border-radius: var(--r);
  background: var(--panel-2);
  border: 1px solid var(--line);
}
.color-field .field-label {
  margin-bottom: 8px;
}
.color-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.color-row input[type="color"] {
  flex: none;
  width: 38px;
  height: 34px;
  padding: 2px;
  border-radius: 9px;
  border: 1px solid var(--line-2);
  background: var(--ink);
  cursor: pointer;
}
.color-row input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}
.color-row input[type="color"]::-webkit-color-swatch {
  border: 0;
  border-radius: 6px;
}
.color-row .input {
  font-family: var(--mono);
  font-size: 13px;
  text-transform: lowercase;
}
.color-state {
  font-size: 11.5px;
  color: var(--muted);
}
.color-state.custom {
  color: var(--brass-2);
}

.rotations {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
@media (max-width: 520px) {
  .rotations {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.rot {
  position: relative;
  cursor: pointer;
}
.rot input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}
.rot-card {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 12px 8px 10px;
  border-radius: var(--r);
  border: 1px solid var(--line-2);
  background: var(--ink);
  color: var(--muted-2);
  font-size: 13px;
}
.rot-card svg {
  width: 54px;
  height: 54px;
}
.rot input:checked + .rot-card {
  border-color: var(--brass);
  color: var(--bone);
  background: var(--brass-soft);
}
.rot input:focus-visible + .rot-card {
  outline: 2px solid var(--brass);
  outline-offset: 2px;
}

.pin-field .input {
  font-family: var(--mono);
  letter-spacing: 0.3em;
  font-size: 17px;
}

.preview-col {
  position: sticky;
  top: 20px;
  min-width: 0;
}
.preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.preview-screens {
  margin-bottom: 12px;
}
.preview-screens .seg {
  display: flex;
  width: 100%;
}
.preview-screens .seg label {
  flex: 1 1 auto;
}
.preview-screens .seg span {
  justify-content: center;
  padding: 0 6px;
  font-size: 12px;
}
.preview-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 16;
  border-radius: 16px;
  border: 7px solid #070706;
  outline: 1px solid var(--line-2);
  background: #000;
  overflow: hidden;
  margin: 0 auto;
}
.preview-frame iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 1080px;
  height: 1920px;
  border: 0;
  transform-origin: 0 0;
  background: #0f0e0c;
}
.preview-note {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}
.preview-close {
  display: none;
}
.preview-fab {
  display: none;
}

@media (max-width: 900px) {
  .editor {
    grid-template-columns: minmax(0, 1fr);
  }
  .preview-col {
    display: none;
  }
  .preview-col.is-open {
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0;
    z-index: 900;
    padding: 12px 12px 16px;
    background: var(--ink);
  }
  .preview-col.is-open .preview-close {
    display: inline-flex;
  }
  .preview-col.is-open .preview-stage {
    flex: 1 1 auto;
    min-height: 0;
    display: grid;
    place-items: center;
  }
  .preview-col.is-open .preview-frame {
    width: auto;
    height: 100%;
    max-width: 100%;
  }
  .preview-fab {
    display: inline-flex;
  }
}

.savebar {
  position: sticky;
  bottom: 14px;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px 14px;
  flex-wrap: wrap;
  margin-top: 22px;
  padding: 12px 14px 12px 18px;
  border-radius: var(--r-lg);
  background: var(--panel-2);
  border: 1px solid var(--line-2);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.5);
}
.savebar.dirty {
  border-color: rgba(198, 169, 107, 0.55);
}
/* only float over the form while there is something to save or to act on */
.savebar:not(.dirty):not(.saved) {
  position: static;
  box-shadow: none;
  background: transparent;
}
.savebar-state {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted-2);
  font-size: 13.5px;
  min-width: 0;
}
.savebar.dirty .savebar-state {
  color: var(--bone);
}
.savebar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
@media (max-width: 600px) {
  .savebar {
    bottom: 10px;
    padding: 10px 12px;
  }
  .savebar-actions {
    width: 100%;
  }
  .savebar-actions .btn {
    flex: 1 1 auto;
  }
}

/* ---------------------------------------------------------------- releases */

.flow {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  counter-reset: flow;
  list-style: none;
  margin: 0;
  padding: 0;
}
.flow li {
  position: relative;
  padding: 14px 14px 14px 46px;
  border-radius: var(--r);
  background: var(--panel-2);
  border: 1px solid var(--line);
  font-size: 13px;
  color: var(--bone-2);
}
.flow li::before {
  counter-increment: flow;
  content: counter(flow);
  position: absolute;
  left: 14px;
  top: 12px;
  font-family: var(--display);
  font-size: 26px;
  line-height: 1;
  color: var(--brass);
  font-variant-numeric: lining-nums;
  font-feature-settings: "lnum" 1;
}
.flow .code-inline {
  padding: 0 4px;
  font-size: 11.5px;
}
.flow b {
  display: block;
  color: var(--bone);
  font-weight: 500;
  margin-bottom: 2px;
}
@media (max-width: 1000px) {
  .flow {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 520px) {
  .flow {
    grid-template-columns: minmax(0, 1fr);
  }
}

.file-drop {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border-radius: var(--r);
  border: 1px dashed var(--line-2);
  background: var(--ink);
  cursor: pointer;
}
.file-drop:hover,
.file-drop.over {
  border-color: var(--brass);
}
.file-drop input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}
.file-drop:focus-within {
  outline: 2px solid var(--brass);
  outline-offset: 2px;
}
.file-drop .ic {
  width: 26px;
  height: 26px;
  color: var(--brass);
}
.file-name {
  color: var(--bone);
  overflow-wrap: anywhere;
}

.versions {
  display: grid;
  gap: 10px;
}
.version-row {
  display: grid;
  grid-template-columns: minmax(0, 150px) minmax(0, 1fr) 50px;
  align-items: center;
  gap: 12px;
  font-size: 13.5px;
}

/* ---------------------------------------------------------------- audit / details */

details.json summary {
  cursor: pointer;
  color: var(--muted-2);
  font-size: 12.5px;
  list-style: none;
}
details.json summary::-webkit-details-marker {
  display: none;
}
details.json summary::before {
  content: "▸ ";
  color: var(--muted);
}
details.json[open] summary::before {
  content: "▾ ";
}
details.json pre {
  margin: 6px 0 0;
  padding: 8px 10px;
  max-width: 420px;
  border-radius: 8px;
  background: #0b0a08;
  border: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--bone-2);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* ---------------------------------------------------------------- help */

.help {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}
.help-toc {
  position: sticky;
  top: 24px;
  display: grid;
  gap: 2px;
}
.help-toc button {
  text-align: left;
  padding: 7px 10px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--muted-2);
  cursor: pointer;
  font-size: 13.5px;
}
.help-toc button:hover {
  background: var(--panel-2);
  color: var(--bone);
}
.help-body .panel {
  scroll-margin-top: 80px;
}
.help-body h2 {
  font-family: var(--display);
  font-size: 26px;
  font-weight: 500;
  line-height: 1.15;
  margin-bottom: 10px;
  color: var(--bone);
}
.help-body p,
.help-body li {
  color: var(--bone-2);
  line-height: 1.6;
  max-width: 76ch;
}
.help-body p + p,
.help-body p + ul,
.help-body p + ol,
.help-body ul + p,
.help-body ol + p {
  margin-top: 10px;
}
.help-body ul,
.help-body ol {
  margin: 0;
  padding-left: 20px;
}
.help-body li + li {
  margin-top: 5px;
}
.help-body b {
  color: var(--bone);
  font-weight: 500;
}
.help-body code,
.code-inline {
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--bone);
  overflow-wrap: anywhere;
}
.help-body pre {
  margin: 10px 0 0;
  padding: 12px 14px;
  border-radius: 10px;
  background: #0b0a08;
  border: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--bone);
  overflow-x: auto;
  white-space: pre;
}
.cmd-table td:first-child {
  white-space: nowrap;
  color: var(--bone);
}
@media (max-width: 900px) {
  .help {
    grid-template-columns: minmax(0, 1fr);
  }
  .help-toc {
    display: none;
  }
}

.role-options {
  display: grid;
  gap: 8px;
}
.role-opt {
  position: relative;
  display: block;
  cursor: pointer;
}
.role-opt input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}
.role-opt span {
  display: block;
  padding: 10px 12px;
  border-radius: var(--r);
  border: 1px solid var(--line-2);
  font-size: 13px;
  color: var(--muted);
}
.role-opt b {
  display: block;
  color: var(--bone);
  font-weight: 500;
  font-size: 14px;
  text-transform: capitalize;
}
.role-opt input:checked + span {
  border-color: var(--brass);
  background: var(--brass-soft);
}
.role-opt input:focus-visible + span {
  outline: 2px solid var(--brass);
  outline-offset: 2px;
}
