/* F7less — Swiss Technical Design System (Canonical Common Stylesheet)
 *
 * Neo-grotesque typography on a strict grid, hairline rules doing the
 * structural work, square corners, and no ornament.
 *
 * Palette is anchored by the logo's three-bar cyan gradient:
 *   #0e7490 (5.36:1 on white) anchors the light scheme.
 *   #22d3ee (10.92:1 on near-black) anchors the dark scheme.
 *
 * Status colours follow the measured Swiss Technical scale:
 *   #0f6d43 / #34d399 (ok)
 *   #92400e / #fbbf24 (warn)
 *   #b42318 / #f87171 (danger)
 */

/* ---------- Fonts ---------- */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/inter-var.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/fonts/plexmono-500.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- Tokens ---------- */

:root {
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --font-heading: var(--font-sans);

  --canvas: #f1f4f7;
  --paper: #ffffff;
  --tint: #eaf0f4;
  --tint-subtle: #f8fafc;
  --ink: #0d1417;
  --ink-muted: #4b5a60;
  --ink-faint: #64757c;
  --rule: #d0dbe0;
  --rule-subtle: #e2ebef;
  --rule-strong: #0d1417;

  /* The logo's dark end anchors the light scheme */
  --accent: #0e7490;
  --accent-hover: #155e75;
  --on-accent: #ffffff;

  --ok: #0f6d43;
  --warn: #92400e;
  --danger: #b42318;
  --ok-bg: #e6f4ea;
  --warn-bg: #fef3c7;
  --danger-bg: #fee2e2;

  /* Universal component aliases */
  --bg: var(--canvas);
  --surface: var(--paper);
  --border: var(--rule);
  --text: var(--ink);
  --muted: var(--ink-muted);
  --bg-dark: var(--canvas);
  --bg-card: var(--paper);
  --bg-card-hover: var(--tint-subtle);
  --border-color: var(--rule);
  --border-color-glow: var(--accent);
  --primary: var(--accent);
  --primary-hover: var(--accent-hover);
  --text-main: var(--ink);
  --text-muted: var(--ink-muted);
  --text-dim: var(--ink-faint);

  /* Fluid type scale matching shell and vcard */
  --step--2: 0.6875rem;
  --step--1: 0.8125rem;
  --step-0: 1.0625rem;
  --step-1: clamp(1.125rem, 1.06rem + 0.32vw, 1.375rem);
  --step-2: clamp(1.375rem, 1.22rem + 0.75vw, 1.875rem);
  --step-3: clamp(1.75rem, 1.42rem + 1.62vw, 3rem);
  --step-4: clamp(2.25rem, 1.55rem + 3.4vw, 4.75rem);

  --measure: 36rem;
  --container: 74rem;
  --gutter: clamp(1.25rem, 4vw, 3rem);

  /* Refined radii */
  --radius-xs: 3px;
  --radius-sm: 5px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-pill: 9999px;
  --radius: var(--radius-md);

  /* Refined soft shadows */
  --shadow-xs: 0 1px 2px 0 rgba(13, 20, 23, 0.04);
  --shadow-sm: 0 1px 3px 0 rgba(13, 20, 23, 0.06), 0 1px 2px -1px rgba(13, 20, 23, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(13, 20, 23, 0.07), 0 2px 4px -2px rgba(13, 20, 23, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(13, 20, 23, 0.08), 0 4px 6px -4px rgba(13, 20, 23, 0.04);
  --shadow-xl: 0 20px 25px -5px rgba(13, 20, 23, 0.1), 0 8px 10px -6px rgba(13, 20, 23, 0.05);
  --shadow-glow: 0 0 16px rgba(14, 116, 144, 0.18);
}

@media (prefers-color-scheme: dark) {
  :root {
    --canvas: #090d10;
    --paper: #12181b;
    --tint: #182226;
    --tint-subtle: #141b1f;
    --ink: #e8eff1;
    --ink-muted: #97a7ad;
    --ink-faint: #7b8b91;
    --rule: #223036;
    --rule-subtle: #1a252a;
    --rule-strong: #e8eff1;

    /* The logo's signature cyan anchors the dark scheme */
    --accent: #22d3ee;
    --accent-hover: #67e8f9;
    --on-accent: #080b0d;

    --ok: #34d399;
    --warn: #fbbf24;
    --danger: #f87171;
    --ok-bg: #064e3b;
    --warn-bg: #78350f;
    --danger-bg: #7f1d1d;

    --bg: var(--canvas);
    --surface: var(--paper);
    --border: var(--rule);
    --text: var(--ink);
    --muted: var(--ink-muted);
    --bg-dark: var(--canvas);
    --bg-card: var(--paper);
    --bg-card-hover: var(--tint);
    --border-color: var(--rule);
    --border-color-glow: var(--accent);
    --primary: var(--accent);
    --primary-hover: var(--accent-hover);
    --text-main: var(--ink);
    --text-muted: var(--ink-muted);
    --text-dim: var(--ink-faint);

    --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.25);
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.35), 0 1px 2px -1px rgba(0, 0, 0, 0.25);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.45), 0 4px 6px -4px rgba(0, 0, 0, 0.35);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 20px rgba(34, 211, 238, 0.2);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Component defaults with refined radii and subtle depth */
.card,
.a-card,
.pane {
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.modal {
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
}

.btn {
  border-radius: var(--radius-sm);
}

input,
select,
textarea {
  border-radius: var(--radius-sm);
}

.stat-pill,
.badge,
.a-badge,
.status-badge {
  border-radius: var(--radius-pill);
}

/* Official Google Sign-in button requires 4px radius per Google Identity guidelines */
.btn-google {
  border-radius: 4px !important;
}

[hidden] {
  display: none !important;
}

html {
  -moz-text-size-adjust: none;
  -webkit-text-size-adjust: none;
  text-size-adjust: none;
}

body {
  margin: 0;
  background-color: var(--canvas);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--step-0);
  font-weight: 400;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* ---------- Typography ---------- */

h1,
h2,
h3,
h4 {
  font-family: var(--font-sans);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.022em;
  margin: 0 0 0.55em;
  text-wrap: balance;
  color: var(--ink);
}

h1 { font-size: var(--step-3); }
h2 { font-size: var(--step-2); }
h3 { font-size: var(--step-1); }
h4 { font-size: var(--step-0); }

p {
  margin: 0 0 1em;
  line-height: 1.55;
  color: var(--ink);
}

.lede {
  font-size: var(--step-0);
  color: var(--ink-muted);
  max-width: var(--measure);
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--step--2);
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--accent);
  display: block;
  margin-bottom: 0.5rem;
}

a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid currentColor;
  padding-bottom: 0.05em;
  transition: color 0.12s linear, border-color 0.12s linear;
}

a:hover {
  color: var(--accent-hover);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

code,
pre,
kbd,
samp {
  font-family: var(--font-mono);
  font-size: var(--step--1);
}

/* ---------- Layout ---------- */

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

main {
  flex: 1 0 auto;
  padding-block: clamp(2rem, 5vw, 4rem) clamp(3rem, 7vw, 6rem);
}

/* ---------- Masthead / Top Bar ---------- */

.masthead,
.navbar,
.bar {
  border-bottom: 1px solid var(--rule);
  background-color: var(--paper);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: none;
}

.masthead__inner,
.nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  min-height: 4rem;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
  padding-block: 0.5rem;
  flex-wrap: wrap;
}

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1.25rem;
}

.bar h1 {
  font-size: 1.15rem;
  margin: 0;
  font-weight: 600;
}

.brand,
.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  border: 0;
  color: var(--ink);
  font-weight: 600;
  font-size: var(--step-0);
  letter-spacing: -0.02em;
  text-decoration: none;
}

.brand:hover,
.logo:hover {
  color: var(--ink);
}

.brand__mark,
.logo-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: auto;
  color: var(--ink);
}

.brand__module {
  font-family: var(--font-mono);
  font-size: var(--step--2);
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--accent);
}

.brand__host {
  font-family: var(--font-mono);
  font-size: var(--step--2);
  letter-spacing: 0.02em;
  color: var(--ink-faint);
}

.masthead__right,
.nav-right {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.identity,
.nav-auth,
.who {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-mono);
  font-size: var(--step--1);
  color: var(--ink-muted);
  min-width: 0;
}

.identity__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.identity__tenant {
  color: var(--accent);
  flex: none;
}

.identity a,
.who a {
  color: var(--ink-muted);
  border-bottom-color: var(--rule);
}

.identity a:hover,
.who a:hover {
  color: var(--accent);
  border-bottom-color: currentColor;
}

/* Status indicator dot */
.nav-status {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: var(--step--2);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.status-indicator {
  width: 6px;
  height: 6px;
  border-radius: 0;
  background-color: var(--ink-faint);
}

.status-indicator.live {
  background-color: var(--ok);
  box-shadow: none;
}

/* ---------- Buttons ---------- */

.btn,
:where(button:not(.btn-ghost, .modal-close, .modal__close, .wk-modal-close)) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  min-height: 2.5rem;
  border: 1px solid var(--ink);
  border-radius: 0;
  background: none;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: var(--step--1);
  font-weight: 500;
  letter-spacing: 0.02em;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.12s linear, border-color 0.12s linear,
    color 0.12s linear;
}

.btn:hover,
button:hover {
  color: var(--ink);
}

.btn--primary,
.btn-primary,
button.primary {
  background-color: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

.btn--primary:hover,
.btn-primary:hover,
button.primary:hover {
  background-color: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

.btn--secondary,
.btn-secondary,
button.secondary {
  background-color: var(--tint);
  border-color: var(--rule);
  color: var(--ink);
}

.btn--secondary:hover,
.btn-secondary:hover,
button.secondary:hover {
  border-color: var(--ink);
  color: var(--ink);
  background-color: var(--paper);
}

.btn--danger,
.btn-danger,
.btn-danger-outline,
button.danger {
  border-color: var(--rule);
  color: var(--danger);
  background: transparent;
}

.btn--danger:hover,
.btn-danger:hover,
.btn-danger-outline:hover,
button.danger:hover {
  border-color: var(--danger);
  color: var(--danger);
  background: transparent;
}

@media (prefers-color-scheme: dark) {
  .btn--secondary,
  .btn-secondary,
  button.secondary {
    border-color: color-mix(in srgb, var(--ink) 25%, transparent);
  }

  .btn--danger,
  .btn-danger,
  .btn-danger-outline,
  button.danger {
    border-color: color-mix(in srgb, var(--danger) 45%, transparent);
  }
}

.btn--sm,
.btn-sm {
  padding: 0.35rem 0.75rem;
  min-height: 2rem;
  font-size: var(--step--2);
}

.btn-outline-dev {
  border: 1px dashed var(--rule);
  color: var(--ink-muted);
  background: transparent;
}

.btn-outline-dev:hover {
  border-color: var(--accent);
  color: var(--accent);
}

button.link {
  border: none;
  background: none;
  color: var(--accent);
  cursor: pointer;
  padding: 0;
  font: inherit;
  text-decoration: underline;
  min-height: auto;
}

.btn[disabled],
button[disabled],
button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

a.btn {
  border-bottom-width: 1px;
}

/* ---------- Google Sign-In Button (Official Spec) ---------- */

.btn-google {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: #ffffff;
  border: 1px solid #747775;
  border-radius: 4px !important;
  box-sizing: border-box;
  color: #1f1f1f;
  cursor: pointer;
  font-family: "Roboto", system-ui, sans-serif;
  font-size: 14px;
  font-weight: 500;
  height: 40px;
  letter-spacing: 0.25px;
  outline: none;
  padding: 0 16px 0 12px;
  position: relative;
  text-align: center;
  text-decoration: none;
  transition: background-color 0.15s, box-shadow 0.15s;
}

.btn-google:hover {
  background: #f8f9fa;
  box-shadow: 0 1px 2px 0 rgba(60, 64, 67, 0.3),
    0 1px 3px 1px rgba(60, 64, 67, 0.15);
  color: #1f1f1f;
}

.btn-google-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 18px;
  width: 18px;
}

.btn-google-icon svg {
  display: block;
  height: 18px;
  width: 18px;
}

@media (prefers-color-scheme: dark) {
  .btn-google {
    background: #131314;
    border-color: #8e918f;
    color: #e3e3e3;
  }

  .btn-google:hover {
    background: #131314;
    border-color: #8e918f;
    color: #e3e3e3;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.3), 0 1px 3px 1px rgba(0, 0, 0, 0.15);
  }
}

.btn-google--sm {
  height: 32px;
  font-size: 13px;
  padding: 0 12px 0 8px;
  gap: 8px;
}

.btn-google--sm .btn-google-icon,
.btn-google--sm .btn-google-icon svg {
  height: 16px;
  width: 16px;
}

/* ---------- Tables & Data Grids ---------- */

.data-table,
.grid {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.data-table thead th,
.grid th {
  font-family: var(--font-mono);
  font-size: var(--step--2);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
  background-color: var(--tint);
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--rule);
}

.data-table tbody td,
.grid td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--rule);
  color: var(--ink);
  font-size: var(--step--1);
  vertical-align: middle;
}

.data-table tbody tr:hover td,
.grid tbody tr:hover td {
  background-color: var(--tint);
}

/* ---------- Forms & Inputs ---------- */

label {
  font-family: var(--font-mono);
  font-size: var(--step--2);
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
  margin-bottom: 0.35rem;
  display: block;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="url"],
input[type="date"],
select,
textarea,
.form-control {
  width: 100%;
  border: 1px solid var(--rule);
  background-color: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--step--1);
  padding: 0.6rem 0.85rem;
  border-radius: 0;
  box-sizing: border-box;
}

input:focus,
select:focus,
textarea:focus,
.form-control:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  border-color: var(--accent);
}

.form-group,
.row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.form-hint,
.hint {
  font-size: var(--step--2);
  color: var(--ink-muted);
  margin-top: 0.35rem;
  display: block;
}

/* ---------- Panes, Cards, Lists ---------- */

.pane {
  border: 1px solid var(--rule);
  background-color: var(--paper);
  padding: 1.5rem;
  margin-bottom: 2rem;
  border-radius: 0;
}

.pane-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 0.75rem;
}

.card,
.a-card {
  border: 1px solid var(--rule);
  background-color: var(--paper);
  border-radius: 0;
  padding: 1.25rem;
  color: var(--ink);
}

.list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* ---------- Dialogs & Modals ---------- */

dialog,
.modal {
  background-color: var(--paper);
  border: 1px solid var(--rule-strong);
  border-radius: 0;
  color: var(--ink);
  box-shadow: none;
  max-width: 580px;
  width: 100%;
}

dialog::backdrop,
.modal-overlay,
.modal-backdrop {
  background-color: rgba(8, 11, 13, 0.75);
  backdrop-filter: none;
}

/* ---------- Badges, Pills & Statuses ---------- */

.badge,
.a-badge,
.stat-pill,
.freshness-badge,
.status-badge {
  font-family: var(--font-mono);
  font-size: var(--step--2);
  padding: 0.2rem 0.5rem;
  border: 1px solid var(--rule);
  border-radius: 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  background-color: var(--tint);
  color: var(--ink);
}

.badge.ok,
.stat-pill.ok,
.freshness-badge.fresh {
  border-color: var(--ok);
  color: var(--ok);
}

.badge.warn,
.stat-pill.warn {
  border-color: var(--warn);
  color: var(--warn);
}

.badge.danger,
.stat-pill.danger,
.freshness-badge.stale {
  border-color: var(--danger);
  color: var(--danger);
}

/* ---------- Toasts ---------- */

.toast,
#toast,
.shell-toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background-color: var(--rule-strong);
  color: var(--paper);
  padding: 0.75rem 1.25rem;
  border: 1px solid var(--rule);
  border-radius: 0;
  font-family: var(--font-mono);
  font-size: var(--step--1);
  z-index: 3000;
  box-shadow: none;
}

/* Notes & callouts */
.note {
  font-size: var(--step--1);
  color: var(--ink-muted);
  max-width: var(--measure);
  border-left: 2px solid var(--rule);
  padding: 0.15rem 0 0.15rem 0.9rem;
  margin-top: 1.5rem;
}

.note--alert {
  border-left-color: var(--accent);
  color: var(--ink);
}
