/* NSEA Control Plane web app (controlplane.netsuite.tech). Olive and cream, dark, like the macOS app. Also defines the tokens,
   keyframes and host classes the shared terminal panel expects (public/ask/term.css header). */
:root {
  color-scheme: dark;
  --olive-950: #181A12; --olive-900: #21241A; --olive-850: #282C1F; --olive-800: #2F3424; --olive-700: #3A4030; --olive-600: #4A513D;
  --clay-700: #A84B2E; --clay-600: #C25E3F; --clay-500: #D97757; --clay-400: #E59177; --clay-300: #EFB29E;
  --cream-50: #FAF7F0; --taupe-200: #C4BBA4; --taupe-300: #A79D83;
  --font-sans: "Hanken Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --radius-xs: 6px; --radius-sm: 10px; --radius-md: 14px; --radius-lg: 20px; --radius-xl: 28px; --radius-pill: 999px;
  --touch-min: 44px;
  --safe-bottom: env(safe-area-inset-bottom, 0px); --safe-top: env(safe-area-inset-top, 0px);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --duration-fast: 120ms; --duration-base: 200ms; --duration-slow: 360ms;
  --surface-base: #2F3424; --surface-sunken: #21241A; --surface-raised: #3A4030; --surface-overlay: #282C1F; --surface-hover: #444B38;
  --surface-accent-soft: rgba(217, 119, 87, 0.14);
  --text-primary: #FAF7F0; --text-secondary: #C4BBA4; --text-muted: #B5AC95; --text-accent: #EFB29E; --text-on-accent: #181A12;
  --border-subtle: rgba(250, 247, 240, 0.08); --border-default: rgba(250, 247, 240, 0.16); --border-strong: rgba(250, 247, 240, 0.26);
  --border-control: #8D917F; --border-accent: #D97757; --focus-ring: #E59177; --focus-border: #E59177;
  --pos-text: #9FBF72; --neg-text: #EE9A86; --warn-text: #E0A33E; --info-text: #8FB3C4;
  --shadow-sm: 0 1px 2px rgba(15, 17, 11, 0.30), 0 2px 6px rgba(15, 17, 11, 0.32);
  --shadow-md: 0 2px 4px rgba(15, 17, 11, 0.28), 0 8px 24px rgba(15, 17, 11, 0.42);
  --shadow-lg: 0 4px 8px rgba(15, 17, 11, 0.30), 0 20px 52px rgba(15, 17, 11, 0.52);
  --shadow-xl: 0 8px 16px rgba(15, 17, 11, 0.34), 0 36px 88px rgba(15, 17, 11, 0.58);
  --inset-top: inset 0 1px 0 rgba(250, 247, 240, 0.06);
  --tabbar-top: 0px; --kb: 0px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--surface-base); color: var(--text-primary); font: 15px/1.45 var(--font-sans); -webkit-text-size-adjust: 100%; }
body { min-height: 100dvh; padding: var(--safe-top) max(16px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px)); overflow-x: hidden; }
[hidden] { display: none !important; }
a { color: var(--text-accent); }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1rem; }
.muted { color: var(--text-muted); }
.mono { font-family: var(--font-mono); font-size: .85em; }
.icon { width: 1.1rem; height: 1.1rem; flex: none; }

button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 38px; padding: .35rem .85rem;
  font: 500 .92rem/1.2 var(--font-sans); color: var(--text-primary); background: var(--surface-raised);
  border: 1px solid var(--border-default); border-radius: var(--radius-sm); cursor: pointer; text-decoration: none;
  transition: background var(--duration-fast) var(--ease-out), border-color var(--duration-fast) var(--ease-out);
}
button:hover:not(:disabled), .button:hover { background: var(--surface-hover); }
button:disabled { opacity: .5; cursor: default; }
button:focus-visible, .button:focus-visible, input:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
button.primary, .button.primary { background: var(--clay-500); border-color: var(--clay-500); color: var(--text-on-accent); font-weight: 600; }
button.primary:hover:not(:disabled), .button.primary:hover { background: var(--clay-400); }
button.danger { color: var(--neg-text); }
button.small { min-height: 32px; padding: .2rem .65rem; font-size: .85rem; }
input { font: inherit; color: var(--text-primary); background: var(--surface-sunken); border: 1px solid var(--border-control); border-radius: var(--radius-sm); padding: .4rem .6rem; }

.drawer-backdrop { position: fixed; inset: 0; background: rgba(10, 11, 7, 0.55); }
@keyframes ns-scale-in { from { opacity: 0; transform: scale(.97); } }
@keyframes ns-sheet-up { from { transform: translateY(100%); } }

/* header */
.top { display: flex; align-items: center; gap: .75rem; padding: .75rem 0; }
.brand { display: flex; align-items: center; gap: .55rem; font-weight: 700; letter-spacing: .01em; margin-right: auto; }
.brand img { width: 28px; height: 28px; border-radius: 7px; }
.session-left { font-size: .8rem; color: var(--text-muted); white-space: nowrap; }
.top .tabs { display: flex; gap: .3rem; }
.tabs button[aria-selected="true"] { background: var(--surface-accent-soft); border-color: var(--border-accent); color: var(--text-accent); }

main { max-width: 1100px; margin: 0 auto; padding-bottom: 2rem; }
section > .head { display: flex; align-items: center; gap: .75rem; margin: .25rem 0 .9rem; flex-wrap: wrap; }
section > .head h2 { margin-right: auto; }

/* sign-in */
.signin { max-width: 26rem; margin: 14vh auto 0; text-align: center; display: flex; flex-direction: column; gap: 1rem; align-items: center; }
.signin img { width: 72px; height: 72px; border-radius: 16px; }

/* fleet */
.hosts { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: .9rem; }
.host { display: flex; flex-direction: column; gap: .65rem; padding: 1rem; background: var(--surface-overlay); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); min-width: 0; }
.host.revoked { opacity: .55; }
.host-head { display: flex; align-items: baseline; gap: .5rem; flex-wrap: wrap; }
.host-head h3 { margin-right: auto; }
.pill { display: inline-flex; align-items: center; gap: .3rem; padding: .05rem .55rem; border-radius: var(--radius-pill); font-size: .75rem; font-weight: 600; background: var(--surface-raised); color: var(--text-secondary); border: 1px solid var(--border-subtle); white-space: nowrap; }
.pill.ok { color: var(--pos-text); } .pill.warn { color: var(--warn-text); } .pill.bad { color: var(--neg-text); }
.facts { display: grid; grid-template-columns: auto 1fr; gap: .2rem .8rem; margin: 0; font-size: .86rem; }
.facts dt { color: var(--text-muted); }
.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.actions { display: flex; flex-wrap: wrap; gap: .4rem; }
.caps { display: flex; flex-wrap: wrap; gap: .35rem; }
.requested { padding: .6rem .7rem; border: 1px dashed var(--border-accent); border-radius: var(--radius-md); background: var(--surface-accent-soft); display: flex; flex-direction: column; gap: .45rem; font-size: .88rem; }
.drift { margin: 0; padding-left: 1.1rem; font-size: .82rem; color: var(--text-secondary); }
.requests { display: flex; flex-direction: column; gap: .2rem; font-size: .8rem; color: var(--text-muted); }
details.more > summary { cursor: pointer; color: var(--text-muted); font-size: .85rem; }
.toast { position: fixed; left: 50%; bottom: calc(1rem + var(--safe-bottom)); transform: translateX(-50%); z-index: 80; max-width: min(92vw, 34rem); padding: .6rem 1rem; border-radius: var(--radius-md); background: var(--surface-raised); border: 1px solid var(--border-default); box-shadow: var(--shadow-lg); font-size: .9rem; }
.toast.error { border-color: var(--neg-text); color: var(--neg-text); }

/* terminal */
.targets { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .6rem; }
.targets button[aria-pressed="true"] { background: var(--surface-accent-soft); border-color: var(--border-accent); color: var(--text-accent); }
.targets .dot { width: .5rem; height: .5rem; border-radius: 50%; background: var(--border-control); }
.targets .dot.on { background: var(--pos-text); }
.fanout { display: flex; flex-direction: column; gap: .7rem; }
.fanout-bar { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.fanout-bar input { flex: 1 1 16rem; min-height: 40px; font-family: var(--font-mono); }
.fanout-confirm { padding: .7rem .8rem; border: 1px solid var(--border-accent); border-radius: var(--radius-md); background: var(--surface-accent-soft); display: flex; flex-direction: column; gap: .5rem; }
.fanout-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); gap: .7rem; }
.fanout-cell { display: flex; flex-direction: column; gap: .3rem; min-width: 0; }
.fanout-cell header { display: flex; align-items: center; gap: .5rem; font-size: .85rem; font-weight: 600; }
.fanout-screen { height: 260px; padding: .4rem; background: var(--surface-sunken); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); overflow: hidden; }
.fanout-screen .xterm { height: 100%; }

/* audit */
.audit table { width: 100%; border-collapse: collapse; font-size: .82rem; }
.audit th, .audit td { text-align: left; padding: .3rem .4rem; border-bottom: 1px solid var(--border-subtle); vertical-align: top; }
.audit td.hash { font-family: var(--font-mono); font-size: .75rem; overflow-wrap: anywhere; }

@media (max-width: 700px), (pointer: coarse) {
  body { padding-bottom: calc(4.5rem + var(--safe-bottom)); }
  .top .tabs { display: none; }
  .tabbar { position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-around; padding: .35rem .5rem calc(.35rem + var(--safe-bottom)); background: color-mix(in srgb, var(--surface-overlay) 88%, transparent); -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px); border-top: 1px solid var(--border-subtle); }
  .tabbar button { flex: 1; flex-direction: column; gap: .15rem; min-height: 50px; background: transparent; border: 0; font-size: .72rem; color: var(--text-muted); }
  .tabbar button[aria-selected="true"] { color: var(--text-accent); }
  body.composing .tabbar { display: none; }
  .hosts { grid-template-columns: 1fr; }
  .session-left { display: none; }
}
@media (min-width: 701px) and (pointer: fine) { .tabbar { display: none; } }
