:root {
  --bg: #f3f6fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e5e7eb;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --danger: #dc2626;
  --success: #16a34a;
  --warning: #d97706;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  --radius: 16px;
  --sidebar-width: 250px;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: none;
}

.app-shell {
  min-height: 100vh;
  display: flex;
}

.sidebar {
  width: var(--sidebar-width);
  background: #0f172a;
  color: #fff;
  padding: 1.5rem 1rem;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.sidebar__brand {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 2rem;
  padding: 0 0.75rem;
}

.sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.sidebar__nav a {
  color: #cbd5e1;
  padding: 0.8rem 0.9rem;
  border-radius: 12px;
  font-size: 0.95rem;
  transition: background 0.2s ease, color 0.2s ease;
}

.sidebar__nav a:hover,
.sidebar__nav a.active {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.main {
  flex: 1;
  min-width: 0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 2rem;
  background: rgba(255,255,255,0.75);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar__title h1 {
  font-size: 1.35rem;
  margin: 0;
}

.topbar__title p {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.topbar__meta {
  color: var(--muted);
  font-size: 0.9rem;
}

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.5rem 2rem 2rem;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.page-header h1,
.page-header h2 {
  margin: 0;
}

.page-header p {
  margin: 0.35rem 0 0;
  color: var(--muted);
}

.card {
  background: var(--surface);
  border: 1px solid rgba(15, 23, 42, 0.04);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
}

.card h1,
.card h2,
.card h3 {
  margin-top: 0;
}

.grid {
  display: grid;
  gap: 1rem;
}

.grid-cards {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.grid-panels {
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
}

.stat-card {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.stat-card__label {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 600;
}

.stat-card__value {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

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

.btn,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  background: var(--primary);
  color: #fff;
  border: 0;
  border-radius: 12px;
  padding: 0.75rem 1rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.05s ease;
}

.btn:hover,
button:hover {
  background: var(--primary-hover);
  text-decoration: none;
}

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

.btn-secondary {
  background: #e2e8f0;
  color: var(--text);
}

.btn-secondary:hover {
  background: #cbd5e1;
}

.btn-danger {
  background: var(--danger);
}

.btn-danger:hover {
  background: #b91c1c;
}

input,
select,
textarea {
  width: 100%;
  padding: 0.78rem 0.9rem;
  margin-top: 0.35rem;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  font-size: 0.95rem;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(37, 99, 235, 0.15);
  border-color: #93c5fd;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.form-grid > div {
  min-width: 0;
}

.actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.flash {
  padding: 0.85rem 1rem;
  border-radius: 14px;
  margin-bottom: 1rem;
  border: 1px solid transparent;
}

.flash-success {
  background: #dcfce7;
  border-color: #86efac;
  color: #166534;
}

.flash-danger {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #991b1b;
}

.flash-warning {
  background: #fef3c7;
  border-color: #fcd34d;
  color: #92400e;
}

.flash-info {
  background: #dbeafe;
  border-color: #93c5fd;
  color: #1d4ed8;
}

.list-stack {
  display: grid;
  gap: 0.85rem;
}

.list-item {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem;
  background: var(--surface-2);
}

.list-item__row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
}

.badge-success {
  background: #dcfce7;
  color: #166534;
}

.badge-warning {
  background: #fef3c7;
  color: #92400e;
}

.badge-danger {
  background: #fee2e2;
  color: #991b1b;
}

.badge-neutral {
  background: #e2e8f0;
  color: #334155;
}

.table-wrap {
  overflow-x: auto;
}

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

.table th,
.table td {
  text-align: left;
  padding: 0.9rem 0.75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.table th {
  color: var(--muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.note-block {
  white-space: pre-wrap;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.85rem;
}

.empty-state {
  color: var(--muted);
  padding: 1rem 0;
}

@media (max-width: 980px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
    border-bottom: 1px solid rgba(255,255,255,0.08);
  }

  .topbar {
    padding: 1rem 1rem;
  }

  .container {
    padding: 1rem;
  }
}
