/* Geist Mono — self-hosted from Google Fonts. Single variable woff2 covers
   weights 100..900; the latin-ext file handles the extended Latin set. */
@font-face {
  font-family: "Geist Mono";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("geist-mono-latin.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: "Geist Mono";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("geist-mono-latin-ext.woff2") format("woff2");
  unicode-range:
    U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304,
    U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB,
    U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* Warm-tinted neutral palette mirroring the Angular meeting room
   (see doc/components/angular.md → Themes and meeting style). The Rails
   pages share the same seven tokens plus accent-on so the experience
   carries across the proxy boundary.

   Theme resolution mirrors the Angular ThemeService:
   - no [data-theme] attribute → auto (follow prefers-color-scheme)
   - [data-theme="light"]      → pin light
   - [data-theme="dark"]       → pin dark
   The inline script in the layout sets data-theme before paint based on
   localStorage["meshThemeMode"], so there's no FOUC. */
:root {
  --theme-bg: #fbf8f4;
  --theme-surface: #f3eee7;
  --theme-surface-elevated: #fffcf7;
  --theme-text: #2a2520;
  --theme-text-muted: #8c827a;
  --theme-border: #e0d8cc;
  --theme-accent: #b8552b;
  --theme-accent-on: #ffffff;
  --theme-danger: #b03a2e;
  --theme-success: #4f7a3a;
  color-scheme: light;
}

:root[data-theme="dark"],
:root:not([data-theme="light"]):not([data-theme="dark"]) {
  /* The :not(...):not(...) pair below selects auto mode. The actual values
     are scoped under the @media query so they only kick in when the OS
     prefers dark. The data-theme="dark" branch always applies. */
}

:root[data-theme="dark"] {
  --theme-bg: #1c1815;
  --theme-surface: #25201c;
  --theme-surface-elevated: #2e2823;
  --theme-text: #f0ebe5;
  --theme-text-muted: #9a8e82;
  --theme-border: #3a322c;
  --theme-accent: #f2b760;
  --theme-accent-on: #1c1815;
  --theme-danger: #e08577;
  --theme-success: #a7c98c;
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) {
    --theme-bg: #1c1815;
    --theme-surface: #25201c;
    --theme-surface-elevated: #2e2823;
    --theme-text: #f0ebe5;
    --theme-text-muted: #9a8e82;
    --theme-border: #3a322c;
    --theme-accent: #f2b760;
    --theme-accent-on: #1c1815;
    --theme-danger: #e08577;
    --theme-success: #a7c98c;
    color-scheme: dark;
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  min-height: 100%;
  background: var(--theme-bg);
  color: var(--theme-text);
  font-family: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--theme-accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

h1,
h2,
h3,
h4,
h5 {
  margin: 0 0 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

h1 { font-size: 22px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--theme-text-muted); }

p { margin: 0 0 12px; }

/* Layout — auth pages center a card; app pages use a full-width page. */
#wrapper {
  width: 100%;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

#wrapper.page {
  display: block;
  max-width: 760px;
  margin: 0 auto;
  padding: 32px 24px 64px;
  min-height: 100vh;
}

#wrapper #main {
  width: 100%;
  max-width: 380px;
}

#wrapper.page #main {
  max-width: 100%;
}

/* The auth card frames login/register/password flows. */
.auth-card {
  background: var(--theme-surface);
  border: 1px solid var(--theme-border);
  border-radius: 10px;
  padding: 28px 24px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.02);
}

.auth-card .brand {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--theme-text-muted);
  margin-bottom: 4px;
}

.auth-card h1 {
  margin-bottom: 20px;
  font-size: 20px;
}

/* Forms. */
.field {
  margin: 0 0 12px;
}

.field label {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--theme-text-muted);
  margin-bottom: 6px;
}

.field input,
.field textarea,
.field select,
#wrapper form input,
#wrapper form textarea,
#wrapper form select {
  display: block;
  width: 100%;
  padding: 10px 12px;
  background: var(--theme-surface-elevated);
  color: var(--theme-text);
  border: 1px solid var(--theme-border);
  border-radius: 6px;
  font: inherit;
  outline: none;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.field input:focus,
.field textarea:focus,
.field select:focus,
#wrapper form input:focus,
#wrapper form textarea:focus,
#wrapper form select:focus {
  border-color: var(--theme-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--theme-accent) 22%, transparent);
}

.field input::placeholder {
  color: var(--theme-text-muted);
  opacity: 0.7;
}

.field.alert,
.field.notice {
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 14px;
}

.field.alert {
  background: color-mix(in srgb, var(--theme-danger) 14%, var(--theme-surface));
  color: var(--theme-danger);
  border: 1px solid color-mix(in srgb, var(--theme-danger) 40%, transparent);
}

.field.notice {
  background: color-mix(in srgb, var(--theme-success) 14%, var(--theme-surface));
  color: var(--theme-success);
  border: 1px solid color-mix(in srgb, var(--theme-success) 40%, transparent);
}

/* Buttons. The selectors are deliberately narrow — applying styles to all
   <button> elements inside #wrapper would over-specify and stomp the
   theme-toggle's own segment reset (every segment ends up looking active). */
#wrapper form input[type="submit"],
button.btn,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 14px;
  background: var(--theme-accent);
  color: var(--theme-accent-on);
  border: 1px solid var(--theme-accent);
  border-radius: 10px;
  font: inherit;
  font-weight: 500;
  line-height: 1.5;
  cursor: pointer;
  transition: filter 0.12s ease, transform 0.04s ease;
}

#wrapper form input[type="submit"]:hover,
button.btn:hover,
.btn:hover {
  filter: brightness(0.94);
}

#wrapper form input[type="submit"]:active,
button.btn:active,
.btn:active {
  transform: translateY(1px);
}

.btn.secondary {
  background: transparent;
  color: var(--theme-text);
  border-color: var(--theme-border);
}

.btn.secondary:hover {
  background: var(--theme-surface-elevated);
  filter: none;
}

.btn.danger {
  background: transparent;
  color: var(--theme-danger);
  border-color: color-mix(in srgb, var(--theme-danger) 40%, transparent);
}

.btn.danger:hover {
  background: color-mix(in srgb, var(--theme-danger) 12%, transparent);
  filter: none;
}

/* Top navigation menu (for authenticated pages). */
menu {
  list-style: none;
  padding: 0 0 14px;
  margin: 0 0 28px;
  display: flex;
  gap: 4px;
  align-items: center;
  border-bottom: 1px solid var(--theme-border);
}

menu li {
  margin: 0;
}

menu a,
menu button,
#wrapper menu button {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 5px;
  background: none;
  border: none;
  color: var(--theme-text-muted);
  font: inherit;
  cursor: pointer;
  text-decoration: none;
}

menu a:hover,
menu button:hover,
#wrapper menu button:hover {
  background: var(--theme-surface);
  color: var(--theme-text);
  text-decoration: none;
}

menu a.active {
  color: var(--theme-text);
  background: var(--theme-surface);
}

menu form {
  margin: 0;
  display: inline;
}

menu li.spacer {
  flex: 1 1 auto;
}

/* Cards for record listings (presets, meetings, account fields). */
.card {
  background: var(--theme-surface);
  border: 1px solid var(--theme-border);
  border-radius: 8px;
  padding: 14px 16px;
  margin: 0 0 12px;
}

.card p {
  margin: 4px 0;
  font-size: 13px;
}

.card p strong {
  color: var(--theme-text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 11px;
  margin-right: 8px;
}

.card code,
.card .mono {
  background: var(--theme-surface-elevated);
  border: 1px solid var(--theme-border);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 12px;
}

/* Card variant: row layout — body left, actions right, inside the same
   card. Used by the presets and meetings lists. */
.card.row {
  display: flex;
  align-items: center;
  gap: 16px;
}

.card.row > .card-body {
  flex: 1 1 auto;
  min-width: 0;
}

.card.row > .card-body p {
  margin: 4px 0;
}

.card.row > .actions {
  margin: 0;
  flex-shrink: 0;
  flex-wrap: nowrap;
}

/* Action rows under cards / forms. */
.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin: 16px 0 24px;
}

.actions form {
  margin: 0;
  display: inline-block;
}

.actions a {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border: 1px solid var(--theme-border);
  border-radius: 10px;
  color: var(--theme-text);
  background: var(--theme-surface-elevated);
  line-height: 1.5;
}

.actions a:hover {
  background: var(--theme-surface);
  text-decoration: none;
}

.actions a.btn {
  background: var(--theme-accent);
  color: var(--theme-accent-on);
  border-color: var(--theme-accent);
}

.actions a.btn:hover {
  background: var(--theme-accent);
  filter: brightness(0.94);
}

.actions a.btn.secondary {
  background: transparent;
  color: var(--theme-text);
  border-color: var(--theme-border);
}

.actions a.btn.secondary:hover {
  background: var(--theme-surface-elevated);
  filter: none;
}

/* Page-level header with title + subline. */
.page-header {
  margin: 0 0 24px;
}

.page-header .eyebrow {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--theme-text-muted);
  margin-bottom: 6px;
}

.page-header h1 {
  margin: 0;
}

.page-header .sub {
  color: var(--theme-text-muted);
  font-size: 13px;
  margin-top: 4px;
}

/* Auxiliary text helpers. */
.muted {
  color: var(--theme-text-muted);
}

.divider {
  height: 1px;
  background: var(--theme-border);
  margin: 24px 0;
  border: 0;
}

.empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--theme-text-muted);
  background: var(--theme-surface);
  border: 1px dashed var(--theme-border);
  border-radius: 8px;
}

/* Admin analytics — stat tiles in a responsive grid, and an inline SVG
   bar chart for daily-new-meetings. The chart inherits the warm theme
   tokens so it auto-adapts to dark mode. */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin: 0 0 16px;
}

.stat {
  background: var(--theme-surface);
  border: 1px solid var(--theme-border);
  border-radius: 8px;
  padding: 12px 14px;
}

.stat-label {
  color: var(--theme-text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 11px;
}

.stat-value {
  font-size: 22px;
  margin-top: 4px;
  letter-spacing: -0.01em;
}

.chart-wrap {
  margin: 10px 0 4px;
}

.chart-wrap svg {
  width: 100%;
  height: auto;
  display: block;
}

.chart-wrap .bar {
  fill: var(--theme-accent);
}

.chart-wrap .axis {
  stroke: var(--theme-border);
  stroke-width: 1;
}

.chart-wrap .tick {
  fill: var(--theme-text-muted);
  font-size: 10px;
  font-family: inherit;
}

/* Small inline link rows below auth forms. */
.aux-links {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 14px;
  font-size: 13px;
  color: var(--theme-text-muted);
}

.aux-links a {
  color: var(--theme-text-muted);
}

.aux-links a:hover {
  color: var(--theme-text);
}

/* Topbar — slim horizontal strip that holds the theme toggle on pages
   without a menu (the auth flows). On app pages the <menu> is the
   topbar and hosts the toggle directly via .theme-toggle-host. */
.topbar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 14px 20px 0;
}

/* Theme toggle pill — three labelled segments; the active one gets
   the accent. Flows inline inside the menu or topbar. Kept compact so
   it doesn't dominate the topbar. */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0;
  padding: 1px;
  background: var(--theme-surface-elevated);
  border: 1px solid var(--theme-border);
  border-radius: 5px;
  font-family: inherit;
  line-height: 1;
}

.theme-toggle button {
  appearance: none;
  background: transparent;
  border: none;
  color: var(--theme-text-muted);
  font: inherit;
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  line-height: 1.4;
  transition: background-color 0.12s ease, color 0.12s ease;
}

.theme-toggle button:hover {
  color: var(--theme-text);
  background: transparent;
}

.theme-toggle button[aria-pressed="true"] {
  background: var(--theme-accent);
  color: var(--theme-accent-on);
}

.theme-toggle button[aria-pressed="true"]:hover {
  filter: brightness(0.94);
}

@media (max-width: 480px) {
  .theme-toggle button {
    padding: 3px 6px;
  }
}
