:root {
  --bg: #0b1220;
  --card: #121b2e;
  --muted: #7f8aa3;
  --text: #e7ecf6;
  --line: #22304f;
  --accent: #4f8cff;
  --good: #2bd576;
  --warn: #ffcc66;
  --bad: #ff6b6b;
  --radius: 14px;
  --bg-gradient: linear-gradient(180deg, #070b14 0%, #0b1220 40%, #070b14 100%);
  --sidebar-bg: rgba(18, 27, 46, .55);
  --glass-bg: rgba(18, 27, 46, .55);
  --input-bg: rgba(9, 14, 26, .55);
  --table-bg: rgba(9, 14, 26, .35);
}

:root[data-theme="light"] {
  --bg: #f8fafc;
  --card: #ffffff;
  --muted: #64748b;
  --text: #0f172a;
  --line: #e2e8f0;
  --accent: #2563eb;
  --good: #10b981;
  --warn: #f59e0b;
  --bad: #ef4444;
  --bg-gradient: linear-gradient(180deg, #f1f5f9 0%, #f8fafc 40%, #f1f5f9 100%);
  --sidebar-bg: rgba(255, 255, 255, .8);
  --glass-bg: rgba(255, 255, 255, .8);
  --input-bg: #ffffff;
  --table-bg: #f1f5f9;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg-gradient);
  transition: background 0.3s, color 0.3s;
}

a {
  color: inherit;
}

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

.sidebar {
  padding: 18px 14px;
  border-right: 1px solid var(--line);
  background: var(--sidebar-bg);
  backdrop-filter: blur(6px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px 18px;
}

.logo {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: radial-gradient(circle at 30% 30%, #7bb1ff 0%, #4f8cff 40%, #2a4a9c 100%);
  box-shadow: 0 10px 30px rgba(79, 140, 255, .25);
}

.brand h1 {
  margin: 0;
  font-size: 14px;
  letter-spacing: .2px;
  line-height: 1.1;
}

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

.nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0 6px;
}

.nav button {
  all: unset;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 10px;
  border-radius: 12px;
  color: var(--text);
  border: 1px solid transparent;
  transition: all 0.2s;
}

.nav button:hover {
  background: rgba(127, 138, 163, .1);
  border-color: rgba(127, 138, 163, .2);
}

.nav button.active {
  background: rgba(79, 140, 255, .12);
  border-color: rgba(79, 140, 255, .25);
  color: var(--accent);
}

.pill {
  font-size: 12px;
  color: var(--muted);
  border: 1px solid var(--line);
  padding: 2px 8px;
  border-radius: 999px;
}

.sidebar .footer {
  margin-top: auto;
  padding: 14px 10px 8px;
  color: var(--muted);
  font-size: 12px;
}

.main {
  padding: 22px;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

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

.topbar .title {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.topbar h2 {
  margin: 0;
  font-size: 18px;
}

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

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

.theme-toggle {
  cursor: pointer;
  background: var(--glass-bg);
  border: 1px solid var(--line);
  color: var(--text);
  width: 40px;
  height: 40px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.theme-toggle:hover {
  background: var(--line);
}

.user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--glass-bg);
}

.avatar {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: linear-gradient(135deg, #2bd576, #4f8cff);
}

.user .meta {
  line-height: 1.1;
}

.user .meta strong {
  display: block;
  font-size: 13px;
}

.user .meta small {
  color: var(--muted);
  font-size: 12px;
}

.grid {
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  gap: 14px;
  align-items: start;
}

.cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}

.card {
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, .05);
  transition: background 0.3s, border 0.3s;
}

[data-theme="dark"] .card {
  box-shadow: 0 18px 40px rgba(0, 0, 0, .25);
  background: rgba(18, 27, 46, .6);
}

.metric .label {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
}

.metric .value {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: .2px;
}

.metric .hint {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  margin-top: 10px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--accent);
}

.dot.good {
  background: var(--good);
}

.dot.warn {
  background: var(--warn);
}

.dot.bad {
  background: var(--bad);
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 10px;
}

.section-title h3 {
  margin: 0;
  font-size: 14px;
}

.section-title small {
  color: var(--muted);
}

.btn {
  cursor: pointer;
  border: 1px solid var(--line);
  background: rgba(127, 138, 163, .1);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 12px;
  font-weight: 600;
  font-size: 13px;
  transition: all 0.2s;
}

.btn.primary {
  border-color: rgba(79, 140, 255, .35);
  background: rgba(79, 140, 255, .18);
  color: var(--accent);
}

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

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

.row>* {
  flex: 1;
}

label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin: 0 0 6px;
}

input,
select,
textarea {
  width: 100%;
  padding: 10px 10px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--input-bg);
  color: var(--text);
  outline: none;
  transition: all 0.2s;
}

textarea {
  min-height: 84px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79, 140, 255, .15);
}

.help {
  color: var(--muted);
  font-size: 12px;
  margin-top: 8px;
}

.divider {
  height: 1px;
  background: var(--line);
  margin: 12px 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--table-bg);
}

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

th {
  color: var(--muted);
  font-weight: 600;
  background: rgba(127, 138, 163, .05);
}

tr:last-child td {
  border-bottom: none;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}

.calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}

.day {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  min-height: 70px;
  background: var(--table-bg);
}

.day strong {
  font-size: 12px;
  color: var(--muted);
}

.badge {
  display: inline-block;
  margin-top: 8px;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(79, 140, 255, .35);
  background: rgba(79, 140, 255, .14);
  color: var(--accent);
}

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

  .sidebar {
    display: none;
  }

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

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