:root {
  --canvas: #f5f7fb;
  --surface: #fff;
  --primary: #4f46e5;
  --healthy: #16854f;
  --minecraft: #6b8e5a;
  --ink: #172033;
  --muted: #667085;
  --line: #dfe4ec;
  --focus: #93c5fd;
  font: 16px Inter, ui-sans-serif, system-ui, sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--canvas); }
button, input { font: inherit; }

/* Shared controls and authentication */
.auth-view { width: min(440px, calc(100% - 32px)); margin: 8vh auto; padding: 32px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 16px 40px #17203312; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.2rem; }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 9px; color: #fff; background: var(--primary); font-weight: 900; }
.auth-view h1 { margin: 32px 0 8px; }
.auth-view p { color: var(--muted); }
form { display: grid; gap: 8px; margin-top: 24px; }
label { margin-top: 8px; font-size: .9rem; font-weight: 650; }
input { width: 100%; min-width: 0; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; }
.button { min-width: 44px; min-height: 44px; padding: 10px 16px; border: 1px solid transparent; border-radius: 8px; font-weight: 700; cursor: pointer; }
.button-primary { background: var(--primary); color: #fff; }
.button-secondary { background: var(--surface); border-color: var(--line); color: var(--ink); }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* Authenticated console layout */
.app-view { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }
.sidebar { display: flex; flex-direction: column; gap: 40px; min-width: 0; padding: 28px 20px; background: var(--surface); border-right: 1px solid var(--line); }
.sidebar nav { display: grid; gap: 4px; }
.sidebar a, .mobile-nav a { padding: 12px; color: var(--muted); text-decoration: none; border-radius: 8px; }
.sidebar a[aria-current="page"], .mobile-nav a[aria-current="page"] { color: var(--primary); background: #eef0ff; font-weight: 700; }
.sidebar-footer { margin-top: auto; color: var(--healthy); font-size: .9rem; }
.status-dot { display: inline-block; width: 9px; height: 9px; background: var(--healthy); border-radius: 50%; }
.content-column { min-width: 0; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 28px 5%; background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar h1 { margin: 4px 0; }
.eyebrow { margin: 0; color: var(--muted); font-size: .8rem; }
.content-column main { min-width: 0; padding: 5%; }
.workspace-placeholder { min-width: 0; overflow-wrap: anywhere; padding: 32px; background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--minecraft); border-radius: 12px; }
.mobile-nav { display: none; }
.mobile-nav a { min-width: 0; word-break: break-word; }
.toast-region { position: fixed; right: 20px; bottom: 20px; z-index: 10; max-width: min(90vw, 420px); overflow-wrap: anywhere; }
dialog#dialog-root { max-width: min(440px, calc(100% - 32px)); padding: 24px; border: 1px solid var(--line); border-radius: 12px; }
dialog#dialog-root::backdrop { background: #17203380; }
.dialog-close { min-width: 44px; min-height: 44px; }

/* Responsive navigation */
@media (max-width: 800px) {
  .app-view { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
  .mobile-nav { display: flex; position: fixed; right: 0; bottom: 0; left: 0; z-index: 5; justify-content: space-around; gap: 4px; padding: 6px; background: var(--surface); border-top: 1px solid var(--line); }
  .content-column main { padding-bottom: 90px; }
}
@media (max-width: 480px) {
  .auth-view { margin-top: 24px; padding: 24px; }
  .topbar { padding: 20px 16px; }
  .content-column main { padding: 24px 16px 90px; }
  .topbar h1 { overflow-wrap: anywhere; }
}
