/*
 * ASI Design System — tokens + color-intent from Harlan's "ASI Design System" (Lovable)
 * Color decision table (intent -> token):
 *   Primary action / main CTA ........ navy #325472 (primary)
 *   Spotlight accent / single CTA .... orange #DE7F2C (accent)
 *   Small accent text < 16px ......... orange-700 #A05716
 *   Success / calm confirmation ...... sage #63776B
 *   Warm surface / muted card ........ paper #F3E3D2 (secondary/muted)
 *   Page background (light) .......... warm-white #F9F7F4 (background)
 *   Page background (dark) ........... amber-black #1F2A35
 *   Warm highlight in dark mode ...... dark-beige #E2B585 (primary dark)
 *   Destructive / error .............. #B3261E
 * Fonts: Libre Baskerville (headings) / Montserrat (body) / Yellowtail (script)
 */
:root {
  --radius: 0.625rem;
  --background: #f9f7f4;
  --foreground: #2c2c2c;
  --card: #ffffff;
  --card-foreground: #2c2c2c;
  --primary: #325472;
  --primary-foreground: #f3e3d2;
  --secondary: #f3e3d2;
  --secondary-foreground: #1f3650;
  --muted: #f8ede0;
  --muted-foreground: #303f4e;
  --accent: #de7f2c;
  --accent-foreground: #ffffff;
  --accent-small: #a05716;        /* small accent text < 16px */
  --destructive: #b3261e;
  --destructive-foreground: #ffffff;
  --border: #e6d3bd;
  --border-strong: #d9c3a6;
  --input: #e6d3bd;
  --ring: #de7f2c;

  --navy: #325472;
  --orange: #de7f2c;
  --orange-700: #a05716;
  --paper: #f3e3d2;
  --sage: #63776b;

  --shadow: 0 1px 3px rgba(44, 44, 44, .05), 0 4px 14px rgba(44, 44, 44, .05);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 15px/1.6 "Montserrat", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--background);
  color: var(--foreground);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  font-family: "Libre Baskerville", Georgia, serif;
  color: var(--primary);
  font-weight: 700;
}

.font-script { font-family: "Yellowtail", "Caveat", cursive; }

/* ---------- Top bar (light warm chrome, navy text) ---------- */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 24px;
  height: 60px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  color: var(--primary);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar a { color: var(--primary); text-decoration: none; }
.brand {
  font-family: "Libre Baskerville", Georgia, serif;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: .01em;
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand::before {
  content: none;
}
.brand-logo {
  height: 30px;
  width: auto;
  display: block;
  select: none;
}
.topnav { display: flex; gap: 14px; align-items: center; }
.topnav a {
  color: var(--primary);
  font-size: 14px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: var(--radius);
  transition: background .15s;
}
.topnav a:hover { background: var(--muted); }
.topnav .who {
  color: var(--muted-foreground);
  font-size: 13px;
  border-right: 1px solid var(--border);
  padding-right: 14px;
}
.inline { display: inline; }
.topbar button {
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 5px 12px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background .15s;
}
.topbar button:hover { background: var(--muted); }

/* ---------- Layout ---------- */
.shell { max-width: 1240px; margin: 0 auto; padding: 24px; }
.cols {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

/* ---------- Sidebar (warm paper surface, navy links) ---------- */
.sidebar {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px);
  padding: 16px 12px;
  position: sticky;
  top: 84px;
  max-height: calc(100vh - 108px);
  overflow-y: auto;
}
.sidebar .nav-dropdown { margin-bottom: 2px; }
.sidebar .nav-section {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted-foreground);
  padding: 10px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  user-select: none;
  font-family: "Montserrat", sans-serif;
  transition: background .12s;
}
.sidebar .nav-section::-webkit-details-marker { display: none; }
.sidebar .nav-section:hover { background: var(--muted); }
.sidebar .nav-section .chevron {
  font-size: 13px;
  color: var(--accent-small);
  transition: transform .15s ease;
}
.sidebar details[open] > .nav-section { color: var(--primary); }
.sidebar details[open] > .nav-section .chevron { transform: rotate(90deg); color: var(--accent); }
.sidebar ul { list-style: none; margin: 0; padding: 0 0 6px; }
.sidebar a {
  display: block;
  padding: 7px 12px;
  border-left: 3px solid transparent;
  border-radius: calc(var(--radius) - 2px);
  color: var(--primary);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.35;
  transition: background .12s;
}
.sidebar a:hover { background: var(--muted); }
.sidebar a.active {
  background: var(--card);
  border-left-color: var(--accent);
  color: var(--primary);
  font-weight: 700;
  box-shadow: var(--shadow);
}

/* ---------- Content ---------- */
.content {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px);
  padding: 32px 36px;
  box-shadow: var(--shadow);
  min-width: 0;
  color: var(--card-foreground);
}
.content article > h1,
.content article > h2 {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -.01em;
  margin: 0 0 6px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--secondary);
}
.content article > h3 { font-size: 19px; font-weight: 700; margin: 28px 0 8px; }
.content article > h4 { font-size: 16px; font-weight: 700; margin: 22px 0 6px; }
.content article p { margin: 10px 0; }
.content article ul { padding-left: 22px; margin: 10px 0; }
.content article li { margin: 5px 0; }
.content article li::marker { color: var(--accent-small); }
.content article a { color: var(--primary); text-decoration: none; font-weight: 600; }
.content article a:hover { text-decoration: underline; color: var(--secondary-foreground); }
.content article img {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 2px);
  margin: 8px 0;
}
.content pre {
  background: #1f2a35;
  color: var(--paper);
  padding: 14px 16px;
  border-radius: var(--radius);
  overflow-x: auto;
  font-size: 13px;
}
.content code { background: var(--muted); color: var(--secondary-foreground); padding: 2px 6px; border-radius: 5px; font-size: .92em; }
.content pre code { background: none; color: inherit; padding: 0; }
.content blockquote {
  border-left: 4px solid var(--accent);
  background: var(--muted);
  margin: 14px 0;
  padding: 10px 16px;
  border-radius: 0 10px 10px 0;
  color: var(--muted-foreground);
}
.content hr { border: 0; border-top: 1px solid var(--border); margin: 26px 0; }

.editlink { margin-top: 30px; padding-top: 14px; border-top: 1px dashed var(--border); font-size: 13px; }
.editlink a { color: var(--accent-small); font-weight: 600; }
.editlink a:hover { color: var(--accent); }

/* ---------- Cards / forms ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px);
  padding: 24px 28px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.login-card { max-width: 380px; margin: 10vh auto; padding: 32px; }
.login-card h1 { margin-top: 0; font-size: 22px; }
.stack { display: flex; flex-direction: column; gap: 14px; max-width: 420px; }
label { display: flex; flex-direction: column; gap: 5px; font-weight: 600; font-size: 13px; color: var(--foreground); }
input, textarea, select {
  font: inherit;
  padding: 9px 12px;
  border: 1px solid var(--input);
  border-radius: var(--radius);
  background: #fff;
  color: var(--foreground);
  transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 3px rgba(222, 127, 44, .18);
}
textarea { font-family: ui-monospace, Consolas, monospace; font-size: 13px; line-height: 1.5; }
button[type=submit], .btn {
  align-self: flex-start;
  background: var(--primary);
  color: var(--primary-foreground);
  border: 0;
  border-radius: var(--radius);
  padding: 10px 20px;
  font-weight: 700;
  font-size: 14px;
  font-family: "Montserrat", sans-serif;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: background .15s;
}
button[type=submit]:hover, .btn:hover { background: var(--secondary-foreground); }

/* ---------- Tables ---------- */
table { width: 100%; border-collapse: collapse; margin: 10px 0 18px; font-size: 14px; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); }
th {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted-foreground);
  background: var(--paper);
  font-family: "Montserrat", sans-serif;
}
tr:hover td { background: #fdfaf6; }
td code { font-size: 12px; }

/* ---------- Misc ---------- */
.error {
  background: #fdeceb;
  border: 1px solid #f2c5c2;
  color: var(--destructive);
  padding: 10px 14px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 13.5px;
}
.foot {
  text-align: center;
  color: var(--muted-foreground);
  font-size: 12px;
  padding: 24px;
}

@media (max-width: 860px) {
  .cols { grid-template-columns: 1fr; }
  .sidebar { position: static; max-height: none; }
  .content { padding: 22px; }
}