* { box-sizing: border-box; }
body {
  font-family: "Segoe UI", Arial, sans-serif;
  margin: 0;
  background: #f4f6f9;
  color: #222;
}
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: 230px;
  background: linear-gradient(180deg, #14335a 0%, #1c4d80 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform 0.25s ease;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 20px 18px; border-bottom: 1px solid rgba(255,255,255,0.14); }
.sidebar-brand img { width: 42px; height: 42px; border-radius: 50%; background: #fff; padding: 3px; object-fit: contain; flex-shrink: 0; }
.sidebar-brand-name { font-weight: 700; font-size: 14.5px; letter-spacing: 0.4px; line-height: 1.25; }
.sidebar-brand-sub { font-size: 11.5px; opacity: 0.75; margin-top: 1px; }

.sidebar-nav { flex: 1; padding: 14px 10px; overflow-y: auto; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; margin-bottom: 4px;
  border-radius: 8px; color: #dce6f5; text-decoration: none; font-size: 14px;
}
.sidebar-nav a:hover { background: rgba(255,255,255,0.08); color: #fff; }
.sidebar-nav a.active { background: #fff; color: #14335a; font-weight: 600; }
.sidebar-nav .nav-icon { width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.sidebar-nav .nav-icon svg { width: 18px; height: 18px; }

.sidebar-footer { padding: 14px 16px; border-top: 1px solid rgba(255,255,255,0.14); }
.sidebar-user { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.sidebar-user-avatar { width: 34px; height: 34px; border-radius: 50%; background: #e5a916; color: #14335a; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; flex-shrink: 0; }
.sidebar-user-name { font-size: 13px; font-weight: 600; }
.sidebar-user-role { font-size: 11px; opacity: 0.75; }
.sidebar-signout { width: 100%; padding: 8px; border: 1px solid rgba(255,255,255,0.3); background: transparent; color: #fff; border-radius: 7px; font-size: 13px; cursor: pointer; }
.sidebar-signout:hover { background: rgba(255,255,255,0.12); }

.sidebar-toggle {
  display: none;
  position: fixed; top: 14px; right: 14px; z-index: 200;
  background: #14335a; color: #fff; border: none;
  width: 38px; height: 38px; border-radius: 8px; font-size: 18px; cursor: pointer;
  align-items: center; justify-content: center;
}
.sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 99; }

.app-main { margin-left: 230px; min-height: 100vh; }
main { padding: 24px; max-width: 1200px; margin: 0 auto; }

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  body.sidebar-open .sidebar { transform: translateX(0); }
  body.sidebar-open .sidebar-backdrop { display: block; }
  .sidebar-toggle { display: flex; }
  .app-main { margin-left: 0; }
  main { padding: 16px; padding-top: 68px; }
}

.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: #eef1f6; padding: 24px; }
.auth-wrap { width: 100%; max-width: 400px; }
.auth-hero {
  background: linear-gradient(135deg, #14335a, #2f6fb3);
  border-radius: 16px 16px 0 0;
  padding: 26px 24px;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 16px;
}
.auth-hero img { width: 56px; height: 56px; border-radius: 50%; background: #fff; padding: 4px; object-fit: contain; flex-shrink: 0; }
.auth-eyebrow { font-size: 11px; letter-spacing: 1px; text-transform: uppercase; opacity: 0.85; margin-bottom: 2px; }
.auth-hero h1 { font-size: 18px; margin: 0 0 2px; }
.auth-subtitle { font-size: 12.5px; opacity: 0.85; }

.auth-card { background: #fff; border-radius: 0 0 16px 16px; padding: 28px 26px 26px; box-shadow: 0 10px 30px rgba(20,51,90,0.15); }
.auth-card label { display: block; font-size: 11.5px; letter-spacing: 0.5px; text-transform: uppercase; color: #667085; margin-bottom: 6px; font-weight: 600; }
.auth-card .field { margin-bottom: 16px; }
.auth-card input { width: 100%; padding: 11px 12px; border: 1px solid #dfe3ea; border-radius: 8px; font-size: 14px; background: #f9fafb; }
.auth-card input:focus { outline: none; border-color: #2f6fb3; background: #fff; }
.auth-password-wrap { position: relative; }
.auth-password-wrap input { padding-right: 40px; }
.auth-password-wrap button { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; color: #98a2b3; font-size: 16px; padding: 4px; line-height: 1; }
.auth-submit { width: 100%; padding: 12px; border: none; border-radius: 8px; background: linear-gradient(135deg, #14335a, #2f6fb3); color: #fff; font-size: 14.5px; font-weight: 600; cursor: pointer; }
.auth-submit:hover { opacity: 0.95; }
.auth-footnote { text-align: center; font-size: 12px; color: #98a2b3; margin-top: 18px; }
.auth-error { background: #fde2e2; color: #a02020; padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 16px; }

.table-responsive { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 8px; }
.table-responsive table { min-width: 640px; }

.cards { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.card {
  background: #fff;
  border-radius: 8px;
  padding: 18px 22px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  min-width: 160px;
  flex: 1;
}
.card .value { font-size: 26px; font-weight: 600; }
.card .label { color: #666; font-size: 13px; margin-top: 4px; }

table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 8px; overflow: hidden; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid #eee; font-size: 14px; }
th { background: #eef1f6; font-weight: 600; }
tr:hover { background: #fafbfd; }

.btn {
  display: inline-block;
  padding: 7px 14px;
  border-radius: 5px;
  background: #14335a;
  color: #fff;
  text-decoration: none;
  border: none;
  font-size: 13px;
  cursor: pointer;
}
.btn.secondary { background: #6c7a91; }
.btn.danger { background: #b03030; }
.btn.small { padding: 4px 9px; font-size: 12px; }

.action-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
  min-width: 150px;
}
.action-grid .btn { width: 100%; text-align: center; padding: 5px 8px; white-space: nowrap; }
.action-grid .full-width { grid-column: 1 / -1; }
.action-grid form { display: contents; }

.icon-actions { display: flex; gap: 4px; align-items: center; flex-wrap: nowrap; }
.icon-actions form { display: contents; }
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: #3a4a63;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}
.icon-btn svg { width: 18px; height: 18px; pointer-events: none; }
.icon-btn:hover { background: #e4e9f1; color: #14335a; }
.icon-btn.danger { color: #c0392b; }
.icon-btn.danger:hover { background: #fbe4e2; color: #8a2323; }
.icon-btn.success { color: #227a3c; }
.icon-btn.success:hover { background: #e1f3e6; color: #185b2c; }

.toolbar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
input, select { padding: 7px 10px; border: 1px solid #ccc; border-radius: 5px; font-size: 14px; }
input[type="checkbox"], input[type="radio"] { width: auto; padding: 0; border: none; border-radius: 0; vertical-align: middle; }

.status-badge { padding: 3px 9px; border-radius: 12px; font-size: 12px; }
.status-unpaid { background: #fde2e2; color: #a02020; }
.status-paid { background: #dff3e2; color: #227a3c; }
.status-partial { background: #fef3c7; color: #92680a; }
.status-overdue { background: #fff0d0; color: #9a6300; }

.amount-paid { color: #227a3c; font-weight: 600; }
.amount-due { color: #c0392b; font-weight: 600; }

.flash { padding: 10px 16px; border-radius: 6px; margin-bottom: 16px; }
.flash.success { background: #dff3e2; color: #227a3c; }
.flash.error { background: #fde2e2; color: #a02020; }

form.stacked label { display: block; margin-bottom: 4px; font-size: 13px; color: #444; }
form.stacked .field { margin-bottom: 14px; }
form.stacked input, form.stacked select { width: 100%; }
form.stacked input[type="checkbox"], form.stacked input[type="radio"] { width: auto; }

.class-table td, .class-table th { text-align: center; }
.class-table td:first-child, .class-table th:first-child { text-align: left; }
.class-table input { width: 90px; }

.dashboard-header { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 22px; }
.dashboard-header h2 { margin: 0 0 2px; font-size: 22px; }
.dashboard-header .subtitle { color: #667085; font-size: 13px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 20px; }
@media (max-width: 480px) { .stat-grid { grid-template-columns: 1fr; } }
.stat-card {
  background: #fff;
  border-radius: 12px;
  padding: 16px 18px;
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.08);
  border: 1px solid #eef1f6;
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.stat-card .stat-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--accent-soft, #eef1f6);
  color: var(--accent, #14335a);
}
.stat-card .stat-icon svg { width: 19px; height: 19px; }
.stat-card .stat-text { min-width: 0; }
.stat-card .stat-value { font-size: 23px; font-weight: 700; color: #101828; line-height: 1.2; white-space: nowrap; }
.stat-card .stat-label { color: #667085; font-size: 12.5px; margin-top: 2px; }
@media (max-width: 480px) {
  .stat-card { padding: 14px; gap: 12px; }
  .stat-card .stat-value { font-size: 19px; }
}
.stat-card.accent-blue { --accent: #2a78d6; --accent-soft: #e7f0fb; }
.stat-card.accent-green { --accent: #0ca30c; --accent-soft: #e5f6e5; }
.stat-card.accent-red { --accent: #d03b3b; --accent-soft: #fbeaea; }
.stat-card.accent-amber { --accent: #c98500; --accent-soft: #fdf3e0; }
.stat-card.accent-purple { --accent: #4a3aa7; --accent-soft: #ece9f7; }
.stat-card.accent-orange { --accent: #ec835a; --accent-soft: #fdece4; }

.voucher-status-panel, .student-status-panel {
  background: #e8f1fc;
  border: 1px solid #c3dcf5;
  border-radius: 12px;
  padding: 20px 20px 6px;
  margin-bottom: 20px;
}
.voucher-status-panel .stat-grid, .student-status-panel .stat-grid { margin-bottom: 16px; }
.voucher-status-panel .status-progress-legend, .student-status-panel .status-progress-legend { margin-bottom: 14px; }

.status-filter-card { cursor: pointer; transition: box-shadow 0.15s, border-color 0.15s; }
.status-filter-card:hover { box-shadow: 0 3px 10px rgba(16, 24, 40, 0.14); }
.status-filter-card.active { border-color: var(--accent, #14335a); box-shadow: 0 0 0 2px var(--accent-soft, #eef1f6) inset, 0 3px 10px rgba(16, 24, 40, 0.14); }

.status-progress-bar { display: flex; height: 14px; border-radius: 7px; overflow: hidden; background: #eef1f6; margin-bottom: 10px; }
.status-progress-bar .segment { height: 100%; transition: width 0.2s; }
.status-progress-bar .segment.paid { background: #0ca30c; }
.status-progress-bar .segment.partial { background: #e5a916; }
.status-progress-bar .segment.unpaid { background: #d03b3b; }
.status-progress-bar .segment.male { background: #2a78d6; }
.status-progress-bar .segment.female { background: #b23a8c; }
.status-progress-bar .segment.empty { background: #dfe3ea; }

.status-progress-legend { display: flex; gap: 18px; flex-wrap: wrap; font-size: 12.5px; color: #444; margin-bottom: 20px; }
.status-progress-legend .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.status-progress-legend .dot.paid { background: #0ca30c; }
.status-progress-legend .dot.partial { background: #e5a916; }
.status-progress-legend .dot.unpaid { background: #d03b3b; }
.status-progress-legend .dot.overdue { background: #7a1f1f; }
.status-progress-legend .dot.male { background: #2a78d6; }
.status-progress-legend .dot.female { background: #b23a8c; }
.status-progress-legend .dot.unset { background: #98a2b3; }

.chart-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 16px; margin-bottom: 26px; }
@media (max-width: 900px) { .chart-grid { grid-template-columns: 1fr; } }
.chart-panel { background: #fff; border-radius: 10px; padding: 18px 20px; box-shadow: 0 1px 3px rgba(16, 24, 40, 0.08); min-width: 0; }
.chart-panel h3 { margin: 0 0 14px; font-size: 15px; color: #101828; }
.chart-panel .chart-wrap { position: relative; height: 260px; }
.chart-panel .chart-empty { color: #98a2b3; font-size: 13px; text-align: center; padding: 40px 0; }

.section-title { font-size: 16px; margin: 4px 0 12px; color: #101828; }

.profile-hero { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.profile-avatar-wrap { position: relative; flex-shrink: 0; width: 96px; height: 96px; }
.profile-avatar-img, .profile-avatar-fallback { width: 96px; height: 96px; border-radius: 50%; flex-shrink: 0; }
.profile-avatar-img { object-fit: cover; border: 1px solid #eef1f6; }
.profile-avatar-fallback { background: #e5a916; color: #14335a; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 34px; }
.profile-avatar-edit {
  position: absolute; right: -2px; bottom: -2px; width: 30px; height: 30px; border-radius: 50%;
  background: #14335a; color: #fff; display: flex; align-items: center; justify-content: center;
  border: 2px solid #fff; cursor: pointer; box-shadow: 0 1px 3px rgba(16, 24, 40, 0.25);
}
.profile-avatar-edit svg { width: 14px; height: 14px; }
.profile-avatar-edit:hover { background: #1c4373; }
.profile-hero-info { min-width: 0; }
.profile-hero-name { font-size: 20px; font-weight: 700; color: #101828; margin-bottom: 6px; }
.profile-hero-meta { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 8px; color: #667085; font-size: 13px; }

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.master-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; background: #fff4d6; color: #7a5300; border: 1px solid #f1d58a; border-radius: 10px; padding: 10px 14px; margin-bottom: 16px; font-size: 14px; }
.master-banner form { margin: 0; }
.feature-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.feature-tag { font-size: 11.5px; padding: 2px 8px; border-radius: 999px; background: #e8eefb; color: #1e3a5f; }
.feature-tag.off { background: #f1f1f1; color: #999; text-decoration: line-through; }
.checkbox-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.checkbox-grid label { display: flex; align-items: center; gap: 8px; font-weight: 500; }

/* Product logo on sign-in / setup pages */
.auth-card { border-radius: 16px; }
.auth-brand { margin: -28px -26px 24px; padding: 30px 24px 20px; text-align: center; border-bottom: 1px solid #e8edf4; }
.auth-brand img { width: 220px; max-width: 70%; height: auto; display: block; margin: 0 auto 14px; }
.auth-brand .auth-eyebrow { color: #2e7d32; opacity: 1; font-weight: 600; }
.auth-brand .auth-subtitle { color: #4a5568; opacity: 1; font-size: 13.5px; }
