:root {
  --navy: #0D224D;
  --navy-90: #1a3162;
  --navy-80: #273f76;
  --blue: #0093D0;
  --blue-light: #1EBDFF;
  --blue-glow: rgba(0, 147, 208, 0.12);
  --green: #709E40;
  --green-light: #9DBF2B;
  --green-bg: rgba(112, 158, 64, 0.08);
  --gold: #F9C213;
  --red: #D12123;
  --text: #2d3139;
  --text-secondary: #5f6672;
  --text-muted: #8b919b;
  --bg: #f7f8fa;
  --white: #ffffff;
  --border: #e4e7ec;
  --border-light: #f0f1f4;
  --shadow-sm: 0 1px 3px rgba(13, 34, 77, 0.06);
  --shadow-md: 0 4px 12px rgba(13, 34, 77, 0.08);
  --shadow-lg: 0 8px 30px rgba(13, 34, 77, 0.12);
}

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

body {
  font-family: 'Open Sans', sans-serif;
  font-weight: 400;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ═══════════════════════════════════════════
   LOGIN
   ═══════════════════════════════════════════ */

#login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--navy);
  position: relative;
  overflow: hidden;
}

.login-bg {
  position: relative;
  z-index: 1;
}

.login-bg::before {
  content: '';
  position: fixed;
  top: -50%;
  right: -30%;
  width: 80vw;
  height: 80vw;
  background: radial-gradient(circle, rgba(0, 147, 208, 0.08) 0%, transparent 70%);
  pointer-events: none;
}

.login-bg::after {
  content: '';
  position: fixed;
  bottom: -30%;
  left: -20%;
  width: 60vw;
  height: 60vw;
  background: radial-gradient(circle, rgba(112, 158, 64, 0.06) 0%, transparent 70%);
  pointer-events: none;
}

.login-card {
  background: var(--white);
  padding: 56px 48px 48px;
  width: 420px;
  max-width: 90vw;
  position: relative;
  animation: loginEnter 0.5s ease-out;
}

@keyframes loginEnter {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.login-accent {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--blue), var(--green));
}

.login-badge {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 3px;
  color: var(--blue);
  margin-bottom: 16px;
}

.login-title {
  font-size: 36px;
  font-weight: 800;
  line-height: 1.15;
  color: var(--navy);
  margin-bottom: 16px;
}

.login-subtitle {
  font-size: 14px;
  font-weight: 300;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 32px;
}

.login-button {
  display: block;
  width: 100%;
  padding: 14px;
  background: var(--blue);
  color: var(--white);
  border: none;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 2px;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.login-button:hover { background: var(--blue-light); }
.login-button:active { transform: scale(0.98); }

.login-error {
  color: var(--red);
  font-size: 13px;
  margin-top: 12px;
  text-align: center;
}

.login-footer {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  text-transform: uppercase;
  text-align: center;
}

/* ═══════════════════════════════════════════
   TOPBAR
   ═══════════════════════════════════════════ */

.topbar {
  background: var(--navy);
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 32px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  text-decoration: none;
  flex-shrink: 0;
}

.topbar-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--blue);
  color: var(--white);
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 1px;
}

.topbar-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2.5px;
  color: rgba(255,255,255,0.9);
}

.topbar-search {
  flex: 1;
  max-width: 480px;
  position: relative;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: rgba(255,255,255,0.35);
  pointer-events: none;
}

.topbar-search input {
  width: 100%;
  padding: 8px 14px 8px 36px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--white);
  font-family: inherit;
  font-size: 13px;
  font-weight: 300;
  outline: none;
  transition: background 0.2s, border-color 0.2s;
}

.topbar-search input::placeholder { color: rgba(255,255,255,0.35); }
.topbar-search input:focus {
  background: rgba(255,255,255,0.12);
  border-color: var(--blue);
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
  flex-shrink: 0;
}

.topbar-user #user-name {
  font-size: 12px;
  font-weight: 400;
  color: rgba(255,255,255,0.6);
}

.topbar-logout {
  background: none;
  border: 1px solid rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.5);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  padding: 5px 12px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.topbar-logout:hover {
  color: rgba(255,255,255,0.9);
  border-color: rgba(255,255,255,0.4);
}

/* ═══════════════════════════════════════════
   MAIN LAYOUT
   ═══════════════════════════════════════════ */

main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px;
  min-height: calc(100vh - 56px);
}

/* ═══════════════════════════════════════════
   HERO STATS
   ═══════════════════════════════════════════ */

.hero {
  background: var(--white);
  padding: 32px;
  margin-bottom: 32px;
  border-left: 3px solid var(--blue);
  box-shadow: var(--shadow-sm);
}

.hero-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2.5px;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 20px;
}

.hero-stats {
  display: flex;
  gap: 48px;
  flex-wrap: wrap;
}

.hero-stat {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.hero-stat-value {
  font-size: 40px;
  font-weight: 800;
  color: var(--navy);
  line-height: 1;
}

.hero-stat-label {
  font-size: 13px;
  font-weight: 300;
  color: var(--text-secondary);
}

.hero-types {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--border-light);
}

.hero-type {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}

.hero-type-count {
  font-weight: 700;
  color: var(--navy);
  font-size: 14px;
}

.hero-type-dot {
  width: 8px;
  height: 8px;
  background: var(--green);
}

/* ═══════════════════════════════════════════
   SECTION HEADERS
   ═══════════════════════════════════════════ */

.section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2.5px;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 16px;
}

/* ═══════════════════════════════════════════
   TOPIC CARDS
   ═══════════════════════════════════════════ */

.topic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 1px;
  background: var(--border);
  margin-bottom: 32px;
}

.topic-card {
  background: var(--white);
  padding: 28px 32px;
  cursor: pointer;
  transition: background 0.15s;
  position: relative;
}

.topic-card:hover { background: var(--bg); }

.topic-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--blue);
  opacity: 0;
  transition: opacity 0.15s;
}

.topic-card:hover::before { opacity: 1; }

.topic-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.topic-card h3 {
  font-size: 18px;
  font-weight: 800;
  color: var(--navy);
  line-height: 1.3;
}

.topic-card-arrow {
  color: var(--text-muted);
  font-size: 18px;
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 0.15s, transform 0.15s;
}

.topic-card:hover .topic-card-arrow {
  opacity: 1;
  transform: translateX(0);
}

.topic-card-desc {
  font-size: 13px;
  font-weight: 300;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 16px;
}

.topic-card-owner {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.topic-card-owner strong {
  color: var(--text-secondary);
  font-weight: 600;
}

/* Completeness bar */
.completeness-bar {
  display: flex;
  gap: 2px;
  height: 4px;
}

.completeness-segment {
  flex: 1;
  background: var(--border-light);
  position: relative;
}

.completeness-segment.filled { background: var(--green); }
.completeness-segment.required { border-bottom: 1px solid var(--blue); }

.completeness-labels {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 10px;
}

.completeness-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.3px;
  padding: 2px 6px;
  color: var(--text-muted);
  background: var(--bg);
}

.completeness-label.filled {
  color: var(--green);
  background: var(--green-bg);
}

/* ═══════════════════════════════════════════
   BREADCRUMBS
   ═══════════════════════════════════════════ */

.breadcrumbs {
  margin-bottom: 24px;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 400;
}

.breadcrumbs a {
  color: var(--blue);
  text-decoration: none;
  cursor: pointer;
  transition: color 0.15s;
}

.breadcrumbs a:hover { color: var(--navy); }
.breadcrumbs .sep { margin: 0 8px; opacity: 0.4; }

/* ═══════════════════════════════════════════
   PAGE HEADER
   ═══════════════════════════════════════════ */

.page-header {
  margin-bottom: 32px;
}

.page-header h2 {
  font-size: 28px;
  font-weight: 800;
  color: var(--navy);
  line-height: 1.2;
}

.page-header-sub {
  font-size: 14px;
  font-weight: 300;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ═══════════════════════════════════════════
   PROVISION CARDS
   ═══════════════════════════════════════════ */

.provision-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--border);
  margin-bottom: 32px;
}

.provision-card {
  background: var(--white);
  padding: 20px 28px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  transition: background 0.15s;
}

.provision-card:hover { background: var(--bg); }

.provision-card h4 {
  font-size: 16px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 6px;
}

.provision-card .type-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.type-tag {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  padding: 3px 8px;
  background: var(--green-bg);
  color: var(--green);
}

.provision-card .count-badge {
  font-size: 12px;
  font-weight: 300;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ═══════════════════════════════════════════
   DOCUMENT TABLE
   ═══════════════════════════════════════════ */

.doc-table {
  width: 100%;
  background: var(--white);
  border-collapse: collapse;
  box-shadow: var(--shadow-sm);
  margin-bottom: 32px;
}

.doc-table th {
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  padding: 14px 20px;
  border-bottom: 2px solid var(--navy);
  background: var(--white);
}

.doc-table td {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  font-size: 14px;
}

.doc-table tbody tr {
  cursor: pointer;
  transition: background 0.1s;
}

.doc-table tbody tr:hover { background: var(--blue-glow); }

.doc-type-pill {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  padding: 4px 10px;
  background: var(--navy);
  color: var(--white);
  white-space: nowrap;
}

.doc-title-cell {
  font-weight: 600;
  color: var(--navy);
}

.doc-meta-cell {
  font-size: 13px;
  font-weight: 300;
  color: var(--text-muted);
}

/* ═══════════════════════════════════════════
   DOCUMENT DETAIL
   ═══════════════════════════════════════════ */

.doc-detail {
  background: var(--white);
  box-shadow: var(--shadow-sm);
}

.doc-detail-header {
  padding: 32px 40px;
  border-bottom: 1px solid var(--border-light);
}

.doc-detail-header h2 {
  font-size: 24px;
  font-weight: 800;
  color: var(--navy);
  margin-bottom: 16px;
  line-height: 1.3;
}

.doc-meta-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
}

.doc-meta-item {
  font-size: 12px;
}

.doc-meta-item-label {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  font-size: 10px;
  margin-bottom: 2px;
}

.doc-meta-item-value {
  font-weight: 400;
  color: var(--text);
}

.doc-detail-body {
  padding: 40px;
  font-size: 14px;
  line-height: 2;
  color: var(--text);
  white-space: pre-wrap;
  max-height: 70vh;
  overflow-y: auto;
}

/* ═══════════════════════════════════════════
   SEARCH RESULTS
   ═══════════════════════════════════════════ */

.search-results {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--border);
  margin-bottom: 32px;
}

.search-result {
  background: var(--white);
  padding: 20px 28px;
  cursor: pointer;
  transition: background 0.15s;
}

.search-result:hover { background: var(--bg); }

.search-result h4 {
  font-size: 15px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 6px;
}

.search-result-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-result-snippet {
  font-size: 13px;
  font-weight: 300;
  line-height: 1.7;
  color: var(--text-secondary);
}

.search-result-snippet b {
  color: var(--navy);
  font-weight: 700;
  background: var(--blue-glow);
  padding: 0 2px;
}

/* ═══════════════════════════════════════════
   EMPTY / LOADING STATES
   ═══════════════════════════════════════════ */

.empty-state {
  text-align: center;
  padding: 80px 32px;
  color: var(--text-muted);
}

.empty-state h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 14px;
  font-weight: 300;
  max-width: 400px;
  margin: 0 auto;
}

.page-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 120px 0;
}

.loader {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border);
  border-top-color: var(--blue);
  animation: spin 0.6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Back-to-home button */
.btn-home {
  display: inline-block;
  margin-top: 16px;
  padding: 10px 24px;
  background: var(--blue);
  color: var(--white);
  border: none;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-home:hover { background: var(--blue-light); }

/* ═══════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════ */

@media (max-width: 768px) {
  .topbar-inner { padding: 0 16px; gap: 12px; }
  .topbar-title { display: none; }
  .topbar-search { max-width: none; }
  .topbar-user #user-name { display: none; }

  main { padding: 20px 16px; }

  .hero { padding: 24px 20px; }
  .hero-stats { gap: 24px; }
  .hero-stat-value { font-size: 28px; }

  .topic-grid { grid-template-columns: 1fr; }
  .topic-card { padding: 20px 24px; }

  .doc-detail-header { padding: 24px; }
  .doc-detail-body { padding: 24px; }

  .login-card { padding: 40px 28px 36px; }
  .login-title { font-size: 28px; }

  .provision-card { flex-direction: column; align-items: flex-start; }
}
