@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Manrope:wght@600;700;800&display=swap');

:root {
  --accent: #5B6CFF;
  --accent-dark: #4453D9;
  --ink: #171A2B;
  --ink-dim: #6B7086;
  --ink-faint: #9498AB;
  --bg: #F5F6FA;
  --panel: #FFFFFF;
  --line: #E7E9F2;
  --sidebar: #121420;
  --sidebar-hover: #1D2033;
  --sidebar-text: #B7BAD1;
  --ok: #1BA672;
  --ok-bg: #E8F8F1;
  --warn: #C8862B;
  --warn-bg: #FBF1E1;
  --danger: #E0475A;
  --danger-bg: #FCE9EC;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(23,26,43,.04), 0 8px 24px rgba(23,26,43,.05);
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14.5px;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: 'Manrope', 'Inter', sans-serif; letter-spacing: -.01em; margin: 0; }
a { color: inherit; text-decoration: none; }

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

/* Sidebar */
.sidebar {
  width: 240px; flex: 0 0 240px;
  background: var(--sidebar);
  color: var(--sidebar-text);
  padding: 28px 16px;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.sidebar .brand { padding: 0 10px 28px; }
.sidebar .brand .name { font-family: 'Manrope', sans-serif; font-weight: 800; font-size: 18px; color: #fff; }
.sidebar .brand .tag { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); font-weight: 700; margin-top: 2px; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sidebar nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 9px;
  font-weight: 600; font-size: 13.5px;
  color: var(--sidebar-text);
  transition: background .12s, color .12s;
}
.sidebar nav a:hover { background: var(--sidebar-hover); color: #fff; }
.sidebar nav a.active { background: var(--accent); color: #fff; }
.sidebar .foot { padding-top: 16px; border-top: 1px solid rgba(255,255,255,.08); font-size: 12px; color: var(--ink-faint); }
.sidebar .foot a { color: var(--sidebar-text); font-weight: 600; }

/* Main */
.main { flex: 1; min-width: 0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 32px; background: var(--panel); border-bottom: 1px solid var(--line);
}
.topbar h1 { font-size: 21px; font-weight: 800; }
.topbar .sub { color: var(--ink-dim); font-size: 13px; margin-top: 3px; }
.content { padding: 28px 32px 60px; max-width: 1200px; }

/* Cards */
.grid-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 28px; }
.stat-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow);
}
.stat-card .label { font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-faint); }
.stat-card .value { font-family: 'Manrope', sans-serif; font-size: 28px; font-weight: 800; margin-top: 6px; }
.stat-card .hint { font-size: 12.5px; color: var(--ink-dim); margin-top: 4px; }
.stat-card .value.accent { color: var(--accent); }
.stat-card .value.warn { color: var(--warn); }
.stat-card .value.danger { color: var(--danger); }

.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); margin-bottom: 24px; overflow: hidden;
}
.panel .panel-head { padding: 18px 22px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.panel .panel-head h2 { font-size: 16px; font-weight: 800; }
.panel .panel-body { padding: 20px 22px; }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-faint); padding: 10px 22px; border-bottom: 1px solid var(--line); }
td { padding: 13px 22px; border-bottom: 1px solid var(--line); font-size: 13.5px; }
tr:last-child td { border-bottom: none; }
tr.row-link { cursor: pointer; }
tr.row-link:hover { background: #FAFAFD; }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 100px; font-size: 11.5px; font-weight: 700; }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-muted { background: #EEF0F6; color: var(--ink-dim); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px; border-radius: 9px; border: none; cursor: pointer;
  font-weight: 700; font-size: 13.5px; font-family: inherit;
  transition: transform .05s, box-shadow .12s;
}
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 2px 0 var(--accent-dark); }
.btn-primary:hover { background: var(--accent-dark); }
.btn-primary:active { transform: translateY(1px); box-shadow: none; }
.btn-ghost { background: #EEF0F6; color: var(--ink); }
.btn-ghost:hover { background: #E4E6F0; }
.btn-danger { background: var(--danger-bg); color: var(--danger); }
.btn-danger:hover { background: #F8D6DB; }
.btn-sm { padding: 7px 13px; font-size: 12.5px; }
.btn-block { width: 100%; }

.form-field { margin-bottom: 16px; }
.form-field label { display: block; font-size: 12.5px; font-weight: 700; color: var(--ink-dim); margin-bottom: 6px; }
.form-field input, .form-field select, .form-field textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px;
  font-family: inherit; font-size: 14px; background: #FCFCFE;
}
.form-field input:focus, .form-field select:focus, .form-field textarea:focus {
  outline: none; border-color: var(--accent); background: #fff;
}
.form-row { display: flex; gap: 14px; }
.form-row .form-field { flex: 1; }
.hint-text { font-size: 12px; color: var(--ink-faint); margin-top: 5px; }

.flash { padding: 12px 18px; border-radius: 9px; margin-bottom: 18px; font-size: 13.5px; font-weight: 600; }
.flash-ok { background: var(--ok-bg); color: var(--ok); }
.flash-error { background: var(--danger-bg); color: var(--danger); }

.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--sidebar); }
.login-card { background: var(--panel); border-radius: 16px; padding: 40px 36px; width: 360px; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.login-card .brand { text-align: center; margin-bottom: 28px; }
.login-card .brand .name { font-family: 'Manrope', sans-serif; font-weight: 800; font-size: 22px; }
.login-card .brand .tag { font-size: 12px; color: var(--ink-dim); margin-top: 4px; letter-spacing: .04em; text-transform: uppercase; }

.empty-state { text-align: center; padding: 50px 20px; color: var(--ink-faint); }

@media (max-width: 860px) {
  .sidebar { display: none; }
  .content { padding: 20px 16px; }
  .topbar { padding: 16px 18px; }
  .form-row { flex-direction: column; gap: 0; }
}
