/* Orbit — light theme per "Services Dashboard" design (claude.ai/design). */
:root {
  --bg: oklch(0.965 0.004 250);
  --panel: oklch(0.99 0.002 250);
  --line: oklch(0.93 0.004 250);
  --line-soft: oklch(0.96 0.004 250);
  --line-input: oklch(0.88 0.004 250);
  --text: oklch(0.26 0.01 250);
  --text-mid: oklch(0.36 0.01 250);
  --text-dim: oklch(0.50 0.01 250);
  --muted: oklch(0.58 0.01 250);
  --ink: oklch(0.28 0.01 250);
  --ink-hover: oklch(0.20 0.01 250);
  --up: oklch(0.60 0.15 150);
  --off: oklch(0.60 0.01 250);
  --fail: oklch(0.58 0.19 27);
  --stop-red: oklch(0.55 0.14 27);
  --link: oklch(0.55 0.13 250);
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }
/* The hidden attribute must always win, even over explicit display rules. */
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

body { margin: 0; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; -webkit-font-smoothing: antialiased; background: var(--bg); color: var(--text); }
a { color: var(--link); text-decoration: none; }
a:hover { color: oklch(0.48 0.13 250); }
input, select, textarea, button { font: inherit; color: inherit; }
input, select, textarea { width: 100%; padding: 9px 12px; border: 1px solid var(--line-input); border-radius: 8px; background: #fff; color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: none; border-color: oklch(0.55 0.06 250); }
::placeholder { color: oklch(0.62 0.01 250); }
.mono { font-family: var(--mono); }
.ta-right { text-align: right; }

@keyframes slideIn { from { transform: translateX(24px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes pulse { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }

/* brand */
.brand-mark { display: inline-flex; width: 24px; height: 24px; flex-shrink: 0; align-items: center; justify-content: center; border-radius: 6px; background: var(--ink); color: #fff; font-weight: 700; font-size: 13px; }
.brand-mark.sm { font-size: 12px; }
.brand-mark.lg { width: 32px; height: 32px; border-radius: 8px; font-size: 15px; margin-bottom: 24px; }

/* buttons */
.btn-primary { display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; font-size: 13px; font-weight: 600; color: #fff; background: var(--ink); border: none; border-radius: 8px; cursor: pointer; }
.btn-primary:hover { background: var(--ink-hover); }
.btn-primary.danger { background: var(--stop-red); }
.btn-primary:disabled { opacity: .55; cursor: default; }
.btn-secondary { padding: 9px 14px; font-size: 13px; font-weight: 600; color: oklch(0.30 0.01 250); background: #fff; border: 1px solid var(--line-input); border-radius: 8px; cursor: pointer; }
.btn-secondary:hover { background: oklch(0.96 0.004 250); }
.btn-secondary.sm { padding: 6px 10px; font-size: 12px; font-weight: 500; }
.btn-danger { padding: 9px 14px; font-size: 13px; font-weight: 600; color: var(--fail); background: #fff; border: 1px solid oklch(0.85 0.05 27); border-radius: 8px; cursor: pointer; }
.btn-danger:hover { background: oklch(0.97 0.01 27); }
.btn-block { width: 100%; justify-content: center; padding: 12px; font-size: 14px; }
.icon-btn { width: 28px; height: 28px; flex-shrink: 0; border-radius: 7px; border: 1px solid oklch(0.90 0.004 250); background: #fff; color: oklch(0.45 0.01 250); font-size: 15px; line-height: 1; cursor: pointer; }
.icon-btn:hover { background: oklch(0.96 0.004 250); }

.eyebrow { margin: 0 0 8px; font-size: 11px; font-weight: 700; letter-spacing: 0.1em; color: oklch(0.55 0.01 250); }
.form-error { min-height: 1.1em; margin: 8px 0; color: var(--fail); font-size: 13px; }
.form-error.pad-x { margin: 0; padding: 0 28px; }
.inline-status { font-size: 12px; color: var(--muted); align-self: center; }

/* ── Login ─────────────────────────────────────────────── */
.login-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 40px; }
.login-card { width: 380px; background: #fff; border: 1px solid oklch(0.90 0.004 250); border-radius: 16px; padding: 44px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05); }
.login-card h1 { margin: 0 0 6px; font-size: 27px; font-weight: 600; }
.login-sub { margin: 0 0 30px; font-size: 14px; color: oklch(0.55 0.01 250); }
.field-label { display: block; font-size: 12px; font-weight: 600; color: oklch(0.42 0.01 250); letter-spacing: 0.02em; }
.login-card input { margin: 6px 0 18px; padding: 11px 13px; font-size: 14px; background: oklch(0.985 0.002 250); }

/* ── App frame ─────────────────────────────────────────── */
.app-frame { display: flex; height: 100vh; overflow: hidden; }

/* sidebar */
.sidebar { width: 216px; flex-shrink: 0; display: flex; flex-direction: column; gap: 4px; padding: 24px 16px; border-right: 1px solid var(--line); background: var(--panel); }
.side-brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 20px; font-size: 15px; font-weight: 600; }
.side-register { width: 100%; margin-bottom: 8px; padding: 10px 12px; text-align: left; }
.side-register .plus { font-size: 15px; line-height: 1; }
.nav-item { padding: 9px 12px; border-radius: 7px; font-size: 13px; color: var(--text-dim); }
.nav-item.active { background: oklch(0.94 0.004 250); color: var(--text); font-weight: 600; }
.nav-item.disabled { cursor: default; opacity: .75; }
.side-uptime { margin-top: auto; padding: 12px; border-radius: 8px; background: oklch(0.97 0.003 250); border: 1px solid var(--line); }
.tile-label { font-size: 11px; color: oklch(0.55 0.01 250); margin-bottom: 3px; }
.tile-value { font-size: 14px; font-weight: 600; }
.side-user { display: flex; align-items: center; gap: 9px; padding: 12px 8px 0; }
.avatar { display: flex; width: 28px; height: 28px; flex-shrink: 0; align-items: center; justify-content: center; border-radius: 50%; background: oklch(0.90 0.02 250); font-size: 12px; font-weight: 600; color: oklch(0.40 0.02 250); text-transform: uppercase; }
.side-user-meta { min-width: 0; }
.side-user-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user-host { font-size: 11px; color: oklch(0.55 0.01 250); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-signout { margin-top: 6px; padding: 7px 8px; font-size: 12px; color: var(--text-dim); background: none; border: none; border-radius: 7px; cursor: pointer; text-align: left; }
.side-signout:hover { background: oklch(0.94 0.004 250); color: var(--text); }

/* main column */
.main-col { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.main-header { padding: 22px 28px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.main-header h2 { margin: 0; font-size: 18px; font-weight: 600; }
.main-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.host-label { font-size: 12px; color: var(--muted); }
.table-scroll { flex: 1; display: flex; flex-direction: column; min-height: 0; overflow-x: auto; }
.svc-grid { min-width: 660px; padding: 12px 28px; display: grid; grid-template-columns: 2fr 0.95fr 0.85fr 0.7fr 0.9fr 1.4fr; gap: 12px; align-items: center; }
.svc-head { font-size: 11px; font-weight: 600; letter-spacing: 0.04em; color: var(--muted); border-bottom: 1px solid var(--line-soft); flex-shrink: 0; }
.svc-body { flex: 1; overflow-y: auto; min-width: 660px; }
.svc-row { padding: 13px 28px; border-bottom: 1px solid oklch(0.96 0.004 250); cursor: pointer; background: transparent; }
.svc-row:hover { background: oklch(0.975 0.003 250); }
.svc-row.selected { background: oklch(0.965 0.006 250); }
.svc-name-cell { min-width: 0; }
.svc-name { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.svc-path { font-size: 11.5px; color: var(--muted); margin-top: 2px; font-family: var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.svc-state { display: flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--off); flex-shrink: 0; }
.state-running .dot, .state-running { color: var(--up); } .state-running .dot { background: var(--up); }
.state-failed .dot, .state-failed { color: var(--fail); } .state-failed .dot { background: var(--fail); }
.state-stopped .dot, .state-stopped { color: var(--off); } .state-stopped .dot { background: var(--off); }
.svc-num { font-size: 13px; color: var(--text-mid); font-family: var(--mono); }
.svc-actions { display: flex; gap: 6px; justify-content: flex-end; align-items: center; }
.svc-btn { padding: 5px 10px; font-size: 12px; color: oklch(0.40 0.01 250); background: #fff; border: 1px solid var(--line-input); border-radius: 6px; cursor: pointer; }
.svc-btn:hover { background: oklch(0.96 0.004 250); }
.empty-state { padding: 48px 28px; text-align: center; color: var(--muted); font-size: 13.5px; display: grid; gap: 14px; justify-items: center; }

/* toggle switch */
.toggle { position: relative; width: 34px; height: 20px; flex-shrink: 0; border: none; border-radius: 20px; padding: 0; background: oklch(0.86 0.004 250); cursor: pointer; transition: background .15s; }
.toggle::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); transition: left .15s; }
.toggle.on { background: var(--up); }
.toggle.on::after { left: 16px; }
.toggle:disabled { opacity: .5; cursor: default; }

/* ── AI chat panel ─────────────────────────────────────── */
.chat-panel { width: 348px; flex-shrink: 0; display: flex; flex-direction: column; border-left: 1px solid var(--line); background: var(--panel); }
.chat-head { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.chat-title { display: flex; align-items: center; gap: 9px; font-size: 14px; font-weight: 600; }
.chat-messages { flex: 1; overflow: auto; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.msg { max-width: 85%; padding: 10px 13px; border-radius: 12px; font-size: 13px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: break-word; }
.msg.ai { align-self: flex-start; background: #fff; color: var(--ink); border: 1px solid oklch(0.90 0.004 250); }
.msg.me { align-self: flex-end; background: var(--ink); color: #fff; }
.msg.thinking { color: var(--muted); animation: pulse 1.4s ease-in-out infinite; }
.chat-input-row { padding: 14px 16px; border-top: 1px solid var(--line); display: flex; gap: 8px; align-items: flex-end; }
.chat-input-row textarea { flex: 1; resize: none; padding: 9px 12px; font-size: 13px; max-height: 90px; }
.chat-input-row .btn-primary { padding: 9px 14px; }

/* ── Details slide-over ────────────────────────────────── */
.overlay { position: fixed; inset: 0; z-index: 20; background: oklch(0.20 0.01 250 / 0.28); display: flex; justify-content: flex-end; }
.overlay.center { align-items: center; justify-content: center; padding: 24px; }
.drawer { width: 440px; max-width: 100%; height: 100%; background: #fff; border-left: 1px solid oklch(0.90 0.004 250); box-shadow: -8px 0 30px rgba(0, 0, 0, 0.08); display: flex; flex-direction: column; animation: slideIn .22s ease; }
.drawer-head { padding: 22px 26px; border-bottom: 1px solid var(--line); display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.drawer-head-meta { min-width: 0; }
.drawer-title-row { display: flex; align-items: center; gap: 9px; }
.drawer-title-row .dot { width: 9px; height: 9px; }
.drawer-title-row h3 { margin: 0; font-size: 18px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drawer-status { font-size: 12.5px; margin-top: 5px; font-weight: 600; }
.drawer-body { flex: 1; overflow: auto; padding: 24px 26px; display: flex; flex-direction: column; gap: 24px; }
.drawer-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 16px; }
.dfield-label { font-size: 11px; color: var(--muted); margin-bottom: 4px; letter-spacing: 0.03em; }
.dfield-value { font-size: 13.5px; color: oklch(0.32 0.01 250); font-family: var(--mono); word-break: break-all; }
.dfield.wide { grid-column: 1 / -1; }
.section-label { font-size: 12px; font-weight: 600; letter-spacing: 0.04em; color: oklch(0.42 0.01 250); margin-bottom: 10px; }
.log-box { background: oklch(0.15 0.006 250); border-radius: 10px; padding: 16px 18px; font-size: 12px; line-height: 1.7; color: oklch(0.80 0.01 250); overflow-x: auto; white-space: pre; max-height: 320px; overflow-y: auto; }
.log-box .l-up { color: var(--up); } .log-box .l-fail { color: oklch(0.68 0.19 27); } .log-box .l-dim { color: oklch(0.60 0.01 250); }
.logs-toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.logs-toolbar .section-label { margin-bottom: 0; }
.logs-toolbar select { width: auto; padding: 4px 8px; font-size: 12px; }
.drawer-foot { padding: 18px 26px; border-top: 1px solid var(--line); display: flex; gap: 10px; }
.drawer-foot .grow { flex: 1; justify-content: center; padding: 11px; }
.editor-text { min-height: 220px; font-size: 12.5px; line-height: 1.55; background: oklch(0.985 0.002 250); }
.editor-tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.editor-tab { padding: 6px 12px; font-size: 12px; font-weight: 600; border: 1px solid var(--line-input); background: #fff; border-radius: 7px; cursor: pointer; color: var(--text-dim); }
.editor-tab.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.editor-actions { display: flex; gap: 10px; margin-top: 10px; }
.reg-label { margin-top: 22px; }

/* ── Modal / forms ─────────────────────────────────────── */
.modal { width: 520px; max-width: 100%; max-height: 92vh; overflow: auto; background: #fff; border: 1px solid oklch(0.90 0.004 250); border-radius: 16px; padding: 30px; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.14); }
.modal h3 { margin: 0 0 18px; font-size: 18px; font-weight: 600; }
.reg-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 14px; }
.reg-grid label { display: grid; gap: 6px; font-size: 12px; font-weight: 600; color: oklch(0.42 0.01 250); }
.reg-grid input, .reg-grid select, .reg-grid textarea { font-size: 13px; font-weight: 400; }
.reg-grid .reg-wide, .reg-grid .full { grid-column: 1 / -1; }
.reg-actions { display: flex; gap: 10px; align-items: center; }
.port-row { display: flex; gap: 8px; }
.port-row input { flex: 1; }

/* toasts */
.toast-root { position: fixed; right: 20px; bottom: 20px; z-index: 60; display: grid; gap: 8px; }
.toast { padding: 11px 15px; border-radius: 9px; background: var(--ink); color: #fff; font-size: 13px; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18); animation: slideIn .2s ease; }
.toast.error { background: var(--stop-red); }
.spinner { display: inline-block; width: 12px; height: 12px; border: 2px solid var(--line-input); border-top-color: var(--ink); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }
