* { box-sizing: border-box; }

:root {
  --touchstone-green: #16833b;
  --touchstone-green-dark: #0f5f2b;
  --touchstone-navy: #102a43;
  --touchstone-navy-dark: #0b1f33;
  --touchstone-brown: #5b3a1f;
  --border: #d9e2ec;
  --muted: #64748b;
}

body {
  margin: 0;
  background: #eef2f7;
  color: #1f2937;
  font-family: Arial, Helvetica, sans-serif;
}

a { color: #0f4c81; }

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 290px 1fr;
}

.sidebar {
  background: linear-gradient(180deg, var(--touchstone-navy) 0%, var(--touchstone-navy-dark) 100%);
  color: white;
  padding: 20px 16px;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 22px;
}

.logo-brand {
  display: block;
  text-align: center;
}

.logo-brand img {
  max-width: 235px;
  width: 100%;
  height: auto;
  display: block;
  margin: 0 auto 10px;
}

.logo-brand h1 { font-size: 17px; margin: 0; }
.logo-brand p { color: #bbf7d0; margin: 4px 0 0; font-size: 13px; }

.nav-label {
  color: #9fb3c8;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: .08em;
  margin: 22px 0 8px;
}

.nav a {
  display: block;
  color: white;
  text-decoration: none;
  padding: 11px 12px;
  border-radius: 8px;
  margin-bottom: 6px;
}

.nav a:hover { background: rgba(22,131,59,.35); }
.nav a.disabled { opacity: .45; cursor: not-allowed; }
.mobile-nav-toggle { display: none; }

.main { padding: 26px; min-width: 0; }

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  margin-bottom: 22px;
}

.topbar h2 { margin: 0 0 4px; font-size: 28px; }
.topbar h2::after {
  content: "";
  display: block;
  width: 72px;
  height: 4px;
  background: var(--touchstone-green);
  border-radius: 999px;
  margin-top: 8px;
}
.topbar p { margin: 0; color: var(--muted); }

.container {
  background: white;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 5px 20px rgba(15,23,42,.08);
}

.card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 14px;
}

.card h3, .card h4 { margin-top: 0; }

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 22px;
}

.stat {
  background: #f8fafc;
  border: 1px solid #dbeafe;
  border-radius: 14px;
  padding: 16px;
}
.stat strong { display: block; font-size: 28px; }
.stat span { color: var(--muted); }

.library-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 22px;
}
.section-list { border-right: 1px solid var(--border); padding-right: 18px; }

.policy-list a {
  display: block;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--touchstone-navy);
  text-decoration: none;
}
.policy-list a:hover { background: #f0f7ff; }

.policy-title-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.badge {
  display: inline-block;
  background: #dcfce7;
  color: #166534;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  margin: 2px 4px 2px 0;
}
.badge.gray { background: #e5e7eb; color: #374151; }
.badge.green { background: #dcfce7; color: #166534; }
.badge.orange { background: #ffedd5; color: #9a3412; }

input, select, textarea {
  width: 100%;
  padding: 11px;
  margin: 6px 0 16px;
  border: 1px solid #bcccdc;
  border-radius: 9px;
  font-size: 15px;
}

.short-textarea { min-height: 90px; }
label { font-weight: bold; }
.checkbox-label { display: flex; gap: 8px; align-items: center; margin: 10px 0 18px; }
.checkbox-label input { width: auto; margin: 0; }

button, .button {
  display: inline-block;
  background: var(--touchstone-green);
  color: white;
  padding: 10px 15px;
  border: 0;
  border-radius: 9px;
  text-decoration: none;
  cursor: pointer;
  font-size: 15px;
}
.button.secondary, button.secondary { background: #64748b; }
.button.danger, button.danger { background: #b91c1c; }
button:disabled { opacity: .45; cursor: not-allowed; }

.actions {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
  margin: 16px 0;
}

.document-page, .public-document {
  max-width: 900px;
  margin: 0 auto;
  background: white;
}

.document-logo {
  text-align: center;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 3px solid var(--touchstone-green);
}
.document-logo img {
  max-width: 430px;
  width: 82%;
  height: auto;
}

.document-page h1, .public-document h1 {
  text-align: center;
  text-transform: uppercase;
  letter-spacing: .02em;
}

.document-meta { color: var(--muted); margin-bottom: 20px; text-align: center; }

.policy-body {
  line-height: 1.7;
  font-size: 16px;
}
.policy-body h1, .policy-body h2, .policy-body h3 { color: var(--touchstone-navy); margin-top: 1.2em; }
.policy-body table { border-collapse: collapse; width: 100%; margin: 16px 0; }
.policy-body table, .policy-body th, .policy-body td { border: 1px solid #94a3b8; }
.policy-body th, .policy-body td { padding: 9px; }

.document-footer {
  margin-top: 42px;
  padding-top: 12px;
  border-top: 1px solid #94a3b8;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}
.login-box { width: 100%; max-width: 440px; }
.login-logo { text-align: center; margin-bottom: 22px; }
.login-logo img { max-width: 360px; width: 100%; height: auto; display: block; margin: 0 auto 10px; }
.login-logo h1 { margin: 0; color: var(--touchstone-navy); font-size: 24px; }
.login-logo p { margin: 5px 0 0; color: var(--muted); }

.alert, .success {
  padding: 12px 14px;
  border-radius: 10px;
  margin-bottom: 14px;
}
.alert { background: #fee2e2; color: #991b1b; }
.success { background: #dcfce7; color: #166534; }
.muted { color: var(--muted); font-weight: normal; }

.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { border-bottom: 1px solid var(--border); padding: 10px; text-align: left; }

.app-version {
  color: #94a3b8;
  font-size: 12px;
  text-align: right;
  padding: 18px 2px 0;
}

.tox.tox-tinymce {
  border-radius: 12px;
  border-color: #bcccdc;
  overflow: hidden;
}
.tox .tox-toolbar, .tox .tox-toolbar__primary, .tox .tox-toolbar__overflow {
  background: #f8fafc !important;
}

@media (max-width: 950px) {
  .app-shell { display: block; }
  .sidebar { position: sticky; top: 0; z-index: 1000; padding: 14px; }
  .logo-brand img { max-width: 180px; }
  .mobile-nav-toggle { display: block; width: 100%; background: #243b53; }
  .nav { display: none; margin-top: 10px; }
  .nav.open { display: block; }
  .nav-label { display: none; }
  .main { padding: 14px; }
  .topbar { display: block; }
  .topbar h2 { font-size: 23px; }
  .container { padding: 16px; border-radius: 12px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .library-grid { grid-template-columns: 1fr; }
  .section-list { border-right: 0; border-bottom: 1px solid var(--border); padding-right: 0; padding-bottom: 14px; }
  .actions { display: block; }
  .actions .button, .actions button { width: 100%; margin-bottom: 8px; text-align: center; }
  input, select, textarea { font-size: 16px; }
  .policy-body table { display: block; overflow-x: auto; white-space: nowrap; }
}

@media (max-width: 540px) {
  .stats { grid-template-columns: 1fr; }
  .main { padding: 10px; }
  .container { padding: 12px; }
  .card { padding: 12px; }
  .document-logo img { width: 95%; }
  .login-logo img { max-width: 240px; }
  .policy-title-row { display: block; }
}

@media print {
  .sidebar, .topbar, .actions, .no-print, .app-version { display: none !important; }
  .app-shell { display: block; }
  .main { padding: 0; }
  .container { box-shadow: none; border-radius: 0; padding: 0; }
  body { background: white; }
  .document-logo { border-bottom: 3px solid var(--touchstone-green) !important; }
  .document-logo img { max-width: 380px; }
  .document-footer { display: block !important; }
  .document-page, .public-document { padding-bottom: 48px; }
}
