/* Thalamus AI Cloud — control plane.
 *
 * Tokens copied verbatim from the SRE console (app/src/styles.css) via
 * ThalamusAICloud/design-system.md. Two details that are easy to get wrong by assuming:
 *
 *   · The accent is NOT the same value in both themes. #f5821f fails contrast on white,
 *     so light mode uses #e2700f. Never hardcode either.
 *   · The sidebar stays dark in light mode (#0e1422). Deliberate, not an oversight.
 *
 * Theme is an explicit persisted choice stamped on <html data-theme>, not
 * prefers-color-scheme — the console does not follow the OS, because an operator who
 * set dark at 2am does not want it flipping at sunrise.
 */

:root,
:root[data-theme='dark'] {
  --bg: #0a0a0b;
  --panel: #161618;
  --panel-2: #1d1d20;
  --border: #2a2a2e;
  --text: #f1f1f3;
  --muted: #8e8e96;
  --accent: #f5821f;
  --accent-rgb: 245, 130, 31;
  --green: #2ecc71;
  --amber: #f1c40f;
  --red: #e74c3c;
  --info: #4f8cff;
  --sidebar-bg: #0d0d0f;
  --code-bg: #100f12;
}

:root[data-theme='light'] {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --panel-2: #f0f2f5;
  --border: #e1e4ea;
  --text: #1a2233;
  --muted: #5a6577;
  --accent: #e2700f;
  --accent-rgb: 226, 112, 15;
  --info: #2f6fed;
  --green: #1f9d57;
  --amber: #c79100;
  --red: #d93838;
  --sidebar-bg: #0e1422;
  --code-bg: #f0f2f5;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ── auth layout ─────────────────────────────────────────────────── */

.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 22px;
}

.brand-mark {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: var(--accent);
  display: grid;
  place-items: center;
  color: #0a0a0b; /* fixed: sits on the accent in both themes */
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.brand-name {
  font-weight: 600;
  letter-spacing: -0.2px;
}

h1 {
  font-size: 19px;
  font-weight: 600;
  margin: 0 0 6px;
  letter-spacing: -0.2px;
  text-wrap: balance;
}

.sub {
  color: var(--muted);
  margin: 0 0 22px;
  line-height: 1.5;
}

/* ── form ────────────────────────────────────────────────────────── */

.field {
  margin-bottom: 15px;
}

label {
  display: block;
  font-size: 12.5px;
  font-weight: 500;
  margin-bottom: 6px;
}

input[type='text'],
input[type='email'],
input[type='password'] {
  width: 100%;
  padding: 9px 11px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 7px;
  outline: none;
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.16);
}

/* Visible keyboard focus everywhere, not only on inputs. */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: 5px;
  line-height: 1.45;
}

button {
  width: 100%;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  color: #0a0a0b;
  background: var(--accent);
  border: none;
  border-radius: 7px;
  cursor: pointer;
}

button:hover:not(:disabled) {
  filter: brightness(1.08);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* ── messages ────────────────────────────────────────────────────── */
/*
 * State is carried by a left rule as well as colour, so it survives a greyscale
 * screenshot in a support ticket and reads for colour-blind operators.
 */

.msg {
  padding: 10px 12px;
  border-radius: 7px;
  margin-bottom: 16px;
  line-height: 1.5;
  border-left: 3px solid transparent;
  background: var(--panel-2);
}

.msg-error {
  border-left-color: var(--red);
}

.msg-ok {
  border-left-color: var(--green);
}

.msg-info {
  border-left-color: var(--info);
}

.foot {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

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

a:hover {
  text-decoration: underline;
}

.theme-toggle {
  position: fixed;
  top: 14px;
  right: 14px;
  width: auto;
  padding: 6px 11px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.theme-toggle:hover {
  color: var(--text);
  filter: none;
}

/* Requirement list on the password screens. */
.reqs {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.reqs li {
  padding-left: 17px;
  position: relative;
  line-height: 1.7;
}

.reqs li::before {
  content: '○';
  position: absolute;
  left: 0;
}

.reqs li.met {
  color: var(--green);
}

.reqs li.met::before {
  content: '●';
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}
