/* =========================================================
   Agenda Harian — Stylesheet
   Palet: teal tua (#2D5F5D) sebagai warna utama, amber (#E8A33D)
   sebagai aksen. Tanpa dependensi CDN — hanya system font stack.
   ========================================================= */

:root {
  --color-bg: #F3F6F5;
  --color-surface: #FFFFFF;
  --color-surface-alt: #EDF2F1;
  --color-primary: #2D5F5D;
  --color-primary-dark: #1D3F3E;
  --color-primary-light: #DCEAE8;
  --color-accent: #E8A33D;
  --color-accent-dark: #C87F1F;
  --color-text: #16211F;
  --color-text-muted: #5C6E6A;
  --color-border: #DFE6E4;
  --color-danger: #C64B3C;
  --color-danger-bg: #FBEAE7;
  --color-success: #3E8F63;
  --color-success-bg: #E7F4EC;
  --color-warning-bg: #FBF1DF;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(23, 35, 33, 0.06);
  --shadow-md: 0 8px 24px rgba(23, 35, 33, 0.08);
  --sidebar-w: 248px;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -0.01em; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; margin: 0; padding: 0; }
button { font-family: inherit; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 0.92rem; font-weight: 600; padding: 10px 18px;
  border-radius: var(--radius-sm); border: 1px solid transparent;
  cursor: pointer; transition: background-color .15s ease, border-color .15s ease, transform .05s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-primary-dark); }
.btn-secondary { background: var(--color-primary-light); color: var(--color-primary-dark); }
.btn-secondary:hover { background: #cfe4e1; }
.btn-ghost { background: transparent; color: var(--color-text); border-color: var(--color-border); }
.btn-ghost:hover { background: var(--color-surface-alt); }
.btn-danger { background: var(--color-danger); color: #fff; }
.btn-danger:hover { background: #a83c2f; }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 12px; font-size: 0.82rem; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: var(--radius-sm);
  border: 1px solid transparent; background: transparent; color: var(--color-text-muted);
  cursor: pointer; transition: background-color .15s ease, color .15s ease;
}
.icon-btn:hover { background: var(--color-surface-alt); color: var(--color-text); }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
label { font-size: 0.85rem; font-weight: 600; color: var(--color-text-muted); }
input[type="text"], input[type="email"], input[type="password"],
input[type="date"], input[type="time"], select, textarea {
  font-family: inherit; font-size: 0.95rem; color: var(--color-text);
  padding: 10px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--color-border); background: var(--color-surface);
  outline: none; transition: border-color .15s ease, box-shadow .15s ease;
  width: 100%;
}
textarea { resize: vertical; min-height: 72px; }
input:focus, select:focus, textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light);
}
.password-field { position: relative; display: flex; }
.password-field input { padding-right: 64px; }
.toggle-password {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  border: none; background: transparent; color: var(--color-primary);
  font-size: 0.8rem; font-weight: 600; cursor: pointer; padding: 6px 8px;
}

/* ---------- Alerts / toasts ---------- */
.alert {
  padding: 12px 14px; border-radius: var(--radius-sm); font-size: 0.88rem;
  margin-bottom: 16px; border: 1px solid transparent;
}
.alert-error { background: var(--color-danger-bg); color: #7a291d; border-color: #f0c9c2; }
.alert-success { background: var(--color-success-bg); color: #1f5c3c; border-color: #bfe2cd; }

.toast-stack {
  position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column;
  gap: 10px; z-index: 1000; max-width: min(340px, calc(100vw - 32px));
}
.toast {
  background: var(--color-primary-dark); color: #fff; padding: 12px 16px;
  border-radius: var(--radius-sm); box-shadow: var(--shadow-md); font-size: 0.88rem;
  animation: toast-in .2s ease-out;
}
.toast.toast-error { background: var(--color-danger); }
.toast.toast-success { background: var(--color-success); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* =========================================================
   Auth pages (login / register)
   ========================================================= */
.auth-body { background: var(--color-primary-dark); }
.auth-shell {
  min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr;
}
.auth-visual {
  background: linear-gradient(160deg, var(--color-primary-dark), var(--color-primary));
  display: flex; align-items: center; padding: 48px;
  position: relative; overflow: hidden;
}
.auth-visual::after {
  content: ""; position: absolute; width: 420px; height: 420px; border-radius: 50%;
  background: rgba(232, 163, 61, 0.14); right: -140px; bottom: -160px;
}
.auth-visual-inner { position: relative; max-width: 420px; color: #fff; }
.auth-visual-inner h2 { font-size: 2rem; margin-bottom: 14px; }
.auth-visual-inner p { color: rgba(255,255,255,0.82); font-size: 1.02rem; margin-bottom: 24px; }
.auth-points { display: flex; flex-direction: column; gap: 12px; }
.auth-points li {
  position: relative; padding-left: 26px; color: rgba(255,255,255,0.92); font-size: 0.95rem;
}
.auth-points li::before {
  content: ""; position: absolute; left: 0; top: 6px; width: 14px; height: 14px;
  border-radius: 50%; background: var(--color-accent);
}
.auth-form-wrap {
  background: var(--color-bg); display: flex; align-items: center; justify-content: center; padding: 32px;
}
.auth-form-card { width: 100%; max-width: 380px; }
.auth-form-head { text-align: left; margin-bottom: 22px; }
.auth-logo { border-radius: 10px; margin-bottom: 14px; }
.auth-form-head h1 { font-size: 1.5rem; margin-bottom: 6px; }
.auth-form-head p { color: var(--color-text-muted); font-size: 0.92rem; }
.auth-switch { margin-top: 18px; text-align: center; font-size: 0.9rem; color: var(--color-text-muted); }
.auth-switch a { color: var(--color-primary); font-weight: 600; }
.auth-hint { margin-top: 10px; text-align: center; font-size: 0.8rem; color: var(--color-text-muted); }
.auth-hint code { background: var(--color-surface-alt); padding: 2px 6px; border-radius: 4px; }

@media (max-width: 860px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-visual { display: none; }
}

/* =========================================================
   App shell (dashboard / agenda / rekap)
   ========================================================= */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w); flex-shrink: 0; background: var(--color-primary-dark);
  color: #fff; display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0; right: auto;
  z-index: 200; transition: transform .25s ease;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px; padding: 20px 20px 16px;
  font-weight: 700; font-size: 1.05rem;
}
.sidebar-brand img { border-radius: 8px; }
.brand-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.brand-name { color: #fff; line-height: 1.15; }
.version-badge {
  align-self: flex-start; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.01em;
  color: var(--color-primary-dark); background: var(--color-accent);
  padding: 1px 8px; border-radius: 999px; line-height: 1.5;
}
.sidebar-nav { display: flex; flex-direction: column; gap: 4px; padding: 8px 12px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.78); font-size: 0.93rem; font-weight: 600; transition: background-color .15s ease, color .15s ease;
}
.nav-item .nav-icon { display: inline-flex; opacity: 0.9; }
.nav-item:hover { background: rgba(255,255,255,0.08); color: #fff; }
.nav-item.active { background: var(--color-accent); color: var(--color-primary-dark); }
.nav-item.active .nav-icon { opacity: 1; }

.sidebar-foot { padding: 14px 16px 20px; border-top: 1px solid rgba(255,255,255,0.12); }
.user-chip { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.user-avatar {
  width: 36px; height: 36px; border-radius: 50%; background: var(--color-accent);
  color: var(--color-primary-dark); display: flex; align-items: center; justify-content: center;
  font-weight: 700; flex-shrink: 0;
}
.user-meta { display: flex; flex-direction: column; overflow: hidden; }
.user-meta strong { font-size: 0.88rem; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-meta small { color: rgba(255,255,255,0.6); font-size: 0.76rem; }
.logout-link {
  display: block; text-align: center; padding: 9px; border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.08); color: #fff; font-size: 0.85rem; font-weight: 600;
}
.logout-link:hover { background: rgba(255,255,255,0.16); }

.app-main { margin-left: var(--sidebar-w); flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; gap: 14px; padding: 16px 28px;
  background: var(--color-surface); border-bottom: 1px solid var(--color-border);
  position: sticky; top: 0; z-index: 100;
}
.sidebar-toggle { display: none; }
.topbar-title { font-size: 1.15rem; }
.topbar-spacer { flex: 1; }
.topbar-date { font-size: 0.86rem; color: var(--color-text-muted); font-weight: 600; }

.app-content { padding: 24px 28px 60px; max-width: 1080px; width: 100%; margin: 0 auto; }

.overlay {
  display: none; position: fixed; inset: 0; background: rgba(15, 26, 24, 0.45); z-index: 150;
}
.overlay.show { display: block; }

/* ---------- Stat cards ---------- */
.stat-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px;
}
.stat-card {
  background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-md);
  padding: 18px 20px; display: flex; flex-direction: column; gap: 4px; box-shadow: var(--shadow-sm);
}
.stat-card--primary { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.stat-card--primary .stat-label { color: rgba(255,255,255,0.78); }
.stat-card--primary .stat-foot { color: rgba(255,255,255,0.68); }
.stat-label { font-size: 0.82rem; color: var(--color-text-muted); font-weight: 600; }
.stat-value { font-size: 1.9rem; font-weight: 700; }
.stat-foot { font-size: 0.78rem; color: var(--color-text-muted); }
.stat-card--action {
  justify-content: space-between; background: var(--color-surface-alt); cursor: pointer;
}
.stat-value-icon { color: var(--color-primary); }

/* ---------- Panels ---------- */
.panel {
  background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg);
  padding: 22px 24px; margin-bottom: 22px; box-shadow: var(--shadow-sm);
}
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.panel-head h2 { font-size: 1.1rem; }
.panel-sub { font-size: 0.86rem; color: var(--color-text-muted); margin-top: 4px; }
.panel-actions { display: flex; gap: 10px; }

.empty-state {
  text-align: center; padding: 40px 20px; color: var(--color-text-muted);
  border: 1px dashed var(--color-border); border-radius: var(--radius-md);
}
.empty-state p { font-weight: 600; color: var(--color-text); margin-bottom: 4px; }
.empty-state span { font-size: 0.88rem; }

/* ---------- Timeline (dashboard & agenda) ---------- */
.timeline { display: flex; flex-direction: column; gap: 10px; }
.timeline-item {
  display: flex; gap: 16px; align-items: flex-start; padding: 14px 16px;
  border-radius: var(--radius-md); border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-border); background: var(--color-surface);
  transition: box-shadow .15s ease;
}
.timeline-item:hover { box-shadow: var(--shadow-sm); }
.timeline-item.prio-tinggi { border-left-color: var(--color-danger); }
.timeline-item.prio-sedang { border-left-color: var(--color-accent); }
.timeline-item.prio-rendah { border-left-color: var(--color-primary); }
.timeline-item.status-selesai { opacity: 0.68; }
.timeline-item.status-selesai .timeline-title-row h3 { text-decoration: line-through; }

.timeline-time {
  flex-shrink: 0; width: 84px; font-size: 0.82rem; font-weight: 700; color: var(--color-text-muted);
  padding-top: 2px;
}
.timeline-time span { display: block; font-weight: 500; }
.timeline-body { flex: 1; min-width: 0; }
.timeline-title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.timeline-title-row h3 { font-size: 0.98rem; }
.timeline-desc { margin-top: 4px; font-size: 0.86rem; color: var(--color-text-muted); }
.timeline-actions { display: flex; gap: 4px; flex-shrink: 0; }

.badge {
  display: inline-flex; align-items: center; font-size: 0.72rem; font-weight: 700;
  padding: 3px 9px; border-radius: 999px;
}
.badge-status-belum { background: var(--color-warning-bg); color: var(--color-accent-dark); }
.badge-status-berlangsung { background: var(--color-primary-light); color: var(--color-primary-dark); }
.badge-status-selesai { background: var(--color-success-bg); color: var(--color-success); }

/* ---------- Upcoming list ---------- */
.upcoming-list { display: flex; flex-direction: column; }
.upcoming-list li {
  display: flex; align-items: center; gap: 14px; padding: 11px 4px;
  border-bottom: 1px solid var(--color-border); font-size: 0.9rem;
}
.upcoming-list li:last-child { border-bottom: none; }
.upcoming-date {
  flex-shrink: 0; width: 58px; font-weight: 700; color: var(--color-primary); font-size: 0.82rem;
}
.upcoming-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upcoming-time { flex-shrink: 0; color: var(--color-text-muted); font-size: 0.8rem; }

/* ---------- Date nav (agenda.php) ---------- */
.date-nav { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.date-nav-form { flex: 1; max-width: 220px; }
.date-nav-form input { width: 100%; }

/* ---------- Filter bar (rekap.php) ---------- */
.filter-bar { display: flex; align-items: flex-end; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.filter-bar .field { margin-bottom: 0; min-width: 150px; }
.filter-bar .btn { height: 42px; }

/* ---------- Rekap table ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--color-border); border-radius: var(--radius-md); }
.rekap-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; min-width: 640px; }
.rekap-table th, .rekap-table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--color-border); vertical-align: top; }
.rekap-table thead th {
  background: var(--color-surface-alt); font-size: 0.78rem; text-transform: none;
  color: var(--color-text-muted); font-weight: 700;
}
.rekap-table tbody tr:last-child td { border-bottom: none; }
.rekap-table tbody tr:hover { background: var(--color-surface-alt); }
.col-no { width: 52px; text-align: center; color: var(--color-text-muted); }
.col-no-kegiatan { width: 90px; text-align: center; color: var(--color-text-muted); white-space: nowrap; }
.col-pengguna { width: 160px; font-weight: 600; }
.col-tanggal { width: 120px; white-space: nowrap; font-weight: 600; }
.col-status { width: 120px; }

.print-header, .print-footer { display: none; }

/* ---------- Changelog ---------- */
.changelog-list { list-style: none; margin: 0; padding: 0; }
.changelog-item { display: flex; gap: 16px; }
.changelog-marker { display: flex; flex-direction: column; align-items: center; flex-shrink: 0; width: 16px; }
.changelog-dot {
  width: 12px; height: 12px; border-radius: 50%; background: var(--color-border);
  border: 2px solid var(--color-surface); box-shadow: 0 0 0 1px var(--color-border);
  flex-shrink: 0; margin-top: 4px;
}
.changelog-dot--current { background: var(--color-accent); box-shadow: 0 0 0 1px var(--color-accent); }
.changelog-line { flex: 1; width: 2px; background: var(--color-border); margin: 4px 0; }
.changelog-body { flex: 1; min-width: 0; padding-bottom: 28px; }
.changelog-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.changelog-version { font-size: 1.02rem; font-weight: 700; }
.changelog-date { font-size: 0.8rem; color: var(--color-text-muted); }
.changelog-notes { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.changelog-notes li { font-size: 0.9rem; color: var(--color-text); line-height: 1.5; }

/* ---------- Modal ---------- */
.modal {
  position: fixed; inset: 0; background: rgba(15, 26, 24, 0.5); display: none;
  align-items: center; justify-content: center; z-index: 400; padding: 20px;
}
.modal.show { display: flex; }
.modal-dialog {
  background: var(--color-surface); border-radius: var(--radius-lg); width: 100%; max-width: 480px;
  max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-md);
  animation: modal-in .18s ease-out;
}
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
.modal-head {
  display: flex; align-items: center; justify-content: space-between; padding: 18px 22px;
  border-bottom: 1px solid var(--color-border);
}
.modal-head h3 { font-size: 1.05rem; }
.modal-form { padding: 20px 22px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 980px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.show { transform: translateX(0); box-shadow: var(--shadow-md); }
  .app-main { margin-left: 0; }
  .sidebar-toggle { display: inline-flex; }
  .app-content { padding: 18px 16px 48px; }
  .topbar { padding: 14px 16px; }
  .topbar-date { display: none; }
}

@media (max-width: 640px) {
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .field-row { grid-template-columns: 1fr; }
  .timeline-item { flex-wrap: wrap; }
  .timeline-time { width: auto; }
  .timeline-actions { margin-left: auto; }
  .panel { padding: 18px 16px; border-radius: var(--radius-md); }
  .auth-form-wrap { padding: 22px; }
}

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

/* ---------- Print styles (used by rekap.php) ---------- */
@media print {
  .sidebar, .topbar, .no-print, .overlay, .toast-stack, .modal { display: none !important; }
  .app-main { margin-left: 0; }
  .app-content { padding: 0; max-width: none; }
  body { background: #fff; }
  .panel { box-shadow: none; border: none; padding: 0; }
  .print-header { display: block; margin-bottom: 16px; }
  .print-header h2 { font-size: 1.3rem; }
  .print-header p { color: #444; margin-top: 4px; }
  .print-footer { display: block; margin-top: 16px; font-size: 0.78rem; color: #666; }
  .rekap-table { min-width: 0; }
  .table-wrap { border: none; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
