:root {
  --bg: #f7f5f0;
  --bg-panel: #ffffff;
  --bg-sunk: #efece4;
  --ink: #14110d;
  --ink-soft: #5b574e;
  --ink-mute: #8a8678;
  --line: #e3dfd4;
  --accent: #b94a1c;
  --accent-soft: #f3e3da;
  --shadow-sm: 0 1px 2px rgba(20, 17, 13, 0.04);
  --shadow-md: 0 8px 28px rgba(20, 17, 13, 0.08);
  --radius: 10px;
  --sidebar-w: 304px;
  --serif: "Iowan Old Style", "Charter", "Source Serif Pro", "Georgia", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

/* SIDEBAR */
.sidebar {
  background: var(--bg-panel);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-height: 100vh;
  position: sticky;
  top: 0;
}

.sidebar-head {
  padding: 22px 22px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 36px; height: 36px;
  background: var(--ink);
  color: var(--bg);
  border-radius: 8px;
  display: grid; place-items: center;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.02em;
}
.brand-title {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1;
}
.brand-sub {
  font-size: 11px;
  color: var(--ink-mute);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 4px;
}
.close-btn {
  display: none;
  background: none;
  border: none;
  font-size: 26px;
  color: var(--ink-soft);
  cursor: pointer;
  padding: 0 4px;
}

.search-wrap {
  padding: 14px 18px 6px;
}
#search {
  width: 100%;
  background: var(--bg-sunk);
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 9px 12px;
  font-family: inherit;
  font-size: 13px;
  color: var(--ink);
  outline: none;
  transition: border-color .15s, background .15s;
}
#search:focus {
  border-color: var(--accent);
  background: var(--bg-panel);
}

.report-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 10px 16px;
}
.report-list a.report-item {
  display: block;
  padding: 10px 12px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--ink);
  margin-bottom: 2px;
  border: 1px solid transparent;
  transition: background .12s, border-color .12s;
}
.report-list a.report-item:hover { background: var(--bg-sunk); }
.report-list a.report-item.active {
  background: var(--accent-soft);
  border-color: rgba(185, 74, 28, 0.18);
}
.report-list .item-title {
  font-weight: 500;
  font-size: 13.5px;
  line-height: 1.35;
}
.report-list .item-meta {
  font-size: 11px;
  color: var(--ink-mute);
  margin-top: 3px;
  font-variant-numeric: tabular-nums;
}
.report-list .empty {
  padding: 16px 12px;
  color: var(--ink-mute);
  font-size: 13px;
  text-align: center;
}

.sidebar-foot {
  padding: 12px 22px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  color: var(--ink-mute);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* VIEWER */
.viewer {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--bg);
}

.viewer-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 22px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 5;
}
.menu-btn {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}
.menu-btn span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--ink);
}
.crumbs {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-size: 13px;
}
.crumb-root {
  color: var(--ink-mute);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 11px;
}
.crumb-sep {
  color: var(--ink-mute);
}
.crumb-title {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.head-action {
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  transition: background .12s;
}
.head-action:hover { background: var(--accent-soft); }

.frame-wrap {
  flex: 1;
  position: relative;
  background: var(--bg);
}
#frame {
  width: 100%;
  height: 100%;
  border: none;
  background: var(--bg-panel);
  display: block;
}

.placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 40px;
}
.placeholder-inner {
  text-align: center;
  max-width: 440px;
}
.placeholder-mark {
  width: 64px; height: 64px;
  margin: 0 auto 22px;
  background: var(--ink);
  color: var(--bg);
  border-radius: 14px;
  display: grid; place-items: center;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 30px;
  box-shadow: var(--shadow-md);
}
.placeholder h1 {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin: 0 0 10px;
}
.placeholder p {
  color: var(--ink-soft);
  margin: 0;
  font-size: 14px;
}
.placeholder code {
  font-family: var(--mono);
  font-size: 12.5px;
  background: var(--bg-sunk);
  padding: 1px 6px;
  border-radius: 4px;
}

/* RESPONSIVE */
@media (max-width: 760px) {
  body { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    top: 0; left: 0;
    width: 88%;
    max-width: 320px;
    height: 100vh;
    z-index: 20;
    transform: translateX(-100%);
    transition: transform .25s ease;
    box-shadow: var(--shadow-md);
  }
  body.menu-open .sidebar { transform: translateX(0); }
  body.menu-open::after {
    content: "";
    position: fixed; inset: 0;
    background: rgba(20,17,13,0.35);
    z-index: 15;
  }
  .close-btn { display: block; }
  .menu-btn { display: flex; }
}
