/*
 * The console's licensing pages: the nav, Home, the Systems toolbar, Features, Plans, Upgrade
 * requests, the Manage sheet's licence and feature switches, and the quick switcher.
 *
 * Only Slate's tokens from styles.css, so light and dark follow the theme toggle with nothing of
 * their own. Everything else (cards, stamps, chips, buttons, fieldsets) is styles.css's markup.
 */

/* ------------------------------------------------------------------ the nav */

.nav { background: var(--shell-deep); border-top: 1px solid rgb(255 255 255 / 0.05); }
.nav-in {
  max-width: 92rem; margin: 0 auto; padding: 0 28px;
  display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none;
}
.nav-in::-webkit-scrollbar { display: none; }
.nav-in a {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  padding: 10px 12px; font-size: 13px; font-weight: 600; color: var(--shell-muted);
  text-decoration: none; border-bottom: 2px solid transparent;
  transition: color var(--base) var(--ease), border-color var(--base) var(--ease);
}
.nav-in a:hover { color: #ffffff; }
.nav-in a[aria-current='page'] { color: #ffffff; border-bottom-color: var(--sky); }
.nav-in a .bar-count { margin-inline-start: 2px; }
.nav :focus-visible { outline-color: var(--sky); outline-offset: -2px; }

.kbd {
  display: inline-flex; align-items: center; min-height: 18px; padding: 0 5px;
  border: 1px solid rgb(255 255 255 / 0.24); border-radius: 5px;
  font-family: var(--mono); font-size: 10.5px; font-weight: 500; color: var(--shell-muted);
}

.page[hidden] { display: none; }
.head-tools { margin-top: 0; }
.section-title { font-size: 15px; margin: 22px 0 10px; }
.note { margin-top: 6px; font-size: 13px; color: var(--ink); }

/* ------------------------------------------------------------------ Systems */

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; min-width: 0; }
.toolbar input[type='search'] { flex: 1 1 16rem; min-width: 0; max-width: 28rem; }
.toolbar select { width: auto; max-width: 100%; min-width: 0; }

th button.sort {
  all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 4px;
  font: inherit; color: inherit; border-radius: 4px;
}
th button.sort::after { content: '↕'; font-size: 10px; opacity: .45; }
th[aria-sort='ascending'] button.sort::after { content: '↑'; opacity: 1; }
th[aria-sort='descending'] button.sort::after { content: '↓'; opacity: 1; }
th button.sort:hover { color: var(--ink); }
th button.sort:focus-visible { outline: 2.5px solid var(--focus); outline-offset: 2px; }

.plan.custom { color: var(--neutral-ink); background: var(--neutral-soft); }
.plan-line .plan { margin-top: 0; }
.attn {
  margin-top: 6px; width: fit-content; max-width: 16rem; padding: 2px 8px; border-radius: 6px;
  font-size: 11.5px; font-weight: 600; line-height: 1.4;
}
.attn.warning { background: var(--warn-soft); color: var(--warn-ink); }
.attn.critical { background: var(--danger-soft); color: var(--danger-ink); }

/* ------------------------------------------------------------------ Home */

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(14rem, 100%), 1fr)); gap: 12px; margin-bottom: 18px; }
.tile {
  display: flex; flex-direction: column; gap: 4px; min-width: 0; padding: 16px 18px;
  border: 1px solid var(--line); border-radius: var(--r-xl); background: var(--surface); box-shadow: var(--shadow-card);
}
.tile-label { font-size: 12.5px; color: var(--faint); }
.tile-value { font-size: 22px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.tile .hint { margin-top: 0; }

.queues { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(22rem, 100%), 1fr)); gap: 12px; }
.queue {
  min-width: 0; padding: 14px 16px 16px; border: 1px solid var(--line); border-radius: var(--r-xl);
  background: var(--surface); box-shadow: var(--shadow-card);
}
.queue header { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.queue h2 { font-size: 14.5px; display: flex; align-items: center; gap: 8px; }
.queue-n {
  display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px;
  background: var(--neutral-soft); color: var(--neutral-ink); font-size: 12px; font-weight: 700;
}
.queue-n.busy { background: var(--warn-soft); color: var(--warn-ink); }
.queue-link { font-size: 12.5px; font-weight: 600; color: var(--accent); text-decoration: none; }
.queue-link:hover { text-decoration: underline; }
.queue ul { list-style: none; margin: 0; padding: 0; }
.queue-item {
  all: unset; box-sizing: border-box; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px;
  width: 100%; padding: 8px 10px; border-radius: var(--r-sm); cursor: pointer; color: var(--ink); font-size: 13px;
}
.queue-item:hover { background: var(--raised); }
.queue-item:focus-visible { outline: 2.5px solid var(--focus); outline-offset: 0; }
.queue-item .sys-name { margin-top: 0; }
.queue-detail { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.queue-item .attn { margin-top: 0; }

/* ------------------------------------------------------------------ Features */

.feature-group { font-size: 13px; color: var(--faint); font-weight: 600; margin: 14px 0 6px; }
.feature-group:first-child { margin-top: 0; }
.feature-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px 14px;
  padding: 10px 12px; margin-top: 6px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--raised);
}
.feature-row b { font-size: 13px; }
.feature-row em { display: block; font-style: normal; font-size: 12px; color: var(--faint); margin-top: 2px; line-height: 1.45; }
.feature-row em.effect { color: var(--muted); }
.feature-row.is-off { background: var(--surface); border-style: dashed; }
.fleet-group .feature-row { grid-template-columns: minmax(0, 1fr) auto auto; }
.feature-ctl .chip.off { text-decoration: none; }
.fleet-counts { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }

/* An on/off switch: a real checkbox, so the keyboard and screen readers have it for free. */
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.switch input {
  appearance: none; -webkit-appearance: none; margin: 0; flex: none;
  width: 38px; height: 22px; border-radius: 999px; background: var(--sunken); border: 1px solid var(--line-strong);
  position: relative; cursor: pointer; transition: background-color var(--base) var(--ease);
}
.switch input::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--surface); box-shadow: var(--shadow-card); transition: transform var(--base) var(--ease);
}
.switch input:checked { background: var(--ok); border-color: var(--ok); }
.switch input:checked::after { transform: translateX(16px); }
.switch input:disabled { opacity: .5; cursor: progress; }
[dir='rtl'] .switch input:checked::after { transform: translateX(-16px); }

/* ------------------------------------------------------------------ Plans */

.cat-table { min-width: 52rem; }
.cat-table td { vertical-align: top; }
.cat-table .chip.off { text-decoration: none; }
.defaults { margin-top: 22px; }
.price-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1.4fr); gap: 8px; margin-top: 12px; }
.price-row[hidden] { display: none; }

/* ------------------------------------------------------------------ the Manage sheet */

.request-note {
  margin: 16px 0 0; padding: 12px 14px; border-radius: var(--r-lg);
  background: var(--info-soft); color: var(--info-ink); font-size: 13px; line-height: 1.5;
}
.plan-facts { margin-top: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--raised); }
.plan-facts .hint:first-child { margin-top: 0; margin-bottom: 6px; }
#licPlanPick { margin: 6px 0 10px; }
.addon-rows { list-style: none; margin: 6px 0 0; padding: 0; }
.addon-row {
  display: grid; grid-template-columns: minmax(0, 1fr) 5rem auto; align-items: center; gap: 8px;
  padding: 8px 10px; margin-top: 6px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--raised);
}
.addon-row b { display: block; font-size: 13px; }
.addon-row em { display: block; font-style: normal; font-size: 12px; color: var(--faint); }
.preview-box { border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
.preview-lines { margin: 0; padding-inline-start: 18px; font-size: 13px; line-height: 1.6; }
.preview-lines .lost { color: var(--danger-ink); }
.preview-lines .gained { color: var(--ok-ink); }

/* ------------------------------------------------------------------ Upgrade requests */

.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: var(--r-lg); background: var(--sunken); margin-bottom: 10px; }
.seg button {
  all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: var(--r-sm); font-size: 13px; font-weight: 600; color: var(--muted);
}
.seg button[aria-selected='true'] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-card); }
.seg button:focus-visible { outline: 2.5px solid var(--focus); outline-offset: 1px; }
.seg-n { font-family: var(--mono); font-size: 11.5px; color: var(--faint); }

/* ------------------------------------------------------------------ Ctrl+K */

.switcher { justify-content: center; align-items: flex-start; }
.switcher-card {
  margin-top: 12vh; width: min(36rem, calc(100% - 32px)); height: auto; max-height: 70vh;
  border: 1px solid var(--line); border-radius: var(--r-xl); overflow: hidden; padding: 10px;
  animation: pop var(--slow) var(--ease);
}
.switcher-card input { width: 100%; min-height: 44px; font-size: 15px; }
.switcher-list { list-style: none; margin: 8px 0 0; padding: 0; overflow-y: auto; max-height: 50vh; }
.switcher-list li {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 9px 12px; border-radius: var(--r-sm); cursor: pointer; font-size: 13.5px;
}
.switcher-list li.on { background: var(--accent-soft); color: var(--accent-ink); }
.switcher-list li .hint { margin: 0; text-align: end; }
.switcher-hint { margin: 8px 4px 0; }

/* ------------------------------------------------------------------ small screens */

@media (max-width: 52rem) {
  .nav-in { padding: 0 16px; }
}

@media (max-width: 40rem) {
  .fleet-group .feature-row, .feature-row { grid-template-columns: minmax(0, 1fr); }
  .fleet-counts { justify-content: flex-start; }
  .feature-row .acts, .feature-ctl { justify-content: flex-start; }
  .addon-row { grid-template-columns: minmax(0, 1fr) 4.5rem; }
  .addon-row button { grid-column: 1 / -1; justify-self: start; }
  .price-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .price-row select { grid-column: 1 / -1; }
  .cat-table { min-width: 40rem; }
  #switcherBtn .kbd { display: none; }
}
