:root {
  --bg: #f6f8fc;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --accent: #1d4ed8;
  --accent-soft: #dbeafe;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.portal {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: #f3f4f6;
  border-right: 1px solid var(--border);
  padding: 22px 14px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.brand {
  border-radius: 14px;
  background: #ffffff;
  border: 1px solid var(--border);
  padding: 12px;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.05);
}

.brand h1 { margin: 0; font-size: 1rem; letter-spacing: -0.01em; }
.brand p { margin: 4px 0 0; font-size: 0.78rem; color: var(--muted); }

.label {
  font-size: 0.78rem;
  color: #6b7280;
  padding: 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.nav-list { display: flex; flex-direction: column; gap: 4px; }

.nav-item {
  border: 0;
  background: transparent;
  color: #111827;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 11px;
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
  font-size: 0.93rem;
  transition: all 0.2s;
}

.nav-item:hover { background: #e5e7eb; }
.nav-item.active { background: #e2e8f0; font-weight: 600; }

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #cbd5e1;
  flex: 0 0 9px;
}

.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  background: #ffffffcc;
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border);
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  position: sticky;
  top: 0;
  z-index: 5;
}

.title-wrap h2 { margin: 0; font-size: 1.32rem; letter-spacing: -0.01em; }
.title-wrap p { margin: 4px 0 0; color: var(--muted); font-size: 0.9rem; }

.search {
  width: min(350px, 100%);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 10px 12px;
  font-size: 0.9rem;
  background: #fff;
  color: #0f172a;
}

.search:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px #dbeafe;
}

.content {
  padding: 24px;
  display: grid;
  grid-template-columns: minmax(340px, 460px) 1fr;
  gap: 20px;
  min-height: calc(100vh - 79px);
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
  min-height: 0;
}

.panel-head {
  padding: 14px 16px;
  background: var(--surface-soft);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-head h3 { margin: 0; font-size: 0.95rem; }

.status-pill {
  border-radius: 999px;
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 9px;
}

.doc-list {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: calc(100vh - 210px);
  overflow: auto;
}

.doc-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  padding: 12px;
  transition: all 0.2s;
  cursor: pointer;
}

.doc-card:hover {
  border-color: #93c5fd;
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.12);
}

.doc-card.active {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px #dbeafe;
  background: #f8fbff;
}

.doc-top {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 8px;
  margin-bottom: 8px;
}

.doc-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.35;
}

.doc-meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.83rem;
  line-height: 1.45;
}

.badge {
  border: 1px solid #bfdbfe;
  color: #1e40af;
  background: var(--accent-soft);
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 4px 8px;
  white-space: nowrap;
}

.doc-actions {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn {
  appearance: none;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #fff;
  color: #0f172a;
  padding: 7px 10px;
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: 0.2s;
}

.btn:hover { border-color: #94a3b8; background: #f8fafc; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #1e40af; }

.preview-wrap { display: flex; flex-direction: column; min-height: 0; height: 100%; }

.preview-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.preview-title { margin: 0; font-size: 1rem; font-weight: 700; }
.preview-subtitle { margin: 4px 0 0; font-size: 0.82rem; color: var(--muted); }
iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.preview-frame { min-height: 560px; height: 100%; }

.empty {
  padding: 26px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 0.92rem;
}

@media (max-width: 1060px) {
  .portal { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .topbar { flex-direction: column; align-items: stretch; }
  .content { grid-template-columns: 1fr; padding: 16px; }
  .doc-list { max-height: 370px; }
}
