:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --text: #12263a;
  --muted: #5b6b7c;
  --line: #e3ebf3;
  --primary: #0b3d91;
  --secondary: #1e88e5;
  --accent: #f5a623;
  --danger: #d64545;
  --success: #1f9d55;
  --sidebar: #0a274f;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(10, 39, 79, 0.08);
  --font: "Sora", "Segoe UI", sans-serif;
  --display: "Fraunces", Georgia, serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(30,136,229,.12), transparent 60%),
    radial-gradient(900px 400px at 100% 0%, rgba(245,166,35,.10), transparent 55%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
}

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

.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.auth-card {
  width: min(440px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 36px 32px;
  position: relative;
  overflow: hidden;
}
.auth-card::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 5px;
  background: linear-gradient(90deg, var(--primary), var(--secondary), var(--accent));
}
.brand-mark {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}
.brand-mark img { width: 44px; height: 44px; object-fit: contain; border-radius: 10px; }
.brand-mark .logo-fallback {
  width: 44px; height: 44px; border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff; display: grid; place-items: center; font-weight: 700;
}
.brand-mark h1 {
  font-family: var(--display);
  font-size: 1.35rem;
  margin: 0;
  line-height: 1.2;
}
.portal-chip {
  display: inline-block;
  font-size: .75rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--secondary);
  background: rgba(30,136,229,.1);
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 14px;
}
.auth-card h2 { margin: 0 0 8px; font-size: 1.4rem; }
.auth-card p.lead { margin: 0 0 22px; color: var(--muted); font-size: .95rem; }

.form-group { margin-bottom: 14px; }
label { display: block; font-size: .85rem; margin-bottom: 6px; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=color],
input[type=date], input[type=url], select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 11px 12px;
  font: inherit;
  color: var(--text);
}
textarea { min-height: 90px; resize: vertical; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 10px; padding: 11px 16px; font: inherit; font-weight: 600;
  cursor: pointer; text-decoration: none !important;
}
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--secondary)); color: #fff; width: 100%; }
.btn-secondary { background: #eef4fb; color: var(--primary); }
.btn-danger { background: #fdecec; color: var(--danger); }
.btn-sm { padding: 7px 11px; font-size: .85rem; width: auto; }
.btn-block { width: 100%; }
.alert {
  padding: 10px 12px; border-radius: 10px; margin-bottom: 14px; font-size: .9rem;
}
.alert-error { background: #fdecec; color: #8f1f1f; }
.alert-success { background: #e8f8ef; color: #146c3c; }

.app-shell { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.sidebar {
  background: linear-gradient(180deg, var(--sidebar), #071a36 80%);
  color: #d7e6ff;
  padding: 22px 16px;
  position: sticky; top: 0; height: 100vh; overflow: auto;
}
.sidebar .side-brand { display: flex; gap: 10px; align-items: center; margin-bottom: 28px; padding: 0 8px; }
.sidebar .side-brand img { width: 38px; height: 38px; border-radius: 9px; object-fit: contain; background: #fff; }
.sidebar .side-brand strong { display: block; color: #fff; font-size: .95rem; }
.sidebar .side-brand span { font-size: .75rem; opacity: .7; }
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 10px; color: #c9dbf7; margin-bottom: 4px;
  text-decoration: none !important; font-size: .92rem;
}
.nav-link:hover, .nav-link.active { background: rgba(255,255,255,.1); color: #fff; }
.main { padding: 22px 26px 40px; }
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 22px; gap: 12px; flex-wrap: wrap;
}
.topbar h1 {
  margin: 0; font-family: var(--display); font-size: 1.7rem; font-weight: 600;
}
.topbar .meta { color: var(--muted); font-size: .9rem; }
.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow);
}
.stat .label { color: var(--muted); font-size: .82rem; margin-bottom: 8px; }
.stat .value { font-size: 1.7rem; font-weight: 700; letter-spacing: -.02em; }
.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
}
.panel-h {
  padding: 14px 16px; border-bottom: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
}
.panel-h h3 { margin: 0; font-size: 1rem; }
.panel-b { padding: 16px; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; }
.badge {
  display: inline-block; padding: 3px 8px; border-radius: 999px; font-size: .75rem; font-weight: 600;
}
.badge-ok { background: #e8f8ef; color: #146c3c; }
.badge-warn { background: #fff4e0; color: #9a6200; }
.badge-bad { background: #fdecec; color: #8f1f1f; }
.badge-info { background: #e8f1ff; color: #0b3d91; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.muted { color: var(--muted); }
.footer-note { margin-top: 24px; color: var(--muted); font-size: .82rem; }
.check-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; }
.check-item {
  display: flex; gap: 8px; align-items: center; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 10px; background: #fafcfe;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.search { max-width: 280px; }
.tool-card {
  border: 1px solid var(--line); border-radius: 14px; padding: 16px; background: #fff;
}
.tool-card h4 { margin: 0 0 6px; }
.tool-card p { margin: 0 0 12px; color: var(--muted); font-size: .9rem; }

@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .grid-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 860px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: relative; height: auto; }
  .grid-4, .grid-3, .grid-2, .form-row, .check-grid { grid-template-columns: 1fr; }
  .main { padding: 16px; }
}
