:root {
  --bg: #f2f6fb;
  --surface: #ffffff;
  --surface-2: #e9eef5;
  --text: #10253f;
  --muted: #5c748d;
  --primary: #1f6feb;
  --primary-dark: #0f4fbb;
  --accent: #0b1f33;
  --success: #1aa874;
  --info: #0ea5e9;
  --warning: #f59e0b;
  --danger: #e11d48;
  --border: #d9e3ee;
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;
  --shadow: 0 18px 40px rgba(9, 24, 42, 0.1);
  --shadow-sm: 0 6px 16px rgba(9, 24, 42, 0.07);
  --shadow-hover: 0 22px 48px rgba(9, 24, 42, 0.16);
  --ease: cubic-bezier(0.2, 0.7, 0.3, 1);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Inter", "Segoe UI", sans-serif;
  background: linear-gradient(160deg, #f7fbff 0%, #eef3fa 45%, #e9f0f9 100%);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

/* ---------------------------------------------------------------------- */
/* Layout shell                                                           */
/* ---------------------------------------------------------------------- */

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

.main-content {
  padding: 28px 32px 40px;
  min-width: 0;
}

/* ---------------------------------------------------------------------- */
/* Sidebar                                                                */
/* ---------------------------------------------------------------------- */

.sidebar {
  background: linear-gradient(180deg, #071625 0%, #12293f 55%, #15324f 100%);
  color: #fff;
  padding: 26px 18px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

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

.brand-block h3,
.brand-block p {
  margin: 0;
}

.brand-block h3 {
  font-size: 16px;
  letter-spacing: 0.01em;
}

.brand-block p {
  color: #9fb4cc;
  font-size: 12px;
}

.sidebar-search {
  position: relative;
  display: flex;
  align-items: center;
}

.sidebar-search .icon {
  position: absolute;
  left: 12px;
  width: 15px;
  height: 15px;
  color: #7d93ac;
  pointer-events: none;
}

.sidebar-search input {
  width: 100%;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  border-radius: 10px;
  padding: 9px 12px 9px 34px;
  font: inherit;
  font-size: 13px;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease);
}

.sidebar-search input::placeholder {
  color: #8298b2;
}

.sidebar-search input:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.28);
}

.nav-links {
  display: grid;
  gap: 4px;
  flex: 1;
}

.nav-links a {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #b9c9de;
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  position: relative;
  transition: background 0.18s var(--ease), color 0.18s var(--ease), transform 0.18s var(--ease);
}

.nav-links a .icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.85;
}

.nav-links a:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  transform: translateX(2px);
}

.nav-links a.active {
  background: linear-gradient(135deg, rgba(31, 111, 235, 0.9), rgba(15, 79, 187, 0.9));
  color: #fff;
  box-shadow: 0 8px 20px rgba(15, 79, 187, 0.35);
}

.nav-links a.active .icon {
  opacity: 1;
}

.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  border-radius: 999px;
  padding: 1px 7px;
  line-height: 1.5;
}

.sidebar-card {
  padding: 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: grid;
  gap: 12px;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-user strong,
.sidebar-user small {
  display: block;
}

.sidebar-user strong {
  color: #fff;
  font-size: 13px;
  line-height: 1.3;
}

.sidebar-user small {
  color: #9fb4cc;
  font-size: 12px;
}

.avatar {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #59a0ff);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.02em;
  box-shadow: 0 6px 14px rgba(31, 111, 235, 0.35);
}

.avatar-sm {
  width: 28px;
  height: 28px;
  font-size: 11px;
}

.sidebar-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
}

.sidebar-logout .icon {
  width: 15px;
  height: 15px;
}

.mobile-nav-toggle {
  display: none;
}

.sidebar-backdrop {
  display: none;
}

/* ---------------------------------------------------------------------- */
/* Topbar                                                                 */
/* ---------------------------------------------------------------------- */

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

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 11px;
  font-weight: 700;
  color: var(--primary);
  margin: 0 0 4px;
}

.topbar h1,
.hero-card h2,
.panel h3 {
  margin: 0;
}

.topbar h1 {
  font-size: 26px;
  letter-spacing: -0.01em;
}

/* ---------------------------------------------------------------------- */
/* Buttons                                                                */
/* ---------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: none;
  border-radius: 999px;
  padding: 10px 18px;
  font-weight: 600;
  font-size: 14px;
  font-family: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s var(--ease), box-shadow 0.15s var(--ease), background 0.15s var(--ease);
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  box-shadow: 0 10px 22px rgba(31, 111, 235, 0.28);
}

.btn-primary:hover {
  box-shadow: 0 14px 28px rgba(31, 111, 235, 0.36);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
}

.btn-secondary:hover {
  background: #dde6f1;
}

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

.btn-danger:hover {
  background: #ffe4e6;
}

.btn-sm {
  padding: 6px 13px;
  font-size: 13px;
}

/* ---------------------------------------------------------------------- */
/* Cards / panels                                                        */
/* ---------------------------------------------------------------------- */

.hero-card,
.panel,
.auth-card,
.form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.hero-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 26px 28px;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
}

.hero-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 100% 0%, rgba(31, 111, 235, 0.08), transparent 55%);
  pointer-events: none;
}

.hero-card p {
  color: var(--muted);
}

.hero-pill {
  background: #e8f2ff;
  color: var(--primary-dark);
  padding: 10px 16px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card {
  border-radius: var(--radius);
  color: #fff;
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
  box-shadow: var(--shadow-sm);
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
}

.stat-card p,
.stat-card strong {
  display: block;
  margin: 0;
  position: relative;
}

.stat-card p {
  opacity: 0.92;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-card strong {
  font-size: 28px;
  margin-top: 10px;
  letter-spacing: -0.01em;
}

.stat-card .icon {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 34px;
  height: 34px;
  opacity: 0.28;
}

.stat-card.primary {
  background: linear-gradient(135deg, var(--primary), #3e8cff);
}
.stat-card.success {
  background: linear-gradient(135deg, var(--success), #1ebc7a);
}
.stat-card.info {
  background: linear-gradient(135deg, var(--info), #38bdf8);
}
.stat-card.warning {
  background: linear-gradient(135deg, var(--warning), #fbbd24);
}

.content-grid {
  display: grid;
  grid-template-columns: 1.4fr 0.9fr;
  gap: 16px;
}

.panel {
  padding: 22px;
  transition: box-shadow 0.2s var(--ease);
}

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

.panel-header h3 {
  font-size: 16px;
}

.panel-header a {
  color: var(--primary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
}

a {
  color: var(--primary);
  font-weight: 700;
  text-decoration: none;
}

.activity-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 4px;
}

.activity-list li {
  padding: 13px 8px;
  border-bottom: 1px solid var(--border);
  border-radius: 10px;
  transition: background 0.15s var(--ease);
}

.activity-list li:hover {
  background: #f7fafd;
}

.activity-list li:last-child {
  border-bottom: none;
}

.activity-list .empty-row {
  color: var(--muted);
  font-size: 14px;
}

.activity-list span,
.alert-box strong {
  display: block;
  font-weight: 600;
}

.activity-list small,
.alert-box p {
  color: var(--muted);
}

.activity-list small {
  display: block;
  margin-top: 2px;
}

.activity-list p {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.read-row {
  opacity: 0.6;
}

/* ---------------------------------------------------------------------- */
/* Alerts / toasts                                                       */
/* ---------------------------------------------------------------------- */

.alert-box {
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  background: #f2f7ff;
  margin-bottom: 10px;
  border-left: 4px solid var(--primary);
  animation: alert-in 0.25s var(--ease);
}

@keyframes alert-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.alert-box.muted {
  background: #f9fbfd;
  border-left-color: var(--muted);
}

.alert-box.success {
  background: #eafbf4;
  border-left-color: var(--success);
}

.alert-box.success strong {
  color: var(--success);
}

.alert-box.danger {
  background: #fff1f2;
  border-left-color: var(--danger);
}

.alert-box.danger strong {
  color: var(--danger);
}

/* ---------------------------------------------------------------------- */
/* Auth pages                                                            */
/* ---------------------------------------------------------------------- */

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(circle at 15% 10%, rgba(31, 111, 235, 0.12), transparent 45%),
    radial-gradient(circle at 85% 90%, rgba(26, 168, 116, 0.1), transparent 45%),
    linear-gradient(160deg, #eef7ff 0%, #f7fafc 55%, #eef3f8 100%);
}

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

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.auth-brand h2,
.auth-brand p {
  margin: 0;
}

.auth-copy {
  color: var(--muted);
  margin-bottom: 20px;
}

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

.auth-form label {
  font-weight: 600;
  font-size: 14px;
}

.auth-form input,
.form-grid input,
.form-grid select,
.form-grid textarea,
.search-form input {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 11px 14px;
  font: inherit;
  background: #fbfdff;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
  width: 100%;
}

.auth-form input:focus,
.form-grid input:focus,
.form-grid select:focus,
.form-grid textarea:focus,
.search-form input:focus,
.status-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(31, 111, 235, 0.14);
}

.auth-form .btn {
  margin-top: 6px;
  justify-content: center;
}

.auth-footer {
  margin-top: 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.auth-footer code {
  background: #f2f7ff;
  color: var(--primary-dark);
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 12px;
}

/* ---------------------------------------------------------------------- */
/* Tables                                                                 */
/* ---------------------------------------------------------------------- */

.data-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

.data-table th,
.data-table td {
  text-align: left;
  padding: 13px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.data-table th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 700;
}

.data-table tbody tr {
  transition: background 0.15s var(--ease);
}

.data-table tbody tr:hover {
  background: #f7fafd;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

/* ---------------------------------------------------------------------- */
/* Badges / pills                                                        */
/* ---------------------------------------------------------------------- */

.badge {
  background: #eef6ff;
  color: var(--primary);
  padding: 7px 13px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
}

.status-pill {
  display: inline-block;
  background: #eafbf4;
  color: var(--success);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  text-transform: capitalize;
  letter-spacing: 0.01em;
}

.status-pill.danger {
  background: #fff1f2;
  color: var(--danger);
}

.status-pill.scheduled {
  background: #eef6ff;
  color: var(--primary-dark);
}

.status-pill.confirmed {
  background: #eafbf4;
  color: var(--success);
}

.status-pill.completed {
  background: #eef2ff;
  color: #4338ca;
}

.status-pill.cancelled,
.status-pill.pending {
  background: #fff1f2;
  color: var(--danger);
}

.status-pill.partial {
  background: #fff7ed;
  color: #b45309;
}

.status-pill.paid {
  background: #eafbf4;
  color: var(--success);
}

.empty-state {
  color: var(--muted);
  margin: 12px 0 0;
  font-size: 14px;
}

.brand-logo {
  width: 52px;
  height: 52px;
  object-fit: contain;
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.16);
  padding: 6px;
}

/* ---------------------------------------------------------------------- */
/* Forms                                                                  */
/* ---------------------------------------------------------------------- */

.form-card {
  padding: 24px;
  margin-top: 16px;
  margin-bottom: 20px;
}

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

.form-grid label {
  display: grid;
  gap: 6px;
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
}

.form-grid .full-width {
  grid-column: 1 / -1;
}

.form-actions {
  margin-top: 4px;
  display: flex;
  gap: 10px;
}

.search-form {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}

.search-form input {
  flex: 1;
}

.inline-form {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.status-select {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 8px;
  font: inherit;
  font-size: 13px;
  background: #fbfdff;
}

/* ---------------------------------------------------------------------- */
/* Misc components                                                       */
/* ---------------------------------------------------------------------- */

.secondary-stats {
  margin-top: 16px;
}

.metric-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.metric-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.metric-card span,
.metric-card strong {
  display: block;
}

.metric-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.metric-card strong {
  margin-top: 9px;
  font-size: 24px;
  letter-spacing: -0.01em;
}

.profile-grid,
.chart-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 16px;
  margin-bottom: 16px;
}

.detail-list {
  display: grid;
  gap: 12px;
  margin: 0;
}

.detail-list div {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.detail-list div:last-child {
  border-bottom: none;
}

.detail-list dt {
  color: var(--muted);
  font-weight: 700;
  font-size: 13px;
}

.detail-list dd {
  margin: 0;
}

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

.bar-list {
  display: grid;
  gap: 10px;
}

.bar-list div {
  position: relative;
  min-height: 42px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: #f8fbff;
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  isolation: isolate;
}

.bar-list div::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--value);
  background: linear-gradient(90deg, rgba(31, 111, 235, 0.22), rgba(26, 168, 116, 0.18));
  z-index: -1;
  transition: width 0.4s var(--ease);
}

.demo-account-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
}

.demo-account-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 4px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.demo-account-list li:last-child {
  border-bottom: none;
}

.demo-account-list code {
  background: #f2f7ff;
  color: var(--primary-dark);
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 13px;
}

.unread-badge {
  display: inline-block;
  background: var(--danger);
  color: #fff;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  margin-left: 6px;
  vertical-align: middle;
}

.icon {
  width: 18px;
  height: 18px;
  display: inline-block;
  vertical-align: middle;
}

/* ---------------------------------------------------------------------- */
/* Responsive                                                            */
/* ---------------------------------------------------------------------- */

@media (max-width: 900px) {
  .page-shell {
    grid-template-columns: 1fr;
  }

  .mobile-nav-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    position: sticky;
    top: 0;
    z-index: 30;
    width: 100%;
    padding: 14px 20px;
    background: #071625;
    color: #fff;
    border: none;
    font: inherit;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
  }

  .mobile-nav-toggle .icon {
    width: 18px;
    height: 18px;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 82%;
    max-width: 320px;
    z-index: 40;
    transform: translateX(-100%);
    transition: transform 0.25s var(--ease);
    box-shadow: var(--shadow-hover);
  }

  body.nav-open .sidebar {
    transform: translateX(0);
  }

  body.nav-open .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(7, 22, 37, 0.45);
    z-index: 35;
  }

  .stats-grid,
  .content-grid,
  .profile-grid,
  .chart-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .main-content {
    padding: 16px;
  }

  .stats-grid,
  .content-grid,
  .profile-grid,
  .chart-grid {
    grid-template-columns: 1fr;
  }

  .hero-card,
  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

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

  .detail-list div {
    grid-template-columns: 1fr;
  }

  .topbar-actions {
    width: 100%;
  }
}
