:root {
  --bg: #0e1014;
  --card: #151823;
  --muted: #9aa3b2;
  --ok: #27c693;
  --warn: #ffb020;
  --err: #ff5470;
  --line: #232a42;
  --panel: #151b28;
  --accent: #3b79ff;
  --accent-hover: #2a66db;
  --text: #f0f0f0;
  --shadow: rgba(0, 0, 0, 0.25);
}

/* === LIGHT THEME === */
.theme-light {
  --bg: #f1f5f9;
  --text: #1e293b;
  --card: #ffffff;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --danger: #ef4444;
  --muted: #64748b;
  --line: #e2e8f0;
  --panel: #f8fafc;
  --shadow: rgba(0, 0, 0, 0.1);
}

/* === BASE === */
body {
  margin: 0;
  padding: 1rem;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  overflow-x: hidden;
}

/* === STRUCTURE === */
h2, h3 {
  color: var(--text);
  margin-bottom: 1rem;
}

.section,
.column section,
.column {
  background: var(--card);
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 4px 20px var(--shadow);
  border: 1px solid var(--line);
  margin-bottom: 24px;
}

/* === TYPOGRAPHY === */
label {
  display: block;
  margin-top: 14px;
  font-weight: 600;
  color: var(--text);
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

.summary p {
  margin: 0.25rem 0;
  font-size: 14px;
  color: var(--text);
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

h3 {
  font-size: 16px;
  margin-bottom: 0.8rem;
}

/* === INPUTS === */
input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  font-size: 15px;
  background-color: var(--card);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  transition: 0.2s border;
  box-sizing: border-box;
  margin-top: 6px;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  background-color: var(--panel);
  outline: none;
}

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

/* === BUTTONS === */
.btn, button,
.button-group button {
  display: inline-block;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  background-color: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.2s ease-in-out, transform 0.2s ease-in-out;
  box-shadow: 0 2px 6px var(--shadow);
}

.btn:hover, button:hover {
  background-color: var(--accent-hover);
  transform: translateY(-1px);
}

.btn-secondary {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
}

.btn-secondary:hover {
  background: var(--line);
}

/* === HEADER === */
.main-header {
  width: 100%;
  padding: 1rem;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 2px 8px var(--shadow);
}

.main-header h1 {
  font-size: 22px;
  margin: 0;
  color: var(--text);
}

.header-top,
.header-actions,
.header-bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.header-actions .btn {
  white-space: nowrap;
}

/* === FILTERS === */
.filters {
  background: var(--card);
  padding: 1rem;
  border-radius: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  border: 1px solid var(--line);
}

.filters label {
  flex: 1 1 160px;
  min-width: 160px;
}

/* === GRIDS === */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 2rem;
}

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

  .header-actions {
    flex-direction: column;
    align-items: flex-end;
  }

  .header-actions .btn {
    width: 100%;
    text-align: center;
  }
}

/* === TABLES === */
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 20px;
  background: var(--card);
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
}

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

th {
  background: var(--card);
  color: var(--muted);
  text-transform: uppercase;
  font-size: 13px;
}

td button {
  padding: 6px 10px;
  font-size: 13px;
  border-radius: 6px;
  background: var(--accent);
  color: white;
  border: none;
  cursor: pointer;
  margin-right: 6px;
}

td button:hover {
  background: var(--accent-hover);
}

/* === CHARTS === */
canvas,
.chart-box canvas {
  background: var(--card);
  border-radius: 8px;
  padding: 12px;
  width: 100% !important;
  max-height: 220px;
}

/* === SECTION TOGGLE === */
.section-content {
  display: none;
  margin-top: 0.5rem;
  padding-left: 1rem;
}
.section-content.open {
  display: block;
}

/* === SCROLLBAR === */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-thumb {
  background: var(--accent);
  border-radius: 4px;
}
