/* QueuePanel — station-board look: navy ink, amber signal, a rail that follows every deploy. */

:root {
  --bg: #f1f3f9;
  --surface: #ffffff;
  --surface-2: #e9edf6;
  --line: #d8ddea;
  --ink: #0f1730;
  --ink-2: #48536f;
  --ink-3: #7681a0;
  --accent: #ffb020;
  --accent-ink: #2b1d00;
  --accent-text: #9a5a00;
  --ok: #0e9a60;
  --ok-bg: #dcf4e8;
  --warn: #a86400;
  --warn-bg: #ffefcf;
  --bad: #d23a2d;
  --bad-bg: #fde3e0;
  --info: #2c57f5;
  --info-bg: #e2e9ff;
  --rail: #c3cbe0;
  --term: #0b1124;
  --term-ink: #cdd6ee;
  --shadow: 0 1px 2px rgba(15, 23, 48, .06), 0 14px 30px -18px rgba(15, 23, 48, .28);
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 22px;
  --ui: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Bricolage Grotesque", "Figtree", system-ui, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, Menlo, monospace;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #090f22;
  --surface: #111a37;
  --surface-2: #19244b;
  --line: #243060;
  --ink: #eef1fb;
  --ink-2: #b0bad8;
  --ink-3: #7f8bb2;
  --accent: #ffb020;
  --accent-ink: #2b1d00;
  --accent-text: #ffc24d;
  --ok: #3bd99a;
  --ok-bg: rgba(59, 217, 154, .14);
  --warn: #ffc24d;
  --warn-bg: rgba(255, 176, 32, .14);
  --bad: #ff7a6e;
  --bad-bg: rgba(255, 122, 110, .14);
  --info: #8aa4ff;
  --info-bg: rgba(138, 164, 255, .15);
  --rail: #2d3a6c;
  --term: #060b1a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 18px 34px -20px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 var(--ui);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--display); margin: 0; letter-spacing: -.01em; line-height: 1.15; }
h1 { font-size: clamp(1.6rem, 3.4vw, 2.1rem); font-weight: 700; }
h2 { font-size: 1.15rem; font-weight: 650; }
h3 { font-size: 1rem; font-weight: 650; }
p { margin: 0; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.small { font-size: .85rem; }
.mono { font-family: var(--mono); font-size: .85em; }
.ic { flex: none; vertical-align: middle; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ------------------------------------------------------------------ shell */
.shell { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100dvh; }
.side {
  position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column;
  padding: 22px 16px 16px; border-right: 1px solid var(--line); background: var(--surface);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 22px; font: 700 1.2rem var(--display); letter-spacing: -.02em; }
.brand svg { width: 30px; height: 30px; }
.nav { position: relative; display: flex; flex-direction: column; gap: 2px; padding-left: 4px; }
.nav::before { content: ""; position: absolute; left: 17px; top: 14px; bottom: 14px; width: 2px; background: var(--rail); border-radius: 2px; }
.nav a {
  position: relative; display: flex; align-items: center; gap: 10px; padding: 9px 12px 9px 34px;
  border-radius: var(--r-sm); text-decoration: none; color: var(--ink-2); font-weight: 550;
}
.nav a::before {
  content: ""; position: absolute; left: 8px; top: 50%; width: 10px; height: 10px; margin-top: -5px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--rail); transition: background .15s, border-color .15s;
}
.nav a:hover { color: var(--ink); background: var(--surface-2); }
.nav a[aria-current="page"] { color: var(--ink); background: var(--surface-2); }
.nav a[aria-current="page"]::before { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 24%, transparent); }
.side-foot { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px 8px 0; border-top: 1px solid var(--line); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--surface-2); object-fit: cover; display: grid; place-items: center; font-weight: 700; flex: none; }
.who { min-width: 0; flex: 1; line-height: 1.25; }
.who b, .who span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who span { font-size: .78rem; color: var(--ink-3); }

.main { padding: 30px clamp(16px, 4vw, 48px) 80px; max-width: 1240px; width: 100%; }
.head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px 20px; margin-bottom: 26px; }
.head .sub { margin-top: 6px; color: var(--ink-2); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }

.tabbar { display: none; }

/* ------------------------------------------------------------------ controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px;
  border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface); font-weight: 600; cursor: pointer;
  text-decoration: none; transition: transform .08s, background .15s, border-color .15s; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { color: var(--bad); }
.btn.sm { min-height: 34px; padding: 0 12px; font-size: .88rem; }
.btn.icon { width: 40px; padding: 0; }
.btn.sm.icon { width: 34px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn.quiet { border-color: transparent; background: transparent; }
.btn.quiet:hover { background: var(--surface-2); }

.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > span { font-weight: 600; font-size: .88rem; }
.field small { color: var(--ink-3); }
.input, select.input, textarea.input {
  width: 100%; min-height: 42px; padding: 9px 12px; background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--r-sm); color: var(--ink);
}
textarea.input { min-height: 90px; resize: vertical; font-family: var(--mono); font-size: .85rem; }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }
.check { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }

.pill {
  display: inline-flex; align-items: center; gap: 7px; padding: 3px 10px 3px 9px; border-radius: 99px; font-size: .8rem; font-weight: 650;
  background: var(--surface-2); color: var(--ink-2); white-space: nowrap;
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.info { background: var(--info-bg); color: var(--info); }
.pill.run::before { animation: blink 1s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .25; } }

.seg { display: inline-flex; padding: 3px; background: var(--surface-2); border-radius: 12px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 7px 14px; border-radius: 9px; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

/* ------------------------------------------------------------------ surfaces */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px; box-shadow: var(--shadow); }
.card.flat { box-shadow: none; }
.card + .card, .stack > * + * { margin-top: 16px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.board { display: grid; gap: 1px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); background: var(--line); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; margin-bottom: 26px; }
.board > div { background: var(--surface); padding: 18px 20px; }
.board b { display: block; font: 700 2rem/1.1 var(--display); letter-spacing: -.02em; }
.board span { color: var(--ink-2); font-size: .88rem; }
.section { margin-top: 30px; }
.section > .head { margin-bottom: 14px; align-items: center; }

.rows { display: grid; }
.row { display: flex; align-items: center; gap: 14px; padding: 13px 4px; border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; }
.row.link { cursor: pointer; border-radius: var(--r-sm); padding-inline: 10px; margin-inline: -10px; }
.row.link:hover { background: var(--surface-2); }
.row .grow { flex: 1; min-width: 0; }
.row .grow b, .row .grow span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .grow span { color: var(--ink-3); font-size: .85rem; }

.site-card { display: flex; flex-direction: column; gap: 14px; cursor: pointer; transition: transform .12s, border-color .15s; }
.site-card:hover { transform: translateY(-2px); border-color: var(--accent); }
.site-card .top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.site-card h3 { overflow-wrap: anywhere; }
.site-card .host { color: var(--ink-3); font-size: .85rem; overflow-wrap: anywhere; }
.site-card .foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; }

.meter { height: 8px; border-radius: 8px; background: var(--surface-2); overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 8px; background: var(--ok); transition: width .5s; }
.meter i.mid { background: var(--accent); }
.meter i.high { background: var(--bad); }
.meters { display: grid; gap: 12px; margin-top: 14px; }
.meters > div > div:first-child { display: flex; justify-content: space-between; font-size: .85rem; color: var(--ink-2); margin-bottom: 5px; }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; overflow-wrap: anywhere; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; scrollbar-width: none; }
.tabs a { padding: 10px 14px; text-decoration: none; color: var(--ink-2); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a[aria-current="true"] { color: var(--ink); border-color: var(--accent); }

.drop { display: grid; place-items: center; gap: 6px; text-align: center; padding: 28px 16px; border: 2px dashed var(--line); border-radius: var(--r-md); cursor: pointer; transition: border-color .15s, background .15s; }
.drop:hover, .drop.over { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.drop input { display: none; }

.empty { text-align: center; padding: 38px 16px; color: var(--ink-2); }
.empty h3 { color: var(--ink); margin-bottom: 6px; }
.empty .btn { margin-top: 14px; }

.skel { border-radius: var(--r-md); background: linear-gradient(90deg, var(--surface-2), var(--surface), var(--surface-2)); background-size: 200% 100%; animation: sheen 1.3s linear infinite; min-height: 90px; }
@keyframes sheen { to { background-position: -200% 0; } }

/* ------------------------------------------------------------------ the rail (deploy progress) */
.rail { display: flex; margin: 4px 0 18px; }
.st { flex: 1; min-width: 56px; position: relative; text-align: center; font-size: .75rem; color: var(--ink-3); font-weight: 600; }
.st i { display: block; position: relative; z-index: 1; width: 16px; height: 16px; margin: 0 auto 7px; border-radius: 50%; background: var(--surface); border: 2px solid var(--rail); }
.st + .st::before { content: ""; position: absolute; top: 7px; left: -50%; width: 100%; height: 2px; background: var(--rail); }
.st.done { color: var(--ink-2); }
.st.done i { background: var(--ok); border-color: var(--ok); }
.st.done::before { background: var(--ok) !important; }
.st.skip i { border-style: dashed; }
.st.active { color: var(--ink); }
.st.active i { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 28%, transparent); animation: ring 1.4s ease-in-out infinite; }
.st.fail { color: var(--bad); }
.st.fail i { background: var(--bad); border-color: var(--bad); }
@keyframes ring { 50% { box-shadow: 0 0 0 9px color-mix(in srgb, var(--accent) 0%, transparent); } }

.term { background: var(--term); color: var(--term-ink); border-radius: var(--r-md); padding: 14px 16px; font: 12.5px/1.65 var(--mono); max-height: min(52vh, 460px); overflow: auto; }
.term .ln { display: grid; grid-template-columns: 64px 1fr; gap: 10px; white-space: pre-wrap; overflow-wrap: anywhere; }
.term .ln time { color: #62709a; }
.term .step { color: #ffc24d; font-weight: 700; margin-top: 8px; }
.term .ok { color: #3bd99a; }
.term .warn { color: #ffc24d; }
.term .error { color: #ff8b80; }
.term .plain { grid-template-columns: 1fr; }

/* ------------------------------------------------------------------ overlays */
.scrim { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 18px; background: rgba(5, 9, 24, .55); backdrop-filter: blur(3px); animation: fade .15s; }
.sheet { width: min(560px, 100%); max-height: calc(100dvh - 36px); overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .6); animation: rise .2s ease-out; }
.sheet.wide { width: min(820px, 100%); }
.sheet header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px 6px; position: sticky; top: 0; background: var(--surface); z-index: 1; }
.sheet .body { padding: 10px 20px 20px; }
.sheet footer { display: flex; justify-content: flex-end; gap: 8px; padding-top: 6px; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(14px); opacity: 0; } }

#toasts { position: fixed; z-index: 80; right: 18px; bottom: 18px; display: grid; gap: 8px; max-width: min(380px, calc(100vw - 36px)); }
.toast { padding: 12px 16px; border-radius: var(--r-md); background: var(--ink); color: var(--bg); font-weight: 550; box-shadow: var(--shadow); animation: rise .2s ease-out; }
.toast.bad { background: var(--bad); color: #fff; }

/* ------------------------------------------------------------------ login */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.login .card { width: min(420px, 100%); padding: 34px 30px; text-align: center; }
.login .brand { justify-content: center; padding-bottom: 8px; font-size: 1.5rem; }
.login .rail { margin: 26px 0 8px; }
.login .btn { width: 100%; min-height: 48px; margin-top: 18px; }
.alert { margin-top: 18px; padding: 12px 14px; border-radius: var(--r-sm); background: var(--bad-bg); color: var(--bad); font-weight: 600; text-align: left; }

/* ------------------------------------------------------------------ small screens */
@media (max-width: 880px) {
  .shell { display: block; }
  .side { display: none; }
  .main { padding: 18px 16px 104px; }
  .two { grid-template-columns: 1fr; }
  .head { margin-bottom: 20px; }
  .tabbar {
    display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; z-index: 40; left: 0; right: 0; bottom: 0;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: blur(14px); border-top: 1px solid var(--line);
  }
  .tabbar a, .tabbar button {
    display: grid; justify-items: center; gap: 3px; padding: 7px 4px; border: 0; background: transparent; border-radius: 12px;
    text-decoration: none; color: var(--ink-3); font-size: .72rem; font-weight: 650; cursor: pointer;
  }
  .tabbar [aria-current="page"] { color: var(--ink); background: var(--surface-2); }
  .tabbar [aria-current="page"] svg { color: var(--accent-text); }
  .scrim { place-items: end center; padding: 0; }
  .sheet, .sheet.wide { width: 100%; max-height: 92dvh; border-radius: var(--r-lg) var(--r-lg) 0 0; border-bottom: 0; }
  .sheet .body { padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
  #toasts { left: 16px; right: 16px; bottom: calc(86px + env(safe-area-inset-bottom)); max-width: none; }
  .row { flex-wrap: wrap; }
  .btn { min-height: 44px; }
  .btn.sm { min-height: 38px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Import from IIS */
.imp-list { max-height: min(52vh, 440px); overflow: auto; margin: 4px -6px 0; padding: 0 6px; }
.imp-tools { display: flex; justify-content: flex-end; margin: 2px 0 4px; }
.imp-row { cursor: pointer; }
.imp-row.off { cursor: default; opacity: .6; }
.imp-row input { width: 20px; height: 20px; flex: none; accent-color: var(--accent); }
