:root{
  --bg:#f6f7fb;
  --panel:#ffffff;
  --ink:#1f2340;
  --ink-2:#5b6079;
  --muted:#8a90a8;
  --line:#e6e8f2;
  --primary:#4b5cf5;
  --primary-2:#3b47d2;
  --ok:#12a570;
  --warn:#e35a3a;
  --info:#2b90d9;
  --danger:#d64545;
  --sidebar:#141833;
  --sidebar-ink:#c8ccdf;
  --sidebar-active:#242a55;
  --radius:12px;
  --shadow:0 1px 2px rgba(20,24,51,.06), 0 4px 16px rgba(20,24,51,.05);
}
*{box-sizing:border-box}
html,body{margin:0;padding:0}
body{
  font-family:'Inter',system-ui,-apple-system,Segoe UI,Roboto,sans-serif;
  background:var(--bg); color:var(--ink);
  display:flex; min-height:100vh;
}
a{color:var(--primary); text-decoration:none}
a:hover{text-decoration:underline}

/* Sidebar */
.sidebar{
  width:240px; background:var(--sidebar); color:var(--sidebar-ink);
  padding:20px 14px; position:sticky; top:0; height:100vh; overflow-y:auto;
}
.brand{display:flex; gap:12px; align-items:center; padding:6px 4px 20px; border-bottom:1px solid #252a4d}
.brand-mark{
  background:linear-gradient(135deg,#4b5cf5,#7a48d6);
  color:#fff; font-weight:700; width:38px; height:38px; border-radius:10px;
  display:flex; align-items:center; justify-content:center; letter-spacing:.5px;
}
.brand-mark.big{width:56px; height:56px; font-size:22px; margin:0 auto 12px}
.brand-title{color:#fff; font-weight:600; font-size:15px}
.brand-sub{color:#8890c2; font-size:12px}
.sidebar nav{display:flex; flex-direction:column; gap:2px; margin-top:12px}
.nav-group{color:#7a80a0; font-size:11px; text-transform:uppercase; letter-spacing:.08em; padding:14px 10px 6px}
.nav-item{
  padding:9px 12px; border-radius:8px; color:var(--sidebar-ink);
  font-size:14px; display:block;
}
.nav-item:hover{background:var(--sidebar-active); text-decoration:none; color:#fff}

/* Main */
.main{flex:1; display:flex; flex-direction:column; min-width:0}
.topbar{
  background:#fff; border-bottom:1px solid var(--line);
  padding:14px 28px; display:flex; align-items:center; justify-content:space-between;
  position:sticky; top:0; z-index:5;
}
.page-title{font-size:18px; font-weight:600}
.user-chip{display:flex; align-items:center; gap:10px}
.avatar{
  width:36px; height:36px; border-radius:50%;
  background:linear-gradient(135deg,#4b5cf5,#7a48d6); color:#fff;
  display:flex; align-items:center; justify-content:center; font-weight:600;
}
.user-name{font-size:13px; font-weight:600}
.user-role{font-size:11px; color:var(--muted); text-transform:uppercase}
.content{padding:24px 28px; flex:1}
.footer{padding:14px 28px; color:var(--muted); font-size:12px; border-top:1px solid var(--line); background:#fff}

/* Cards / panels */
.panel{
  background:var(--panel); border:1px solid var(--line); border-radius:var(--radius);
  padding:18px; box-shadow:var(--shadow); margin-bottom:20px;
}
.panel-head{display:flex; align-items:center; justify-content:space-between; margin-bottom:12px}
.panel-head h2{font-size:15px; margin:0}
.two-col{display:grid; grid-template-columns:1fr 1fr; gap:20px}
@media(max-width:960px){.two-col{grid-template-columns:1fr}}

/* Stats */
.stats-grid{display:grid; grid-template-columns:repeat(6,1fr); gap:14px; margin-bottom:20px}
.stats-grid.money{grid-template-columns:repeat(4,1fr)}
@media(max-width:1200px){.stats-grid{grid-template-columns:repeat(3,1fr)}}
@media(max-width:600px){.stats-grid,.stats-grid.money{grid-template-columns:repeat(2,1fr)}}
.stat-card{
  background:#fff; border:1px solid var(--line); border-radius:var(--radius);
  padding:14px 16px; box-shadow:var(--shadow);
}
.stat-label{font-size:12px; color:var(--muted); text-transform:uppercase; letter-spacing:.05em}
.stat-value{font-size:22px; font-weight:700; margin-top:6px}
.stat-card.ok .stat-value{color:var(--ok)}
.stat-card.warn .stat-value{color:var(--warn)}
.stat-card.info .stat-value{color:var(--info)}

/* Tables */
.table{width:100%; border-collapse:collapse; font-size:14px}
.table th,.table td{padding:10px 12px; text-align:left; border-bottom:1px solid var(--line); vertical-align:middle}
.table th{font-size:12px; color:var(--muted); text-transform:uppercase; letter-spacing:.04em; background:#fbfbfe}
.table tr:hover td{background:#fafbff}
.table .r{text-align:right}
.table .actions{white-space:nowrap; display:flex; gap:6px; justify-content:flex-end}

/* Badges */
.badge{
  display:inline-block; padding:3px 8px; border-radius:999px;
  background:#eef0fb; color:#4b5cf5; font-size:11px; font-weight:600;
  text-transform:uppercase; letter-spacing:.03em;
}
.badge.ok{background:#e0f6ec; color:var(--ok)}
.badge.warn{background:#fdece6; color:var(--warn)}
.badge.info{background:#e2f0fb; color:var(--info)}
.badge.prio-alta{background:#fdece6; color:var(--warn)}
.badge.prio-media{background:#fff5da; color:#b58200}
.badge.prio-bassa{background:#eaf6ea; color:#3d8a3d}

/* Buttons */
.btn{
  display:inline-flex; align-items:center; gap:6px;
  padding:8px 14px; border-radius:8px; font-size:13px; font-weight:500;
  background:#eef0fb; color:var(--ink); border:1px solid var(--line);
  cursor:pointer; transition:all .15s;
}
.btn:hover{background:#e4e7f6; text-decoration:none}
.btn.primary{background:var(--primary); color:#fff; border-color:var(--primary)}
.btn.primary:hover{background:var(--primary-2)}
.btn.danger{background:#fdecec; color:var(--danger); border-color:#f6d3d3}
.btn.danger:hover{background:#fbd6d6}
.btn.ghost{background:transparent; border-color:transparent}
.btn.small{padding:5px 10px; font-size:12px}
.btn.block{width:100%; justify-content:center}
button.btn{font-family:inherit}

/* Forms */
form label{display:block; font-size:13px; font-weight:500; margin-bottom:12px}
form input, form select, form textarea{
  display:block; width:100%; margin-top:5px;
  padding:9px 12px; border:1px solid var(--line); border-radius:8px;
  background:#fff; font-family:inherit; font-size:14px; color:var(--ink);
}
form input:focus, form select:focus, form textarea:focus{
  outline:none; border-color:var(--primary); box-shadow:0 0 0 3px rgba(75,92,245,.15);
}
form textarea{min-height:80px; resize:vertical}
.form-grid{display:grid; grid-template-columns:1fr 1fr; gap:14px}
@media(max-width:700px){.form-grid{grid-template-columns:1fr}}
.form-actions{display:flex; gap:10px; margin-top:14px}
.check-inline{display:flex; align-items:center; gap:8px; margin-bottom:12px}
.check-inline input{width:auto; margin:0}

/* Flash */
.flash{padding:11px 14px; border-radius:8px; margin-bottom:14px; font-size:14px; font-weight:500}
.flash-success{background:#e0f6ec; color:var(--ok); border:1px solid #b8e6cd}
.flash-error{background:#fdecec; color:var(--danger); border:1px solid #f6d3d3}

/* List header */
.list-head{display:flex; align-items:center; justify-content:space-between; margin-bottom:16px; gap:14px; flex-wrap:wrap}
.list-head .search{flex:1; max-width:320px}
.list-head input{padding:8px 12px; border:1px solid var(--line); border-radius:8px; font-family:inherit; font-size:13px; width:100%}
.muted{color:var(--muted)}

/* Login */
.login-shell{
  min-height:100vh; width:100%; display:flex; align-items:center; justify-content:center;
  background:linear-gradient(135deg,#4b5cf5,#7a48d6);
  padding:20px;
}
.login-card{
  background:#fff; padding:36px 32px; border-radius:16px;
  width:100%; max-width:400px; box-shadow:0 24px 60px rgba(0,0,0,.25);
  text-align:center;
}
.login-card h1{font-size:22px; margin:6px 0 4px}
.login-card p{margin-top:0}
.login-card form{text-align:left; margin-top:20px}
.hint{
  margin-top:18px; padding:12px; background:#f6f7fb; border-radius:10px;
  font-size:12px; color:var(--ink-2); line-height:1.6;
}
