/* ============================================================
   Pusat Matahari — Portal AIM (Amanah Ikhtiar Malaysia)
   Theme: "AIM Sun Modern" — golden sun on deep navy
   ============================================================ */

:root {
  --sun: #f59e0b;
  --sun-dark: #d97706;
  --sun-deep: #92400e;
  --sun-soft: #fef3c7;
  --gold: #ffc944;
  --gold-2: #f59e0b;
  --navy: #0b1220;
  --navy-2: #16233b;
  --bg: #f4f6fb;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e6eaf2;
  --success: #10b981;
  --success-bg: #d1fae5;
  --danger: #ef4444;
  --danger-bg: #fee2e2;
  --warn: #f59e0b;
  --warn-bg: #fef3c7;
  --info: #3b82f6;
  --info-bg: #dbeafe;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 4px 12px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 20px 40px -12px rgba(15, 23, 42, 0.22);
  --shadow-gold: 0 8px 22px -6px rgba(245, 158, 11, 0.45);
  --ring: 0 0 0 4px rgba(245, 158, 11, 0.16);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', sans-serif;
  background:
    radial-gradient(1200px 500px at 100% -10%, rgba(245, 158, 11, 0.07), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(59, 130, 246, 0.05), transparent 55%),
    var(--bg);
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--sun-deep); text-decoration: none; transition: color 0.15s; }
a:hover { color: var(--sun-dark); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 999px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; background-clip: content-box; border: 2px solid transparent; }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 248px;
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--navy-2) 0%, var(--navy) 100%);
  color: #b6c2d6;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
.brand-logo {
  width: 42px; height: 42px;
  border-radius: 13px;
  background: linear-gradient(135deg, #ffd76b, #f59e0b 60%, #d97706);
  display: grid; place-items: center;
  font-size: 23px;
  box-shadow: var(--shadow-gold), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
.brand-name { font-weight: 800; color: #fff; font-size: 16px; line-height: 1.2; letter-spacing: -0.01em; }
.brand-tag { font-size: 11px; color: #7d8ca3; letter-spacing: 0.02em; }

.nav { flex: 1; padding: 16px 12px; overflow-y: auto; }
.nav-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.12em; color: #5b6b83; padding: 14px 12px 7px; font-weight: 700; }
.nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 10.5px 12px; border-radius: 12px;
  color: #b6c2d6; font-weight: 500;
  margin-bottom: 3px;
  transition: background 0.18s, color 0.18s, transform 0.1s;
  position: relative;
}
.nav-link:hover { background: rgba(255, 255, 255, 0.06); color: #fff; text-decoration: none; transform: translateX(2px); }
.nav-link.active {
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.22), rgba(245, 158, 11, 0.05));
  color: #ffd76b;
  box-shadow: inset 0 0 0 1px rgba(245, 158, 11, 0.25);
}
.nav-link.active::before {
  content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 4px; height: 60%; border-radius: 0 4px 4px 0;
  background: linear-gradient(180deg, var(--gold), var(--sun));
}
.nav-link .ico { width: 20px; text-align: center; font-size: 16px; filter: saturate(1.1); }

.sidebar-foot { padding: 14px; border-top: 1px solid rgba(255, 255, 255, 0.07); }
.sidebar-user { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(135deg, #ffd76b, #d97706);
  color: #fff; font-weight: 800; font-size: 14px;
  display: grid; place-items: center;
  box-shadow: 0 4px 10px rgba(245, 158, 11, 0.35);
}
.sidebar-user .u-name { color: #fff; font-weight: 600; font-size: 13px; }
.sidebar-user .u-role { color: #7d8ca3; font-size: 11.5px; text-transform: capitalize; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  padding: 16px 30px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 20px; font-weight: 800; letter-spacing: -0.01em; }
.topbar .sub { color: var(--muted); font-size: 12.5px; }

/* ---------- Notifications ---------- */
.notif { position: relative; }
.notif-btn {
  position: relative;
  width: 38px; height: 38px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 17px;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.notif-btn:hover { background: #f8fafc; }
.notif-badge {
  position: absolute; top: -6px; right: -6px;
  min-width: 18px; height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  background: #dc2626; color: #fff;
  font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.notif-panel {
  display: none;
  position: absolute; top: calc(100% + 10px); right: 0;
  width: 320px; max-width: 86vw;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  z-index: 60;
}
.notif-panel.open { display: block; }
.notif-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-weight: 700; font-size: 13.5px;
}
.notif-close {
  border: none; background: transparent; cursor: pointer;
  color: var(--muted); font-size: 13px;
}
.notif-item {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  text-decoration: none; color: inherit;
}
.notif-item:hover { background: #f8fafc; }
.notif-ico { font-size: 18px; line-height: 1.3; }
.notif-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.notif-text { font-size: 13px; line-height: 1.35; }
.notif-sub { font-size: 11.5px; color: var(--muted); }
.notif-empty { padding: 20px; text-align: center; color: var(--muted); font-size: 13px; }

/* ---------- Gallery ---------- */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}
.gallery-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  display: flex;
  flex-direction: column;
}
.gallery-img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  display: block;
  background: #f1f5f9;
}
.gallery-meta { padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; }
@media (max-width: 640px) {
  .gallery-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .gallery-img { height: 130px; }
}

.content { padding: 28px 30px; max-width: 1240px; width: 100%; }

/* ---------- Cards ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  transition: box-shadow 0.2s, transform 0.2s, border-color 0.2s;
  animation: fadeUp 0.35s ease both;
}
.card + .card { margin-top: 20px; }
.card:hover { box-shadow: var(--shadow-lg); border-color: #dde3ee; }
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; gap: 12px; flex-wrap: wrap;
}
.card-title { font-size: 16px; font-weight: 800; letter-spacing: -0.01em; }
.card-sub { color: var(--muted); font-size: 12.5px; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.grid { display: grid; gap: 18px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }

/* ---------- Stat cards ---------- */
.stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
  display: flex; align-items: center; gap: 15px;
  position: relative; overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  animation: fadeUp 0.35s ease both;
}
.stat:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: #d9e0ec; }
.stat::after {
  content: ''; position: absolute; right: -30px; top: -30px;
  width: 110px; height: 110px; border-radius: 50%;
  background: radial-gradient(circle, rgba(245, 158, 11, 0.12), transparent 70%);
  pointer-events: none;
}
.stat-ico {
  width: 48px; height: 48px; border-radius: 14px;
  display: grid; place-items: center; font-size: 23px;
  background: linear-gradient(135deg, #fff7e0, #fef3c7);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.7), 0 4px 10px rgba(245, 158, 11, 0.12);
  flex-shrink: 0;
}
.stat-ico.green { background: linear-gradient(135deg, #ecfdf5, #d1fae5); box-shadow: inset 0 1px 0 rgba(255,255,255,0.7), 0 4px 10px rgba(16, 185, 129, 0.12); }
.stat-ico.red { background: linear-gradient(135deg, #fef2f2, #fee2e2); box-shadow: inset 0 1px 0 rgba(255,255,255,0.7), 0 4px 10px rgba(239, 68, 68, 0.12); }
.stat-ico.blue { background: linear-gradient(135deg, #eff6ff, #dbeafe); box-shadow: inset 0 1px 0 rgba(255,255,255,0.7), 0 4px 10px rgba(59, 130, 246, 0.12); }
.stat .label { color: var(--muted); font-size: 12.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.stat .value { font-size: 23px; font-weight: 800; line-height: 1.15; letter-spacing: -0.01em; }
.stat .hint { font-size: 11.5px; color: var(--muted); }

/* ---------- Progress ---------- */
.progress { background: #e9edf4; border-radius: 999px; height: 10px; overflow: hidden; }
.progress > span {
  display: block; height: 100%;
  background: linear-gradient(90deg, #ffd76b, #f59e0b);
  border-radius: 999px;
  transition: width 0.5s ease;
}

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--muted);
  padding: 12px 14px; border-bottom: 1px solid var(--border);
  white-space: nowrap; background: #f8fafd;
}
.table th:first-child { border-radius: 10px 0 0 10px; }
.table th:last-child { border-radius: 0 10px 10px 0; }
.table td { padding: 12px 14px; border-bottom: 1px solid #eef1f7; vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background 0.15s; }
.table tbody tr:hover { background: #fbfcff; }
.table .num { text-align: right; }
.table th.num { text-align: right; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3.5px 11px; border-radius: 999px;
  font-size: 11.5px; font-weight: 700;
  white-space: nowrap;
}
.badge-green { background: var(--success-bg); color: #047857; }
.badge-red { background: var(--danger-bg); color: #b91c1c; }
.badge-amber { background: var(--warn-bg); color: var(--sun-deep); }
.badge-blue { background: var(--info-bg); color: #1d4ed8; }
.badge-gray { background: #eef2f8; color: #475569; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 18px; border-radius: 11px;
  border: 1px solid transparent; cursor: pointer;
  font-size: 13.5px; font-weight: 700;
  transition: filter 0.15s, background 0.15s, transform 0.1s, box-shadow 0.15s;
  background: var(--card);
  font-family: inherit;
}
.btn:active { transform: translateY(1px) scale(0.99); }
.btn-primary {
  background: linear-gradient(135deg, #ffd76b, #f59e0b 65%, #d97706);
  color: #5b2c05; border-color: rgba(217, 119, 6, 0.3);
  box-shadow: 0 6px 16px -6px rgba(245, 158, 11, 0.55);
}
.btn-primary:hover { filter: brightness(1.04); box-shadow: 0 8px 20px -6px rgba(245, 158, 11, 0.6); }
.btn-dark { background: linear-gradient(135deg, #243450, #0f172a); color: #fff; }
.btn-dark:hover { filter: brightness(1.15); }
.btn-outline { border-color: var(--border); color: var(--text); background: #fff; box-shadow: 0 1px 2px rgba(15,23,42,0.04); }
.btn-outline:hover { background: #f8fafc; border-color: #d4dae6; }
.btn-danger { background: linear-gradient(135deg, #f87171, #ef4444); color: #fff; box-shadow: 0 6px 14px -6px rgba(239, 68, 68, 0.5); }
.btn-danger:hover { filter: brightness(1.06); }
.btn-success { background: linear-gradient(135deg, #34d399, #10b981); color: #fff; box-shadow: 0 6px 14px -6px rgba(16, 185, 129, 0.5); }
.btn-success:hover { filter: brightness(1.06); }
.btn-sm { padding: 6px 12px; font-size: 12.5px; border-radius: 9px; }
.btn-block { width: 100%; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }
.form-label { font-size: 13px; font-weight: 700; color: #334155; }
.form-hint { font-size: 11.5px; color: var(--muted); }
.form-control {
  padding: 10px 13px; border: 1px solid var(--border); border-radius: 11px;
  font-size: 14px; font-family: inherit; background: #fff; color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s; width: 100%;
}
.form-control:focus { outline: none; border-color: var(--sun); box-shadow: var(--ring); }
textarea.form-control { resize: vertical; min-height: 120px; }
select.form-control { cursor: pointer; }
.checkbox-row { display: flex; align-items: center; gap: 8px; }
.checkbox-row input { width: 17px; height: 17px; accent-color: var(--sun); }

/* ---------- Alerts ---------- */
.alert {
  padding: 13px 16px; border-radius: 12px; margin-bottom: 18px;
  display: flex; align-items: center; gap: 9px; font-weight: 600; font-size: 13.5px;
}
.alert-success { background: var(--success-bg); color: #047857; border: 1px solid #a7f3d0; }
.alert-danger { background: var(--danger-bg); color: #b91c1c; border: 1px solid #fecaca; }
.alert-info { background: var(--info-bg); color: #1d4ed8; border: 1px solid #bfdbfe; }
.alert-warning { background: #fffbeb; color: #b45309; border: 1px solid #fcd34d; }
.alert ul { margin-left: 18px; }

/* ---------- Announcements ---------- */
.announce {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; background: #fff; position: relative;
  transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s;
}
.announce + .announce { margin-top: 12px; }
.announce:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: #d9e0ec; }
.announce.pinned { border-color: #fcd34d; background: linear-gradient(180deg, #fffbeb, #fffdf5); box-shadow: 0 6px 18px -8px rgba(245, 158, 11, 0.35); }
.announce .meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.announce h3 { font-size: 15.5px; font-weight: 800; }
.ann-title { color: inherit; text-decoration: none; }
.ann-title:hover { color: #d97706; }
.ann-show .meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.ann-show-title { font-size: 21px; font-weight: 800; margin-bottom: 12px; }
.ann-show-body { color: #475569; font-size: 14.5px; white-space: pre-line; line-height: 1.7; }
.ann-preview { max-height: 150px; overflow: hidden; }
.announce .body { color: #475569; font-size: 13.5px; white-space: pre-line; margin-top: 4px; }
.announce .date { font-size: 12px; color: var(--muted); }
.announce .ann-attach, .ann-show .ann-attach { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.announce .ann-link, .ann-show .ann-link { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; border: 1px solid #e2e8f0; background: #f8fafc; color: #1d4ed8; font-size: 12.5px; font-weight: 600; text-decoration: none; transition: all .15s ease; }
.announce .ann-link a, .ann-show .ann-link a { color: #1d4ed8; text-decoration: none; font-weight: 600; }
.announce .ann-link a:hover, .ann-show .ann-link a:hover { text-decoration: underline; }
.announce .att-save, .ann-show .att-save { color: #64748b; text-decoration: none; font-size: 13px; padding: 0 2px; line-height: 1; }
.announce .att-save:hover, .ann-show .att-save:hover { color: #0f172a; transform: translateY(1px); }
.announce .ann-link:hover, .ann-show .ann-link:hover { background: #eff6ff; border-color: #bfdbfe; transform: translateY(-1px); }
.announce .ann-link .inline { display: inline-flex; margin: 0; }
.announce .att-remove { background: none; border: none; color: #dc2626; cursor: pointer; font-size: 12px; padding: 0 2px; line-height: 1; font-weight: 700; }
.announce .att-remove:hover { color: #991b1b; transform: scale(1.2); }
.ann-attach.mt-1 { margin-top: 6px; }
.attach-fields { display: flex; flex-direction: column; gap: 8px; }
.attach-row { display: flex; gap: 8px; align-items: center; }
.attach-row .form-control { flex: 1; }
.attach-row-remove { background: none; border: none; color: #dc2626; font-size: 15px; cursor: pointer; padding: 4px 6px; line-height: 1; font-weight: 700; }
.attach-row-remove:hover { color: #991b1b; transform: scale(1.15); }

/* ---------- Recommendations ---------- */
.reco {
  display: flex; gap: 14px; padding: 16px 18px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: #fff; align-items: flex-start;
  transition: transform 0.18s, box-shadow 0.18s;
}
.reco + .reco { margin-top: 12px; }
.reco:hover { transform: translateX(3px); box-shadow: var(--shadow); }
.reco .r-ico { font-size: 24px; flex-shrink: 0; }
.reco .r-title { font-weight: 800; font-size: 14.5px; margin-bottom: 2px; }
.reco .r-text { color: var(--muted); font-size: 13px; }
.reco a { font-size: 13px; font-weight: 700; }

/* ---------- Login ---------- */
.login-wrap {
  min-height: 100vh; display: grid; place-items: center;
  background:
    radial-gradient(700px 400px at 85% 10%, rgba(245, 158, 11, 0.22), transparent 60%),
    radial-gradient(900px 600px at 0% 100%, rgba(59, 130, 246, 0.12), transparent 55%),
    linear-gradient(160deg, #0b1220 0%, #16233b 60%, #271a05 135%);
  padding: 24px;
}
.login-card {
  width: 100%; max-width: 408px; background: #fff; border-radius: 20px;
  box-shadow: var(--shadow-lg); padding: 36px 34px;
  animation: fadeUp 0.4s ease both;
}
.login-logo {
  width: 62px; height: 62px; border-radius: 18px;
  background: linear-gradient(135deg, #ffd76b, #f59e0b 60%, #d97706);
  display: grid; place-items: center; font-size: 32px;
  margin: 0 auto 16px;
  box-shadow: var(--shadow-gold), inset 0 1px 0 rgba(255, 255, 255, 0.55);
}
.login-title { text-align: center; font-size: 21px; font-weight: 800; letter-spacing: -0.01em; }
.login-sub { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 24px; }
.login-hint { text-align: center; color: var(--muted); font-size: 12px; margin-top: 12px; }
.login-demo {
  margin-top: 20px; padding: 14px 16px; background: linear-gradient(180deg, #fffbeb, #fef9e7);
  border: 1px solid #fde68a; border-radius: 12px; font-size: 12px; color: #92400e;
}
.login-demo code { background: rgba(255, 255, 255, 0.85); padding: 1px 6px; border-radius: 6px; font-weight: 600; }

/* ---------- Misc ---------- */
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.between { justify-content: space-between; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.money { font-weight: 700; font-variant-numeric: tabular-nums; }

.pagination { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin-top: 18px; }
.pagination a, .pagination span {
  padding: 7px 12px; border: 1px solid var(--border); border-radius: 9px;
  background: #fff; color: var(--text); font-size: 13px;
  transition: all 0.15s;
}
.pagination a:hover { border-color: var(--sun); color: var(--sun-deep); text-decoration: none; box-shadow: 0 2px 8px rgba(245,158,11,0.15); }
.pagination .active { background: linear-gradient(135deg, #ffd76b, #f59e0b); border-color: #f59e0b; color: #5b2c05; font-weight: 800; box-shadow: 0 4px 12px -4px rgba(245,158,11,0.5); }
.pagination .disabled { color: #9ca3af; }

.week-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.week-nav .label { font-weight: 800; font-size: 14.5px; }
.week-nav form { display: inline; }

.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty .e-ico { font-size: 40px; margin-bottom: 10px; }

.chart { display: flex; align-items: flex-end; gap: 14px; height: 190px; padding-top: 10px; }
.chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.chart-bar {
  width: 100%; max-width: 42px; border-radius: 8px 8px 3px 3px;
  background: linear-gradient(180deg, #ffd76b, #f59e0b);
  min-height: 4px; transition: height 0.5s ease;
  box-shadow: 0 4px 10px -4px rgba(245, 158, 11, 0.4);
}
.chart-bar.low { background: linear-gradient(180deg, #fca5a5, #ef4444); box-shadow: 0 4px 10px -4px rgba(239, 68, 68, 0.4); }
.chart-bar.mid { background: linear-gradient(180deg, #fcd34d, #f59e0b); }
.chart-label { font-size: 11px; color: var(--muted); }
.chart-value { font-size: 11px; font-weight: 800; }

.kv { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.kv .k { color: var(--muted); font-size: 12.5px; }
.kv .v { font-weight: 700; font-size: 14.5px; }

.icon-btn { background: none; border: none; cursor: pointer; font-size: 15px; padding: 4px; border-radius: 7px; transition: background 0.15s; }
.icon-btn:hover { background: #eef2f8; }

/* Modal scrolling: keep tall modals usable on small viewports */
#payModal > div, #expModal > div, #recModal > div {
    max-height: 92vh;
    overflow-y: auto;
}
#payModal, #expModal, #recModal {
    overflow-y: auto;
}

/* ---------- Chat Assistant ---------- */
.chat-toggle {
  position: fixed; right: 22px; bottom: 22px; z-index: 200;
  width: 58px; height: 58px; border-radius: 50%; border: 0; cursor: pointer;
  background: linear-gradient(135deg, #ffd76b, #f59e0b 60%, #d97706);
  box-shadow: 0 10px 24px -6px rgba(245, 158, 11, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  display: grid; place-items: center;
  transition: transform 0.2s, box-shadow 0.2s;
}
.chat-toggle:hover { transform: translateY(-2px) scale(1.05); }
.chat-toggle-ico { font-size: 26px; }

.chat-box {
  position: fixed; right: 22px; bottom: 22px; z-index: 200;
  width: 370px; max-width: calc(100vw - 32px); height: 520px; max-height: calc(100vh - 44px);
  background: #fff; border-radius: 18px; overflow: hidden;
  box-shadow: 0 24px 50px -12px rgba(15, 23, 42, 0.35), 0 4px 14px rgba(15, 23, 42, 0.1);
  border: 1px solid var(--border);
  display: flex; flex-direction: column;
  animation: fadeUp 0.25s ease both;
}
.chat-box[hidden] { display: none !important; }
.chat-toggle[hidden] { display: none !important; }
.chat-head {
  display: flex; align-items: center; gap: 11px;
  padding: 14px 16px;
  background: linear-gradient(135deg, var(--navy-2), var(--navy));
  color: #fff;
}
.chat-head-logo {
  width: 38px; height: 38px; border-radius: 12px; flex-shrink: 0;
  background: linear-gradient(135deg, #ffd76b, #f59e0b 60%, #d97706);
  display: grid; place-items: center; font-size: 20px;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.45);
}
.chat-head-title { font-weight: 800; font-size: 15px; }
.chat-head-sub { font-size: 11.5px; color: #8fa0b8; }
.chat-close {
  margin-left: auto; background: rgba(255, 255, 255, 0.1); border: 0; cursor: pointer;
  color: #cbd5e1; width: 30px; height: 30px; border-radius: 9px; font-size: 14px;
  transition: background 0.15s;
}
.chat-close:hover { background: rgba(255, 255, 255, 0.2); color: #fff; }

.chat-msgs { flex: 1; overflow-y: auto; padding: 16px 14px; display: flex; flex-direction: column; gap: 10px; background: #f8fafd; }
.chat-msg { display: flex; }
.chat-msg.bot { justify-content: flex-start; }
.chat-msg.user { justify-content: flex-end; }
.chat-bubble {
  max-width: 82%; padding: 10px 13px; border-radius: 14px;
  font-size: 13.5px; line-height: 1.5; white-space: pre-line;
}
.chat-msg.bot .chat-bubble {
  background: #fff; border: 1px solid var(--border);
  border-bottom-left-radius: 4px; box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
}
.chat-msg.user .chat-bubble {
  background: linear-gradient(135deg, #ffd76b, #f59e0b 65%, #d97706);
  color: #5b2c05; font-weight: 600;
  border-bottom-right-radius: 4px; box-shadow: 0 4px 12px -4px rgba(245, 158, 11, 0.5);
}

.chat-quick { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 12px 4px; background: #f8fafd; }
.chat-chip {
  border: 1px solid #fcd34d; background: #fffbeb; color: var(--sun-deep);
  border-radius: 999px; padding: 6px 12px; font-size: 12px; font-weight: 600; cursor: pointer;
  transition: all 0.15s;
}
.chat-chip:hover { background: #fef3c7; border-color: #f59e0b; transform: translateY(-1px); }

.chat-input-row { display: flex; gap: 8px; padding: 12px; background: #fff; border-top: 1px solid var(--border); }
.chat-input {
  flex: 1; padding: 10px 13px; border: 1px solid var(--border); border-radius: 11px;
  font-size: 13.5px; font-family: inherit; color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.chat-input:focus { outline: none; border-color: var(--sun); box-shadow: var(--ring); }
.chat-send {
  width: 42px; height: 42px; border-radius: 11px; border: 0; cursor: pointer;
  background: linear-gradient(135deg, #ffd76b, #f59e0b 65%, #d97706);
  color: #5b2c05; font-size: 16px; font-weight: 800;
  box-shadow: 0 4px 12px -4px rgba(245, 158, 11, 0.5);
  transition: transform 0.1s, filter 0.15s;
}
.chat-send:hover { filter: brightness(1.05); }
.chat-send:active { transform: scale(0.95); }

@media (max-width: 560px) {
  .chat-box { right: 8px; bottom: 8px; }
  .chat-toggle { right: 14px; bottom: 14px; }
}

/* Responsive */
@media (max-width: 900px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .form-grid { grid-template-columns: 1fr; }
  .sidebar { width: 70px; }
  .brand-name, .brand-tag, .nav-label, .nav-link span:not(.ico), .sidebar-user .u-name, .sidebar-user .u-role { display: none; }
  .nav-link { justify-content: center; }
  .nav-link.active::before { left: -12px; }
  .brand { justify-content: center; padding: 18px 8px; }
  .brand-logo { width: 38px; height: 38px; }
  .content { padding: 18px 16px; }
  .topbar { padding: 12px 16px; }
}
@media (max-width: 560px) {
  .grid-4, .grid-3 { grid-template-columns: 1fr; }
}
