/* ──────────────────────────────────────────────────────────────────
 * City AI Workspace — styles
 * Aligned to the SF.gov design system:
 *   – Primary civic blue #1b519e (navy header at primary-800)
 *   – Accent orange #b64a00 for eyebrows
 *   – Roboto Slab (display) / Roboto Flex (body) / Roboto Mono
 *   – 4pt spacing grid, 4px / 8px radii, 1px borders, near-flat
 *   – Sentence case, underlined links, solid focus rings
 * ────────────────────────────────────────────────────────────────── */

/*
@import url('https://fonts.googleapis.com/css2?family=Roboto+Flex:opsz,wght@8..144,300..800&family=Roboto+Slab:wght@400;500;600;700&family=Roboto+Mono:wght@400;500&display=swap');
*/

* { box-sizing: border-box; margin: 0; padding: 0; }

/* Nav logo link — removes the inline-block gap beneath the image */
.nav-logo-link { font-size: 0; }
/* Next.js-style image colour placeholder */
.nav-logo-img  { color: transparent; }

:root {
  /* ── SF.gov core palette ─────────────────────────────────────── */
  --primary-50:  #e9f1fe;
  --primary-100: #dfebfd;
  --primary-200: #afccf7;
  --primary-500: #386ebf;
  --primary-600: #1b519e;   /* core brand primary */
  --primary-700: #043578;
  --primary-800: #001d4e;   /* navy header */
  --primary-900: #000925;

  --accent-100: #fde4d7;
  --accent-500: #b64a00;    /* eyebrow accent */
  --accent-600: #942a00;

  --secondary-600: #00646c;

  --neutral-10:  #f7f8f8;
  --neutral-50:  #eff0f0;
  --neutral-100: #e9eaea;
  --neutral-200: #c9caca;
  --neutral-300: #aaabab;
  --neutral-400: #8b8d8d;
  --neutral-500: #6e7070;
  --neutral-600: #535454;
  --neutral-700: #383939;
  --neutral-800: #202121;
  --neutral-900: #0b0b0b;

  --white: #fcfcfc;
  --black: #0b0c0c;

  /* ── Semantic tints (status pills) ───────────────────────────── */
  --info-bg:    #daebff;
  --info-text:  #002996;
  --success-bg:    #def1d6;
  --success-text:  #004a00;
  --warning-bg:    #f7e7d3;
  --warning-text:  #612600;
  --neutral-bg:    var(--neutral-100);
  --neutral-text:  var(--neutral-700);

  /* ── Semantic aliases ────────────────────────────────────────── */
  --fg-1:       var(--neutral-900);
  --fg-2:       var(--neutral-700);
  --fg-muted:   var(--neutral-500);
  --bg:         var(--white);
  --bg-soft:    var(--neutral-50);
  --border-1:   var(--neutral-200);
  --border-2:   var(--neutral-100);
  --link:       #2a60af;
  --link-hover: #001d4e;

  /* Type families */
  --font-sans: 'Roboto Flex', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-slab: 'Roboto Slab', Georgia, 'Times New Roman', serif;
  --font-mono: 'Roboto Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  /* Radii */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-pill: 999px;

  /* Shadows (minimal — sf.gov is nearly flat) */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.06);
}

html, body { height: 100%; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--fg-1);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-size: 16px;
  line-height: 1.5;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Focus — solid ring per sf.gov */
:where(a, button, [role="button"], [tabindex]):focus-visible {
  outline: 2px solid var(--primary-500);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
  box-shadow: none;
}

/* Skip link */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--primary-800);
  color: var(--white);
  padding: 10px 14px;
  z-index: 1000;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
}
.skip-link:focus {
  left: 8px;
  top: 8px;
}

/* ── TOP NAV ─────────────────────────────────────────────────────── */
header {
  flex-shrink: 0;
}

nav[aria-label="Site"] {
  background: var(--primary-900);
  height: 64px;
  display: flex;
  align-items: center;
  padding: 0 32px;
}

.nav-seal {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  margin-right: 24px;
}

.seal-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.seal-inner {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid var(--primary-900);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-slab);
  font-size: 11px;
  font-weight: 700;
  color: var(--primary-900);
  letter-spacing: 0.4px;
  line-height: 1;
}

.nav-site-name {
  font-family: var(--font-slab);
  font-size: 18px;
  font-weight: 600;
  color: var(--white);
  letter-spacing: -0.1px;
}

.nav-divider {
  width: 1px;
  height: 24px;
  background: rgba(255, 255, 255, 0.25);
  margin: 0 20px;
}

.nav-workspace-name {
  font-size: 15px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.85);
}

.beta-pill {
  margin-left: 12px;
  font-size: 10px;
  font-weight: 700;
  background: var(--accent-500);
  color: var(--white);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  letter-spacing: 0.8px;
  text-transform: uppercase;
  line-height: 1.4;
}

.nav-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 16px;
}

.nav-dept {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.75);
}

.nav-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--primary-600);
  border: 2px solid rgba(255, 255, 255, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--white);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}
.nav-avatar:hover { background: var(--primary-500); border-color: rgba(255,255,255,0.6); }
.nav-avatar[aria-current="page"] { border-color: var(--white); }

/* ── LAYOUT ──────────────────────────────────────────────────────── */
.main {
  display: flex;
  flex: 1;
  overflow: hidden;
  height: calc(100vh - 64px);
}

/* ── SIDEBAR ─────────────────────────────────────────────────────── */
aside {
  width: 240px;
  flex-shrink: 0;
  background: var(--white);
  border-right: 1px solid var(--border-1);
  padding: 24px 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.aside-section { margin-bottom: 12px; }

.aside-footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border-1);
}

.aside-section-label {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--fg-muted);
  padding: 12px 24px 8px;
}

.aside-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 24px;
  font-size: 15px;
  font-weight: 400;
  color: var(--fg-2);
  cursor: pointer;
  border-left: 4px solid transparent;
  transition: background 0.1s, color 0.1s, border-color 0.1s;
  text-decoration: none;
  line-height: 1.4;
}

.aside-item:hover {
  background: var(--neutral-50);
  color: var(--primary-700);
}

.aside-item.active {
  color: var(--primary-700);
  border-left-color: var(--primary-600);
  background: var(--primary-50);
  font-weight: 600;
}

.aside-item[aria-disabled="true"] {
  color: var(--fg-muted);
  cursor: default;
}
.aside-item[aria-disabled="true"]:hover {
  background: transparent;
  color: var(--fg-muted);
}

.aside-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  opacity: 0.85;
}
.aside-item.active .aside-icon { opacity: 1; color: var(--primary-600); }

/* ── CONTENT ─────────────────────────────────────────────────────── */
.content {
  flex: 1;
  overflow-y: auto;
  padding: 48px 56px;
  background: var(--bg);
}

.content-header {
  margin-bottom: 40px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--border-1);
}

/* Eyebrow above page title — accent orange */
.content-header .eyebrow {
  display: block;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--accent-500);
  margin-bottom: 8px;
}

.content-header h1 {
  font-family: var(--font-slab);
  font-size: 46px;
  line-height: 1.15;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--fg-1);
  margin-bottom: 12px;
}

.content-header p {
  font-size: 17px;
  color: var(--fg-2);
  font-weight: 400;
  line-height: 1.5;
  max-width: 64ch;
}

/* ── SECTION LABEL ───────────────────────────────────────────────── */
.section-label {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--accent-500);
  margin-bottom: 16px;
}

/* ── TILE GRID ───────────────────────────────────────────────────── */
.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.tile {
  background: var(--white);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-sm);
  padding: 24px;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  text-decoration: none;
  color: inherit;
  min-height: 200px;
}

a.tile { cursor: pointer; }

a.tile:hover {
  border-color: var(--link);
  box-shadow: var(--shadow-sm);
}

div.tile {
  /* non-clickable (planning / not yet deployed) */
  background: var(--neutral-10);
}

.tile-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.tile-icon-wrap {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: var(--primary-50);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Title row with right-aligned arrow */
.tile-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

/* Arrow indicator (sf.gov link pattern) */
.tile-arrow {
  width: 22px;
  height: 22px;
  color: var(--link);
  flex-shrink: 0;
  transition: color 0.15s;
  margin-top: 2px;
}
a.tile:hover .tile-arrow,
a.tile:focus-visible .tile-arrow {
  color: var(--link-hover);
}
div.tile .tile-arrow { color: var(--neutral-300); }
.tile-icon-wrap svg {
  width: 22px;
  height: 22px;
  color: var(--primary-700);
}

div.tile .tile-icon-wrap {
  background: var(--neutral-100);
}
div.tile .tile-icon-wrap svg {
  color: var(--neutral-600);
}

.tile-status {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  letter-spacing: 0.1px;
  line-height: 1.4;
  white-space: nowrap;
}

.status-available { background: var(--success-bg); color: var(--success-text); }
.status-june      { background: var(--info-bg);    color: var(--info-text); }
.status-july      { background: var(--info-bg);    color: var(--info-text); }
.status-planning  { background: var(--neutral-bg); color: var(--neutral-text); }

.tile-name {
  font-family: var(--font-slab);
  font-size: 20px;
  font-weight: 600;
  color: var(--link);
  line-height: 1.25;
  letter-spacing: -0.005em;
  transition: color 0.1s;
  flex: 1;
  min-width: 0;
}
a.tile:hover .tile-name,
a.tile:focus-visible .tile-name {
  color: var(--link-hover);
  text-decoration: underline;
  text-underline-offset: 3px;
}
div.tile .tile-name { color: var(--fg-1); }

.tile-desc {
  font-size: 15px;
  color: var(--fg-2);
  line-height: 1.5;
  font-weight: 400;
}

.tile-link {
  font-size: 15px;
  color: var(--link);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: auto;
  padding-top: 4px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.tile-link.is-coming-soon {
  color: var(--fg-muted);
  font-weight: 400;
  font-style: normal;
  text-decoration: none;
}

/* ── AUTH SCREEN ───────────────────────────────────────────────────── */
body.auth-locked .main {
  display: none;
}

.auth-shell {
  flex: 1;
  min-height: calc(100vh - 64px);
  background: var(--neutral-50);
  display: grid;
  place-items: center;
  padding: 40px 20px;
}

.auth-panel {
  width: min(100%, 460px);
  background: var(--white);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-sm);
  padding: 32px;
  box-shadow: var(--shadow-sm);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.auth-eyebrow {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--accent-500);
}

.auth-form h1 {
  font-family: var(--font-slab);
  font-size: 32px;
  line-height: 1.18;
  font-weight: 600;
  color: var(--fg-1);
}

.auth-copy {
  font-size: 15px;
  color: var(--fg-2);
  line-height: 1.55;
  margin-top: -8px;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.auth-field label {
  color: var(--fg-1);
  font-size: 14px;
  font-weight: 700;
}

.auth-input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--neutral-300);
  border-radius: var(--radius-sm);
  color: var(--fg-1);
  background: var(--white);
  font: inherit;
  font-size: 16px;
  padding: 10px 12px;
}

.auth-input:focus {
  outline: 2px solid var(--primary-500);
  outline-offset: 2px;
  border-color: var(--primary-600);
}

.auth-password-wrap {
  position: relative;
}

.auth-password-wrap .auth-input {
  padding-right: 46px;
}

.auth-password-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  width: 34px;
  height: 34px;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--primary-700);
  cursor: pointer;
}

.auth-password-toggle:hover:not(:disabled),
.auth-password-toggle:focus-visible:not(:disabled) {
  background: var(--primary-50);
}

.auth-password-toggle svg {
  width: 20px;
  height: 20px;
}

.auth-message {
  border-left: 4px solid;
  border-radius: var(--radius-sm);
  font-size: 14px;
  line-height: 1.5;
  padding: 12px 14px;
}

.auth-message-info {
  background: var(--info-bg);
  border-color: var(--primary-600);
  color: var(--info-text);
}

.auth-message-error {
  background: var(--accent-100);
  border-color: var(--accent-600);
  color: var(--accent-600);
}

.auth-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.auth-link-button {
  border: 0;
  background: transparent;
  color: var(--link);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  padding: 4px 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.auth-link-button:hover:not(:disabled),
.auth-link-button:focus-visible:not(:disabled) {
  color: var(--link-hover);
}

/* ── FOOTER ──────────────────────────────────────────────────────── */
.content-footer {
  margin-top: 24px;
  padding: 20px 24px;
  background: var(--neutral-50);
  border-left: 4px solid var(--accent-500);
  border-radius: var(--radius-sm);
}

.content-footer p {
  font-size: 14px;
  color: var(--fg-2);
  line-height: 1.55;
  font-weight: 400;
  max-width: 80ch;
}

/* ── BREADCRUMB ──────────────────────────────────────────────────── */
.breadcrumb {
  font-size: 14px;
  color: var(--fg-muted);
  margin-bottom: 20px;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.breadcrumb a {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.breadcrumb a:hover { color: var(--link-hover); }
.breadcrumb [aria-current="page"] { color: var(--fg-1); font-weight: 500; }
.breadcrumb span[aria-hidden="true"] { color: var(--neutral-300); }

/* ── SETTINGS PAGE ───────────────────────────────────────────────── */
.settings-section {
  margin-bottom: 36px;
}
.settings-section .section-label {
  font-family: var(--font-slab);
  font-size: 40px;
  line-height: 52px;
  font-weight: 500;
  color: var(--neutral-900);
  text-transform: unset;
  margin-bottom: 28px;
}

.settings-card {
  background: var(--white);
  padding: 0 0 28px 0;
}
.settings-card-compact { padding: 20px 24px; }

.settings-dl {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 12px 24px;
  margin: 0 0 12px;
  font-size: 15px;
}
.settings-dl dt {
  color: var(--fg-muted);
  font-weight: 500;
}
.settings-dl dd {
  color: var(--fg-1);
  margin: 0;
}
.settings-dl dd a {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.settings-dl dd a:hover { color: var(--link-hover); }

.settings-helper {
  font-size: 14px;
  color: var(--fg-2);
  line-height: 1.6;
  padding: 14px 18px;
  background: var(--neutral-50);
  border-left: 4px solid var(--primary-600);
  border-radius: var(--radius-sm);
  margin-bottom: 0;
  margin-top: 16px;
}
.settings-helper a {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.settings-links {
  list-style: none;
  margin: 0;
  padding: 0;
}
.settings-links li {
  padding: 16px 0;
  border-bottom: 1px solid var(--border-2);
}
.settings-links li:last-child { border-bottom: none; padding-bottom: 0; }
.settings-links li:first-child { padding-top: 0; }

.settings-links a {
  color: var(--link);
  font-weight: 700;
  font-size: 16px;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.settings-links a:hover { color: var(--link-hover); }

.settings-link-desc {
  display: block;
  font-size: 14px;
  color: var(--fg-2);
  margin-top: 4px;
  font-weight: 400;
  line-height: 1.5;
}

.settings-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* Action row: descriptive label on the left, button on the right. */
.settings-action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 20px 0;
  border-bottom: 1px solid var(--border-2);
}
.settings-action-row:first-child { padding-top: 0; }
.settings-action-row:last-of-type { border-bottom: none; padding-bottom: 0; }
.settings-action-text { flex: 1; min-width: 0; }
.settings-action-name {
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 600;
  color: var(--fg-1);
  margin-bottom: 4px;
}
.settings-action-desc {
  font-size: 14px;
  color: var(--fg-2);
  line-height: 1.55;
  font-weight: 400;
}
.settings-action-row .btn { flex-shrink: 0; }

@media (max-width: 540px) {
  .settings-action-row {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .settings-action-row .btn { align-self: flex-start; }
}

/* ── BUTTONS (per sf.gov spec) ───────────────────────────────────── */
.btn {
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid transparent;
  line-height: 1.4;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn:disabled {
  background: var(--neutral-100);
  color: var(--neutral-300);
  border-color: var(--neutral-100);
  cursor: not-allowed;
}
.btn-primary {
  background: var(--primary-600);
  color: var(--white);
  border-color: var(--primary-600);
}
.btn-primary:hover:not(:disabled),
.btn-primary:focus-visible:not(:disabled) {
  background: var(--primary-800);
  border-color: var(--primary-800);
}
.btn-secondary {
  background: var(--white);
  color: var(--primary-700);
  border-color: var(--primary-500);
}
.btn-secondary:hover:not(:disabled),
.btn-secondary:focus-visible:not(:disabled) {
  background: var(--primary-100);
  color: var(--primary-900);
  border-color: var(--primary-700);
}

/* ── RESPONSIVE ──────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .content { padding: 32px 28px; }
  .content-header h1 { font-size: 32px; }
}

@media (max-width: 720px) {
  aside { display: none; }
  .content { padding: 24px 20px; }
  .content-header h1 { font-size: 28px; }
  .content-header p { font-size: 15px; }
  nav[aria-label="Site"] { padding: 0 16px; }
  .nav-divider, .nav-workspace-name, .nav-dept { display: none; }
  .settings-card { padding: 20px; }
  .settings-dl { grid-template-columns: 1fr; gap: 4px 0; }
  .settings-dl dt { margin-top: 8px; }
  .auth-shell {
    align-items: start;
    padding: 24px 16px;
  }
  .auth-panel {
    padding: 24px 20px;
  }
  .auth-form h1 {
    font-size: 28px;
  }
  .auth-actions {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
  }
  .auth-actions .btn,
  .auth-actions .auth-link-button {
    width: 100%;
  }
}
