/* ============================================================================
   SCHOOLAID — Owner portal styles
   Palette: deep navy #0a1b3d · gold #f5b800 · clean white · soft greys
   ============================================================================ */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --navy:        #0a1b3d;
  --navy-dark:   #061229;
  --navy-soft:   #12244a;
  --gold:        #f5b800;
  --gold-light:  #ffcc33;
  --gold-dark:   #d99e00;
  --white:       #ffffff;
  --grey-50:     #f7f9fc;
  --grey-100:    #eef2f7;
  --grey-200:    #dde4ee;
  --grey-300:    #b8c2d1;
  --grey-500:    #6b7789;
  --grey-700:    #3a4557;
  --text:        #0a1b3d;
  --text-soft:   #5a6678;
  --success:     #16a34a;
  --success-bg:  #e8f8ee;
  --danger:      #dc2626;
  --danger-bg:   #fee2e2;
  --warning:     #d97706;
  --warning-bg:  #fef3c7;
  --info:        #2563eb;
  --info-bg:     #dbeafe;
  --shadow-sm:   0 1px 3px rgba(10,27,61,0.08);
  --shadow-md:   0 4px 14px rgba(10,27,61,0.10);
  --shadow-lg:   0 12px 30px rgba(10,27,61,0.15);
  --radius-sm:   8px;
  --radius:      12px;
  --radius-lg:   18px;
  --font:        -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--grey-50);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ============ LOGIN PAGE ============ */
.login-body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 20% 10%, rgba(245,184,0,0.10), transparent 40%),
    radial-gradient(circle at 80% 90%, rgba(245,184,0,0.08), transparent 40%),
    linear-gradient(135deg, var(--navy) 0%, var(--navy-dark) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-shell {
  width: 100%;
  max-width: 440px;
}

.login-brand {
  text-align: center;
  margin-bottom: 28px;
}

.brand-shield {
  width: 72px;
  height: 72px;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 38px;
  margin: 0 auto 14px;
  box-shadow: 0 10px 30px rgba(245,184,0,0.35);
}

.brand-name {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--white);
  margin-bottom: 4px;
}
.brand-school { color: var(--white); }
.brand-aid { color: var(--gold); }

.brand-tag {
  font-size: 13px;
  color: var(--gold);
  letter-spacing: 2px;
  font-weight: 600;
  text-transform: uppercase;
}

.brand-lock {
  margin-top: 10px;
  font-size: 11px;
  color: rgba(255,255,255,0.5);
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.login-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 40px 32px 32px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
  border-top: 4px solid var(--gold);
}

.login-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--navy);
  text-align: center;
  margin-bottom: 4px;
}

.login-sub {
  text-align: center;
  font-size: 12px;
  color: var(--grey-500);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 28px;
  font-weight: 600;
}

.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-group input {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--grey-200);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 15px;
  color: var(--text);
  background: var(--white);
  transition: border-color .15s, box-shadow .15s;
}

.form-group input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 4px rgba(245,184,0,0.15);
}

.password-wrap { position: relative; }
.password-wrap input { padding-right: 48px; }
.pw-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  font-size: 18px;
  padding: 8px 12px;
  cursor: pointer;
  border-radius: 8px;
  opacity: 0.5;
}
.pw-toggle:hover { opacity: 1; background: var(--grey-100); }

.btn-primary {
  width: 100%;
  padding: 15px;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-light) 100%);
  color: var(--navy);
  border: none;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: transform .12s, box-shadow .12s;
  box-shadow: 0 6px 20px rgba(245,184,0,0.35);
  margin-top: 8px;
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 10px 26px rgba(245,184,0,0.45);
}
.btn-primary:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.login-foot {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--grey-100);
  text-align: center;
  font-size: 11px;
  color: var(--grey-500);
  letter-spacing: 1px;
  text-transform: uppercase;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.dot-live {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(22,163,74,0.2);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.login-footer-text {
  text-align: center;
  color: rgba(255,255,255,0.4);
  font-size: 11px;
  margin-top: 20px;
  letter-spacing: 0.5px;
}

.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 18px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
}
.alert.error   { background: var(--danger-bg);  color: var(--danger);  border-left: 4px solid var(--danger); }
.alert.success { background: var(--success-bg); color: var(--success); border-left: 4px solid var(--success); }
.alert.info    { background: var(--info-bg);    color: var(--info);    border-left: 4px solid var(--info); }

/* ============ DASHBOARD ============ */
body.app-body {
  background: var(--grey-50);
  min-height: 100vh;
}

.app-header {
  background: var(--navy);
  color: var(--white);
  padding: 16px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 100;
}

.app-header .brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.3px;
}
.app-header .brand-shield-sm {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}
.app-header .brand-school { color: var(--white); }
.app-header .brand-aid { color: var(--gold); }

.app-header .header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.owner-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 100px;
  padding: 6px 14px 6px 8px;
  font-size: 13px;
  font-weight: 600;
}
.owner-chip .dot {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  display: flex; align-items: center; justify-content: center;
  color: var(--navy); font-weight: 800; font-size: 12px;
}

.btn-ghost {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.2);
  color: var(--white);
  padding: 8px 16px;
  border-radius: 10px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .12s;
}
.btn-ghost:hover { background: rgba(255,255,255,0.1); }

/* ---- Tabs ---- */
.tab-bar {
  background: var(--white);
  border-bottom: 1px solid var(--grey-200);
  padding: 0 28px;
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  position: sticky;
  top: 70px;
  z-index: 99;
}
.tab-bar::-webkit-scrollbar { display: none; }

.tab-btn {
  background: transparent;
  border: none;
  padding: 16px 20px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--grey-500);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
  transition: color .12s, border-color .12s;
  display: flex;
  align-items: center;
  gap: 8px;
}
.tab-btn:hover { color: var(--navy); }
.tab-btn.active {
  color: var(--navy);
  border-bottom-color: var(--gold);
}

/* ---- Main ---- */
.app-main {
  padding: 24px 28px 60px;
  max-width: 1400px;
  margin: 0 auto;
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ---- Cards ---- */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  margin-bottom: 20px;
  border: 1px solid var(--grey-100);
}

.card-title {
  font-size: 17px;
  font-weight: 800;
  color: var(--navy);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ---- Stat grid ---- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  border-left: 5px solid var(--gold);
  box-shadow: var(--shadow-sm);
}
.stat-card .stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--grey-500);
  font-weight: 700;
  margin-bottom: 8px;
}
.stat-card .stat-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--navy);
  line-height: 1;
}
.stat-card .stat-sub {
  font-size: 12px;
  color: var(--grey-500);
  margin-top: 6px;
}
.stat-card.green  { border-left-color: var(--success); }
.stat-card.red    { border-left-color: var(--danger); }
.stat-card.blue   { border-left-color: var(--info); }
.stat-card.dark   { border-left-color: var(--navy); }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 10px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: transform .12s, box-shadow .12s;
  text-decoration: none;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-gold {
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  color: var(--navy);
  box-shadow: 0 4px 12px rgba(245,184,0,0.3);
}
.btn-navy { background: var(--navy); color: var(--white); }
.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-soft { background: var(--grey-100); color: var(--navy); }
.btn-sm { padding: 7px 12px; font-size: 12px; }

/* ---- Table ---- */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--grey-100);
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: var(--white);
}

table.data thead th {
  background: var(--navy);
  color: var(--white);
  padding: 12px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  white-space: nowrap;
}

table.data tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--grey-100);
  color: var(--text);
}

table.data tbody tr:hover { background: var(--grey-50); }
table.data tbody tr:last-child td { border-bottom: none; }

table.data td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data td.mono { font-family: ui-monospace, Menlo, monospace; font-size: 12px; }

/* ---- Badges ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.badge.yes     { background: var(--success-bg); color: var(--success); }
.badge.no      { background: var(--danger-bg); color: var(--danger); }
.badge.warn    { background: var(--warning-bg); color: var(--warning); }
.badge.info    { background: var(--info-bg); color: var(--info); }
.badge.gold    { background: rgba(245,184,0,0.15); color: var(--gold-dark); }
.badge.neutral { background: var(--grey-100); color: var(--grey-700); }

/* ---- Form ---- */
.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.field input, .field select, .field textarea {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid var(--grey-200);
  border-radius: 10px;
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--white);
  transition: border-color .12s, box-shadow .12s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 4px rgba(245,184,0,0.15);
}
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.field-hint {
  font-size: 11px;
  color: var(--grey-500);
  margin-top: 4px;
}

/* ---- Modal ---- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10,27,61,0.6);
  backdrop-filter: blur(4px);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 20px;
  z-index: 1000;
  overflow-y: auto;
}
.modal-backdrop.show { display: flex; }

.modal {
  background: var(--white);
  border-radius: var(--radius-lg);
  max-width: 720px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  border-top: 5px solid var(--gold);
  animation: slideDown .2s ease;
  margin: auto;
}
.modal.wide { max-width: 900px; }
@keyframes slideDown {
  from { transform: translateY(-20px); opacity: 0; }
  to   { transform: translateY(0);     opacity: 1; }
}

.modal-head {
  padding: 22px 26px 16px;
  border-bottom: 1px solid var(--grey-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-head h2 {
  font-size: 18px;
  font-weight: 800;
  color: var(--navy);
}
.modal-close {
  background: transparent;
  border: none;
  font-size: 22px;
  color: var(--grey-500);
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 8px;
  line-height: 1;
}
.modal-close:hover { background: var(--grey-100); color: var(--navy); }

.modal-body { padding: 22px 26px; }
.modal-foot {
  padding: 16px 26px 22px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid var(--grey-100);
}

/* ---- Toast ---- */
.toast-wrap {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 380px;
}
.toast {
  padding: 14px 18px;
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: var(--shadow-lg);
  border-left: 5px solid var(--gold);
  font-size: 13px;
  font-weight: 600;
  color: var(--navy);
  animation: slideIn .25s ease;
}
.toast.success { border-left-color: var(--success); }
.toast.error   { border-left-color: var(--danger); }
.toast.info    { border-left-color: var(--info); }
@keyframes slideIn {
  from { transform: translateX(120%); opacity: 0; }
  to   { transform: translateX(0);     opacity: 1; }
}

/* ---- Empty ---- */
.empty {
  text-align: center;
  padding: 50px 20px;
  color: var(--grey-500);
}
.empty .empty-icon {
  font-size: 42px;
  margin-bottom: 12px;
  opacity: 0.5;
}

/* ---- Loader ---- */
.loader {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: var(--white);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Progress bar (credits) ---- */
.credit-bar {
  height: 8px;
  background: var(--grey-100);
  border-radius: 100px;
  overflow: hidden;
  margin-top: 8px;
}
.credit-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--gold-light));
  border-radius: 100px;
  transition: width .4s;
}
.credit-bar-fill.low { background: linear-gradient(90deg, var(--danger), #f87171); }

/* ---- Responsive ---- */
@media (max-width: 720px) {
  .app-header { padding: 14px 16px; }
  .app-main { padding: 16px; }
  .tab-bar { padding: 0 12px; top: 62px; }
  .field-row { grid-template-columns: 1fr; }
  .modal { padding: 0; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .stat-card .stat-value { font-size: 22px; }
}