/* Auger app UI — shared design system (Sandstone) */

:root {
  --bg: #f8f6f3;
  --surface: #ffffff;
  --surface-2: #f0ebe4;
  --surface-3: #e8dfd3;
  --border: #d9cfc0;
  --border-soft: #e8e4df;
  --muted: #a69680;
  --secondary: #6b5c4c;
  --primary: #5c4d3c;
  --primary-hover: #4a3f31;
  --text: #3d3629;
  --accent: #8b9a7c;
  --accent-deep: #5d6b5d;

  /* citation type colors */
  --cit-data: #5d7a5d;
  --cit-data-bg: #e9f0e6;
  --cit-qa: #b07d3f;
  --cit-qa-bg: #f7ecdc;
  --cit-standard: #6b5c4c;
  --cit-standard-bg: #efe8de;
  --cit-precedent: #7a6b8b;
  --cit-precedent-bg: #ece8f1;
  --cit-figure: #4f7d83;
  --cit-figure-bg: #e3eef0;
  --cit-judgment: #8c8275;
  --cit-judgment-bg: #f1eee9;

  --danger: #a8503f;
  --danger-bg: #f6e6e2;

  --shadow-sm: 0 1px 3px rgba(61, 54, 41, 0.08);
  --shadow-md: 0 4px 16px rgba(61, 54, 41, 0.10);
  --shadow-lg: 0 12px 40px rgba(61, 54, 41, 0.14);

  --radius: 10px;
  --radius-sm: 6px;
}

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

body {
  font-family: 'DM Sans', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  font-size: 14px;
}

h1, h2, h3, .serif { font-family: 'Fraunces', serif; font-weight: 500; }

/* ---------- Sidebar navigation ---------- */
body.has-sidenav { padding-left: 232px; }

.side-nav {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: 232px;
  background: var(--surface);
  border-right: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  padding: 18px 14px 12px;
  z-index: 400;
  overflow-y: auto;
}

.app-logo { display: flex; align-items: center; gap: 7px; text-decoration: none; }
.app-logo svg { width: 24px; height: 24px; }
.app-logo span {
  font-family: 'Fraunces', serif;
  font-size: 18px;
  color: var(--text);
}
.side-nav .app-logo { margin: 0 6px 16px; }

.sn-new { justify-content: center; margin-bottom: 20px; }

.sn-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 6px 7px;
}
.sn-nav ~ .sn-label { margin-top: 22px; }

.sn-nav { display: flex; flex-direction: column; gap: 2px; }
.sn-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--secondary);
  text-decoration: none;
  border: none;
  background: none;
  font-family: inherit;
  cursor: pointer;
  width: 100%;
  text-align: left;
}
.sn-item svg { width: 17px; height: 17px; flex-shrink: 0; }
.sn-item:hover { background: var(--surface-2); color: var(--text); }
.sn-item.on { background: var(--surface-3); color: var(--text); font-weight: 600; }
.kbd-hint {
  margin-left: auto;
  font-size: 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0 5px;
  color: var(--muted);
}

/* current report block */
.sn-report {
  background: var(--bg);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 11px;
}
.sn-rname { font-size: 13px; font-weight: 600; line-height: 1.35; }
.sn-rmeta { font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.sn-stages { display: flex; flex-direction: column; gap: 1px; margin-top: 10px; }
.sn-stage {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 7px;
  border-radius: 7px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--secondary);
  text-decoration: none;
}
.sn-stage:hover { background: var(--surface-2); color: var(--text); }
.sn-stage.on { background: var(--surface-3); color: var(--text); font-weight: 600; }
.sn-stage.done { color: var(--accent-deep); }
.sn-stage .n {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--surface-3);
  color: var(--secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
}
.sn-stage.on .n { background: var(--primary); color: #fff; }
.sn-stage.done .n { background: var(--cit-data-bg); color: var(--accent-deep); }

.sn-spacer { flex: 1; min-height: 18px; }
.sn-map { color: var(--muted); }

.sn-user {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 8px;
  margin-top: 8px;
  border-top: 1px solid var(--border-soft);
  border-radius: 0 0 8px 8px;
  cursor: pointer;
  position: relative;
}
.sn-user:hover { background: var(--surface-2); }
.sn-uinfo { display: flex; flex-direction: column; line-height: 1.25; }
.sn-uinfo b { font-size: 12.5px; }
.sn-uinfo span { font-size: 10.5px; color: var(--muted); }
.sn-caret { margin-left: auto; color: var(--muted); font-size: 11px; }

/* ---------- Sub-header (report pages) ---------- */
.sub-header {
  height: 48px;
  background: rgba(248, 246, 243, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px;
  position: sticky;
  top: 0;
  z-index: 200;
}
.crumbs { display: flex; align-items: center; gap: 8px; font-size: 13px; min-width: 0; }
.crumbs a { color: var(--secondary); text-decoration: none; }
.crumbs a:hover { color: var(--text); text-decoration: underline; }
.c-sep { color: var(--border); }
.c-here {
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 380px;
}
.c-stage {
  font-size: 11px;
  font-weight: 700;
  background: var(--surface-3);
  color: var(--secondary);
  border-radius: 10px;
  padding: 2px 9px;
  white-space: nowrap;
}

/* ---------- Report figures (shared by workspace + previews) ---------- */
.fig-canvas { height: 180px; position: relative; }
.fig-canvas.fence {
  background: linear-gradient(180deg, #f3efe8 0 28%, #e4d9c6 28% 45%, #cdbfa4 45% 70%, #b3a285 70% 100%);
}
.fig-canvas.plan { background: #edefe6; }
.fig-canvas .bh { position: absolute; top: 10px; bottom: 10px; width: 10px; background: rgba(92,77,60,0.55); border-radius: 3px; }
.fig-canvas .bh::after { content: attr(data-l); position: absolute; top: -2px; left: 14px; font-size: 9px; color: var(--secondary); font-weight: 700; }
.fig-canvas .bplan { position: absolute; left: 24%; top: 22%; width: 44%; height: 54%; border: 2px dashed rgba(92,77,60,0.45); border-radius: 4px; }
.fig-canvas .bplan::after { content: 'proposed building'; position: absolute; bottom: 4px; left: 8px; font-size: 9px; color: var(--muted); font-weight: 600; }
.fig-canvas .bhdot { position: absolute; width: 10px; height: 10px; border-radius: 50%; background: #5c4d3c; }
.fig-canvas .bhdot::after { content: attr(data-l); position: absolute; top: -3px; left: 13px; font-size: 9px; font-weight: 700; color: #6b5e4d; }

/* ---------- User menu (opens upward from sidebar) ---------- */
.um-drop {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  width: 230px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 8px;
  display: none;
  z-index: 500;
  cursor: default;
}
.um-drop.open { display: block; }
.um-id {
  display: flex; gap: 10px; align-items: center;
  padding: 10px 10px 12px;
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 6px;
  font-size: 13.5px;
}
.um-id .um-sub { font-size: 11px; color: var(--muted); }
.um-drop a {
  display: block;
  padding: 8px 10px;
  border-radius: 7px;
  font-size: 13px;
  color: var(--secondary);
  text-decoration: none;
}
.um-drop a:hover { background: var(--surface-2); color: var(--text); }
.um-div { height: 1px; background: var(--border-soft); margin: 6px 0; }
.um-out { color: var(--danger) !important; }

/* ---------- Demo map overlay ---------- */
.demo-map {
  position: fixed; inset: 0;
  background: rgba(61, 54, 41, 0.35);
  backdrop-filter: blur(3px);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 60px 20px;
  z-index: 1000;
  overflow-y: auto;
}
.demo-map.open { display: flex; }
.dm-card {
  width: 720px;
  background: var(--surface);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  padding: 22px 26px 26px;
}
.dm-head { display: flex; align-items: center; margin-bottom: 6px; }
.dm-group { margin-top: 16px; }
.dm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.dm-item {
  display: block;
  padding: 11px 14px;
  border: 1px solid var(--border-soft);
  border-radius: 9px;
  text-decoration: none;
  color: var(--text);
  font-size: 13.5px;
  transition: all .12s;
}
.dm-item:hover { border-color: var(--secondary); background: var(--bg); }
.dm-item span { display: block; font-size: 11.5px; color: var(--muted); margin-top: 1px; }

.doc-title { display: flex; flex-direction: column; line-height: 1.2; }
.doc-title .t { font-size: 14px; font-weight: 600; color: var(--text); }
.doc-title .s { font-size: 11.5px; color: var(--muted); }

.header-spacer { flex: 1; }

.badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 20px;
  letter-spacing: 0.02em;
}
.badge.draft { background: var(--surface-3); color: var(--secondary); }
.badge.ok { background: var(--cit-data-bg); color: var(--cit-data); }
.badge.warn { background: var(--cit-qa-bg); color: var(--cit-qa); }

.avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}
.avatar.b { background: var(--secondary); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-outline { background: transparent; color: var(--primary); border: 1.5px solid var(--border); }
.btn-outline:hover { background: var(--surface-3); border-color: var(--surface-3); }
.btn-ghost { background: transparent; color: var(--secondary); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { padding: 4px 10px; font-size: 12px; border-radius: 6px; }
.btn-accent { background: var(--accent-deep); color: #fff; }
.btn-accent:hover { filter: brightness(1.08); }

/* ---------- Citation chips ---------- */
.cit {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  vertical-align: super;
  line-height: 1.4;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
  user-select: none;
}
.cit:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.cit.data { background: var(--cit-data-bg); color: var(--cit-data); }
.cit.qa { background: var(--cit-qa-bg); color: var(--cit-qa); }
.cit.standard { background: var(--cit-standard-bg); color: var(--cit-standard); }
.cit.precedent { background: var(--cit-precedent-bg); color: var(--cit-precedent); }
.cit.figure { background: var(--cit-figure-bg); color: var(--cit-figure); }
.cit.judgment { background: var(--cit-judgment-bg); color: var(--cit-judgment); border: 1px dashed var(--cit-judgment); }

.judgment-text {
  border-bottom: 2px dotted var(--cit-judgment);
  cursor: help;
}

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.section-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- Form bits ---------- */
input[type="text"], textarea, select {
  font-family: inherit;
  font-size: 13.5px;
  color: var(--text);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 9px 12px;
  outline: none;
  transition: border-color 0.15s ease;
  width: 100%;
}
input[type="text"]:focus, textarea:focus, select:focus { border-color: var(--secondary); }

/* ---------- Scrollbars ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 6px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- Utility ---------- */
.muted { color: var(--muted); }
.small { font-size: 12px; }
.flex { display: flex; align-items: center; gap: 8px; }
.grow { flex: 1; }
