/* =========================================================================
   NanoCore Office — application styles.  Dark, dense, NanoCore.
   Base controls, auth, shell, popovers and modals come from Vault so the
   products read as one family; Office-specific styles follow below.
   Colour is reserved for meaning: health status, alerts, client accents.
   ========================================================================= */

.app { min-height: 100dvh; }
.boot { display: grid; place-items: center; min-height: 100dvh; }
.spinner { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line); border-top-color: #fff; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* --- generic controls ------------------------------------------------------- */
.input, .field input, .field textarea, .field select, .access-row select {
  width: 100%; min-height: var(--tap); padding: 11px 14px;
  background: var(--panel-3); border: 1px solid var(--line); border-radius: var(--radius-sm);
  color: var(--fg); font-size: 15px; transition: border-color var(--fast), box-shadow var(--fast);
}
.field textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
.field select, .access-row select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
.input::placeholder, .field input::placeholder, .field textarea::placeholder { color: var(--ghost); }
.input:focus, .field input:focus, .field textarea:focus, .field select:focus, .access-row select:focus { outline: none; border-color: rgba(255,255,255,0.6); box-shadow: 0 0 0 3px rgba(255,255,255,0.07); }
.field { display: block; margin-bottom: 14px; }
.field > span, .field > label, .label { display: block; font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--muted); margin-bottom: 7px; }
.field--row { display: flex; gap: 8px; align-items: flex-end; }
.field--row > * { flex: 1; }
.field .mono-in { font-family: var(--font-mono); font-size: 14px; letter-spacing: 0.02em; }
.hint { font-size: 12.5px; color: var(--faint); margin-top: 6px; line-height: 1.45; }
.iconbtn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: var(--radius-xs); border: 0; background: none; color: var(--muted); cursor: pointer; transition: background var(--fast), color var(--fast); flex: 0 0 auto; }
.iconbtn:hover { background: var(--hover); color: var(--fg); }
.iconbtn.is-on { color: #fbbf24; }
.linkbtn { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 13px; padding: 4px 0; }
.linkbtn:hover { color: var(--fg); text-decoration: underline; }
.btn--danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn--danger-solid:hover:not(:disabled) { box-shadow: 0 0 0 1px var(--danger), 0 0 24px rgba(239,68,68,0.3); border-color: var(--danger); }
.btn--ghost { background: transparent; }
.btn--block { width: 100%; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel-2); font-size: 12px; color: var(--fg-dim); white-space: nowrap; cursor: pointer; transition: border-color var(--fast), color var(--fast); min-height: 28px; }
.chip:hover { border-color: var(--line-hard); color: var(--fg); }
.chip.is-on { background: #fff; color: #000; border-color: #fff; }
.chip__dot { width: 8px; height: 8px; border-radius: 50%; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 600; color: #fff; flex: 0 0 auto; letter-spacing: 0.02em; }
.avatar--lg { width: 44px; height: 44px; font-size: 14px; }
.tile { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; font-family: var(--font-display); font-weight: 600; font-size: 14px; color: #fff; flex: 0 0 auto; text-shadow: 0 1px 2px rgba(0,0,0,0.4); }
.tile.lg { width: 56px; height: 56px; font-size: 20px; border-radius: 14px; }
.tile.sm { width: 28px; height: 28px; font-size: 10px; border-radius: 7px; }
.kbd { font-family: var(--font-mono); font-size: 10px; padding: 2px 6px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; color: var(--muted); background: var(--panel-2); }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px; font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; border: 1px solid var(--line); color: var(--muted); }
.pill--ok { color: var(--ok); border-color: rgba(34,197,94,0.4); }
.pill--warn { color: var(--warn); border-color: rgba(245,158,11,0.4); }
.pill--danger { color: var(--danger); border-color: rgba(239,68,68,0.4); }
.pill--accent { color: #d8b4fe; border-color: rgba(168,85,247,0.45); }
.meter { display: flex; gap: 3px; margin-top: 8px; }
.meter i { flex: 1; height: 3px; border-radius: 2px; background: var(--line); }
.meter[data-score="1"] i:nth-child(-n+1), .meter[data-score="2"] i:nth-child(-n+2) { background: var(--danger); }
.meter[data-score="2"] i:nth-child(-n+2) { background: var(--warn); }
.meter[data-score="3"] i:nth-child(-n+3) { background: #a3e635; }
.meter[data-score="4"] i:nth-child(-n+5) { background: var(--ok); }
.meter[data-score="0"] i:first-child { background: var(--danger); }

/* --- auth screens ------------------------------------------------------------ */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 28px 20px calc(28px + env(safe-area-inset-bottom)); position: relative; isolation: isolate;
  background: radial-gradient(900px 520px at 78% -8%, rgba(255,255,255,0.08), transparent 60%), radial-gradient(700px 600px at -5% 100%, rgba(255,255,255,0.05), transparent 60%), #000; }
/* the NanoCore ambient grid — brand, so it lives where people land */
.auth::after { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,0.09) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.09) 1px, transparent 1px);
  background-size: 58px 58px; mask-image: radial-gradient(circle at 50% 35%, #000, transparent 80%); -webkit-mask-image: radial-gradient(circle at 50% 35%, #000, transparent 80%); }
.auth__card { width: 100%; max-width: 440px; background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 38px 34px 30px; box-shadow: var(--shadow); position: relative; overflow: hidden; animation: auth-in 0.3s var(--ease) both; }
.auth__card--wide { max-width: 560px; }
@keyframes auth-in { from { opacity: 0; transform: translateY(12px) scale(0.985); } to { opacity: 1; transform: none; } }
.auth__card::before { content: ""; position: absolute; top: 0; left: 12%; right: 12%; height: 1px; background: linear-gradient(90deg, transparent, rgba(255,255,255,0.75), transparent); }
.auth__brand { display: flex; flex-direction: column; align-items: center; gap: 14px; margin-bottom: 26px; text-align: center; }
.auth__emblem { position: relative; width: 74px; height: 74px; display: grid; place-items: center; }
.auth__emblem img { width: 46px; height: 46px; object-fit: contain; }
.auth__emblem::before { content: ""; position: absolute; inset: 0; border-radius: 22px; border: 1px solid var(--line); }
.auth__emblem::after { content: ""; position: absolute; inset: -8px; border-radius: 28px; border: 1px solid var(--line-soft); border-top-color: rgba(255,255,255,0.5); animation: spin 9s linear infinite; }
.auth__wordmark { font-family: var(--font-display); font-size: 28px; letter-spacing: 0.18em; text-transform: uppercase; line-height: 1; }
.auth__tagline { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.34em; text-transform: uppercase; color: var(--faint); margin-top: 9px; }
.auth__who { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line-soft); border-radius: var(--radius-sm); margin-bottom: 18px; background: var(--panel); }
.auth__who b { display: block; font-size: 14px; }
.auth__who span { font-size: 12px; color: var(--muted); }
.auth__who button { margin-left: auto; }
.auth__error { display: none; background: rgba(239,68,68,0.12); border: 1px solid rgba(239,68,68,0.4); color: #fca5a5; border-radius: var(--radius-sm); padding: 10px 13px; font-size: 13.5px; margin-bottom: 16px; }
.auth__error.is-on { display: block; }
.auth__note { font-size: 13.5px; color: var(--fg-dim); line-height: 1.55; margin-bottom: 18px; }
.auth__submit { width: 100%; margin-top: 6px; }
.auth__bio { width: 100%; margin-bottom: 14px; padding: 16px; gap: 12px; font-size: 13px; }
.auth__bio svg { width: 22px; height: 22px; }
.auth__or { display: flex; align-items: center; gap: 12px; font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--ghost); margin: 8px 0 14px; }
.auth__or::before, .auth__or::after { content: ""; flex: 1; height: 1px; background: var(--line-soft); }
.auth__links { display: flex; justify-content: space-between; margin-top: 18px; font-size: 12.5px; color: var(--muted); }
.auth__links a, .auth__links button { color: var(--muted); background: none; border: 0; cursor: pointer; font-size: inherit; }
.auth__links a:hover, .auth__links button:hover { color: var(--fg); text-decoration: underline; }
.auth__foot { text-align: center; margin-top: 22px; font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--ghost); }
.auth__foot a:hover { color: var(--fg); }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 56px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); height: 34px; padding: 0 10px; background: none; border: 0; cursor: pointer; font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--faint); }
.pw-toggle:hover { color: var(--fg); }
.progress { height: 3px; background: var(--line-soft); border-radius: 2px; overflow: hidden; margin: 14px 0 0; }
.progress i { display: block; height: 100%; width: 0; background: #fff; transition: width 0.3s var(--ease); }
.progress.is-busy i { width: 100%; animation: indet 1.2s ease-in-out infinite; }
@keyframes indet { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }

/* Recovery codes (styled like Vault's Emergency Kit) */
.kit { border: 1px dashed var(--line-hard); border-radius: var(--radius-sm); padding: 18px; background: var(--panel); margin: 16px 0; }
.kit__key { font-family: var(--font-mono); font-size: 17px; letter-spacing: 0.05em; word-break: break-all; text-align: center; padding: 12px 0; user-select: all; }
.kit__meta { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 13px; color: var(--fg-dim); }
.kit__meta b { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted); align-self: center; }
.kit__actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; font-size: 13.5px; color: var(--fg-dim); margin: 14px 0 6px; }
.check input { width: 18px; height: 18px; margin-top: 1px; accent-color: #fff; }

/* --- shell ------------------------------------------------------------------ */
.shell { display: grid; grid-template-columns: var(--rail) 1fr; grid-template-areas: "rail main"; height: 100dvh; overflow: hidden; }
.shell.has-panel { grid-template-columns: var(--rail) minmax(340px, 1fr) minmax(420px, 46%); grid-template-areas: "rail main panel"; }
.rail { grid-area: rail; background: var(--bg-1); border-right: 1px solid var(--line-soft); display: flex; flex-direction: column; min-height: 0; }
.rail__brand { display: flex; align-items: center; gap: 10px; padding: 18px 16px 12px; font-family: var(--font-display); font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; font-size: 15px; }
.rail__brand img { width: 24px; height: 24px; }
.rail__brand .sub { margin-left: auto; font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.24em; color: var(--ghost); font-weight: 400; }
.rail__scroll { flex: 1; overflow-y: auto; min-height: 0; padding-bottom: 12px; }
.rail__section { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.26em; text-transform: uppercase; color: var(--ghost); padding: 16px 16px 6px; display: flex; align-items: center; }
.rail__section button { margin-left: auto; }
.rail__link { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 16px 9px 13px; border: 0; border-left: 3px solid transparent; background: none; color: var(--fg-dim); font-size: 13.5px; text-align: left; cursor: pointer; transition: background var(--fast), color var(--fast); min-height: 38px; }
.rail__link:hover { background: var(--hover); color: var(--fg); }
.rail__link.is-active { background: var(--active); color: var(--fg); border-left-color: #fff; }
.rail__link svg { flex: 0 0 auto; opacity: 0.75; }
.rail__link .dot { width: 9px; height: 9px; border-radius: 3px; flex: 0 0 auto; }
.rail__link .txt { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail__link .count { font-family: var(--font-mono); font-size: 10px; color: var(--ghost); }
.rail__link .count.is-warn { color: var(--warn); }
.rail__foot { border-top: 1px solid var(--line-soft); padding: 10px; display: flex; align-items: center; gap: 8px; }
.userbtn { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; padding: 6px 8px; border-radius: var(--radius-sm); border: 0; background: none; color: var(--fg-dim); cursor: pointer; text-align: left; }
.userbtn:hover { background: var(--hover); color: var(--fg); }
.userbtn__name { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.userbtn__sub { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.14em; color: var(--ghost); text-transform: uppercase; display: flex; align-items: center; gap: 5px; }
.live { width: 6px; height: 6px; border-radius: 50%; background: var(--faint); }
.live.is-on { background: var(--ok); box-shadow: 0 0 8px rgba(34,197,94,0.7); }

.main { grid-area: main; display: flex; flex-direction: column; min-height: 0; min-width: 0; background: var(--bg); }
.topbar { display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-bottom: 1px solid var(--line-soft); min-height: var(--topbar); flex: 0 0 auto; }
.topbar__title { font-family: var(--font-display); font-size: 17px; white-space: nowrap; }
.topbar__count { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.14em; color: var(--ghost); }
.topbar__spacer { flex: 1; }
.search { position: relative; flex: 1; max-width: 520px; }
.search input { width: 100%; min-height: 38px; padding: 8px 12px 8px 36px; background: var(--panel-2); border: 1px solid var(--line-soft); border-radius: 999px; color: var(--fg); font-size: 14px; }
.search input:focus { outline: none; border-color: var(--line-hard); }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search .kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); }
.filterbar { display: flex; gap: 6px; padding: 10px 18px; border-bottom: 1px solid var(--line-soft); overflow-x: auto; scrollbar-width: none; flex: 0 0 auto; align-items: center; }
.filterbar::-webkit-scrollbar { display: none; }
.content { flex: 1; overflow-y: auto; min-height: 0; overscroll-behavior: contain; }
.content--pad { padding: 20px 22px 60px; }
.empty { text-align: center; padding: 70px 24px; color: var(--muted); }
.empty h2 { font-size: 20px; color: var(--fg); margin: 12px 0 6px; }
.empty p { font-size: 14px; margin-bottom: 18px; max-width: 380px; margin-inline: auto; line-height: 1.55; }
.empty svg { opacity: 0.35; }

/* --- popovers, modals, toasts ------------------------------------------------ */
.pop { position: fixed; z-index: var(--z-pop); min-width: 200px; max-width: min(360px, calc(100vw - 20px)); max-height: min(70vh, 480px); overflow-y: auto; background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow); padding: 5px; animation: pop-in 0.14s var(--ease); }
@keyframes pop-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.pop__head { padding: 7px 11px 5px; font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--ghost); }
.pop__item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 11px; border: 0; border-radius: var(--radius-xs); background: none; color: var(--fg-dim); font-size: 13.5px; text-align: left; cursor: pointer; min-height: 38px; }
.pop__item:hover { background: var(--hover); color: var(--fg); }
.pop__item.is-active { color: var(--fg); }
.pop__item.is-danger { color: #fca5a5; }
.pop__item.is-danger:hover { background: rgba(239,68,68,0.13); }
.pop__item svg:last-child { margin-left: auto; }
.pop__dot { width: 9px; height: 9px; border-radius: 3px; flex: 0 0 auto; }
.pop__label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pop__sub { color: var(--ghost); font-size: 11px; margin-left: 6px; }
.pop__sep { height: 1px; background: var(--line-soft); margin: 5px 4px; }
.modal-back { position: fixed; inset: 0; z-index: var(--z-modal); background: rgba(0,0,0,0.7); backdrop-filter: blur(6px); display: grid; place-items: center; padding: 16px; opacity: 0; transition: opacity 0.18s var(--ease); }
.modal-back.is-in { opacity: 1; }
.modal { width: 100%; max-width: 460px; max-height: calc(100dvh - 32px); overflow-y: auto; background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); transform: translateY(8px); transition: transform 0.18s var(--ease); }
.modal-back.is-in .modal { transform: none; }
.modal--wide { max-width: 640px; }
.modal__title { font-size: 19px; margin-bottom: 10px; }
.modal__body { color: var(--fg-dim); font-size: 14px; margin-bottom: 16px; line-height: 1.55; }
.modal__foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.toasts { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: var(--z-toast); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 9px; padding: 10px 16px; background: #fff; color: #000; border-radius: 999px; font-size: 13.5px; font-weight: 500; box-shadow: var(--shadow-sm); opacity: 0; transform: translateY(8px); transition: opacity 0.22s var(--ease), transform 0.22s var(--ease); white-space: nowrap; }
.toast.is-in { opacity: 1; transform: none; }
.toast--error { background: var(--danger); color: #fff; }

/* =========================================================================
   Office
   ========================================================================= */

/* --- rail extras ----------------------------------------------------------- */
.rail__brand .wordmark { display: flex; flex-direction: column; line-height: 1.05; }
.rail__brand .wordmark small { font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.32em; color: var(--ghost); font-weight: 400; margin-top: 3px; }
.rail__link .sdot { margin-left: auto; }
.rail__client { padding-left: 26px; font-size: 13px; min-height: 34px; }
.rail__client .bar { width: 3px; height: 14px; border-radius: 2px; flex: 0 0 auto; }

/* --- page scaffolding --------------------------------------------------------- */
.page { padding: 26px 28px 80px; max-width: 1400px; }
.page__head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page__titles { flex: 1; min-width: 220px; }
.page__eyebrow { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.3em; text-transform: uppercase; color: var(--faint); margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.page__eyebrow a:hover { color: var(--fg); }
.page__title { font-size: clamp(24px, 3vw, 32px); letter-spacing: -0.015em; display: flex; align-items: center; gap: 12px; }
.page__sub { color: var(--muted); font-size: 14px; margin-top: 6px; }
.page__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.section { margin-top: 30px; }
.section__head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.section__title { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.26em; text-transform: uppercase; color: var(--muted); }
.section__head .spacer { flex: 1; }
.accentbar { width: 6px; align-self: stretch; border-radius: 3px; min-height: 30px; }

/* --- status ------------------------------------------------------------------- */
.sdot { width: 9px; height: 9px; border-radius: 50%; background: var(--faint); flex: 0 0 auto; display: inline-block; }
.sdot--up { background: var(--ok); box-shadow: 0 0 10px rgba(34,197,94,0.55); }
.sdot--down { background: var(--danger); box-shadow: 0 0 12px rgba(239,68,68,0.7); animation: beat 1.4s ease-in-out infinite; }
.sdot--misconfigured { background: var(--warn); }
.sdot--paused { background: transparent; border: 1.5px solid var(--faint); }
.sdot--unknown { background: var(--ghost); }
@keyframes beat { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.35); opacity: 0.6; } }
.status { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--fg-dim); white-space: nowrap; }
.status--down { color: #fca5a5; }
.status--misconfigured { color: #fcd34d; }
.status--up { color: #86efac; }
.status--paused, .status--unknown { color: var(--faint); }

/* --- stat tiles ------------------------------------------------------------------- */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.stat { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 16px 18px; position: relative; overflow: hidden; }
.stat__label { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.24em; text-transform: uppercase; color: var(--faint); }
.stat__value { font-family: var(--font-display); font-size: 30px; font-weight: 600; margin-top: 8px; line-height: 1; display: flex; align-items: baseline; gap: 6px; }
.stat__value small { font-size: 14px; color: var(--faint); font-weight: 500; }
.stat__sub { font-size: 12.5px; color: var(--muted); margin-top: 8px; }
.stat--bad { border-color: rgba(239,68,68,0.45); background: linear-gradient(180deg, rgba(239,68,68,0.08), var(--panel)); }
.stat--warn { border-color: rgba(245,158,11,0.4); }
.stat--good .stat__value { color: #fff; }

/* --- client cards --------------------------------------------------------------------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.ccard { display: flex; flex-direction: column; gap: 14px; background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 20px 20px 18px 24px; position: relative; overflow: hidden; cursor: pointer; text-align: left; color: inherit; transition: border-color var(--med), transform var(--med), box-shadow var(--med); }
.ccard::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--accent-c, #fff); }
.ccard:hover { border-color: var(--line-hard); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.ccard.is-archived { opacity: 0.5; }
.ccard__top { display: flex; align-items: flex-start; gap: 12px; }
.ccard__name { font-family: var(--font-display); font-size: 20px; font-weight: 600; flex: 1; }
.ccard__meta { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--faint); margin-top: 4px; }
.ccard__apps { display: flex; flex-wrap: wrap; gap: 6px; }
.ccard__app { display: inline-flex; align-items: center; gap: 7px; padding: 5px 10px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line-soft); font-size: 12.5px; color: var(--fg-dim); }
.ccard__foot { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); border-top: 1px solid var(--line-soft); padding-top: 12px; }
.ccard__foot b { color: var(--fg); font-weight: 500; }
.ccard--new { align-items: center; justify-content: center; border-style: dashed; color: var(--muted); min-height: 150px; flex-direction: row; }
.ccard--new::before { display: none; }

/* --- app tiles --------------------------------------------------------------------------- */
.apps { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.atile { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius); display: flex; flex-direction: column; overflow: hidden; transition: border-color var(--med), box-shadow var(--med); }
.atile:hover { border-color: var(--line); }
.atile--down { border-color: rgba(239,68,68,0.55); box-shadow: 0 0 0 1px rgba(239,68,68,0.15), 0 0 30px rgba(239,68,68,0.08); }
.atile--misconfigured { border-color: rgba(245,158,11,0.35); }
.atile--paused { opacity: 0.6; }
.atile__head { display: flex; align-items: center; gap: 12px; padding: 16px 16px 12px; }
.appicon { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; font-family: var(--font-display); font-weight: 600; font-size: 15px; color: #fff; flex: 0 0 auto; overflow: hidden; background: var(--panel-3); border: 1px solid var(--line-soft); }
.appicon img { width: 100%; height: 100%; object-fit: cover; }
.appicon.lg { width: 56px; height: 56px; font-size: 20px; border-radius: 14px; }
.atile__name { font-size: 16px; font-weight: 600; font-family: var(--font-display); display: flex; align-items: center; gap: 8px; }
.atile__host { font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.atile__titles { min-width: 0; flex: 1; }
.atile__err { margin: 0 16px 10px; padding: 8px 10px; border-radius: var(--radius-xs); background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3); color: #fca5a5; font-size: 12.5px; }
.atile__err.is-warn { background: rgba(245,158,11,0.08); border-color: rgba(245,158,11,0.3); color: #fcd34d; }
.meta { display: grid; grid-template-columns: 1fr 1.3fr 0.8fr; gap: 1px; background: var(--line-soft); border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); }
.meta > div { background: var(--panel); padding: 10px 14px; min-width: 0; }
.meta dt { font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--ghost); }
.meta dd { font-size: 13px; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--fg-dim); }
.meta dd.mono2 { font-family: var(--font-mono); font-size: 11.5px; letter-spacing: -0.01em; }
.meta dd.is-warn { color: var(--warn); }
.meta dd.is-bad { color: var(--danger); }
.atile__foot { display: flex; align-items: center; gap: 8px; padding: 12px 16px; }
.atile__foot .spacer { flex: 1; }
.tag { display: inline-flex; align-items: center; padding: 2px 7px; border-radius: 5px; font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.12em; text-transform: uppercase; border: 1px solid var(--line); color: var(--muted); }
.tag--contract { color: #d8b4fe; border-color: rgba(168,85,247,0.45); }

/* --- tabs ---------------------------------------------------------------------------------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line-soft); margin-bottom: 20px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { padding: 11px 14px; border: 0; background: none; color: var(--muted); font-size: 13.5px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; gap: 8px; align-items: center; }
.tab:hover { color: var(--fg); }
.tab.is-active { color: var(--fg); border-bottom-color: #fff; }
.tab .count { font-family: var(--font-mono); font-size: 10px; color: var(--ghost); }

/* --- tables / lists --------------------------------------------------------------------------- */
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--ghost); font-weight: 400; padding: 8px 12px; border-bottom: 1px solid var(--line-soft); }
.table td { padding: 11px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; color: var(--fg-dim); }
.table tr:hover td { background: var(--hover); }
.table .mono2 { font-family: var(--font-mono); font-size: 12px; }
.table .actions { text-align: right; white-space: nowrap; }
.tablewrap { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius); overflow-x: auto; }
.feed { display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius); }
.feed__row { display: flex; align-items: center; gap: 12px; padding: 11px 16px; border-bottom: 1px solid var(--line-soft); font-size: 13.5px; color: var(--fg-dim); min-height: 46px; }
.feed__row:last-child { border-bottom: 0; }
.feed__row a:hover { color: var(--fg); text-decoration: underline; }
.feed__when { margin-left: auto; font-family: var(--font-mono); font-size: 11px; color: var(--ghost); white-space: nowrap; }
.feed__empty { padding: 22px 16px; color: var(--faint); font-size: 13.5px; text-align: center; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }

/* --- charts ---------------------------------------------------------------------------------------- */
.panelbox { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 18px; }
.bars { display: flex; align-items: flex-end; gap: 2px; height: 70px; }
.bars i { flex: 1; min-width: 1px; background: rgba(255,255,255,0.35); border-radius: 1px 1px 0 0; }
.bars i.is-bad { background: var(--danger); height: 100% !important; opacity: 0.85; }
.bars i.is-empty { background: var(--line-soft); height: 2px; }
.bars i:not(.is-empty):hover { background: #fff; }
.days { display: flex; gap: 3px; height: 34px; }
.days i { flex: 1; border-radius: 3px; background: var(--ok); opacity: 0.85; }
.days i.mid { background: var(--warn); }
.days i.low { background: var(--danger); }
.days i.none { background: var(--line); opacity: 1; }
.chartaxis { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: 10px; color: var(--ghost); margin-top: 6px; }
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.kv dt { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--ghost); }
.kv dd { font-size: 15px; margin-top: 4px; word-break: break-word; }
.kv dd.mono2 { font-family: var(--font-mono); font-size: 13px; }

/* --- servers ----------------------------------------------------------------------------------------- */
.scard { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; }
.scard__top { display: flex; align-items: flex-start; gap: 12px; }
.scard__name { font-family: var(--font-display); font-size: 18px; font-weight: 600; }
.scard__ip { font-family: var(--font-mono); font-size: 13px; color: var(--fg-dim); margin-top: 3px; display: flex; gap: 8px; align-items: center; }
.vitals { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.vital__label { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--ghost); margin-bottom: 6px; }
.vital__label b { color: var(--fg-dim); font-weight: 500; letter-spacing: 0.05em; }
.vbar { height: 6px; border-radius: 3px; background: var(--line-soft); overflow: hidden; }
.vbar i { display: block; height: 100%; background: #fff; border-radius: 3px; }
.vbar i.is-warn { background: var(--warn); }
.vbar i.is-bad { background: var(--danger); }
.novitals { font-size: 13px; color: var(--faint); padding: 10px 12px; border: 1px dashed var(--line-soft); border-radius: var(--radius-sm); line-height: 1.5; }

/* --- forms ------------------------------------------------------------------------------------------------ */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.grid3 { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 0 14px; }
.inspect { display: flex; gap: 8px; align-items: flex-end; }
.inspect .field { flex: 1; margin-bottom: 0; }
.notice { padding: 10px 13px; border-radius: var(--radius-sm); font-size: 13px; line-height: 1.5; background: var(--panel); border: 1px solid var(--line-soft); color: var(--fg-dim); margin: 12px 0; }
.notice--ok { border-color: rgba(34,197,94,0.35); }
.notice--warn { border-color: rgba(245,158,11,0.4); color: #fde68a; }
.notice--bad { border-color: rgba(239,68,68,0.4); color: #fca5a5; }
.checks { display: flex; flex-wrap: wrap; gap: 6px; }
.secretbox { font-family: var(--font-mono); font-size: 13px; padding: 12px; border: 1px dashed var(--line-hard); border-radius: var(--radius-sm); background: var(--panel); word-break: break-all; user-select: all; margin: 12px 0; }
.qrbox { background: #fff; border-radius: 12px; padding: 10px; width: 190px; height: 190px; margin: 6px auto 14px; }
.qrbox svg { width: 100%; height: 100%; }
.steps { display: flex; gap: 6px; justify-content: center; margin-bottom: 18px; }
.steps i { width: 26px; height: 3px; border-radius: 2px; background: var(--line); }
.steps i.is-on { background: #fff; }
.codes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 20px; font-family: var(--font-mono); font-size: 15px; text-align: center; padding: 6px 0; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { width: 30px; height: 30px; border-radius: 8px; border: 2px solid transparent; cursor: pointer; }
.swatch.is-on { border-color: #fff; box-shadow: 0 0 0 2px #000 inset; }
.dangerzone { margin-top: 26px; padding-top: 16px; border-top: 1px solid var(--line-soft); display: flex; gap: 8px; flex-wrap: wrap; }

/* --- live indicator ----------------------------------------------------------------------------------------- */
.livebar { display: inline-flex; align-items: center; gap: 7px; font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ghost); }

/* --- bottom nav (phones) ------------------------------------------------------------------------------------- */
.tabbar { display: none; }
.mtop { display: none; }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; grid-template-areas: "main"; }
  .rail { display: none; }
  .mtop { display: flex; align-items: center; gap: 10px; padding: calc(10px + env(safe-area-inset-top)) 16px 10px; border-bottom: 1px solid var(--line-soft); background: var(--bg-1); }
  .mtop img { width: 22px; height: 22px; }
  .mtop b { font-family: var(--font-display); letter-spacing: 0.16em; text-transform: uppercase; font-size: 14px; }
  .mtop .spacer { flex: 1; }
  .mtop .userbtn { flex: 0 0 auto; padding: 4px; }
  .tabbar { display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; background: rgba(6,7,8,0.94); backdrop-filter: blur(14px); border-top: 1px solid var(--line-soft); padding-bottom: env(safe-area-inset-bottom); }
  .tabbar button { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 9px 0 8px; background: none; border: 0; color: var(--faint); font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.14em; text-transform: uppercase; cursor: pointer; }
  .tabbar button.is-active { color: #fff; }
  .main { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  .page { padding: 18px 16px 40px; }
  .cols, .grid2, .grid3 { grid-template-columns: 1fr; }
  .apps, .cards { grid-template-columns: 1fr; }
  .meta { grid-template-columns: 1fr 1fr; }
  .vitals { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr 1fr; }
  .modal { padding: 20px 18px; }
  .table th:nth-child(n+4), .table td:nth-child(n+4) { display: none; }
  .table td.actions, .table th.actions { display: table-cell; }
}

/* --- NanoCore ID (staff pages) --------------------------------------------------- */
.staff__title { font-size: 22px; letter-spacing: 0.12em; }
.auth__emblem[style*="--ring"]::after { border-top-color: var(--ring); }
.staff__apps { display: grid; gap: 10px; }
.staff__app { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 1px solid var(--line-soft); border-radius: var(--radius-sm); background: var(--panel); color: var(--fg); text-decoration: none; transition: border-color 0.15s, transform 0.15s; }
.staff__app:hover { border-color: var(--line); transform: translateY(-1px); }
.staff__app > div:nth-child(2) { flex: 1; min-width: 0; }
.staff__app b { display: block; font-size: 15px; }
.staff__app span { font-size: 12px; color: var(--muted); text-transform: capitalize; }
.staff__app > svg { color: var(--faint); }
.staff__icon { width: 40px; height: 40px; }

/* --- People & templates (admin) ---------------------------------------------------- */
.ptable { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.ptable th { text-align: left; font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--faint); font-weight: 500; padding: 8px 10px; border-bottom: 1px solid var(--line-soft); }
.ptable td { padding: 11px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.ptable tr.is-off td { opacity: 0.5; }
.ptable tr[data-id] { cursor: pointer; }
.ptable tr[data-id]:hover td { background: var(--panel); }
.ptable .sub { display: block; font-size: 12px; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { font-size: 11.5px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line-soft); color: var(--fg-dim); white-space: nowrap; }
.chip--warn { border-color: rgba(245,158,11,0.5); color: #fcd34d; }
.access-grid { display: grid; gap: 10px; }
.access-row { display: grid; grid-template-columns: 1fr 160px; gap: 10px; align-items: start; padding: 12px; border: 1px solid var(--line-soft); border-radius: var(--radius-sm); }
.access-row.is-tpl { border-style: dashed; }
.access-row__name { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.access-row__name small { display: block; font-size: 11.5px; color: var(--muted); }
.access-row select { width: 100%; }
.access-stores { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; }
.access-stores label { display: flex; align-items: center; gap: 6px; }
@media (max-width: 640px) {
  .ptable .hide-sm { display: none; }
  .access-row { grid-template-columns: 1fr; }
}
.callout { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line-soft); border-radius: var(--radius-sm); background: var(--panel); font-size: 13.5px; color: var(--fg-dim); line-height: 1.55; margin-bottom: 14px; }
.callout > svg { flex: none; margin-top: 2px; color: var(--muted); }
.ptable td:first-child, .ptable th:first-child { padding-left: 16px; }
