/* Reset & Base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #003f7f;
  --primary-light: #0056b3;
  --accent: #c8a415;
  --bg: #f4f6f9;
  --surface: #ffffff;
  --text: #1a1a2e;
  --text-muted: #6c757d;
  --danger: #dc3545;
  --success: #28a745;
  --warning: #ffc107;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --nav-height: 64px;
  --header-height: 56px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100dvh;
  overflow: hidden;
}

/* Screens */
.screen { position: fixed; inset: 0; }
.screen.hidden { display: none; }
.screen.active { display: flex; flex-direction: column; }

/* ── Login ── */
.login-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: 2rem;
  background: linear-gradient(160deg, var(--primary) 0%, #001f3f 100%);
}

.login-logo { text-align: center; margin-bottom: 2.5rem; color: #fff; }
.login-logo h1 { font-size: 2rem; font-weight: 700; letter-spacing: 1px; }
.login-logo p { color: rgba(255,255,255,0.6); margin-top: 0.25rem; }

#form-login {
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.form-group { display: flex; flex-direction: column; gap: 0.4rem; }
.form-group label { color: rgba(255,255,255,0.8); font-size: 0.875rem; }
.form-group input {
  padding: 0.8rem 1rem;
  border-radius: var(--radius);
  border: 1.5px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.1);
  color: #fff;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}
.form-group input:focus { border-color: var(--accent); }
.form-group input::placeholder { color: rgba(255,255,255,0.4); }

.btn-primary {
  padding: 0.9rem;
  border-radius: var(--radius);
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 0.5rem;
  transition: opacity 0.2s;
}
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.error-msg {
  background: rgba(220,53,69,0.2);
  border: 1px solid var(--danger);
  color: #fff;
  padding: 0.7rem 1rem;
  border-radius: 8px;
  font-size: 0.875rem;
}
.hidden { display: none !important; }

/* ── App Shell ── */
.app-header {
  height: var(--header-height);
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  padding: 0 1rem;
  gap: 0.75rem;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.header-left, .header-right { min-width: 60px; }
.header-right { text-align: right; font-size: 0.8rem; color: rgba(255,255,255,0.7); }
.header-title { flex: 1; text-align: center; font-weight: 600; font-size: 1rem; }

.icon-btn {
  background: none;
  border: none;
  color: #fff;
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0.25rem;
}

.app-content {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  padding-bottom: calc(var(--nav-height) + 1rem);
}

/* ── Bottom Nav ── */
.bottom-nav {
  height: var(--nav-height);
  background: var(--surface);
  border-top: 1px solid #e0e0e0;
  display: flex;
  flex-shrink: 0;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.06);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.65rem;
  transition: color 0.2s;
  padding: 0.5rem 0;
}
.nav-item.active { color: var(--primary); }
.nav-icon { font-size: 1.4rem; line-height: 1; }

/* ── Cards ── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
}
.card-title { font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 0.5rem; }
.card-value { font-size: 1.75rem; font-weight: 700; color: var(--primary); }
.card-sub { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.2rem; }

.cards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

/* ── Forms ── */
.page-form { display: flex; flex-direction: column; gap: 1rem; }
.field { display: flex; flex-direction: column; gap: 0.35rem; }
.field label { font-size: 0.875rem; font-weight: 500; color: var(--text); }
.field input, .field select, .field textarea {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  border: 1.5px solid #dde1e7;
  font-size: 1rem;
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary); }
.field textarea { resize: vertical; min-height: 80px; }

.btn-submit {
  padding: 0.875rem;
  border-radius: var(--radius);
  border: none;
  background: var(--primary);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-submit:hover { background: var(--primary-light); }
.btn-submit:disabled { opacity: 0.6; cursor: not-allowed; }

/* ── Status Badges ── */
.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-pending  { background: #fff3cd; color: #856404; }
.badge-approved { background: #d1e7dd; color: #0a3622; }
.badge-rejected { background: #f8d7da; color: #58151c; }

/* ── News ── */
.news-item {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 0.75rem;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--primary);
}
.news-item h3 { font-size: 1rem; margin-bottom: 0.25rem; }
.news-item .news-date { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 0.5rem; }
.news-item p { font-size: 0.9rem; color: var(--text-muted); }

/* ── Loading ── */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  color: var(--text-muted);
}

.spinner {
  width: 32px; height: 32px;
  border: 3px solid #dde1e7;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Toast ── */
#toast {
  position: fixed;
  bottom: calc(var(--nav-height) + 1rem);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #1a1a2e;
  color: #fff;
  padding: 0.75rem 1.5rem;
  border-radius: 24px;
  font-size: 0.875rem;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  z-index: 1000;
  pointer-events: none;
  white-space: nowrap;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.success { background: var(--success); }
#toast.error { background: var(--danger); }
