:root {
  --primary: #00AEEF;
  --primary-dark: #0678C2;
  --primary-light: #2FD2FF;
  --dark-gray: #1C1C1E;
  --medium-gray: #6E6E73;
  --light-gray: #F2F2F7;
  --background: #F6FAFD;
  --white: #FFFFFF;
  --success: #34C759;
  --danger: #FF3B30;

  --border: rgba(28, 28, 30, 0.09);
  --border-soft: rgba(28, 28, 30, 0.06);
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-md: 0 4px 14px rgba(16, 24, 40, 0.08);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, 0.14);
  --sidebar-w: 252px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--background);
  color: var(--dark-gray);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; }

/* ---------- Shell / sidebar layout ---------- */

.shell {
  display: flex;
  align-items: flex-start;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  min-height: 100vh;
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  background: var(--white);
  border-right: 1px solid var(--border);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 22px 20px 16px;
}

.brand-logo {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  object-fit: cover;
  box-shadow: var(--shadow-sm);
}

.brand-name {
  font-weight: 800;
  font-size: 15.5px;
  letter-spacing: -0.2px;
  color: var(--primary-dark);
}

.sidebar-nav {
  flex: 1;
  padding: 6px 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.nav-section {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--medium-gray);
  font-weight: 800;
  padding: 16px 12px 6px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: 10px;
  color: var(--medium-gray);
  text-decoration: none;
  font-weight: 600;
  font-size: 13.5px;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.nav-link svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.nav-link:hover {
  background: var(--light-gray);
  color: var(--dark-gray);
}

.nav-link.active {
  background: var(--primary);
  color: var(--white);
  box-shadow: 0 6px 14px rgba(0, 174, 239, 0.32);
}

.sidebar-footer {
  padding: 10px 12px 16px;
  border-top: 1px solid var(--border);
}

.nav-link.logout { color: var(--danger); }
.nav-link.logout:hover { background: rgba(255, 59, 48, 0.08); color: var(--danger); }

.main-wrap { flex: 1; min-width: 0; }

main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 34px 40px 64px;
}

/* ---------- Typography ---------- */

h1 {
  font-size: 23px;
  font-weight: 800;
  letter-spacing: -0.3px;
  margin: 0 0 22px;
}

h2 {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 12px;
  color: var(--dark-gray);
}

h3 { font-size: 14.5px; font-weight: 700; margin: 0 0 12px; }

/* ---------- Stat cards ---------- */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  margin-bottom: 30px;
}

.card {
  background: var(--white);
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.cards .card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.card .value {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.4px;
  font-variant-numeric: tabular-nums;
}

.card .label {
  font-size: 12.5px;
  color: var(--medium-gray);
  font-weight: 600;
  margin-top: 5px;
}

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

.table-wrap {
  background: var(--white);
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
  margin-bottom: 8px;
}

table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
}

.table-wrap table { min-width: 100%; }

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

th {
  color: var(--medium-gray);
  font-weight: 700;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--light-gray);
}

tbody tr { transition: background 0.12s ease; }
tbody tr:hover { background: rgba(0, 174, 239, 0.045); }
tr:last-child td { border-bottom: none; }

td.actions, th:last-child { white-space: nowrap; }

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

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.badge.success { background: rgba(52, 199, 89, 0.14); color: #219a44; }
.badge.danger { background: rgba(255, 59, 48, 0.12); color: var(--danger); }
.badge.neutral { background: rgba(110, 110, 115, 0.14); color: var(--medium-gray); }
.badge.info { background: rgba(0, 174, 239, 0.14); color: var(--primary-dark); }

/* ---------- Filter pills ---------- */

.filters { margin-bottom: 16px; display: flex; gap: 8px; flex-wrap: wrap; }

.filters a {
  padding: 7px 14px;
  border-radius: 10px;
  background: var(--white);
  border: 1px solid var(--border-soft);
  color: var(--medium-gray);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.filters a:hover { border-color: var(--border); color: var(--dark-gray); }
.filters a.active { background: var(--primary); border-color: var(--primary); color: var(--white); box-shadow: var(--shadow-sm); }

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

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 17px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: var(--primary);
  color: var(--white);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
  transition: filter 0.15s ease, transform 0.05s ease, box-shadow 0.15s ease;
  box-shadow: 0 2px 8px rgba(0, 174, 239, 0.28);
}

.btn:hover { filter: brightness(0.94); }
.btn:active { transform: translateY(1px); }

.btn.danger { background: var(--danger); box-shadow: 0 2px 8px rgba(255, 59, 48, 0.25); }
.btn.outline {
  background: var(--white);
  color: var(--dark-gray);
  border-color: var(--border);
  box-shadow: none;
}
.btn.outline:hover { background: var(--light-gray); filter: none; }

form.inline { display: inline; }

/* ---------- Login ---------- */

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 30% 20%, var(--primary-light), transparent 55%),
              linear-gradient(135deg, var(--primary), var(--primary-dark));
}

.login-card {
  background: var(--white);
  border-radius: 24px;
  padding: 36px 32px;
  width: 340px;
  box-shadow: var(--shadow-lg);
}

.login-card h1 { text-align: center; color: var(--primary-dark); margin-bottom: 4px; }

.login-logo {
  display: block;
  width: 68px;
  height: 68px;
  border-radius: 18px;
  object-fit: cover;
  margin: 0 auto 14px;
  box-shadow: var(--shadow-sm);
}

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

.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 12.5px;
  color: var(--medium-gray);
  margin-bottom: 6px;
  font-weight: 700;
}

.field input, .field select, .field textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--light-gray);
  font-size: 14px;
  font-family: inherit;
  color: var(--dark-gray);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(0, 174, 239, 0.16);
}

.error {
  color: var(--danger);
  font-size: 13px;
  margin-bottom: 14px;
  padding: 10px 12px;
  background: rgba(255, 59, 48, 0.08);
  border-radius: 10px;
  font-weight: 600;
}

/* ---------- Misc content blocks ---------- */

.photos { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 20px; }
.photos figure { margin: 0; }
.photos img {
  width: 220px;
  height: 160px;
  object-fit: cover;
  border-radius: 14px;
  background: var(--light-gray);
  border: 1px solid var(--border-soft);
  cursor: zoom-in;
  transition: transform 0.15s ease;
}
.photos img:hover { transform: scale(1.03); }
.photos figcaption { font-size: 12px; color: var(--medium-gray); margin-top: 6px; text-align: center; }

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(10, 12, 16, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  cursor: zoom-out;
}
.lightbox[hidden] { display: none; }
.lightbox img {
  max-width: 88vw;
  max-height: 88vh;
  object-fit: contain;
  border-radius: 8px;
  cursor: zoom-in;
  box-shadow: var(--shadow-lg);
}

.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 24px; margin-bottom: 22px; }
.detail-grid .k { color: var(--medium-gray); font-size: 12.5px; font-weight: 600; }
.detail-grid .v { font-weight: 700; font-size: 14px; }

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

.place-pin { vertical-align: -2px; margin-right: 2px; }

.stars { color: #F5A623; letter-spacing: 1px; font-size: 14px; }

/* ---------- Avatars ---------- */

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-light), var(--primary-dark));
  color: var(--white);
  font-weight: 700;
  flex-shrink: 0;
  object-fit: cover;
  overflow: hidden;
}

.avatar.sm { width: 32px; height: 32px; font-size: 12px; }
.avatar.lg { width: 84px; height: 84px; font-size: 28px; box-shadow: var(--shadow-md); }

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

.profile-header {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 22px;
}

.profile-header .name { font-size: 19px; font-weight: 800; letter-spacing: -0.2px; }
.profile-header .sub { font-size: 13px; color: var(--medium-gray); margin-top: 3px; }

/* ---------- Dashboard charts ---------- */

.stat-charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
  align-items: stretch;
}

.chart-card {
  background: var(--white);
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.chart-card h2 { margin-bottom: 16px; }

.donut-wrap { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }

.donut-center-value { font-size: 22px; font-weight: 800; fill: var(--dark-gray); }
.donut-center-label { font-size: 10px; fill: var(--medium-gray); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }

.chart-legend { list-style: none; margin: 0; padding: 0; flex: 1; min-width: 160px; }
.chart-legend li {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 12.5px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border-soft);
}
.chart-legend li:last-child { border-bottom: none; }
.chart-legend .dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.chart-legend .lbl { flex: 1; color: var(--dark-gray); font-weight: 600; }
.chart-legend .num { font-weight: 800; font-variant-numeric: tabular-nums; }
.chart-legend .pct { color: var(--medium-gray); font-size: 11px; min-width: 36px; text-align: right; }

.bar-rows { display: flex; flex-direction: column; gap: 12px; }
.bar-row .bar-top { display: flex; justify-content: space-between; font-size: 12.5px; margin-bottom: 5px; }
.bar-row .bar-top .lbl { font-weight: 600; color: var(--dark-gray); }
.bar-row .bar-top .num { font-weight: 800; font-variant-numeric: tabular-nums; }
.bar-track { height: 9px; border-radius: 6px; background: var(--light-gray); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 6px; transition: width 0.3s ease; }

.trend-chart {
  display: flex;
  align-items: flex-end;
  gap: 5px;
  height: 140px;
  padding-top: 8px;
}
.trend-bar-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  gap: 6px;
}
.trend-bar {
  width: 100%;
  max-width: 22px;
  border-radius: 4px 4px 0 0;
  background: linear-gradient(180deg, var(--primary-light), var(--primary));
  min-height: 3px;
  transition: height 0.3s ease;
}
.trend-day { font-size: 9.5px; color: var(--medium-gray); font-weight: 600; white-space: nowrap; }

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

@media (max-width: 880px) {
  .shell { flex-direction: column; }
  .sidebar {
    position: static;
    width: 100%;
    min-height: auto;
    flex-direction: row;
    align-items: center;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .sidebar-brand { padding: 14px 16px; }
  .sidebar-nav { flex-direction: row; overflow-x: auto; padding: 6px 10px; }
  .nav-section { display: none; }
  .nav-link span { display: none; }
  .nav-link { padding: 10px; }
  .sidebar-footer { border-top: none; padding: 10px; }
  main { padding: 22px 18px 48px; }
}
