/* ==========================================================================
   CivitasOPS portal - design tokens
   Copied from static/style.css rather than shared: the two Flask apps have
   no build step and no way to serve one file from each other's /static, so
   this is duplicated on purpose and should be kept in step by eye.
   ========================================================================== */

:root {
  color-scheme: light dark;

  --bg:            #f2f5f9;
  --panel:         #ffffff;
  --panel-soft:    #f7f9fc;
  --panel-inset:   #eef2f8;
  --border:        #e1e7f0;
  --border-strong: #c8d2e0;

  --text:  #101725;
  --muted: #5a6779;

  --accent:        #1f5fbe;
  --accent-hover:  #17509e;
  --accent-soft:   #eaf1fc;
  --accent-line:   #c7dbf6;
  --on-accent:     #ffffff;

  --ok:     #0f7a55;
  --warn:   #b45309;
  --danger: #b42318;
  --ok-soft:     #eaf6f1;
  --warn-soft:   #fdf4e7;
  --danger-soft: #fdf0ee;

  --shadow-sm: 0 1px 2px rgba(16, 23, 37, .05), 0 1px 3px rgba(16, 23, 37, .04);
  --shadow-md: 0 1px 2px rgba(16, 23, 37, .04), 0 8px 20px rgba(16, 23, 37, .07);

  --radius-sm:  8px;
  --radius:    12px;
  --radius-lg: 16px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg:            #0f131a;
    --panel:         #171c24;
    --panel-soft:    #1d232d;
    --panel-inset:   #12171e;
    --border:        #29313c;
    --border-strong: #3a4553;
    --text:  #e6eaf0;
    --muted: #97a3b4;
    --accent:        #7ea8f5;
    --accent-hover:  #9dc0fa;
    --accent-soft:   #1b2536;
    --accent-line:   #2f4468;
    --on-accent:     #0b1220;
    --ok:     #34d399;
    --warn:   #f5b544;
    --danger: #f87171;
    --ok-soft:     #10241d;
    --warn-soft:   #241c0d;
    --danger-soft: #2a1618;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg:            #0f131a;
  --panel:         #171c24;
  --panel-soft:    #1d232d;
  --panel-inset:   #12171e;
  --border:        #29313c;
  --border-strong: #3a4553;
  --text:  #e6eaf0;
  --muted: #97a3b4;
  --accent:        #7ea8f5;
  --accent-hover:  #9dc0fa;
  --accent-soft:   #1b2536;
  --accent-line:   #2f4468;
  --on-accent:     #0b1220;
  --ok:     #34d399;
  --warn:   #f5b544;
  --danger: #f87171;
  --ok-soft:     #10241d;
  --warn-soft:   #241c0d;
  --danger-soft: #2a1618;
}

/* ==========================================================================
   Base
   ========================================================================== */

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

h1 { font-size: 1.5rem; margin: 0 0 .25rem; }
h2 { font-size: 1.05rem; margin: 2rem 0 .75rem; }
.muted { color: var(--muted); }
.lede { color: var(--muted); margin: 0 0 1.5rem; }

a.link { color: var(--accent); text-decoration: none; font-size: .9rem; }
a.link:hover { text-decoration: underline; }

/* ==========================================================================
   Top bar
   ========================================================================== */

.topbar {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: .75rem 1.5rem;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
.topbar .brand { display: flex; align-items: baseline; gap: .5rem; }
.topbar .sub { color: var(--muted); font-size: .85rem; }
.topbar .tabs { display: flex; gap: 1rem; flex: 1; }
.topbar .tabs a {
  color: var(--muted);
  text-decoration: none;
  padding: .4rem 0;
  border-bottom: 2px solid transparent;
  font-size: .92rem;
}
.topbar .tabs a.on { color: var(--text); border-color: var(--accent); }
.topbar-right { display: flex; align-items: center; gap: 1rem; }
.whoami { font-size: .9rem; }

/* ==========================================================================
   Layout
   ========================================================================== */

.page { max-width: 960px; margin: 0 auto; padding: 2rem 1.5rem 4rem; }

.authcard {
  max-width: 380px;
  margin: 4rem auto;
  padding: 2rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

/* ==========================================================================
   Forms + buttons
   ========================================================================== */

form label {
  display: block;
  font-size: .85rem;
  color: var(--muted);
  margin-bottom: .9rem;
}
form input {
  display: block;
  width: 100%;
  margin-top: .3rem;
  padding: .55rem .7rem;
  font: inherit;
  color: var(--text);
  background: var(--panel-soft);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
}
form input:focus { outline: 2px solid var(--accent-line); border-color: var(--accent); }

button, .primary, .ghost {
  font: inherit;
  padding: .55rem 1.1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--panel-soft);
  color: var(--text);
  cursor: pointer;
}
button.primary, .primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
}
button.primary:hover { background: var(--accent-hover); }
button.ghost { background: transparent; border-color: transparent; color: var(--muted); }
button.ghost:hover { color: var(--danger); }

.inline-form {
  display: flex;
  align-items: flex-end;
  gap: 1rem;
  padding: 1rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.inline-form label { margin: 0; min-width: 220px; }

/* ==========================================================================
   Cards, tables, badges, flashes
   ========================================================================== */

.licence-key {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .9rem 1.2rem;
  margin-top: 1rem;
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  border-radius: var(--radius);
}
.licence-key code {
  display: block;
  font: 1.05rem/1.4 ui-monospace, "Cascadia Mono", SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: .02em;
}
.licence-key-hint { margin-top: .5rem; font-size: .85rem; }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}
.card {
  padding: 1rem 1.2rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.card-label { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.card-value { font-size: 1.4rem; font-weight: 600; margin-top: .2rem; }

table { width: 100%; border-collapse: collapse; background: var(--panel); border-radius: var(--radius); overflow: hidden; }
th, td { text-align: left; padding: .6rem .9rem; border-bottom: 1px solid var(--border); font-size: .92rem; }
th { color: var(--muted); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; }
tr:last-child td { border-bottom: none; }

.badge { display: inline-block; padding: .15rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 600; }
.badge--ok { background: var(--ok-soft); color: var(--ok); }
.badge--muted { background: var(--panel-inset); color: var(--muted); }

.flashes { margin-bottom: 1.5rem; }
.flash { padding: .7rem 1rem; border-radius: var(--radius-sm); margin-bottom: .5rem; font-size: .92rem; }
.flash--ok  { background: var(--ok-soft); color: var(--ok); }
.flash--err { background: var(--danger-soft); color: var(--danger); }

/* Phone-width: stack the top bar and let the invite form drop to one column. */
@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; }
  .topbar .tabs { order: 3; width: 100%; }
  .inline-form { flex-direction: column; align-items: stretch; }
  .inline-form label { min-width: 0; }
}
