/*
 * The cabinet and the control room.
 *
 * Both are one shape: a rail of sections on the left, one working surface on the right. A screen
 * opens with its name and a half-line saying what it is for; inside, facts sit in two columns, label
 * left and value right, one line each. The accent marks state and nothing else.
 */

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

.panel-shell {
  display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: clamp(20px, 4vw, 56px);
  margin: clamp(26px, 4vw, 48px) 0 80px; align-items: start;
}

.rail { position: sticky; top: 92px; display: grid; gap: 22px; }
.rail-id { display: flex; align-items: center; gap: 12px; }
.avatar {
  width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; flex: none;
  font-family: var(--head); font-weight: 640; font-size: 15px; color: var(--accent);
  background: rgba(var(--accent-rgb), .1); border: 1px solid rgba(var(--accent-rgb), .26);
}
.avatar svg { width: 18px; height: 18px; }
.rail-id b { display: block; font-family: var(--head); font-size: 14.5px; font-weight: 600; word-break: break-all; }

.role-badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 99px;
  font-size: 10px; letter-spacing: .12em; text-transform: uppercase; font-weight: 700; margin-top: 4px;
  border: 1px solid var(--line-2); color: var(--dim);
}
.role-badge::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.role-badge[data-role="Media"] { color: #8EC8FF; border-color: rgba(142, 200, 255, .3); }
.role-badge[data-role="Admin"] { color: var(--accent); border-color: rgba(var(--accent-rgb), .38); }
.role-badge[data-role="Dev"] { color: #C9A2FF; border-color: rgba(201, 162, 255, .35); }

.rail-nav { display: grid; gap: 1px; }
.rail-nav button {
  position: relative; display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 2px 10px 14px;
  border: none; background: transparent; color: var(--dim); cursor: pointer; font-size: 13.5px; text-align: left;
  transition: color .3s var(--ease), padding-left .4s var(--ease);
}
.rail-nav button::before {
  content: ''; position: absolute; left: 0; top: 50%; width: 2px; height: 0; margin-top: 0; border-radius: 2px;
  background: var(--accent); box-shadow: 0 0 8px var(--accent);
  transition: height .4s var(--ease), margin-top .4s var(--ease);
}
.rail-nav button svg { width: 16px; height: 16px; flex: none; }
.rail-nav button:hover { color: var(--text); padding-left: 18px; }
.rail-nav button.active { color: var(--text); }
.rail-nav button.active::before { height: 16px; margin-top: -8px; }

.panel-main { display: grid; gap: clamp(26px, 3.4vw, 42px); min-width: 0; }

/* ------------------------------------------------------------------ headings */

.panel-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.panel-head h1 { font-size: clamp(27px, 3.4vw, 40px); letter-spacing: -.03em; }
.panel-head .slash { color: var(--faint); font-size: 14px; }
.panel-head .slash::before { content: '/ '; }
.panel-head .end { margin-left: auto; display: flex; gap: 9px; align-items: center; flex-wrap: wrap; }

.caption {
  display: flex; align-items: center; gap: 9px; margin-bottom: 18px;
  font-size: 11.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--faint); font-weight: 600;
}
.caption svg { width: 14px; height: 14px; color: var(--accent); }
.caption .pill { margin-left: 8px; }

.block { display: grid; }
.block + .block { margin-top: clamp(26px, 3.4vw, 42px); }
.split { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: clamp(24px, 3.6vw, 48px); }

/* ------------------------------------------------------------------ rows */

.rows { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 clamp(24px, 4vw, 56px); }
.rows.one { grid-template-columns: 1fr; }
.row {
  display: flex; align-items: center; gap: 14px; min-height: 46px; padding: 8px 0;
  border-bottom: 1px solid var(--line); font-size: 14px;
}
.row .k { display: flex; align-items: center; gap: 9px; color: var(--dim); font-size: 13.5px; }
.row .k svg { width: 14px; height: 14px; color: var(--faint); flex: none; }
.row .v { margin-left: auto; text-align: right; font-weight: 500; word-break: break-all; }
.row .v small { display: block; color: var(--faint); font-size: 12px; font-weight: 400; }
.row .v code { color: var(--dim); font-size: 12.5px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; font-size: 11.5px;
  border: 1px solid var(--line-2); color: var(--dim); white-space: nowrap;
}
.chip.on { color: var(--accent); border-color: rgba(var(--accent-rgb), .4); background: rgba(var(--accent-rgb), .06); }
.chip.off { color: var(--faint); }
.chip.bad { color: #FF8A8A; border-color: rgba(255, 138, 138, .3); }

/* ------------------------------------------------------------------ subscription */

.sub-card {
  position: relative; overflow: hidden; border-radius: var(--r-l); border: 1px solid var(--line);
  background: var(--panel); padding: 26px; display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
}
.sub-card.live { border-color: rgba(var(--accent-rgb), .3); }
.sub-card::before {
  content: ''; position: absolute; inset: -60% 55% auto -25%; height: 200%;
  background: radial-gradient(circle, rgba(var(--accent-rgb), .16), transparent 62%); filter: blur(40px); opacity: 0;
  transition: opacity .8s var(--ease);
}
.sub-card.live::before { opacity: 1; }
.sub-card > * { position: relative; }
.sub-card .meta { display: grid; gap: 5px; }
.sub-card .meta b { font-family: var(--head); font-size: clamp(19px, 2.2vw, 24px); font-weight: 620; letter-spacing: -.02em; }
.sub-card .meta small { color: var(--dim); font-size: 13px; }
.sub-card .end { margin-left: auto; display: flex; gap: 9px; flex-wrap: wrap; }

.dial-ring-small { width: 84px; height: 84px; flex: none; position: relative; display: grid; place-items: center; }
.dial-ring-small svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.dial-ring-small circle { fill: none; stroke-width: 5; stroke-linecap: round; }
.dial-ring-small .track { stroke: var(--panel-3); }
.dial-ring-small .fill { stroke: var(--accent); filter: drop-shadow(0 0 6px rgba(var(--accent-rgb), .6)); transition: stroke-dashoffset 1.4s var(--ease); }
.dial-ring-small b { font-family: var(--head); font-size: 19px; font-weight: 640; line-height: 1; }
.dial-ring-small small { display: block; font-size: 10px; color: var(--faint); letter-spacing: .06em; text-align: center; }

.redeem { display: flex; gap: 10px; flex-wrap: wrap; }
.redeem input { flex: 1 1 240px; font-family: var(--mono); letter-spacing: .08em; text-transform: uppercase; }

.stat { padding: 0 0 16px; border-bottom: 1px solid var(--line); }
.stat small { display: block; font-size: 11.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); }
.stat b { display: block; font-family: var(--head); font-size: clamp(22px, 2.6vw, 30px); font-weight: 620; margin-top: 8px; letter-spacing: -.03em; }
.metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: clamp(20px, 3vw, 40px); }

form.stack { display: grid; gap: 14px; max-width: 420px; }
form.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; align-items: end; }
form.grid-2 .wide { grid-column: 1 / -1; }

/* cosmetics */
.wardrobe { display: grid; grid-template-columns: repeat(auto-fill, minmax(146px, 1fr)); gap: 12px; }
.wear {
  position: relative; padding: 16px; border-radius: var(--r-m); border: 1px solid var(--line); background: var(--panel);
  text-align: center; cursor: pointer; transition: border-color .35s var(--ease), transform .35s var(--ease);
}
.wear:hover { transform: translateY(-3px); border-color: var(--line-2); }
.wear.on { border-color: rgba(var(--accent-rgb), .42); }
.wear .orb { width: 42px; height: 42px; margin: 2px auto 12px; border-radius: 50%; border: 2px solid var(--item); box-shadow: 0 0 20px -5px var(--item); }
.wear b { display: block; font-family: var(--head); font-size: 13.5px; font-weight: 560; }
.wear small { font-size: 11px; color: var(--faint); }

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

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 600px; }
thead th {
  text-align: left; padding: 0 14px 12px 0; font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--faint); font-weight: 600; border-bottom: 1px solid var(--line);
}
tbody td { padding: 13px 14px 13px 0; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr { transition: background .25s var(--ease); }
tbody tr:hover { background: var(--panel); }
td b { font-weight: 560; }
td small { display: block; color: var(--faint); font-size: 11.5px; }
td code { font-size: 12px; color: var(--dim); }
td .end { display: flex; gap: 7px; justify-content: flex-end; }

.admin-search { display: flex; gap: 10px; margin-bottom: 20px; }
.admin-search input { flex: 1; }

.audit-line { font-family: var(--mono); font-size: 12px; color: var(--dim); padding: 8px 0; border-bottom: 1px solid var(--line); word-break: break-all; }
.audit-line:hover { color: var(--text); }
.audit-list { max-height: 60vh; overflow: auto; }

.check-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.check-chip { display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border-radius: 99px; border: 1px solid var(--line); background: var(--panel); font-size: 12.5px; cursor: pointer; color: var(--dim); transition: color .3s var(--ease), border-color .3s var(--ease); }
.check-chip:has(input:checked) { color: var(--text); border-color: rgba(var(--accent-rgb), .45); }
.check-chip input { width: auto; height: auto; accent-color: var(--accent); }

@media (max-width: 900px) {
  .panel-shell { grid-template-columns: 1fr; }
  .rail { position: static; }
  .rail-nav { grid-auto-flow: column; grid-auto-columns: max-content; overflow-x: auto; gap: 4px; padding-bottom: 4px; }
  .rail-nav button { padding: 8px 12px; }
  .rail-nav button::before { left: 12px; right: 12px; top: auto; bottom: 0; width: auto; height: 0; }
  .rail-nav button.active::before { height: 2px; margin-top: 0; }
  .rows { grid-template-columns: 1fr; }
}
