:root {
  color-scheme: dark;
  --bg: #15181d;
  --bg-elevated: #1d2128;
  --bg-panel: #252a33;
  --bg-panel-2: #2f353f;
  --border: rgba(255, 255, 255, 0.08);
  --text: #f4efe5;
  --muted: #aeb4bf;
  --teal: #2aa8b8;
  --teal-2: #1d7f8e;
  --gold: #ffb200;
  --gold-2: #d89600;
  --danger: #ff6d6d;
  --ok: #76d39a;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.35);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --font: "Avenir Next", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --logo-filter: brightness(0) invert(1);
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #eef2f7;
  --bg-elevated: #ffffff;
  --bg-panel: #ffffff;
  --bg-panel-2: #f6f8fc;
  --border: rgba(15, 23, 42, 0.11);
  --text: #182230;
  --muted: #5f6b7c;
  --shadow: 0 18px 50px rgba(15, 23, 42, 0.12);
  --logo-filter: brightness(0);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(42, 168, 184, 0.18), transparent 26%),
    radial-gradient(circle at top right, rgba(255, 178, 0, 0.12), transparent 22%),
    linear-gradient(180deg, #101318 0%, #0e1115 100%);
  color: var(--text);
  font-family: var(--font);
}

html[data-theme="light"] body {
  background:
    radial-gradient(circle at top left, rgba(42, 168, 184, 0.14), transparent 26%),
    radial-gradient(circle at top right, rgba(255, 178, 0, 0.1), transparent 22%),
    linear-gradient(180deg, #f8fbff 0%, #eef2f7 100%);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

a {
  color: inherit;
}

#app {
  min-height: 100vh;
}

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

.sidebar {
  background: linear-gradient(180deg, rgba(34, 39, 47, 0.98), rgba(20, 23, 28, 0.98));
  border-right: 1px solid var(--border);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(42, 168, 184, 0.18), rgba(255, 178, 0, 0.12));
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: var(--shadow);
}

.brand-mark {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--gold), var(--teal));
  display: grid;
  place-items: center;
  color: #101318;
  font-weight: 800;
  letter-spacing: 0.08em;
}

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

.brand-title strong {
  font-size: 1.02rem;
}

.brand-title span {
  color: var(--muted);
  font-size: 0.86rem;
}

.sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar-label {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  padding: 0 6px;
}

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-item {
  width: 100%;
  text-align: left;
  padding: 14px 15px;
  border-radius: 16px;
  background: transparent;
  color: #d6dae2;
  border: 1px solid transparent;
  transition: transform 150ms ease, background 150ms ease, border-color 150ms ease;
}

.nav-item:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.06);
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(42, 168, 184, 0.22), rgba(255, 178, 0, 0.12));
  border-color: rgba(42, 168, 184, 0.3);
  color: white;
}

.sidebar-footer {
  margin-top: auto;
  display: grid;
  gap: 12px;
}

.status-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
}

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

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}

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

.status-dot.ok {
  background: var(--ok);
}

.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(18px);
  background: rgba(15, 18, 23, 0.76);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 24px;
}

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

.topbar-title strong {
  font-size: 1.25rem;
}

.topbar-title span {
  color: var(--muted);
  font-size: 0.92rem;
}

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

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: white;
}

.btn {
  border-radius: 14px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: white;
  transition: transform 150ms ease, background 150ms ease;
}

.btn:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.08);
}

.btn.primary {
  background: linear-gradient(135deg, var(--gold), #ffcc3a);
  color: #171717;
  font-weight: 700;
  border-color: transparent;
}

.btn.ghost {
  background: transparent;
}

.btn.danger-btn {
  background: rgba(255, 109, 109, 0.14);
  color: #ffd6d6;
  border-color: rgba(255, 109, 109, 0.22);
}

.content {
  padding: 24px;
  display: grid;
  gap: 18px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(280px, 0.7fr);
  gap: 18px;
}

.panel {
  background: linear-gradient(180deg, rgba(36, 41, 49, 0.98), rgba(25, 29, 36, 0.98));
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

.panel.pad {
  padding: 22px;
}

.hero-copy {
  position: relative;
  overflow: hidden;
}

.hero-copy::after {
  content: "";
  position: absolute;
  inset: auto -60px -80px auto;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(42, 168, 184, 0.35), transparent 70%);
  pointer-events: none;
}

.hero h1 {
  margin: 0 0 10px;
  font-size: clamp(1.8rem, 2.5vw, 2.8rem);
  line-height: 1.04;
}

.hero p {
  margin: 0;
  color: var(--muted);
  max-width: 62ch;
  line-height: 1.6;
}

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: #f7f0e1;
  border: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.9rem;
}

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

.kpi {
  padding: 18px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.025));
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.kpi label {
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 8px;
}

.kpi strong {
  display: block;
  font-size: 1.8rem;
  letter-spacing: -0.03em;
}

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

.section-head h2 {
  margin: 0;
  font-size: 1.2rem;
}

.section-head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

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

.stat-card {
  padding: 18px;
  border-radius: 22px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
}

.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 0.84rem;
}

.stat-card strong {
  display: block;
  margin-top: 8px;
  font-size: 1.5rem;
}

.table-wrap {
  overflow: auto;
  border-radius: 22px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.16);
}

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

.table th,
.table td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  text-align: left;
  vertical-align: top;
}

.table th {
  background: rgba(255, 255, 255, 0.03);
  color: #e8ecf3;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.table td {
  color: #f2f3f6;
}

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

.stack {
  display: grid;
  gap: 12px;
}

.list-card {
  padding: 16px;
  border-radius: 18px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
}

.list-card strong {
  display: block;
  margin-bottom: 6px;
}

.list-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

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

.empty-state,
.loading-state,
.error-state,
.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(100%, 520px);
  padding: 28px;
  border-radius: 30px;
  background: linear-gradient(180deg, rgba(36, 41, 49, 0.98), rgba(22, 26, 32, 0.98));
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.login-logo-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 20px;
}

.login-logo {
  width: min(100%, 320px);
  height: auto;
  display: block;
  filter: var(--logo-filter);
}

.login-submit {
  width: 100%;
}

.link-btn {
  width: 100%;
  margin-top: 12px;
  padding: 10px 0 0;
  background: transparent;
  border: 0;
  color: var(--muted);
  text-align: center;
}

.link-btn:hover {
  color: var(--text);
  text-decoration: underline;
}

.login-card h1 {
  margin: 18px 0 8px;
  font-size: 2rem;
}

.login-card p {
  margin: 0 0 22px;
  color: var(--muted);
  line-height: 1.5;
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.field label {
  color: #dfe4eb;
  font-size: 0.9rem;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: white;
  border-radius: 16px;
  padding: 14px 16px;
  outline: none;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: rgba(42, 168, 184, 0.65);
  box-shadow: 0 0 0 4px rgba(42, 168, 184, 0.14);
}

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

.helper {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.5;
}

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

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

.search {
  min-width: 260px;
  flex: 1;
}

.section {
  display: grid;
  gap: 18px;
}

.toolbar-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: #fff;
  font-size: 0.84rem;
}

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

.detail-box {
  position: sticky;
  top: 96px;
  align-self: start;
  padding: 18px;
  border-radius: 22px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
}

.detail-box h3 {
  margin-top: 0;
}

.detail-box p,
.detail-box li {
  color: var(--muted);
  line-height: 1.55;
}

.detail-box ul {
  margin: 0;
  padding-left: 18px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(6, 8, 12, 0.68);
  backdrop-filter: blur(10px);
  display: grid;
  place-items: center;
  padding: 18px;
}

.modal-panel {
  width: min(100%, 860px);
  max-height: min(92vh, 980px);
  overflow: auto;
  background: linear-gradient(180deg, rgba(35, 40, 48, 0.99), rgba(21, 25, 30, 0.99));
  border: 1px solid var(--border);
  border-radius: 28px;
  box-shadow: var(--shadow);
  padding: 22px;
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.modal-head h3 {
  margin: 0 0 6px;
  font-size: 1.3rem;
}

.modal-head p {
  margin: 0;
  color: var(--muted);
}

.modal-body {
  display: grid;
  gap: 16px;
}

.modal-error {
  border-color: rgba(255, 109, 109, 0.25);
  background: rgba(255, 109, 109, 0.12);
  color: #ffd6d6;
}

.link {
  color: #fff;
  text-decoration: underline;
}

.warn {
  color: #ffd76a;
}

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

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

html[data-theme="light"] .sidebar {
  background: linear-gradient(180deg, #ffffff, #f4f7fb);
}

html[data-theme="light"] .brand {
  background: linear-gradient(135deg, rgba(42, 168, 184, 0.1), rgba(255, 178, 0, 0.08));
  border-color: rgba(15, 23, 42, 0.08);
}

html[data-theme="light"] .nav-item {
  color: #243041;
}

html[data-theme="light"] .nav-item:hover {
  background: rgba(15, 23, 42, 0.04);
  border-color: rgba(15, 23, 42, 0.07);
}

html[data-theme="light"] .nav-item.active {
  background: linear-gradient(135deg, rgba(42, 168, 184, 0.16), rgba(255, 178, 0, 0.12));
  border-color: rgba(42, 168, 184, 0.26);
  color: #101318;
}

html[data-theme="light"] .status-card,
html[data-theme="light"] .panel,
html[data-theme="light"] .login-card,
html[data-theme="light"] .detail-box,
html[data-theme="light"] .list-card,
html[data-theme="light"] .stat-card,
html[data-theme="light"] .kpi,
html[data-theme="light"] .timeline-item,
html[data-theme="light"] .modal-card {
  background: linear-gradient(180deg, #ffffff, #f8fbff);
}

html[data-theme="light"] .topbar {
  background: rgba(248, 250, 253, 0.9);
}

html[data-theme="light"] .btn {
  background: rgba(15, 23, 42, 0.05);
  color: var(--text);
}

html[data-theme="light"] .btn.ghost {
  background: transparent;
}

html[data-theme="light"] .btn.primary {
  background: linear-gradient(135deg, #ffbe2f, #f5d873);
  color: #131313;
}

html[data-theme="light"] .pill,
html[data-theme="light"] .status-chip {
  background: rgba(15, 23, 42, 0.05);
  color: var(--text);
}

html[data-theme="light"] .field label {
  color: #314056;
}

html[data-theme="light"] .field input,
html[data-theme="light"] .field select,
html[data-theme="light"] .field textarea {
  background: #ffffff;
  color: var(--text);
  border-color: rgba(15, 23, 42, 0.12);
}

html[data-theme="light"] .field input::placeholder,
html[data-theme="light"] .field textarea::placeholder {
  color: rgba(24, 34, 48, 0.48);
}

html[data-theme="light"] .table {
  background: #ffffff;
}

html[data-theme="light"] .table th {
  background: #f5f7fb;
  color: #2a3648;
}

html[data-theme="light"] .table td {
  border-top-color: rgba(15, 23, 42, 0.08);
  color: var(--text);
}

html[data-theme="light"] .modal-backdrop {
  background: rgba(15, 23, 42, 0.35);
}

html[data-theme="light"] .modal-card {
  color: var(--text);
}

html[data-theme="light"] .link {
  color: #214f8f;
}

html[data-theme="light"] .warn {
  color: #9a6a00;
}

html[data-theme="light"] .ok {
  color: #0d8850;
}

html[data-theme="light"] .danger {
  color: #c43c3c;
}

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

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .hero,
  .split {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 720px) {
  .content,
  .topbar,
  .sidebar {
    padding-left: 16px;
    padding-right: 16px;
  }

  .card-grid,
  .grid-2,
  .kpi-grid {
    grid-template-columns: 1fr;
  }

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

  .login-card {
    padding: 22px;
    border-radius: 24px;
  }
}
