:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-2: #eff5ff;
  --text: #16324f;
  --muted: #67809b;
  --line: #dbe4ef;
  --primary: #0d6e6e;
  --primary-dark: #084d4d;
  --secondary: #ffb703;
  --danger: #d64545;
  --success: #2f855a;
  --info: #2b6cb0;
  --shadow: 0 18px 50px rgba(22, 50, 79, 0.08);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: radial-gradient(circle at top left, #fdf6e3 0%, var(--bg) 45%, #eef6f6 100%);
  color: var(--text);
}

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

img {
  max-width: 100%;
}

.page {
  min-height: 100vh;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
}

.auth-brand-stack {
  display: grid;
  grid-template-rows: auto auto;
  gap: 18px;
  padding: 18px 0 18px 18px;
}

.auth-brand {
  padding: 56px;
  background: linear-gradient(135deg, #0f766e, #164e63 70%);
  color: white;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-radius: 28px;
}

.auth-banner {
  overflow: hidden;
  border-radius: 28px;
  min-height: 260px;
}

.auth-banner-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.auth-brand h1 {
  font-size: 3rem;
  line-height: 1.05;
  margin: 0 0 12px;
}

.auth-brand p {
  color: rgba(255, 255, 255, 0.86);
  max-width: 520px;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.feature-card {
  padding: 18px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 18px;
  backdrop-filter: blur(10px);
}

.auth-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
}

.card {
  background: var(--surface);
  border: 1px solid rgba(219, 228, 239, 0.9);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.auth-card {
  width: min(100%, 460px);
  padding: 32px;
}

.brand-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  font-size: 0.92rem;
  margin-bottom: 24px;
}

.auth-card h2 {
  margin: 0 0 8px;
  font-size: 2rem;
}

.muted {
  color: var(--muted);
}

.form-grid {
  display: grid;
  gap: 16px;
}

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

.field label {
  font-weight: 600;
  font-size: 0.95rem;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 13px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  font: inherit;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 18px;
  border: none;
  border-radius: 14px;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  transition: 0.2s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
}

.btn-secondary {
  background: #eef6ff;
  color: var(--info);
}

.btn-danger {
  background: #fff1f1;
  color: var(--danger);
}

.btn-full {
  width: 100%;
}

.alert {
  padding: 14px 16px;
  border-radius: 14px;
  margin-bottom: 18px;
  font-size: 0.95rem;
}

.alert-success {
  background: #ecfdf3;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.alert-error {
  background: #fff1f2;
  color: #be123c;
  border: 1px solid #fecdd3;
}

.app-shell {
  display: grid;
  grid-template-columns: 290px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: linear-gradient(180deg, #16324f 0%, #0f172a 100%);
  color: #eef6ff;
  padding: 24px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar .logo {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
}

.sidebar .logo-badge {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #ffb703, #ffd166);
  color: #1f2937;
  font-weight: 800;
}

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

.nav-link {
  padding: 12px 14px;
  border-radius: 14px;
  color: rgba(238, 246, 255, 0.82);
}

.nav-link.active,
.nav-link:hover {
  background: rgba(255, 255, 255, 0.12);
  color: white;
}

.user-panel {
  margin-top: 24px;
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.08);
}

.main {
  padding: 26px;
}

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

.topbar h1 {
  margin: 0;
  font-size: 2rem;
}

.hero {
  padding: 24px;
  background: linear-gradient(135deg, #fff7ed 0%, #eff6ff 100%);
  margin-bottom: 22px;
}

.hero-grid,
.stats-grid,
.grid-2,
.grid-3 {
  display: grid;
  gap: 18px;
}

.hero-grid {
  grid-template-columns: 1.2fr 0.8fr;
}

.stats-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.stat-card,
.panel {
  padding: 22px;
}

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  margin-top: 10px;
}

.panel h3 {
  margin-top: 0;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

th {
  font-size: 0.9rem;
  color: var(--muted);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
}

.badge-success { background: #ecfdf3; color: #166534; }
.badge-info { background: #eff6ff; color: #1d4ed8; }
.badge-warning { background: #fff7ed; color: #c2410c; }
.badge-danger { background: #fff1f2; color: #be123c; }
.badge-muted { background: #f1f5f9; color: #475569; }

.progress {
  width: 100%;
  height: 12px;
  background: #e5edf6;
  border-radius: 999px;
  overflow: hidden;
}

.progress > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  border-radius: inherit;
}

.split {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

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

.kpi-list,
.report-bars {
  display: grid;
  gap: 14px;
}

.report-bar-label {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
  font-size: 0.92rem;
}

.empty-state {
  padding: 26px;
  text-align: center;
  color: var(--muted);
}

.footer-note {
  font-size: 0.9rem;
  color: var(--muted);
}

.filter-multiselect {
  min-height: 140px;
}

.selection-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.selection-chip {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: #eef6ff;
  color: var(--info);
  border: 1px solid #bfdbfe;
  font-size: 0.9rem;
  font-weight: 700;
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.pagination-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  font-weight: 700;
}

.pagination-link.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-color: transparent;
  color: #fff;
}

.pagination-link.disabled {
  pointer-events: none;
  opacity: 0.45;
}

.print-only {
  display: none;
}

@media (max-width: 1100px) {
  .app-shell,
  .auth-shell,
  .hero-grid,
  .stats-grid,
  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
  }

  .auth-brand-stack {
    padding: 18px 18px 0;
  }
}

@media (max-width: 760px) {
  .main,
  .auth-panel,
  .auth-brand {
    padding: 18px;
  }

  .topbar,
  .section-head,
  .split {
    flex-direction: column;
    align-items: flex-start;
  }

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

  th,
  td {
    min-width: 120px;
  }
}

@media print {
  .sidebar,
  .topbar .btn,
  .screen-only {
    display: none !important;
  }

  .print-only {
    display: block;
  }

  .app-shell {
    display: block;
  }

  .main {
    padding: 0;
  }

  .card,
  .panel,
  .hero {
    box-shadow: none;
    border: 1px solid #ddd;
  }
}
