/* ============================================================
   GULISTONLIK.UZ — admin panel uslublari
   ============================================================ */
:root{
  --accent:#D6173A; --accent-dark:#A8102C;
  --ink:#16181D; --muted:#7b818c; --line:#e6e8ee;
  --bg:#f1f3f7; --card:#fff; --side:#15171d; --side-2:#1d2027;
  --ok:#1aa34a; --warn:#d9822b; --r:10px;
  --font:'Inter','Segoe UI',system-ui,-apple-system,Arial,sans-serif;
}
*{box-sizing:border-box}
body{margin:0;font-family:var(--font);background:var(--bg);color:var(--ink);font-size:14.5px;-webkit-font-smoothing:antialiased}
a{color:inherit;text-decoration:none}
button,input,select,textarea{font-family:inherit}
:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.hidden{display:none!important}

/* ---------- LOGIN ---------- */
.login-wrap{min-height:100vh;display:grid;place-items:center;padding:20px;
  background:radial-gradient(1200px 600px at 50% -10%, #2a2f3a, #15171d)}
.login-card{width:min(400px,94vw);background:#fff;border-radius:16px;padding:34px 30px;box-shadow:0 24px 70px rgba(0,0,0,.4)}
.login-card .brand{display:flex;align-items:center;gap:10px;justify-content:center;margin-bottom:6px}
.login-card .brand .word{font-weight:900;font-size:24px;letter-spacing:-.5px}
.login-card .brand .dot{color:var(--accent)}
.login-card .tulip{width:34px;height:34px}
.login-card .sub{text-align:center;color:var(--muted);font-size:13px;margin-bottom:24px}
.login-card label{display:block;font-size:13px;font-weight:600;margin:14px 0 6px;color:#3c4048}
.login-card input{width:100%;padding:12px 14px;border:1px solid var(--line);border-radius:9px;font-size:15px}
.login-card input:focus{border-color:var(--accent);outline:none}
.login-card .btn{width:100%;margin-top:22px;background:var(--accent);color:#fff;border:0;padding:13px;border-radius:9px;
  font-weight:700;font-size:15px;cursor:pointer;transition:.15s}
.login-card .btn:hover{background:var(--accent-dark)}
.login-card .btn:disabled{opacity:.6;cursor:default}
.login-err{background:#fdecef;color:#b3122e;font-size:13px;padding:10px 12px;border-radius:8px;margin-top:14px;display:none}
.login-err.show{display:block}
.login-hint{text-align:center;margin-top:18px;font-size:12px;color:var(--muted)}

/* ---------- APP SHELL ---------- */
.app{display:grid;grid-template-columns:236px 1fr;min-height:100vh}
.sidebar{background:var(--side);color:#aeb4c0;display:flex;flex-direction:column;position:sticky;top:0;height:100vh}
.sidebar .logo{display:flex;align-items:center;gap:9px;padding:20px 20px;border-bottom:1px solid rgba(255,255,255,.07)}
.sidebar .logo .word{font-weight:900;font-size:19px;color:#fff;letter-spacing:-.4px}
.sidebar .logo .dot{color:var(--accent)}
.sidebar .logo .tulip{width:28px;height:28px}
.sidebar nav{padding:14px 12px;flex:1;overflow-y:auto}
.sidebar nav a{display:flex;align-items:center;gap:11px;padding:11px 14px;border-radius:9px;font-size:14px;font-weight:500;
  color:#aeb4c0;margin-bottom:3px;transition:.15s;cursor:pointer}
.sidebar nav a:hover{background:var(--side-2);color:#fff}
.sidebar nav a.active{background:var(--accent);color:#fff}
.sidebar nav a svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:2;flex:0 0 auto}
.sidebar .foot{padding:12px;border-top:1px solid rgba(255,255,255,.07)}
.sidebar .foot a{display:flex;align-items:center;gap:10px;padding:10px 14px;border-radius:9px;color:#9aa0ab;font-size:13.5px;cursor:pointer}
.sidebar .foot a:hover{background:var(--side-2);color:#fff}
.sidebar .foot svg{width:17px;height:17px;fill:none;stroke:currentColor;stroke-width:2}

.main{display:flex;flex-direction:column;min-width:0}
.topbar2{background:#fff;border-bottom:1px solid var(--line);padding:0 26px;height:62px;display:flex;align-items:center;gap:14px;
  position:sticky;top:0;z-index:20}
.topbar2 h1{margin:0;font-size:19px;font-weight:800}
.topbar2 .spacer{flex:1}
.topbar2 .ghost{display:inline-flex;align-items:center;gap:7px;border:1px solid var(--line);background:#fff;border-radius:8px;
  padding:8px 14px;font-size:13.5px;font-weight:600;cursor:pointer;color:#3c4048}
.topbar2 .ghost:hover{border-color:var(--accent);color:var(--accent)}
.topbar2 .ghost svg{width:15px;height:15px;fill:none;stroke:currentColor;stroke-width:2}
.topbar2 .user{display:flex;align-items:center;gap:9px;font-size:13.5px;font-weight:600}
.topbar2 .avatar{width:34px;height:34px;border-radius:50%;background:var(--accent);color:#fff;display:grid;place-items:center;font-weight:800}
.burger2{display:none;border:0;background:none;cursor:pointer}
.burger2 svg{width:24px;height:24px;stroke:var(--ink);fill:none;stroke-width:2}

.content{padding:26px;max-width:1200px;width:100%}

/* ---------- STAT CARDS ---------- */
.stats{display:grid;grid-template-columns:repeat(4,1fr);gap:16px;margin-bottom:22px}
.stat{background:var(--card);border:1px solid var(--line);border-radius:var(--r);padding:18px 20px}
.stat .ico{width:42px;height:42px;border-radius:10px;display:grid;place-items:center;margin-bottom:12px}
.stat .ico svg{width:21px;height:21px;fill:none;stroke-width:2}
.stat .ico.a{background:#fdecef}.stat .ico.a svg{stroke:var(--accent)}
.stat .ico.b{background:#e8f5ec}.stat .ico.b svg{stroke:var(--ok)}
.stat .ico.c{background:#fff3e6}.stat .ico.c svg{stroke:var(--warn)}
.stat .ico.d{background:#e9eefb}.stat .ico.d svg{stroke:#3b62d4}
.stat .num{font-size:28px;font-weight:800;line-height:1}
.stat .lbl{color:var(--muted);font-size:13px;margin-top:4px}

.cols{display:grid;grid-template-columns:1.3fr 1fr;gap:18px}
.panel{background:var(--card);border:1px solid var(--line);border-radius:var(--r);padding:20px}
.panel h3{margin:0 0 16px;font-size:15px;font-weight:800}
.bar-row{display:flex;align-items:center;gap:12px;margin-bottom:12px;font-size:13.5px}
.bar-row .name{flex:0 0 110px;font-weight:600}
.bar-row .track{flex:1;height:9px;background:#eef0f4;border-radius:6px;overflow:hidden}
.bar-row .fill{height:100%;background:var(--accent);border-radius:6px}
.bar-row .val{flex:0 0 34px;text-align:right;color:var(--muted);font-weight:600}
.mini{list-style:none;margin:0;padding:0}
.mini li{display:flex;justify-content:space-between;gap:12px;padding:10px 0;border-bottom:1px solid var(--line);font-size:13.5px}
.mini li:last-child{border-bottom:0}
.mini .t{font-weight:500;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.mini .v{color:var(--muted);flex:0 0 auto;font-size:12.5px}

/* ---------- TOOLBAR ---------- */
.toolbar{display:flex;align-items:center;gap:12px;margin-bottom:18px;flex-wrap:wrap}
.toolbar .search{flex:1;min-width:200px;position:relative}
.toolbar .search input{width:100%;padding:10px 12px 10px 36px;border:1px solid var(--line);border-radius:9px;background:#fff;font-size:14px}
.toolbar .search svg{position:absolute;left:11px;top:50%;transform:translateY(-50%);width:16px;height:16px;stroke:var(--muted);fill:none;stroke-width:2}
.toolbar select{padding:10px 12px;border:1px solid var(--line);border-radius:9px;background:#fff;font-size:14px;font-weight:500}
.btn-primary{display:inline-flex;align-items:center;gap:7px;background:var(--accent);color:#fff;border:0;border-radius:9px;
  padding:10px 18px;font-weight:700;font-size:14px;cursor:pointer;transition:.15s}
.btn-primary:hover{background:var(--accent-dark)}
.btn-primary svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:2.4}

/* ---------- TABLE ---------- */
.tbl-wrap{background:#fff;border:1px solid var(--line);border-radius:var(--r);overflow:hidden}
table{width:100%;border-collapse:collapse;font-size:14px}
thead th{text-align:left;padding:13px 16px;font-size:12px;font-weight:700;color:var(--muted);text-transform:uppercase;
  letter-spacing:.4px;border-bottom:1px solid var(--line);background:#fafbfc}
tbody td{padding:13px 16px;border-bottom:1px solid var(--line);vertical-align:middle}
tbody tr:last-child td{border-bottom:0}
tbody tr:hover{background:#fafbfd}
.t-title{font-weight:600;max-width:420px}
.t-title a:hover{color:var(--accent)}
.badge{display:inline-block;font-size:11.5px;font-weight:700;padding:3px 9px;border-radius:20px}
.badge.pub{background:#e8f5ec;color:var(--ok)}
.badge.draft{background:#fff3e6;color:var(--warn)}
.badge.star{background:#fdecef;color:var(--accent);margin-left:6px}
.row-actions{display:flex;gap:6px}
.iconbtn{width:32px;height:32px;border:1px solid var(--line);background:#fff;border-radius:8px;display:grid;place-items:center;cursor:pointer;transition:.15s}
.iconbtn svg{width:15px;height:15px;fill:none;stroke:#5a606b;stroke-width:2}
.iconbtn:hover{border-color:var(--accent)}
.iconbtn:hover svg{stroke:var(--accent)}
.iconbtn.del:hover{border-color:#d33;background:#fff5f5}.iconbtn.del:hover svg{stroke:#d33}

.pagination{display:flex;justify-content:center;gap:6px;margin-top:18px}
.pagination button{min-width:36px;height:36px;border:1px solid var(--line);background:#fff;border-radius:8px;cursor:pointer;font-weight:600;font-size:13.5px}
.pagination button.active{background:var(--accent);color:#fff;border-color:var(--accent)}
.pagination button:disabled{opacity:.45;cursor:default}

/* ---------- FORM / EDITOR ---------- */
.form-card{background:#fff;border:1px solid var(--line);border-radius:var(--r);padding:24px;max-width:860px}
.form-grid{display:grid;grid-template-columns:1fr 280px;gap:24px}
.field{margin-bottom:18px}
.field label{display:block;font-size:13px;font-weight:700;margin-bottom:7px}
.field .help{font-weight:400;color:var(--muted);font-size:12px;margin-left:4px}
.field input[type=text],.field textarea,.field select{width:100%;padding:11px 13px;border:1px solid var(--line);border-radius:9px;font-size:14.5px;background:#fff}
.field input:focus,.field textarea:focus,.field select:focus{border-color:var(--accent);outline:none}
.field textarea{resize:vertical;line-height:1.6}
.field textarea.body{min-height:300px;font-size:14.5px}
.editor-toolbar{display:flex;gap:4px;margin-bottom:8px;flex-wrap:wrap}
.editor-toolbar button{border:1px solid var(--line);background:#fff;border-radius:7px;padding:6px 10px;font-size:13px;cursor:pointer;font-weight:600}
.editor-toolbar button:hover{border-color:var(--accent);color:var(--accent)}
.check{display:flex;align-items:center;gap:9px;font-size:14px;font-weight:600;cursor:pointer;padding:10px 0}
.check input{width:18px;height:18px;accent-color:var(--accent)}
.img-preview{width:100%;aspect-ratio:16/9;border-radius:9px;background:#f1f3f7 url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 24 24' fill='none' stroke='%23c3c8d0' stroke-width='1.6'><rect x='3' y='3' width='18' height='18' rx='2'/><circle cx='9' cy='9' r='2'/><path d='M21 15l-5-5L5 21'/></svg>") center/48px no-repeat;
  overflow:hidden;margin-top:10px;border:1px solid var(--line)}
.img-preview img{width:100%;height:100%;object-fit:cover}
.form-actions{display:flex;gap:10px;margin-top:8px;padding-top:20px;border-top:1px solid var(--line)}
.btn-ghost{border:1px solid var(--line);background:#fff;border-radius:9px;padding:11px 20px;font-weight:600;cursor:pointer;font-size:14px}
.btn-ghost:hover{border-color:var(--accent);color:var(--accent)}
.btn-danger{border:1px solid #f0c2c2;background:#fff;color:#d33;border-radius:9px;padding:11px 20px;font-weight:600;cursor:pointer;font-size:14px;margin-left:auto}
.btn-danger:hover{background:#fff5f5}
.aside-card{background:#fafbfc;border:1px solid var(--line);border-radius:var(--r);padding:16px}
.aside-card h4{margin:0 0 12px;font-size:13px;font-weight:800;text-transform:uppercase;letter-spacing:.4px;color:var(--muted)}

/* categories list */
.cat-list{background:#fff;border:1px solid var(--line);border-radius:var(--r);overflow:hidden;max-width:640px}
.cat-list .cat-row{display:flex;align-items:center;gap:12px;padding:13px 16px;border-bottom:1px solid var(--line)}
.cat-list .cat-row:last-child{border-bottom:0}
.cat-list .cat-row .nm{font-weight:600;flex:1}
.cat-list .cat-row .sl{color:var(--muted);font-size:12.5px;font-family:monospace}

/* ---------- TOASTS ---------- */
#toasts{position:fixed;right:20px;bottom:20px;z-index:100;display:flex;flex-direction:column;gap:10px}
.toast{background:#fff;border-left:4px solid var(--ok);border-radius:9px;padding:13px 18px;box-shadow:0 8px 30px rgba(0,0,0,.15);
  font-size:14px;font-weight:600;min-width:240px;animation:slidein .25s}
.toast.err{border-left-color:var(--accent)}
@keyframes slidein{from{transform:translateX(20px);opacity:0}to{transform:translateX(0);opacity:1}}

.loading{padding:40px;text-align:center;color:var(--muted)}
.spinner{width:30px;height:30px;border:3px solid var(--line);border-top-color:var(--accent);border-radius:50%;animation:spin .8s linear infinite;margin:0 auto 12px}
@keyframes spin{to{transform:rotate(360deg)}}

/* ---------- RESPONSIVE ---------- */
@media (max-width:900px){
  .app{grid-template-columns:1fr}
  .sidebar{position:fixed;left:0;top:0;width:236px;z-index:50;transform:translateX(-100%);transition:.25s}
  .sidebar.open{transform:translateX(0)}
  .burger2{display:block}
  .stats{grid-template-columns:repeat(2,1fr)}
  .cols{grid-template-columns:1fr}
  .form-grid{grid-template-columns:1fr}
  .scrim{position:fixed;inset:0;background:rgba(0,0,0,.4);z-index:40;display:none}
  .scrim.show{display:block}
}
@media (max-width:560px){
  .stats{grid-template-columns:1fr}
  .content{padding:16px}
  .hide-sm{display:none}
}
