/* ==========================================================================
   ENDURANCE OS — Complete Stylesheet
   Brand: Endurance Taekwondo
   Design System: Inter (body), Playfair Display (headings)
   Palette: Gold (#EB9D45), Charcoal (#212121), Cream (#F5F2ED)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=Playfair+Display:wght@700;800;900&display=swap');

/* --- CSS Custom Properties — Endurance Design System --- */
:root {
  /* Core palette */
  --charcoal: #212121;
  --gold: #EB9D45;
  --gold-light: #F4C97B;
  --gold-dark: #C47E2A;
  --gold-dim: rgba(235, 157, 69, 0.10);
  --gold-border: rgba(235, 157, 69, 0.20);

  /* Backgrounds */
  --bg: #F5F2ED;
  --surface: #FFFFFF;
  --accent-bg: #FAF8F5;

  /* Text */
  --text: #2D2D2D;
  --text-secondary: #5A5A5A;
  --text-dim: #8A8A8A;

  /* Borders */
  --border: #E0DCD6;
  --border-light: #EDE9E3;

  /* Status */
  --success: #4A7C59;
  --amber: #D4880F;
  --blue: #3A6FA8;
  --red-alert: #C0392B;

  /* Sidebar — dark charcoal */
  --sidebar-bg: #1C1C1C;
  --sidebar-text: #B0ACA6;
  --sidebar-hover: #2A2723;
  --sidebar-active: #EB9D45;
  --sidebar-border: rgba(235, 157, 69, 0.12);

  /* Typography */
  --font-heading: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Layout */
  --sidebar-width: 280px;
  --topbar-height: 56px;
  --transition: 200ms ease;
  --radius: 10px;
  --radius-sm: 6px;

  /* Shadows — warm-toned */
  --shadow-sm: 0 1px 3px rgba(33, 33, 33, 0.06);
  --shadow-md: 0 4px 16px rgba(33, 33, 33, 0.08);
  --shadow-lg: 0 8px 32px rgba(33, 33, 33, 0.12);
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; font-size: 16px; }

body {
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* --- Dark Mode --- */
body.dark-mode {
  --bg: #121212;
  --surface: #1E1E1E;
  --accent-bg: #1A1A1A;
  --text: #E0E0E0;
  --text-secondary: #AAAAAA;
  --text-dim: #777777;
  --border: #333333;
  --border-light: #2A2A2A;
  --charcoal: #FFFFFF;
  --sidebar-bg: #0D0D0D;
  background: #121212;
  color: #e0e0e0;
}

body.dark-mode .topbar { background: #1e1e1e; border-color: #333; }
body.dark-mode .content-area { background: #161616; }
body.dark-mode .search-input { background: #2a2a2a; color: #e0e0e0; border-color: #444; }
body.dark-mode .search-results { background: #1e1e1e; border-color: #333; }
body.dark-mode .search-result-item:hover { background: #2a2a2a; }
body.dark-mode .feedback-panel { background: #1e1e1e; border-color: #333; }
body.dark-mode input, body.dark-mode textarea, body.dark-mode select {
  background: #2a2a2a; color: #e0e0e0; border-color: #444;
}
body.dark-mode .stat-card { background: #1e1e1e; }
body.dark-mode .section-card { background: #1e1e1e; }
body.dark-mode .section-card-title { color: #fff; }
body.dark-mode .dashboard-header h1 { color: #fff; }
body.dark-mode .progress-bar { background: #333; }
body.dark-mode .doc-nav-btn { background: #2a2a2a; color: #ccc; border-color: #444; }
body.dark-mode .feedback-item { background: #1e1e1e; }
body.dark-mode .document-content { background: #1e1e1e; color: #e0e0e0; }
body.dark-mode .document-content h1,
body.dark-mode .document-content h2,
body.dark-mode .document-content h3,
body.dark-mode .document-content h4,
body.dark-mode .document-content strong { color: #fff; }
body.dark-mode .document-content table th { background: #333; }
body.dark-mode .document-content table td { border-color: #444; }
body.dark-mode .document-header h1 { color: #fff; }
body.dark-mode .feedback-dashboard h1,
body.dark-mode .feedback-dashboard h2 { color: #fff; }

/* ==========================================================================
   LOGIN PAGE
   ========================================================================== */

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 20px;
  position: relative;
}

/* Subtle pattern overlay */
.login-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(235, 157, 69, 0.06) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(235, 157, 69, 0.04) 0%, transparent 50%);
  pointer-events: none;
}

.login-container {
  text-align: center;
  max-width: 520px;
  width: 100%;
  position: relative;
  z-index: 1;
}

.login-logo {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  margin-bottom: 28px;
  filter: drop-shadow(0 4px 16px rgba(235, 157, 69, 0.25));
  background: #fff;
  object-fit: cover;
}

.login-title {
  font-family: var(--font-heading);
  font-size: 2.8rem;
  font-weight: 800;
  color: var(--charcoal);
  line-height: 1.2;
  margin-bottom: 8px;
}

.login-subtitle {
  color: var(--text-secondary);
  font-size: 0.95rem;
  font-weight: 400;
  margin-bottom: 8px;
}

/* Gold rule under subtitle */
.login-container .login-subtitle::after {
  content: '';
  display: block;
  width: 60px;
  height: 3px;
  background: var(--gold);
  border-radius: 2px;
  margin: 20px auto 40px;
}

.portal-buttons {
  display: flex;
  gap: 20px;
  justify-content: center;
  flex-wrap: wrap;
}

.portal-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 32px 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  cursor: pointer;
  transition: all var(--transition);
  min-width: 150px;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
}

.portal-btn:hover {
  border-color: var(--gold);
  transform: translateY(-4px);
  box-shadow: 0 8px 32px rgba(235, 157, 69, 0.15);
}

.portal-btn-icon {
  font-size: 2.2rem;
}

.portal-btn-label {
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--charcoal);
}

/* --- Password Modal --- */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(33, 33, 33, 0.6);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(6px);
}

.modal-overlay.active { display: flex; }

.modal {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 40px;
  width: 90%;
  max-width: 400px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  animation: modalIn 200ms ease;
  border-top: 3px solid var(--gold);
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal h2 {
  font-family: var(--font-heading);
  font-weight: 800;
  color: var(--charcoal);
  margin-bottom: 8px;
  font-size: 1.5rem;
}

.modal p { color: var(--text-secondary); margin-bottom: 24px; font-size: 0.9rem; }

.modal-input {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--accent-bg);
  color: var(--text);
  font-size: 1rem;
  font-family: var(--font-body);
  outline: none;
  transition: border-color var(--transition);
}

.modal-input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-dim); }

.modal-input.shake {
  animation: shake 400ms ease;
  border-color: var(--red-alert);
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}

.modal-error {
  color: var(--red-alert);
  font-size: 0.85rem;
  margin-top: 8px;
  min-height: 20px;
}

.modal-submit {
  width: 100%;
  padding: 14px;
  margin-top: 16px;
  background: var(--charcoal);
  color: var(--gold);
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  cursor: pointer;
  transition: all var(--transition);
}

.modal-submit:hover { background: #333; }

.modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1.5rem;
  cursor: pointer;
  transition: color var(--transition);
}
.modal-close:hover { color: var(--text); }

/* ==========================================================================
   PORTAL LAYOUT
   ========================================================================== */

.portal-layout {
  display: flex;
  min-height: 100vh;
}

/* --- Sidebar --- */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  overflow-y: auto;
  transition: transform var(--transition);
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--sidebar-border);
}

.sidebar-logo {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: #fff;
  box-shadow: 0 0 0 2px rgba(235, 157, 69, 0.2);
}

.sidebar-brand { display: flex; flex-direction: column; }
.sidebar-brand-name {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 800;
  color: #FFFFFF;
  line-height: 1.2;
}
.sidebar-brand-portal {
  font-size: 0.65rem;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 2px;
  font-weight: 600;
  margin-top: 2px;
}

.sidebar-nav {
  padding: 8px 0;
  flex: 1;
  overflow-y: auto;
}

.sidebar-section {
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.sidebar-section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 20px;
  cursor: pointer;
  transition: background var(--transition);
  user-select: none;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--sidebar-text);
}

.sidebar-section-header:hover { background: var(--sidebar-hover); }
.sidebar-section-header.active { color: var(--gold); }

.sidebar-section-icon { font-size: 1rem; flex-shrink: 0; }
.sidebar-section-title { flex: 1; }

.sidebar-section-arrow {
  font-size: 0.7rem;
  transition: transform var(--transition);
  color: #555;
}

.sidebar-section.expanded .sidebar-section-arrow { transform: rotate(90deg); color: var(--gold); }

.sidebar-doc-list {
  max-height: 0;
  overflow: hidden;
  transition: max-height 300ms ease;
  background: rgba(0, 0, 0, 0.15);
}

.sidebar-section.expanded .sidebar-doc-list { max-height: 2000px; }

.sidebar-doc-link {
  display: block;
  padding: 7px 20px 7px 48px;
  color: #888;
  font-size: 0.78rem;
  text-decoration: none;
  transition: all var(--transition);
  cursor: pointer;
  border-left: 2px solid transparent;
}

.sidebar-doc-link:hover {
  color: #ddd;
  background: rgba(255, 255, 255, 0.03);
}

.sidebar-doc-link.active {
  color: var(--gold);
  border-left-color: var(--gold);
  background: rgba(235, 157, 69, 0.06);
  font-weight: 500;
}

/* --- Sidebar Search --- */
.sidebar-search { padding: 12px 16px; }
.sidebar-search .search-container { max-width: none; }
.sidebar-search .search-input {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #ccc;
  padding: 9px 14px;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  width: 100%;
  outline: none;
  transition: all var(--transition);
}
.sidebar-search .search-input::placeholder { color: #666; }
.sidebar-search .search-input:focus {
  border-color: var(--gold);
  background: rgba(255, 255, 255, 0.09);
  box-shadow: none;
}
.sidebar-search .search-results {
  background: #2A2723;
  border-color: rgba(235, 157, 69, 0.15);
  border-radius: var(--radius-sm);
}
.sidebar-search .search-result-item { border-color: rgba(255, 255, 255, 0.05); }
.sidebar-search .search-result-item:hover { background: rgba(235, 157, 69, 0.08); }
.sidebar-search .search-result-title { color: #fff; }
.sidebar-search .search-no-results { color: #888; }

/* --- Sidebar Progress --- */
.sidebar-progress {
  padding: 12px 20px;
  border-bottom: 1px solid var(--sidebar-border);
}

.sidebar-progress-label {
  font-size: 0.65rem;
  color: #666;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-weight: 500;
}

.progress-bar {
  height: 3px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--gold);
  border-radius: 2px;
  transition: width 500ms ease;
}

/* --- Sidebar Footer --- */
.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--sidebar-border);
  display: flex;
  gap: 8px;
  justify-content: center;
  background: var(--sidebar-bg);
  flex-shrink: 0;
}
.sidebar-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  cursor: pointer;
  font-size: 0.95rem;
  transition: all var(--transition);
  color: #999;
}
.sidebar-btn:hover {
  background: rgba(235, 157, 69, 0.1);
  border-color: var(--gold-border);
  color: var(--gold);
}

/* --- Main Content Area --- */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* --- Top Bar --- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--topbar-height);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
}

.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text);
  padding: 4px;
}

.hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text);
  margin: 4px 0;
  border-radius: 2px;
  transition: all var(--transition);
}

.topbar-title {
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  letter-spacing: 0.3px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.topbar-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  color: var(--text-dim);
  padding: 6px;
  border-radius: 50%;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.topbar-btn:hover { background: var(--accent-bg); color: var(--text); }

/* --- Search (in topbar if needed) --- */
.search-container {
  flex: 1;
  max-width: 500px;
  position: relative;
}

.search-input {
  width: 100%;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 0.85rem;
  font-family: var(--font-body);
  outline: none;
  background: var(--accent-bg);
  transition: all var(--transition);
  color: var(--text);
}

.search-input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-dim); }

.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  max-height: 400px;
  overflow-y: auto;
  display: none;
  z-index: 60;
  margin-top: 4px;
}

.search-results.active { display: block; }

.search-result-item {
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-light);
  transition: background var(--transition);
}

.search-result-item:hover { background: var(--accent-bg); }
.search-result-item:last-child { border-bottom: none; }

.search-result-title {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--charcoal);
}

.search-result-section {
  font-size: 0.7rem;
  color: var(--gold);
  font-weight: 600;
  letter-spacing: 0.5px;
  margin-top: 2px;
}

.search-result-preview {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 4px;
  line-height: 1.4;
}
.search-result-preview mark,
.search-result-title mark {
  background: var(--gold-dim);
  color: inherit;
  padding: 1px 3px;
  border-radius: 2px;
}
.search-no-results {
  padding: 16px;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.85rem;
}

/* --- Content Area --- */
.content-area {
  padding: 28px;
  flex: 1;
}

/* ==========================================================================
   DOCUMENT VIEW
   ========================================================================== */

.document-view { max-width: 900px; }

.document-breadcrumb {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-bottom: 20px;
  font-weight: 400;
}
.document-breadcrumb a {
  color: var(--gold-dark);
  text-decoration: none;
  font-weight: 500;
}
.document-breadcrumb a:hover { text-decoration: underline; color: var(--gold); }
.breadcrumb-sep { margin: 0 8px; color: var(--border); }

/* --- Iframe-based document rendering --- */
.document-frame-container {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  min-height: 400px;
  border: 1px solid var(--border-light);
}
.document-frame {
  width: 100%;
  min-height: 400px;
  border: none;
  display: block;
  background: #fff;
}

/* --- Document nav (prev/next) --- */
.document-nav {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--border-light);
  flex-wrap: wrap;
}

.doc-nav-btn {
  display: inline-block;
  padding: 10px 20px;
  background: var(--surface);
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  cursor: pointer;
  transition: all var(--transition);
  border: 1px solid var(--border);
  font-weight: 500;
}
.doc-nav-btn:hover {
  border-color: var(--gold);
  color: var(--gold-dark);
  background: var(--accent-bg);
}
.doc-nav-btn.next { margin-left: auto; }

/* --- Back to top --- */
.back-to-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 42px;
  height: 42px;
  background: var(--charcoal);
  color: var(--gold);
  border: none;
  border-radius: 50%;
  font-size: 1.1rem;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 40;
  transition: all var(--transition);
}

.back-to-top.visible { display: flex; }
.back-to-top:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }

/* ==========================================================================
   DASHBOARD
   ========================================================================== */

.dashboard { max-width: 1000px; }

.dashboard-header {
  margin-bottom: 32px;
}
.dashboard-header h1 {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 800;
  color: var(--charcoal);
  line-height: 1.2;
  margin-bottom: 6px;
}
.dashboard-header p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* Gold rule after header */
.dashboard-header::after {
  content: '';
  display: block;
  width: 60px;
  height: 3px;
  background: var(--gold);
  border-radius: 2px;
  margin-top: 16px;
}

.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 36px;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 22px 20px;
  text-align: center;
  border: 1px solid var(--border-light);
  transition: all var(--transition);
}
.stat-card:hover {
  border-color: var(--gold-border);
  box-shadow: var(--shadow-sm);
}

.stat-number {
  font-family: var(--font-heading);
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--gold);
  line-height: 1;
}

.stat-label {
  font-size: 0.72rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-top: 6px;
  font-weight: 500;
}

.dashboard-sections h2 {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 800;
  margin-bottom: 16px;
  color: var(--charcoal);
}

.section-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.section-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px;
  cursor: pointer;
  transition: all var(--transition);
  border: 1px solid var(--border-light);
}
.section-card:hover {
  border-color: var(--gold);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.section-card-icon { font-size: 1.8rem; margin-bottom: 10px; }
.section-card-title {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--charcoal);
  margin-bottom: 6px;
  line-height: 1.3;
}
.section-card-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 10px;
  line-height: 1.5;
}
.section-card-count {
  display: inline-block;
  padding: 3px 10px;
  background: var(--gold-dim);
  color: var(--gold-dark);
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  border-radius: 20px;
}

/* ==========================================================================
   FEEDBACK PANEL (slide-over)
   ========================================================================== */

.feedback-panel {
  position: fixed;
  top: 0;
  right: -400px;
  width: 380px;
  height: 100vh;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  transition: right 300ms ease;
  overflow-y: auto;
  border-left: 3px solid var(--gold);
  margin-top: 0;
  border-radius: 0;
}
.feedback-panel.active { right: 0; }

.feedback-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid var(--border);
}
.feedback-panel-header h3 {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--charcoal);
}
.feedback-panel-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-dim);
  transition: color var(--transition);
}
.feedback-panel-close:hover { color: var(--text); }

.feedback-panel form,
.feedback-panel .feedback-success { padding: 20px; }

.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  margin-bottom: 5px;
  color: var(--text);
  letter-spacing: 0.3px;
}
.form-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.85rem;
  outline: none;
  transition: border-color var(--transition);
  color: var(--text);
  background: var(--accent-bg);
}
.form-input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-dim); }
.form-textarea { min-height: 80px; resize: vertical; }

.rating-group { display: flex; flex-direction: column; gap: 4px; }
.rating-option { font-size: 0.85rem; cursor: pointer; padding: 4px 0; }
.rating-option input { margin-right: 8px; }

.btn {
  padding: 10px 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-weight: 600;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-size: 0.8rem;
  transition: all var(--transition);
}
.btn-primary { background: var(--charcoal); color: var(--gold); }
.btn-primary:hover { background: #333; }
.btn-secondary { background: var(--accent-bg); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--gold); }
.btn-danger { background: var(--red-alert); color: #fff; }
.btn-danger:hover { background: #a93226; }

.feedback-success {
  text-align: center;
  padding: 40px 20px;
}
.feedback-success-icon {
  width: 60px;
  height: 60px;
  background: var(--success);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin: 0 auto 16px;
}

/* ==========================================================================
   FEEDBACK DASHBOARD
   ========================================================================== */

.feedback-dashboard { max-width: 900px; }
.feedback-dashboard h1 {
  font-family: var(--font-heading);
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--charcoal);
  margin-bottom: 24px;
}
.feedback-dashboard h2 {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 800;
  margin-bottom: 16px;
  color: var(--charcoal);
}

.feedback-list { margin-top: 24px; }
.feedback-item {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px 20px;
  border: 1px solid var(--border-light);
  margin-bottom: 12px;
}
.feedback-item-header { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; }
.feedback-item-type {
  display: inline-block;
  padding: 2px 10px;
  background: var(--gold-dim);
  color: var(--gold-dark);
  border-radius: 20px;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.feedback-item-date { font-size: 0.75rem; color: var(--text-dim); }
.feedback-item-rating { font-size: 0.75rem; }
.feedback-item-doc { font-size: 0.8rem; font-weight: 600; color: var(--charcoal); }
.feedback-item-message { font-size: 0.85rem; color: var(--text-secondary); margin-top: 4px; line-height: 1.6; }

.feedback-actions { margin-top: 24px; display: flex; gap: 12px; }
.no-feedback { color: var(--text-dim); font-style: italic; }

.feedback-filters { display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.feedback-filters select {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-family: var(--font-body);
}

.status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
}
.status-new { background: rgba(58, 111, 168, 0.1); color: var(--blue); }
.status-in-review { background: rgba(212, 136, 15, 0.1); color: var(--amber); }
.status-resolved { background: rgba(74, 124, 89, 0.1); color: var(--success); }

/* ==========================================================================
   PRINT
   ========================================================================== */

@media print {
  .sidebar, .topbar, .feedback-panel, .back-to-top, .document-breadcrumb,
  .document-nav { display: none !important; }
  .main-content { margin-left: 0 !important; }
  .document-frame-container { box-shadow: none; border: none; }
  body { background: #fff; }
  .content-area { padding: 0; }
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

@media (max-width: 1024px) {
  .dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }

  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(33, 33, 33, 0.5);
    z-index: 99;
    backdrop-filter: blur(2px);
  }
  .sidebar-overlay.active { display: block; }

  .main-content { margin-left: 0; }
  .hamburger { display: block; }
  .content-area { padding: 16px; }

  .portal-buttons { flex-direction: column; align-items: center; }
  .dashboard-stats { grid-template-columns: 1fr 1fr; }
  .section-grid { grid-template-columns: 1fr; }
}

@media (max-width: 375px) {
  .login-title { font-size: 2rem; }
  .dashboard-stats { grid-template-columns: 1fr; }
  .content-area { padding: 12px; }
}

/* --- Loading Skeleton --- */
.loading-skeleton { padding: 40px; }
.skeleton-line {
  height: 14px;
  background: linear-gradient(90deg, var(--border-light) 25%, var(--border) 50%, var(--border-light) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
  margin-bottom: 12px;
}
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* --- Error State --- */
.error-state {
  text-align: center;
  padding: 60px 20px;
}
.error-icon { font-size: 3rem; margin-bottom: 16px; }
.error-state h2 {
  font-family: var(--font-heading);
  font-weight: 800;
  color: var(--charcoal);
  margin-bottom: 8px;
}
.error-state p { color: var(--text-secondary); }

/* --- Scrollbar styling --- */
::-webkit-scrollbar { width: 7px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }
.sidebar::-webkit-scrollbar-thumb { background: #444; }
.sidebar::-webkit-scrollbar-thumb:hover { background: #666; }

/* --- Fallback document content (non-iframe) --- */
.document-content {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 40px;
  line-height: 1.7;
  border: 1px solid var(--border-light);
}
.document-content h1,
.document-content h2,
.document-content h3,
.document-content h4 {
  font-family: var(--font-heading);
  color: var(--charcoal);
  font-weight: 800;
}
.document-content h1 { font-size: 1.8rem; margin: 24px 0 12px; }
.document-content h2 {
  font-size: 1.3rem; margin: 32px 0 12px;
  padding-bottom: 8px; border-bottom: 2px solid var(--gold);
}
.document-content h3 { font-size: 1.1rem; margin: 24px 0 8px; }
.document-content h4 { font-size: 1rem; margin: 20px 0 6px; }
.document-content p { margin-bottom: 12px; color: var(--text-secondary); }
.document-content ul, .document-content ol { margin: 8px 0 16px 24px; color: var(--text-secondary); }
.document-content li { margin-bottom: 6px; }
.document-content strong { color: var(--charcoal); }
.document-content table { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: 0.85rem; }
.document-content table th {
  background: var(--charcoal); color: #fff;
  padding: 10px 14px; text-align: left;
  font-family: var(--font-body); font-weight: 600; font-size: 0.78rem;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.document-content table td { padding: 10px 14px; border-bottom: 1px solid var(--border); }
.document-content table tr:hover td { background: var(--gold-dim); }
.document-content input[type="checkbox"] {
  accent-color: var(--gold); width: 16px; height: 16px; margin-right: 8px; cursor: pointer;
}

/* --- Doc content (legacy) --- */
.doc-content {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 40px;
  box-shadow: var(--shadow-sm);
  max-width: 900px;
  line-height: 1.7;
}
