/* Oasis shared styles. Plain CSS, design tokens on :root, dark mode via media query. */

:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --text: #171a1f;
  --muted: #667085;
  --border: #e3e6eb;
  --accent: #2458e6;
  --accent-text: #ffffff;
  --ok: #178a4c;
  --ok-bg: #e4f5ea;
  --warn: #b7640a;
  --warn-bg: #fdf0dc;
  --danger: #c92a2a;
  --danger-bg: #fde8e8;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.1);
  --radius: 10px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1216;
    --surface: #171b22;
    --surface-2: #1f242d;
    --text: #e7eaee;
    --muted: #98a2b3;
    --border: #2b313c;
    --accent: #4f7dff;
    --ok: #3ccf7a;
    --ok-bg: #11311f;
    --warn: #f2a93b;
    --warn-bg: #3a2a0f;
    --danger: #ff6b6b;
    --danger-bg: #3b1515;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { font-family: var(--font); font-size: 16px; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); line-height: 1.4; min-height: 100dvh; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }
small { font-size: 0.8em; }
h1, h2, h3 { margin: 0 0 0.5em; font-weight: 600; letter-spacing: -0.01em; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 0.75em; }

/* ---- controls ---------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4em;
  min-height: 44px; padding: 0 1em; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-weight: 500; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { filter: brightness(1.08); background: var(--accent); }
.btn.danger { color: var(--danger); border-color: var(--danger); }
.btn.danger:hover { background: var(--danger-bg); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { min-height: 34px; padding: 0 0.7em; font-size: 0.9rem; border-radius: 8px; }
.btn.icon { width: 44px; padding: 0; font-size: 1.3rem; }

.input, input[type="text"], input[type="password"], input[type="search"], input[type="tel"], select, textarea {
  width: 100%; min-height: 44px; padding: 0.5em 0.8em; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
textarea { min-height: 8em; resize: vertical; font-family: var(--mono); font-size: 0.9rem; }
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
label { display: block; font-size: 0.9rem; color: var(--muted); margin-bottom: 0.25em; }
.field { margin-bottom: 0.9em; }
.check { display: inline-flex; align-items: center; gap: 0.5em; color: var(--text); font-size: 1rem; min-height: 44px; }
.check input { width: 1.2em; height: 1.2em; min-height: 0; }
.row-actions { display: flex; gap: 0.5em; flex-wrap: wrap; align-items: center; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 0.75em; flex-wrap: wrap; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1em; box-shadow: var(--shadow); }

.tag { display: inline-flex; align-items: center; gap: 0.35em; padding: 0.1em 0.55em; border-radius: 999px; font-size: 0.8rem; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.tag .dot { width: 0.65em; height: 0.65em; border-radius: 50%; border: 1px solid rgba(0,0,0,0.15); }
.tag.walkin { color: var(--warn); background: var(--warn-bg); border-color: transparent; }
.tag.state-live { color: var(--ok); background: var(--ok-bg); border-color: transparent; }
.tag.state-draft { color: var(--muted); }
.tag.state-archived { color: var(--muted); text-decoration: line-through; }

table.grid { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
table.grid th, table.grid td { text-align: left; padding: 0.45em 0.5em; border-bottom: 1px solid var(--border); vertical-align: top; }
table.grid th { color: var(--muted); font-weight: 500; }
table.grid tr.warn td { background: var(--warn-bg); }

.notice { padding: 0.75em 1em; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface-2); font-size: 0.95rem; }
.notice.warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.notice.danger { background: var(--danger-bg); color: var(--danger); border-color: transparent; }
.notice.ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }

code, pre { font-family: var(--mono); font-size: 0.9em; }
pre { background: var(--surface-2); padding: 0.75em; border-radius: 8px; overflow: auto; }
.keybox { font-family: var(--mono); font-size: 1.2rem; padding: 0.75em 1em; border-radius: var(--radius); background: var(--ok-bg); color: var(--ok); user-select: all; word-break: break-all; }

/* ---- dialogs ----------------------------------------------------------------------- */
dialog {
  border: 1px solid var(--border); border-radius: 14px; background: var(--surface); color: var(--text);
  padding: 0; width: min(720px, calc(100vw - 2rem)); max-height: calc(100dvh - 2rem); box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
dialog.wide { width: min(1000px, calc(100vw - 2rem)); }
dialog::backdrop { background: rgba(10, 12, 16, 0.55); }
dialog .dlg-head { display: flex; align-items: center; justify-content: space-between; padding: 1em 1.25em 0.5em; }
dialog .dlg-head h2 { margin: 0; }
dialog .dlg-body { padding: 0.5em 1.25em 1.25em; overflow: auto; max-height: calc(100dvh - 9rem); }
dialog .dlg-foot { display: flex; gap: 0.5em; justify-content: flex-end; padding: 0.75em 1.25em 1.25em; border-top: 1px solid var(--border); flex-wrap: wrap; }

/* ---- toasts ------------------------------------------------------------------------ */
#toasts { position: fixed; left: 50%; bottom: 1rem; transform: translateX(-50%); display: flex; flex-direction: column; gap: 0.5em; z-index: 1000; width: min(520px, calc(100vw - 2rem)); pointer-events: none; }
.toast { pointer-events: auto; padding: 0.75em 1em; border-radius: var(--radius); background: var(--text); color: var(--bg); box-shadow: var(--shadow); font-size: 0.95rem; animation: toast-in 0.15s ease-out; }
.toast.ok { background: var(--ok); color: #fff; }
.toast.warn { background: var(--warn); color: #fff; }
.toast.danger { background: var(--danger); color: #fff; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---- sign-in page ------------------------------------------------------------------ */
.signin { max-width: 420px; margin: 10vh auto; padding: 1rem; }
.signin .brand { text-align: center; margin-bottom: 1.5rem; }
.brand-word { font-size: 2rem; font-weight: 600; letter-spacing: -0.02em; }
.brand-word em { font-style: italic; font-weight: 300; color: var(--muted); }
