:root {
  --primary: #041e42;
  --primary-2: #0b2f66;
  --secondary: #d61f26;
  --bg: #eef2f7;
  --card: #ffffff;
  --text: #132238;
  --muted: #66758c;
  --border: #d6deea;
  --shadow: 0 14px 36px rgba(4, 30, 66, 0.10);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

a { color: inherit; text-decoration: none; }

.app-shell { min-height: 100vh; display: flex; }

.sidebar {
  width: 300px;
  background: linear-gradient(180deg, var(--primary), var(--primary-2));
  color: #fff;
  padding: 18px;
}

.sidebar-shell {
  display: grid;
  gap: 18px;
}

.brand-card {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 24px;
  padding: 18px;
  box-shadow: 0 16px 36px rgba(0,0,0,0.12);
}

.brand { display: flex; align-items: center; gap: 14px; }

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--secondary);
  display: grid;
  place-items: center;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.brand-title { font-size: 1rem; font-weight: 700; }
.brand-subtitle { font-size: 0.85rem; color: rgba(255,255,255,0.75); }
.brand-copy { line-height: 1.1; }

.nav { display: grid; gap: 8px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border-radius: 12px;
  color: rgba(255,255,255,0.9);
  background: rgba(255,255,255,0.05);
  transition: 0.2s ease;
}

.nav-item:hover { background: rgba(255,255,255,0.14); }

.nav-item.active {
  background: #ffffff;
  color: var(--primary);
  border: 1px solid rgba(255,255,255,0.92);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
}

.nav-item.active .nav-subtitle {
  color: rgba(11, 31, 77, 0.72);
}

.nav-item.active .nav-icon {
  background: linear-gradient(180deg, #edf3ff, #dbe7ff);
  color: var(--primary);
  border-color: rgba(11, 31, 77, 0.08);
}

.nav-item.sub {
  margin-left: 10px;
  width: calc(100% - 10px);
  padding-left: 20px;
  font-size: 0.92rem;
  opacity: 0.96;
}

.nav-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: linear-gradient(180deg, rgba(255,255,255,0.16), rgba(255,255,255,0.08));
  border: 1px solid rgba(255,255,255,0.10);
  font-size: 0.85rem;
  font-weight: 800;
  flex: 0 0 auto;
}

.nav-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.nav-title {
  font-size: 0.96rem;
  font-weight: 700;
  line-height: 1.1;
}

.nav-subtitle {
  font-size: 0.74rem;
  color: rgba(255,255,255,0.68);
  line-height: 1.1;
}

.sidebar-group {
  display: grid;
  gap: 10px;
}

.sidebar-section-title {
  padding: 0 6px;
  font-size: 0.74rem;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.54);
}

.brand-status {
  margin-top: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  font-size: 0.8rem;
  color: rgba(255,255,255,0.88);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #34d399;
  box-shadow: 0 0 0 4px rgba(52,211,153,0.14);
}

.main { flex: 1; padding: 10px 14px; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 6px 10px;
  box-shadow: var(--shadow);
}
.topbar h1 { margin: 0; font-size: 1rem; line-height: 1.05; }
.topbar p { margin: 1px 0 0; color: var(--muted); font-size: 0.72rem; line-height: 1.05; }

.topbar-actions {
  display: flex;
  gap: 5px;
  flex-wrap: nowrap;
  align-items: center;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid rgba(24, 79, 188, 0.18);
  border-radius: 10px;
  padding: 5px 9px;
  background: linear-gradient(180deg, #184fbc, #0b2f66);
  color: #fff;
  font-weight: 800;
  font-size: 0.76rem;
  box-shadow: 0 10px 20px rgba(24, 79, 188, 0.16);
}

.action-btn::before {
  content: '+';
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-size: 0.92rem;
  font-weight: 900;
  line-height: 1;
  flex: 0 0 auto;
}

.action-btn.secondary {
  background: #fff;
  color: var(--primary);
}

.action-btn.secondary::before {
  background: rgba(4, 30, 66, 0.1);
  color: var(--primary);
}

.action-btn:hover {
  filter: brightness(1.02);
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 50;
}

.modal.is-open {
  display: block;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 30, 66, 0.42);
  backdrop-filter: blur(8px);
}

.modal-panel {
  position: relative;
  width: min(92vw, 860px);
  max-height: 88vh;
  overflow: auto;
  margin: 5vh auto;
  border-radius: 22px;
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: 0 30px 80px rgba(4, 30, 66, 0.18);
  padding: 22px;
}

.modal-panel .section-title {
  color: var(--text);
}

.modal-panel .helper-text {
  color: var(--muted);
}

.modal-panel .field label,
.modal-panel .field span {
  color: var(--primary);
}

.modal-panel .field input,
.modal-panel .field select,
.modal-panel .field textarea {
  background: #fff;
  color: var(--text);
  border-color: var(--border);
}

.modal-panel .field input::placeholder,
.modal-panel .field textarea::placeholder {
  color: #8b97a8;
}

.modal-panel .field input:focus,
.modal-panel .field select:focus,
.modal-panel .field textarea:focus {
  border-color: rgba(24, 79, 188, 0.55);
  box-shadow: 0 0 0 4px rgba(24, 79, 188, 0.10);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.modal-title {
  margin: 0;
  font-size: 1.35rem;
  color: var(--text);
}

.modal-subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.modal-close {
  border: 0;
  background: #f0f3fa;
  color: var(--primary);
  width: 42px;
  height: 42px;
  border-radius: 12px;
  font-size: 1.2rem;
  cursor: pointer;
}

.modal-close:hover {
  background: #e4ebf7;
}

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 20px;
  box-shadow: var(--shadow);
}

.stat-card {
  padding: 16px 18px;
}

.stat-card .card-value {
  font-size: 1.7rem;
  line-height: 1.1;
}

.stat-card.danger .card-value {
  color: #c81e1e;
}

.metric-card {
  position: relative;
  display: block;
  color: inherit;
  text-decoration: none;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.metric-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 28px rgba(4, 30, 66, 0.14);
}

.metric-card .metric-arrow {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: #f0f3fa;
  color: var(--primary);
  font-size: 1rem;
  font-weight: 900;
  line-height: 1;
}

.metric-card.danger .metric-arrow {
  background: #fde8e8;
  color: #c81e1e;
}

.metric-card .card-label {
  padding-right: 44px;
}

.card-label { color: var(--muted); font-size: 0.9rem; margin-bottom: 8px; }
.card-value { font-size: 2rem; font-weight: 800; color: var(--primary); }

.section { margin-top: 18px; }
.section-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 12px; }

.table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.table th, .table td { padding: 14px 16px; text-align: left; border-bottom: 1px solid var(--border); }
.table th { background: #edf3fa; color: var(--primary); }

.badge {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}

.badge.success { background: #e7f8ef; color: #1a7f37; }
.badge.warn { background: #fff4dd; color: #a66b00; }
.badge.danger { background: #fde8e8; color: #c81e1e; }

@media (max-width: 900px) {
  .app-shell { flex-direction: column; }
  .sidebar { width: 100%; }
}


.sidebar-chip {
  margin: 4px 0 18px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.88);
  font-size: 0.82rem;
  letter-spacing: 0.2px;
}

.sidebar-footer {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid rgba(255,255,255,0.12);
}

.logout-btn {
  width: 100%;
  border: 0;
  border-radius: 12px;
  padding: 12px 14px;
  background: rgba(255,255,255,0.10);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.logout-btn:hover {
  background: rgba(255,255,255,0.18);
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at top left, rgba(24,79,188,0.24), transparent 30%),
    radial-gradient(circle at bottom right, rgba(214,31,38,0.10), transparent 30%),
    linear-gradient(180deg, #06152f 0%, #041e42 48%, #081a33 100%);
}

.auth-card {
  width: min(100%, 460px);
  background: rgba(6, 21, 47, 0.84);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 24px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
  padding: 30px;
  color: #fff;
}

.auth-card--home {
  width: min(100%, 980px);
}

.auth-brand {
  display: grid;
  justify-items: center;
  text-align: center;
  margin-bottom: 18px;
}

.auth-mark {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  background: linear-gradient(180deg, #184fbc, #0b2f66);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
  letter-spacing: 0.5px;
  box-shadow: 0 12px 24px rgba(24,79,188,0.24);
}

.auth-kicker {
  font-size: 0.85rem;
  color: #8fb6ff;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.auth-brand h1 {
  margin: 0;
  font-size: 1.45rem;
  color: #fff;
}

.auth-lead {
  margin: 0 0 18px;
  color: rgba(255,255,255,0.78);
  line-height: 1.5;
}

.auth-error {
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(214, 31, 38, 0.16);
  color: #ffd9db;
  border: 1px solid rgba(214, 31, 38, 0.36);
  font-size: 0.95rem;
}

.auth-form {
  display: grid;
  gap: 14px;
}

.auth-form label {
  display: grid;
  gap: 8px;
  font-size: 0.92rem;
  color: rgba(255,255,255,0.92);
  font-weight: 600;
}

.auth-form span {
  color: #cfe0ff;
}

.auth-form input {
  width: 100%;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 14px;
  padding: 13px 14px;
  font-size: 1rem;
  outline: none;
  background: rgba(255,255,255,0.06);
  color: #fff;
}

.auth-form input:focus {
  border-color: rgba(143,182,255,0.7);
  box-shadow: 0 0 0 4px rgba(143,182,255,0.12);
}

.auth-button {
  margin-top: 6px;
  border: 0;
  border-radius: 14px;
  padding: 13px 16px;
  background: linear-gradient(180deg, #184fbc, #0b2f66);
  color: #fff;
  font-weight: 800;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: 0 12px 26px rgba(24,79,188,0.20);
}

.auth-button:hover {
  filter: brightness(1.03);
}

.auth-note {
  margin-top: 16px;
  font-size: 0.85rem;
  color: rgba(255,255,255,0.68);
  text-align: center;
}

.home-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: 16px;
  margin-top: 18px;
}

.home-panel {
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 20px;
  padding: 18px;
  background: rgba(255,255,255,0.05);
}

.home-panel--accent {
  background: linear-gradient(180deg, rgba(24,79,188,0.20), rgba(11,47,102,0.20));
}

.home-panel-title {
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: 0.2px;
  color: #d7e6ff;
  margin-bottom: 12px;
}

.home-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.home-tags span {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(255,255,255,0.09);
  border: 1px solid rgba(255,255,255,0.10);
  color: #fff;
  font-size: 0.84rem;
  font-weight: 700;
}

.home-copy {
  margin: 14px 0 0;
  color: rgba(255,255,255,0.78);
  line-height: 1.55;
}

.home-button {
  width: 100%;
  margin-top: 14px;
  text-align: center;
}

.home-meta {
  margin-top: 12px;
  color: rgba(255,255,255,0.68);
  font-size: 0.84rem;
}

.auth-shell--home .auth-brand {
  margin-bottom: 6px;
}

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


.page-stack {
  display: grid;
  gap: 8px;
}

.section-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 20px;
  box-shadow: var(--shadow);
}

.panel-form {
  display: grid;
  gap: 14px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}

.field {
  display: grid;
  gap: 8px;
}

.field label {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--primary);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 13px;
  font-size: 0.96rem;
  background: #fff;
  color: var(--text);
  outline: none;
}

.field textarea {
  min-height: 100px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: rgba(214,31,38,0.55);
  box-shadow: 0 0 0 4px rgba(214,31,38,0.10);
}

.panel-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.accounting-topbar-stack {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: nowrap;
}

.accounting-topbar-copy {
  display: grid;
  gap: 2px;
}

.accounting-month-picker {
  display: grid;
  gap: 4px;
  min-width: 180px;
}

.accounting-month-picker label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
}

.accounting-month-picker select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px 10px;
  background: #fff;
  color: var(--text);
  font-size: 0.82rem;
  outline: none;
}

.accounting-month-picker select:focus {
  border-color: rgba(24, 79, 188, 0.55);
  box-shadow: 0 0 0 4px rgba(24, 79, 188, 0.08);
}

.accounting-summary {
  margin-bottom: 6px;
}

.submit-btn {
  border: 0;
  border-radius: 14px;
  padding: 12px 16px;
  background: linear-gradient(180deg, var(--secondary), #ba1b22);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 12px 26px rgba(214,31,38,0.18);
}

.submit-btn:hover {
  filter: brightness(1.03);
}

.helper-text {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.badge-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}


.brand-mark-logo,
.auth-logo-mark {
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, #184fbc, #0b2f66);
}

.brand-shape,
.auth-logo-shape {
  position: absolute;
  inset: 18px;
  background: #fff;
  transform: rotate(45deg);
  border-radius: 2px;
}

.brand-shape::after,
.auth-logo-shape::after {
  content: '';
  position: absolute;
  inset: 10px;
  background: linear-gradient(180deg, #184fbc, #0b2f66);
  border-radius: 2px;
}

.brand-city {
  margin-top: 3px;
  font-size: 0.78rem;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.72);
}

.auth-logo {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 18px;
  border-radius: 20px;
  background: linear-gradient(180deg, #06152f, #0b2f66);
  color: #fff;
  margin-bottom: 18px;
}

.auth-logo-mark {
  width: 74px;
  height: 74px;
  border-radius: 12px;
  border: 2px solid rgba(255,255,255,0.12);
  box-shadow: 0 10px 24px rgba(4, 30, 66, 0.18);
  flex: 0 0 auto;
}

.auth-logo-copy {
  line-height: 1;
}

.auth-logo-top {
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: 0.8px;
}

.auth-logo-mid {
  font-size: 0.98rem;
  font-weight: 900;
  margin-top: 8px;
  letter-spacing: 0.4px;
  white-space: nowrap;
}

.auth-logo-bottom {
  font-size: 0.82rem;
  letter-spacing: 6px;
  margin-top: 10px;
  color: rgba(255,255,255,0.82);
}

html,
body {
  overflow-x: hidden;
}

@media (max-width: 900px) {
  .app-shell {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    padding: 14px;
  }

  .sidebar-shell {
    gap: 14px;
  }

  .brand-card {
    border-radius: 18px;
    padding: 14px;
  }

  .main {
    padding: 12px;
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
    height: auto;
    padding: 14px;
    margin-bottom: 12px;
  }

  .topbar-actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .topbar-actions .action-btn,
  .topbar-actions .badge {
    width: 100%;
  }

  .grid {
    grid-template-columns: 1fr;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .section-card,
  .card {
    padding: 16px;
  }

  .table {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .table th,
  .table td {
    white-space: nowrap;
  }

  .modal-panel {
    width: min(96vw, 860px);
    margin: 3vh auto;
    padding: 16px;
  }
}

@media (max-width: 640px) {
  .topbar h1 {
    font-size: 1.2rem;
  }

  .topbar p {
    font-size: 0.82rem;
  }

  .brand {
    gap: 10px;
  }

  .nav-item {
    padding: 11px 12px;
  }

  .nav-title {
    font-size: 0.92rem;
  }

  .nav-subtitle {
    font-size: 0.7rem;
  }

  .card-value {
    font-size: 1.5rem;
  }

  .modal-header {
    align-items: stretch;
  }

  .modal-close {
    align-self: flex-start;
  }
}
