:root {
  --bg: #f6fbff;
  --surface: rgba(255,255,255,0.9);
  --panel: #ffffff;
  --text: #12334a;
  --muted: #6a8597;
  --primary: #2563eb;
  --secondary: #14b8a6;
  --danger: #dc2626;
  --border: rgba(37,99,235,0.12);
  --shadow: 0 18px 36px rgba(18,51,74,0.08);
  --radius: 22px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Inter', sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(37,99,235,0.12), transparent 24%),
    radial-gradient(circle at top right, rgba(20,184,166,0.1), transparent 22%),
    linear-gradient(180deg, #f8fcff 0%, #eef8ff 100%);
}
button, input, select, textarea { font: inherit; }
a { color: inherit; text-decoration: none; }

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

.sidebar {
  background: rgba(255,255,255,0.86);
  border-right: 1px solid rgba(18,51,74,0.07);
  padding: 1.3rem;
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 1.2rem;
}
.brand-badge {
  width: 46px;
  height: 46px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  color: white;
  background: linear-gradient(135deg, var(--primary), #4338ca);
  box-shadow: 0 12px 24px rgba(37,99,235,0.24);
  font-weight: 800;
}
.sidebar-nav {
  display: grid;
  gap: 0.45rem;
  margin-top: 1rem;
}
.sidebar-link {
  padding: 0.9rem 1rem;
  border-radius: 16px;
  color: var(--muted);
  font-weight: 600;
}
.sidebar-link.active,
.sidebar-link:hover {
  background: white;
  color: var(--text);
  box-shadow: var(--shadow);
}

.main {
  padding: 1.25rem;
}

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

.card,
.panel,
.metric,
.table-wrap,
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card, .panel, .table-wrap { padding: 1rem; }

.grid {
  display: grid;
  gap: 1rem;
}
.grid.metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.content { grid-template-columns: 1.05fr 1.35fr; }
.grid.forms { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.metric { padding: 1rem; }
.metric strong { display: block; font-size: 1.75rem; margin-bottom: 0.2rem; }
.metric span, .muted { color: var(--muted); }

button {
  border: none;
  cursor: pointer;
  border-radius: 14px;
  padding: 0.85rem 1rem;
  font-weight: 700;
}
.button-primary {
  color: white;
  background: linear-gradient(135deg, var(--primary), #4338ca);
  box-shadow: 0 14px 28px rgba(37,99,235,0.24);
}
.button-secondary {
  background: white;
  color: var(--text);
  border: 1px solid rgba(18,51,74,0.08);
}
.button-danger {
  color: white;
  background: linear-gradient(135deg, #ef4444, var(--danger));
}
.button-small { padding: 0.55rem 0.8rem; border-radius: 12px; }

input, select, textarea {
  width: 100%;
  border: 1px solid rgba(18,51,74,0.1);
  border-radius: 14px;
  padding: 0.85rem 0.95rem;
  background: white;
  color: var(--text);
}
textarea { min-height: 110px; resize: vertical; }

.form-grid {
  display: grid;
  gap: 0.85rem;
}

label {
  display: grid;
  gap: 0.45rem;
  font-weight: 600;
}

.table-wrap {
  overflow: auto;
}

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

th, td {
  text-align: left;
  padding: 0.85rem 0.7rem;
  border-bottom: 1px solid rgba(18,51,74,0.08);
  vertical-align: top;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.7rem;
  border-radius: 999px;
  background: rgba(37,99,235,0.08);
  color: var(--primary);
  font-weight: 700;
  font-size: 0.82rem;
}
.notice {
  padding: 0.9rem 1rem;
  border-radius: 18px;
  background: rgba(37,99,235,0.08);
  color: var(--primary);
  border: 1px solid rgba(37,99,235,0.15);
}
.notice.error {
  background: rgba(220,38,38,0.08);
  color: var(--danger);
  border-color: rgba(220,38,38,0.15);
}
.stack { display: grid; gap: 0.85rem; }
.flex { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.right { margin-left: auto; }
.hidden { display: none !important; }
.center {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1rem;
}
.login-card {
  width: min(480px, 100%);
  padding: 1.5rem;
}

@media (max-width: 1080px) {
  .grid.metrics,
  .grid.content,
  .grid.forms,
  .shell {
    grid-template-columns: 1fr;
  }
  .sidebar { border-right: none; border-bottom: 1px solid rgba(18,51,74,0.07); }
}
