:root {
  --bg: #0b1220;
  --bg-elevated: #111827;
  --surface: #ffffff;
  --surface-muted: #f8fafc;
  --border: #e2e8f0;
  --text: #0f172a;
  --text-muted: #64748b;
  --primary: #0ea5e9;
  --primary-dark: #0284c7;
  --accent: #22d3ee;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --sidebar-w: 260px;
  --radius: 14px;
  --shadow: 0 10px 40px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 20px 50px rgba(15, 23, 42, 0.12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--surface-muted);
  color: var(--text);
  line-height: 1.5;
}

a { color: var(--primary-dark); text-decoration: none; }
a:hover { color: var(--primary); }

/* Auth / public pages */
.auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: linear-gradient(135deg, #0b1220 0%, #1e3a5f 50%, #0c4a6e 100%);
}

.auth-hero {
  padding: 3rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  color: #e2e8f0;
}

.auth-hero h1 {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0 0 1rem;
  background: linear-gradient(90deg, #fff, #7dd3fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.auth-hero ul { padding-left: 1.2rem; color: #94a3b8; }
.auth-hero li { margin-bottom: 0.5rem; }

.auth-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: rgba(255,255,255,0.03);
  backdrop-filter: blur(8px);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 2rem;
}

.public-page {
  min-height: 100vh;
  background: linear-gradient(160deg, #f0f9ff 0%, #e0f2fe 40%, #f8fafc 100%);
  padding: 2rem 1rem 4rem;
}

.public-wrap {
  max-width: 1100px;
  margin: 0 auto;
}

/* App shell */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.app-sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, #0b1220 0%, #111827 100%);
  color: #cbd5e1;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(255,255,255,0.06);
  transition: transform 0.25s ease;
}

.sidebar-brand {
  padding: 1.25rem 1.5rem;
  font-weight: 800;
  font-size: 1.15rem;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.sidebar-brand span {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: grid;
  place-items: center;
  font-size: 1rem;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 0.75rem;
}

.nav-section {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #64748b;
  padding: 0.75rem 0.75rem 0.35rem;
  margin-top: 0.5rem;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  color: #94a3b8;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.15s;
}

.sidebar-nav a:hover {
  background: rgba(255,255,255,0.06);
  color: #fff;
}

.sidebar-nav a.active {
  background: linear-gradient(90deg, rgba(14,165,233,0.25), rgba(34,211,238,0.1));
  color: #fff;
  border: 1px solid rgba(14,165,233,0.35);
}

.sidebar-nav .badge-notify {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 0.7rem;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  min-width: 1.25rem;
  text-align: center;
}

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,0.06);
  font-size: 0.8rem;
}

.sidebar-user {
  color: #fff;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.sidebar-role {
  color: #64748b;
  font-size: 0.75rem;
  text-transform: capitalize;
}

.app-main {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-width: 0;
}

.app-topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.app-topbar h1 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.app-content {
  padding: 1.5rem;
  max-width: 1400px;
}

.mobile-toggle {
  display: none;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
}

/* Cards & stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.stat-card .label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

.stat-card .value {
  font-size: 1.75rem;
  font-weight: 800;
  margin-top: 0.25rem;
  letter-spacing: -0.03em;
}

.stat-card.primary .value { color: var(--primary-dark); }
.stat-card.success .value { color: var(--success); }
.stat-card.warning .value { color: var(--warning); }

.panel {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  margin-bottom: 1.5rem;
  overflow: hidden;
}

.panel-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.panel-header h2, .panel-header h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
}

.panel-body { padding: 1.25rem; }

/* Forms */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.form-control, .form-select {
  width: 100%;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 0.95rem;
  font-family: inherit;
  background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-control:focus, .form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15);
}

.service-check {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 0.5rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.service-check:hover {
  border-color: var(--primary);
  background: #f0f9ff;
}

.service-check input { width: 1.1rem; height: 1.1rem; accent-color: var(--primary); }

.service-check .price {
  margin-left: auto;
  font-weight: 700;
  color: var(--primary-dark);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 1.1rem;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  border: none;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.15s;
}

.btn:active { transform: scale(0.98); }

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  box-shadow: 0 4px 14px rgba(14, 165, 233, 0.35);
}

.btn-primary:hover { filter: brightness(1.05); color: #fff; }

.btn-success { background: var(--success); color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-secondary { background: #e2e8f0; color: var(--text); }
.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.8rem; }
.btn-lg { padding: 0.75rem 1.5rem; font-size: 1rem; }
.w-100 { width: 100%; }

/* Tables */
.table-wrap { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.data-table th {
  text-align: left;
  padding: 0.75rem 1rem;
  background: var(--surface-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 700;
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data-table tbody tr:hover { background: #f8fafc; }

/* Badges & alerts */
.badge {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-success { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-info { background: #e0f2fe; color: #075985; }

.alert {
  padding: 0.85rem 1rem;
  border-radius: 10px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.alert-info { background: #e0f2fe; color: #0c4a6e; border: 1px solid #7dd3fc; }
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }
.alert-danger { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }

.empty-state {
  text-align: center;
  padding: 2.5rem;
  color: var(--text-muted);
}

.dash-pay-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
}

.dash-pay-card {
  padding: 1rem 1.15rem;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.dash-pay-card__label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.dash-pay-card__value {
  margin-top: 0.35rem;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text);
}

.dash-pay-card__meta {
  margin-top: 0.2rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.dash-bonuri-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

@media (max-width: 960px) {
  .dash-bonuri-grid {
    grid-template-columns: 1fr;
  }
}

.data-table th.num,
.data-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.text-warning {
  color: #b45309;
}

.casa-ops-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

@media (max-width: 800px) {
  .casa-ops-grid {
    grid-template-columns: 1fr;
  }
}

.app-footer {
  text-align: center;
  padding: 1.5rem;
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* FullCalendar */
#calendar .fc-toolbar-title { font-size: 1.25rem; font-weight: 700; }
#calendar .fc-button-primary {
  background: var(--primary);
  border-color: var(--primary-dark);
}
#calendar .fc-button-primary:not(:disabled).fc-button-active,
#calendar .fc-button-primary:not(:disabled):active {
  background: var(--primary-dark);
}
#calendar .fc-event { border-radius: 6px; font-size: 0.8rem; padding: 2px 4px; }

@media (max-width: 992px) {
  .auth-page { grid-template-columns: 1fr; }
  .auth-hero { display: none; }

  .app-sidebar {
    transform: translateX(-100%);
  }

  .app-sidebar.open {
    transform: translateX(0);
  }

  .app-main { margin-left: 0; }
  .mobile-toggle { display: inline-flex; }
}
