/* ===================== Design tokens ===================== */
/* Palette sampled directly from the Revival Technologies & Academy logo:
   forest green badge, muted sage-green accents, near-black wordmark. */
:root {
  --color-primary: #225D31;        /* forest green - sampled from logo badge */
  --color-primary-light: #2F7A41;  /* lighter green - sampled from logo badge */
  --color-primary-dark: #163D21;   /* darkest green - for sidebar/hero backgrounds */
  --color-sage: #6E9171;           /* muted sage green - sampled from logo, for soft accents */
  --color-accent: #D98C3D;         /* warm gold - complements the logo's green, used for CTAs/highlights */
  --color-accent-light: #E8AD6E;
  --color-ink: #1B1B1B;            /* near-black - matches the logo's "revival" wordmark */
  --color-ink-soft: #4B5A4E;
  --color-bg: #F6F5F1;             /* warm neutral background */
  --color-surface: #FFFFFF;
  --color-border: #E1E4DD;
  --color-success: #2F7A41;
  --color-success-bg: #E7F2E9;
  --color-warning: #C97A1A;
  --color-warning-bg: #FBEBD8;
  --color-danger: #B3413A;
  --color-danger-bg: #FBE7E5;
  --color-info: #3B6FA0;
  --color-info-bg: #E7EFF7;

  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(22, 61, 33, 0.08);
  --shadow-md: 0 8px 24px rgba(22, 61, 33, 0.12);
}

* { box-sizing: border-box; }

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

button, input, textarea, select { font-family: inherit; }

a { color: var(--color-primary); }

::selection { background: var(--color-accent-light); color: var(--color-ink); }

/* The hidden attribute must always win, even on elements (like .login-screen
   and .app-shell) that set their own `display: grid` via a class. Without
   this, toggling `.hidden = true/false` in JS has no visible effect, since
   the class's explicit display value takes precedence over the browser's
   default [hidden] behavior at equal specificity. */
[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* ===================== Buttons ===================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.05s ease, background 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-primary-light); }
.btn-secondary { background: var(--color-surface); color: var(--color-primary); border-color: var(--color-primary); }
.btn-secondary:hover { background: var(--color-info-bg); }
.btn-ghost { background: transparent; color: var(--color-ink-soft); border-color: var(--color-border); }
.btn-ghost:hover { background: var(--color-border); }
.btn-danger { background: var(--color-danger); color: #fff; }
.btn-danger:hover { opacity: 0.9; }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ===================== Login screen ===================== */
.login-screen {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100vh;
}
.login-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 64px 96px;
  max-width: 560px;
}
.login-brand {
  margin-bottom: 8px;
}
.login-logo-full {
  height: 52px;
  width: auto;
  display: block;
}
.login-product-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 12.5px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--color-ink-soft);
  margin: 14px 0 44px;
}
.login-panel h1 {
  font-family: var(--font-display);
  font-size: 38px;
  font-weight: 600;
  line-height: 1.15;
  margin: 0 0 12px;
}
.login-copy { color: var(--color-ink-soft); margin: 0 0 32px; font-size: 15px; }
.login-form { display: flex; flex-direction: column; gap: 18px; }
.login-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-ink-soft);
}
.login-form input {
  padding: 12px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  background: var(--color-surface);
}
.login-form input:focus { border-color: var(--color-primary); outline: none; }
.form-error {
  background: var(--color-danger-bg);
  color: var(--color-danger);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
}
.login-hint {
  margin-top: 36px;
  font-size: 12.5px;
  color: var(--color-ink-soft);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
}
.login-hint ul { margin: 8px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.login-hint code { background: var(--color-border); padding: 1px 6px; border-radius: 4px; font-family: var(--font-mono); }

.login-side {
  background: linear-gradient(160deg, var(--color-primary-dark), var(--color-primary) 60%, var(--color-accent) 160%);
  display: flex;
  align-items: flex-end;
  padding: 64px;
  position: relative;
  overflow: hidden;
}
.login-side::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 80% 15%, rgba(232,135,58,0.35), transparent 45%),
    radial-gradient(circle at 15% 85%, rgba(255,255,255,0.08), transparent 40%);
}
.login-side-quote {
  position: relative;
  color: #F6F5F1;
  font-family: var(--font-display);
  font-size: 26px;
  line-height: 1.4;
  max-width: 420px;
}

/* ===================== App shell ===================== */
.app-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--color-primary-dark);
  color: #F6F5F1;
  display: flex;
  flex-direction: column;
  padding: 22px 16px;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px 24px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 17px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
  margin-bottom: 16px;
}
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: transparent;
  border: none;
  color: rgba(246,245,241,0.75);
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.nav-icon { font-size: 15px; width: 18px; text-align: center; }
.nav-item:hover { background: rgba(255,255,255,0.08); color: #fff; }
.nav-item.active { background: var(--color-accent); color: var(--color-primary-dark); font-weight: 600; }

.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 8px 4px;
  font-size: 12px;
  color: rgba(246,245,241,0.6);
  border-top: 1px solid rgba(255,255,255,0.12);
}
.connection-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--color-danger); transition: background 0.2s; }
.connection-dot.online { background: #4CAF7D; }

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

.topbar {
  height: 68px;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 5;
}
.topbar-title { font-family: var(--font-display); font-size: 21px; font-weight: 600; }
.topbar-user { display: flex; align-items: center; gap: 16px; }
.topbar-user-info { text-align: right; }
.topbar-user-name { font-size: 13.5px; font-weight: 600; }
.topbar-user-role { font-size: 11.5px; color: var(--color-ink-soft); text-transform: uppercase; letter-spacing: 0.04em; }

.content { padding: 28px 32px 60px; flex: 1; }

.view { animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* ===================== Stat cards / dashboard ===================== */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}
.stat-card .stat-label { font-size: 12px; color: var(--color-ink-soft); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 8px; }
.stat-card .stat-value { font-family: var(--font-display); font-size: 30px; font-weight: 600; }
.stat-card.accent { border-color: var(--color-accent); background: linear-gradient(160deg, #fff, #FFF6EC); }

.dashboard-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 20px; }
@media (max-width: 980px) { .dashboard-grid { grid-template-columns: 1fr; } }

.panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.panel.span-2 { grid-column: span 2; }
.panel-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.panel-header h2 { font-family: var(--font-display); font-size: 17px; margin: 0; font-weight: 600; }

/* ===================== Tasks ===================== */
.view-toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; gap: 12px; flex-wrap: wrap; }
.view-subcopy { color: var(--color-ink-soft); font-size: 13.5px; margin: 0; }
.filter-group { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-ink-soft);
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.chip.active { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }

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

.task-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
  transition: box-shadow 0.15s ease, transform 0.1s ease;
}
.task-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }

.task-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.task-card-title { font-weight: 600; font-size: 14.5px; line-height: 1.35; }
.task-card-meta { font-size: 11.5px; color: var(--color-ink-soft); font-family: var(--font-mono); }
.task-card-desc { font-size: 13px; color: var(--color-ink-soft); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.task-card-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 4px; }

.progress-ring { position: relative; width: 42px; height: 42px; flex-shrink: 0; }
.progress-ring svg { transform: rotate(-90deg); }
.progress-ring-track { fill: none; stroke: var(--color-border); stroke-width: 4; }
.progress-ring-fill { fill: none; stroke: var(--color-accent); stroke-width: 4; stroke-linecap: round; transition: stroke-dashoffset 0.4s ease; }
.progress-ring-label { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 10.5px; font-weight: 700; font-family: var(--font-mono); }

.badge { padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.badge-status-not-started { background: var(--color-info-bg); color: var(--color-info); }
.badge-status-in-progress { background: var(--color-warning-bg); color: var(--color-warning); }
.badge-status-completed { background: var(--color-success-bg); color: var(--color-success); }
.badge-status-blocked { background: var(--color-danger-bg); color: var(--color-danger); }

.badge-priority-low { background: #EEF1EC; color: #587058; }
.badge-priority-medium { background: var(--color-info-bg); color: var(--color-info); }
.badge-priority-high { background: var(--color-warning-bg); color: var(--color-warning); }
.badge-priority-urgent { background: var(--color-danger-bg); color: var(--color-danger); }

.task-list { display: flex; flex-direction: column; gap: 10px; }
.task-list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  gap: 10px;
}
.task-list-row:hover { background: var(--color-bg); }
.task-list-row-title { font-size: 13.5px; font-weight: 500; }
.task-list-row-sub { font-size: 11.5px; color: var(--color-ink-soft); }

.empty-state { color: var(--color-ink-soft); font-size: 13.5px; padding: 20px; text-align: center; }

/* ===================== Documents ===================== */
.doc-table-wrap { overflow-x: auto; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); }
.doc-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.doc-table th {
  text-align: left;
  padding: 12px 16px;
  background: var(--color-bg);
  color: var(--color-ink-soft);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--color-border);
}
.doc-table td { padding: 12px 16px; border-bottom: 1px solid var(--color-border); vertical-align: middle; }
.doc-table tr:last-child td { border-bottom: none; }
.doc-file-name { font-weight: 600; }
.doc-file-meta { font-size: 11px; color: var(--color-ink-soft); font-family: var(--font-mono); }

/* ===================== Notice board ===================== */
.notice-board { display: flex; flex-direction: column; gap: 14px; }
.notice-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-primary);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}
.notice-card.pinned { border-left-color: var(--color-accent); background: linear-gradient(160deg, #fff, #FFF6EC); }
.notice-card-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.notice-card-title { font-family: var(--font-display); font-size: 16.5px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.notice-card-meta { font-size: 11.5px; color: var(--color-ink-soft); font-family: var(--font-mono); }
.notice-card-body { font-size: 13.5px; color: var(--color-ink-soft); line-height: 1.55; white-space: pre-wrap; }
.pin-flag { color: var(--color-accent); font-size: 13px; }

.notice-list { display: flex; flex-direction: column; gap: 10px; }
.notice-list-item { padding: 10px 12px; border: 1px solid var(--color-border); border-radius: var(--radius-sm); }
.notice-list-item-title { font-size: 13.5px; font-weight: 600; }
.notice-list-item-sub { font-size: 11.5px; color: var(--color-ink-soft); margin-top: 2px; }

/* ===================== Reports ===================== */
.report-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 980px) { .report-grid { grid-template-columns: 1fr; } }

/* ===================== Modal ===================== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(27,36,48,0.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 20px;
  animation: fadeIn 0.15s ease;
}
.modal {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  width: 100%; max-width: 560px;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: var(--shadow-md);
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px; border-bottom: 1px solid var(--color-border);
}
.modal-header h3 { font-family: var(--font-display); margin: 0; font-size: 19px; }
.modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--color-ink-soft); }
.modal-body { padding: 22px 24px; display: flex; flex-direction: column; gap: 16px; }
.modal-footer { padding: 16px 24px 22px; display: flex; justify-content: flex-end; gap: 10px; border-top: 1px solid var(--color-border); }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--color-ink-soft); }
.field input, .field select, .field textarea {
  padding: 10px 12px; border: 1px solid var(--color-border); border-radius: var(--radius-sm);
  font-size: 14px; background: var(--color-bg); font-family: inherit;
}
.field textarea { resize: vertical; min-height: 80px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.comment-list { display: flex; flex-direction: column; gap: 10px; max-height: 200px; overflow-y: auto; }
.comment-item { background: var(--color-bg); border-radius: var(--radius-sm); padding: 10px 12px; }
.comment-item-author { font-size: 12px; font-weight: 700; }
.comment-item-time { font-size: 10.5px; color: var(--color-ink-soft); font-family: var(--font-mono); margin-left: 6px; }
.comment-item-msg { font-size: 13px; margin-top: 3px; line-height: 1.5; }

.slider-row { display: flex; align-items: center; gap: 12px; }
.slider-row input[type="range"] { flex: 1; }
.slider-value { font-family: var(--font-mono); font-weight: 700; font-size: 13px; width: 42px; text-align: right; }

/* ===================== Programs ===================== */
.program-segment-panel {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  margin-bottom: 16px;
  background: var(--color-bg);
}
.program-segment-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.program-segment-title { font-family: var(--font-display); font-weight: 600; font-size: 15.5px; }
.program-segment-meta { font-size: 11.5px; color: var(--color-ink-soft); font-family: var(--font-mono); }

.checklist-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 4px;
  border-bottom: 1px solid var(--color-border);
}
.checklist-item:last-child { border-bottom: none; }
.checklist-item input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--color-primary); cursor: pointer; flex-shrink: 0; }
.checklist-item-name { flex: 1; font-size: 13.5px; font-weight: 500; }
.checklist-item-name.checked { text-decoration: line-through; color: var(--color-ink-soft); }
.checklist-item-deadline { font-size: 12px; }
.checklist-item-deadline input {
  padding: 5px 8px; border: 1px solid var(--color-border); border-radius: 5px; font-size: 12px; font-family: var(--font-mono);
  background: var(--color-surface);
}
.checklist-item-overdue { color: var(--color-danger); font-weight: 700; font-size: 11px; white-space: nowrap; }
.checklist-item-checkedby { font-size: 10.5px; color: var(--color-ink-soft); white-space: nowrap; }

.program-progress-chip {
  font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 999px;
  background: var(--color-info-bg); color: var(--color-info);
}
.program-progress-chip.complete { background: var(--color-success-bg); color: var(--color-success); }
.program-progress-chip.overdue { background: var(--color-danger-bg); color: var(--color-danger); }

.author-label {
  font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  padding: 1px 6px; border-radius: 4px; margin-left: 6px;
}
.author-label-monitor { background: var(--color-info-bg); color: var(--color-info); }
.author-label-program_admin { background: var(--color-success-bg); color: var(--color-success); }
.author-label-ceo, .author-label-admin { background: var(--color-warning-bg); color: var(--color-warning); }
.tag { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 10.5px; font-weight: 700; margin-right: 6px; }
.tag-ceo { background: var(--color-primary); color: #fff; }
.tag-admin { background: var(--color-accent); color: #fff; }
.tag-hod { background: var(--color-info-bg); color: var(--color-info); }
.tag-employee { background: #EEF1EC; color: #587058; }

/* ===================== Toasts ===================== */
.toast-root { position: fixed; bottom: 24px; right: 24px; display: flex; flex-direction: column; gap: 10px; z-index: 200; }
.toast {
  background: var(--color-ink); color: #fff; padding: 12px 18px; border-radius: var(--radius-sm);
  font-size: 13.5px; box-shadow: var(--shadow-md); animation: slideIn 0.2s ease;
  max-width: 320px;
}
.toast.success { background: var(--color-success); }
.toast.error { background: var(--color-danger); }
@keyframes slideIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }

/* ===================== Responsive ===================== */
@media (max-width: 860px) {
  .login-screen { grid-template-columns: 1fr; }
  .login-side { display: none; }
  .login-panel { padding: 40px 24px; }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; bottom: 0; left: 0; right: 0; top: auto; flex-direction: row; padding: 8px; z-index: 20; }
  .sidebar-brand, .sidebar-footer { display: none; }
  .sidebar-nav { flex-direction: row; overflow-x: auto; flex: 1; }
  .nav-item { flex-direction: column; font-size: 10px; gap: 3px; padding: 8px; }
  .main-area { padding-bottom: 70px; }
  .content { padding: 20px 16px 40px; }
  .field-row { grid-template-columns: 1fr; }
  .panel.span-2 { grid-column: span 1; }
}
