:root {
  --ink: #f4efe8;
  --muted: #b8aea3;
  --panel: rgba(18, 17, 16, 0.96);
  --panel-soft: rgba(30, 28, 26, 0.93);
  --panel-hover: rgba(38, 34, 30, 0.97);
  --topbar: rgba(13, 12, 11, 0.94);
  --input: #0f0e0d;
  --input-line: #504a44;
  --app-wash: rgba(8, 6, 5, 0.35);
  --line: rgba(255, 255, 255, 0.12);
  --accent: #d6a66e;
  --accent-strong: #edc18e;
  --danger: #ffb7b7;
  --focus: #f2c994;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: #140e0a;
  font-synthesis: none;
}

:root[data-panel-theme="light"] {
  --ink: #2b2119;
  --muted: #695b4e;
  --panel: rgba(244, 234, 219, 0.97);
  --panel-soft: rgba(238, 225, 207, 0.96);
  --panel-hover: rgba(249, 240, 226, 0.98);
  --topbar: rgba(240, 227, 208, 0.96);
  --input: #fffaf2;
  --input-line: #9a8067;
  --app-wash: rgba(40, 25, 14, 0.14);
  --line: rgba(72, 50, 33, 0.2);
  --accent: #8a592b;
  --accent-strong: #68401d;
  --focus: #9a5d24;
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(rgba(9, 6, 4, 0.35), rgba(9, 6, 4, 0.58)),
    url("../images/dark-walnut.1cd1adb3973c.png") center / cover fixed;
}
button, input { font: inherit; }
a { color: inherit; }
.skip-link { position: fixed; z-index: 100; left: 1rem; top: -5rem; padding: .75rem 1rem; background: #fff; color: #111; border-radius: .35rem; }
.skip-link:focus { top: 1rem; }

.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; }
.auth-card {
  width: min(100%, 27rem);
  padding: clamp(1.75rem, 5vw, 2.75rem);
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: var(--panel);
  box-shadow: 0 2rem 5rem rgba(0, 0, 0, .5);
}
.brand-mark, .mini-mark {
  display: grid; place-items: center; width: 3.25rem; height: 3.25rem;
  border: 1px solid rgba(214, 166, 110, .55); border-radius: .65rem;
  color: var(--accent-strong); font-weight: 750; letter-spacing: .06em;
  background: linear-gradient(145deg, rgba(214,166,110,.16), rgba(214,166,110,.03));
}
.lock-mark { font-size: 1.35rem; }
.eyebrow { margin: 1.4rem 0 .35rem; color: var(--accent); font-size: .75rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
h1 { margin: 0; font-size: clamp(1.75rem, 4vw, 2.25rem); line-height: 1.15; letter-spacing: -.025em; }
.supporting-text, .dashboard-heading > p:last-child { color: var(--muted); line-height: 1.6; }
.auth-card form { margin-top: 1.7rem; }
.field { margin-bottom: 1.15rem; }
label { display: block; margin-bottom: .45rem; font-size: .9rem; font-weight: 650; }
input {
  width: 100%; min-height: 3rem; padding: .75rem .85rem;
  border: 1px solid #504a44; border-radius: .5rem; outline: none;
  background: var(--input); color: var(--ink);
  border-color: var(--input-line);
}
input:hover { border-color: #776b60; }
input:focus-visible { border-color: var(--focus); box-shadow: 0 0 0 3px rgba(242,201,148,.18); }
.primary-button, .logout-button {
  border: 1px solid transparent; border-radius: .5rem; cursor: pointer; font-weight: 700;
}
.primary-button {
  width: 100%; min-height: 3rem; padding: .75rem 1rem;
  background: var(--accent); color: #1c130b;
}
.primary-button:hover { background: var(--accent-strong); }
.primary-button:focus-visible, .logout-button:focus-visible, .appearance-toggle:focus-visible, .admin-link:focus-visible, .project-tile:focus-visible, .quiet-link:focus-visible, .wordmark:focus-visible {
  outline: 3px solid var(--focus); outline-offset: 3px;
}
.button-link { display: block; margin-top: 1.5rem; text-align: center; text-decoration: none; line-height: 1.5rem; }
.quiet-link { display: inline-block; margin-top: 1.25rem; color: var(--muted); font-size: .9rem; text-underline-offset: .25rem; }
.field-error { color: var(--danger); font-size: .85rem; margin: .45rem 0 0; }
.alert { margin: 1rem 0; padding: .8rem; border: 1px solid rgba(255,130,130,.35); border-radius: .45rem; background: rgba(145,35,35,.18); color: #ffd0d0; font-size: .9rem; }

.app-shell { min-height: 100vh; background: var(--app-wash); }
.topbar {
  min-height: 4.5rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .8rem clamp(1rem, 4vw, 3.5rem); border-bottom: 1px solid var(--line); background: var(--topbar);
}
.wordmark { display: flex; align-items: center; gap: .75rem; font-weight: 750; text-decoration: none; }
.mini-mark { width: 2.3rem; height: 2.3rem; border-radius: .45rem; font-size: .78rem; }
.account-area { display: flex; align-items: center; gap: .8rem; }
.admin-email { color: var(--muted); font-size: .88rem; }
.status-badge { padding: .38rem .6rem; border-radius: 999px; background: rgba(68,139,95,.2); color: #aee5be; font-size: .78rem; white-space: nowrap; }
.status-badge span { display: inline-block; width: .45rem; height: .45rem; margin-right: .25rem; border-radius: 50%; background: #70d18e; }
.account-area form { margin: 0; }
.logout-button, .appearance-toggle, .admin-link { min-height: 2.35rem; padding: .5rem .72rem; border: 1px solid var(--line); border-radius: .5rem; background: transparent; color: var(--ink); }
.appearance-toggle { display: inline-flex; align-items: center; gap: .4rem; cursor: pointer; }
.appearance-toggle svg { width: 1rem; height: 1rem; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }
.admin-link { display: inline-flex; align-items: center; text-decoration: none; font-size: .86rem; font-weight: 650; white-space: nowrap; }
.logout-button:hover, .appearance-toggle:hover, .admin-link:hover { background: color-mix(in srgb, var(--ink) 8%, transparent); border-color: color-mix(in srgb, var(--ink) 25%, transparent); }
.dashboard { width: min(76rem, 100%); margin: 0 auto; padding: clamp(2.5rem, 7vw, 5.5rem) clamp(1rem, 4vw, 3rem); }
.dashboard-heading { max-width: 37rem; }
.dashboard-heading .eyebrow { margin-top: 0; }
.dashboard-heading h1 { color: #f4efe8; }
.dashboard-heading > p:last-child { color: #c7bdb3; }
.project-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(16rem, 21rem));
  gap: 1.2rem; margin-top: 2.3rem; justify-content: start;
}
.project-tile {
  position: relative; display: flex; flex-direction: column; aspect-ratio: 1 / 1;
  min-height: 16rem; padding: 1.5rem; overflow: hidden; text-decoration: none;
  border: 1px solid var(--line); border-radius: .85rem; background: var(--panel-soft);
  box-shadow: 0 1rem 2.5rem rgba(0,0,0,.22); transition: transform .15s ease, border-color .15s ease, background .15s ease;
}
.project-tile:hover { transform: translateY(-3px); border-color: rgba(214,166,110,.6); background: var(--panel-hover); }
.project-icon { display: grid; place-items: center; width: 3.8rem; height: 3.8rem; border-radius: .7rem; background: rgba(214,166,110,.12); color: var(--accent-strong); }
.project-icon svg { width: 2.25rem; height: 2.25rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.project-copy { display: flex; flex-direction: column; gap: .55rem; margin-top: auto; padding-top: 2rem; }
.project-copy strong { font-size: 1.25rem; }
.project-copy > span { color: var(--muted); line-height: 1.5; font-size: .9rem; }
.project-copy .project-status { color: var(--muted); font-size: .75rem; letter-spacing: .02em; }
.tile-arrow { position: absolute; top: 1.6rem; right: 1.6rem; color: var(--muted); font-size: 1.2rem; }
.empty-state { color: var(--muted); }

@media (max-width: 700px) {
  body { background-attachment: scroll; }
  .topbar { align-items: flex-start; }
  .wordmark > span:last-child, .admin-email, .status-badge, [data-appearance-label] { display: none; }
  .account-area { gap: .5rem; }
  .appearance-toggle { width: 2.35rem; justify-content: center; padding: .45rem; }
  .project-grid { grid-template-columns: minmax(0, 1fr); }
  .project-tile { aspect-ratio: auto; min-height: 15rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
