:root {
  --bg: #ffffff;
  --surface: #f6f8fa;
  --border: #d0d7de;
  --text: #1f2328;
  --text-secondary: #59636e;
  --text-muted: #8c959f;
  --accent: #0969da;
  --accent-hover: #0757ba;
  --danger: #cf222e;
  --danger-hover: #a40e26;
  --success: #1a7f37;
  --success-hover: #116329;
  --radius: 8px;
  --radius-sm: 6px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1117;
    --surface: #161b22;
    --border: #30363d;
    --text: #e6edf3;
    --text-secondary: #9198a1;
    --text-muted: #6e7681;
    --accent: #4493f8;
    --accent-hover: #79c0ff;
    --danger: #f85149;
    --danger-hover: #ff7b72;
    --success: #3fb950;
    --success-hover: #56d364;
  }
}

:root[data-theme="dark"] {
  --bg: #0d1117;
  --surface: #161b22;
  --border: #30363d;
  --text: #e6edf3;
  --text-secondary: #9198a1;
  --text-muted: #6e7681;
  --accent: #4493f8;
  --accent-hover: #79c0ff;
  --danger: #f85149;
  --danger-hover: #ff7b72;
  --success: #3fb950;
  --success-hover: #56d364;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1px 5px;
}

h1, h2, h3, h4, h5, h6 { font-weight: 600; margin: 0 0 12px; }
h2 { font-size: 20px; }
h5 { font-size: 15px; }
h6 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.03em; color: var(--text-secondary); }

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 20px 48px;
}

.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
}

.navbar-brand {
  font-weight: 600;
  font-size: 15px;
}

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

.theme-toggle {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
}
.theme-toggle:hover { border-color: var(--text-muted); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 16px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.btn:hover { border-color: var(--text-muted); }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn-danger {
  color: var(--danger);
  border-color: var(--border);
}
.btn-danger:hover { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, var(--surface)); }

.btn-success {
  color: var(--success);
  border-color: var(--border);
}
.btn-success:hover { border-color: var(--success); background: color-mix(in srgb, var(--success) 10%, var(--surface)); }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th, td {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
}
th { color: var(--text-secondary); font-weight: 500; }
tr:hover td { background: var(--surface); }

.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.badge-accent { background: color-mix(in srgb, var(--accent) 15%, var(--surface)); color: var(--accent); border-color: transparent; }

input[type="text"], input[type="password"], input[type="number"], input[type="date"], input[type="datetime-local"], textarea, select {
  width: 100%;
  font: inherit;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}

.alert {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  font-size: 13px;
}
.alert-danger {
  background: color-mix(in srgb, var(--danger) 12%, var(--surface));
  color: var(--danger);
  border: 1px solid color-mix(in srgb, var(--danger) 30%, var(--border));
}

.pagination {
  display: flex;
  gap: 6px;
  list-style: none;
  padding: 0;
  margin: 16px 0 0;
}
.page-item .page-link {
  display: inline-flex;
  align-items: center;
  font-size: 13px;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  color: var(--text);
}
.page-item .page-link:hover { border-color: var(--text-muted); text-decoration: none; }
.page-item.disabled .page-link {
  color: var(--text-muted);
  pointer-events: none;
  border-color: var(--border);
}

label {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.row { display: flex; flex-wrap: wrap; }
.justify-content-center { justify-content: center; }
.justify-content-between { justify-content: space-between; }
.align-items-center { align-items: center; }
.col-md-4 { width: 100%; max-width: 360px; }

.d-flex { display: flex; }
.d-inline { display: inline; }
.d-inline-block { display: inline-block; }
.gap-2 { gap: 8px; }
.w-100 { width: 100%; }

.text-muted { color: var(--text-muted); }
.text-danger { color: var(--danger); }
.text-center { text-align: center; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
