:root {
  --font-bump: 0px;
  --btn-height: 36px;
  --bg-app: #ffffff;
  --bg-sidebar: #f8fafc;
  --border: #e5e7eb;
  --text-main: #111827;
  --text-muted: #6b7280;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --danger: #dc2626;
  --danger-hover: #b91c1c;
}

* { box-sizing: border-box; }
html, body { width: 100%; min-height: 100%; margin: 0; }
body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text-main);
  background: var(--bg-app);
}
.main { width: 100%; padding: 20px; }
.app-layout { width: 100%; max-width: 1180px; margin: 0 auto; }
.top-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.page-title { margin: 0; font-size: calc(24px + var(--font-bump)); }
.page-subtitle {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: calc(14px + var(--font-bump));
}
.page-divider { border-top: 1px solid var(--border); margin: 12px 0 18px; }
.section {
  margin-bottom: 24px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  padding: 16px;
}
.section h2 { margin: 0 0 8px; font-size: calc(18px + var(--font-bump)); }
.section h3 { margin: 0 0 8px; font-size: calc(15px + var(--font-bump)); }
.section p {
  margin: 0 0 14px;
  color: var(--text-muted);
  font-size: calc(14px + var(--font-bump));
  line-height: 1.45;
}
.demo-row, .toolbar-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.btn {
  min-height: var(--btn-height);
  padding: 0 18px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-family: inherit;
  font-size: calc(14px + var(--font-bump));
  cursor: pointer;
  line-height: 1.1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.2);
  outline-offset: 1px;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { color: #fff; background: var(--primary); }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-secondary { color: #374151; background: #fff; border-color: #d1d5db; }
.btn-secondary:hover:not(:disabled) { border-color: #9ca3af; color: #111827; }
.btn-danger { color: #fff; background: var(--danger); }
.btn-danger:hover:not(:disabled) { background: var(--danger-hover); }
.btn-ghost { color: var(--primary); background: #eff6ff; border-color: #bfdbfe; }
.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(240px, 1fr));
  gap: 12px;
}
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
label { font-size: calc(13px + var(--font-bump)); color: #374151; }
input, select, textarea {
  min-height: var(--btn-height);
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 0 10px;
  font-family: inherit;
  font-size: calc(14px + var(--font-bump));
  width: 100%;
  color: #111827;
  background-color: #fff;
}
input:hover, select:hover, textarea:hover { border-color: #9ca3af; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); }
input:disabled, select:disabled, textarea:disabled {
  background: #f3f4f6;
  color: #9ca3af;
  cursor: not-allowed;
}
.field input[type="checkbox"] {
  appearance: none;
  width: 16px;
  height: 16px;
  min-height: 16px;
  border-radius: 4px;
  border: 1px solid #d1d5db;
  background: #fff;
  display: inline-grid;
  place-content: center;
  margin: 0;
  padding: 0;
}
.field input[type="checkbox"]::after {
  content: "";
  width: 10px;
  height: 10px;
  transform: scale(0);
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0, 43% 62%);
  background: #fff;
}
.field input[type="checkbox"]:checked { background: var(--primary); border-color: var(--primary); }
.field input[type="checkbox"]:checked::after { transform: scale(1); }
.checkbox-group { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.checkbox-group label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: calc(13px + var(--font-bump));
}
.hint {
  margin-top: 6px;
  color: var(--text-muted);
  font-size: calc(12px + var(--font-bump));
  line-height: 1.35;
}
.tabs-demo { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.tab-button {
  border: 1px solid #d1d5db;
  background: #fff;
  color: #374151;
  font-size: calc(13px + var(--font-bump));
  padding: 0 18px;
  border-radius: 999px;
  min-height: var(--btn-height);
  cursor: pointer;
}
.tab-button.is-selected { color: #1d4ed8; background: #e0e7ff; border-color: #bfdbfe; }
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: calc(13px + var(--font-bump)); }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); }
th { color: #374151; background: #f8fafc; font-weight: 600; }
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  min-height: 30px;
  padding: 0 14px;
  font-size: calc(14px + var(--font-bump));
  border: 1.5px solid transparent;
}
.badge-success { background: #dcfce7; color: #166534; border-color: #86efac; }
.badge-danger { background: #fee2e2; color: #991b1b; border-color: #fca5a5; }
.badge-info { background: #dbeafe; color: #1d4ed8; border-color: #93c5fd; }
.alert {
  border-radius: 10px;
  padding: 10px 12px;
  font-size: calc(13px + var(--font-bump));
  line-height: 1.45;
}
.alert-success { background: #ecfdf3; border: 1px solid #bbf7d0; color: #166534; }
.alert-warning { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }
.alpha-alert {
  background: #fee2e2;
  border: 1px solid #fecaca;
  color: #7f1d1d;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: calc(13px + var(--font-bump));
}
.cards-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
}
.mini-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: #fff;
}
.mini-card-title { font-size: calc(13px + var(--font-bump)); color: var(--text-muted); }
.mini-card-value { margin-top: 8px; font-size: calc(18px + var(--font-bump)); font-weight: 700; }
.footer-link { color: var(--primary); text-decoration: none; }
.footer-link:hover { text-decoration: underline; }
.hidden { display: none !important; }

@media (max-width: 768px) {
  :root { --font-bump: 2px; --btn-height: 42px; }
  .main { padding: 12px; }
  .field-grid, .cards-grid { grid-template-columns: 1fr; }
  .top-bar { flex-direction: column; }
  th, td { padding: 9px 8px; }
}
