/* =====================================================================
   Growzy Connect — Admin Panel styles
   Mobile first. No external fonts, no CDN, no build step.
   ===================================================================== */

:root{
  --bg:#f4f6fb;
  --surface:#ffffff;
  --surface-2:#f8fafc;
  --border:#e5e9f2;
  --text:#1f2937;
  --muted:#6b7280;
  --primary:#4f46e5;
  --primary-dark:#4338ca;
  --ok:#16a34a;
  --warn:#d97706;
  --danger:#dc2626;
  --info:#0284c7;
  --sidebar:#111827;
  --sidebar-2:#1f2937;
  --radius:14px;
  --shadow:0 1px 2px rgba(16,24,40,.06), 0 8px 24px rgba(16,24,40,.06);
}

*{box-sizing:border-box}
html,body{margin:0;padding:0}
body{
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,"Noto Sans",sans-serif;
  background:var(--bg); color:var(--text); font-size:15px; line-height:1.5;
  -webkit-text-size-adjust:100%;
}
a{color:var(--primary); text-decoration:none}
a:hover{text-decoration:underline}
h1,h2,h3,h4{margin:0 0 .5rem; line-height:1.25}
code{background:var(--surface-2); border:1px solid var(--border); border-radius:6px; padding:1px 5px; font-size:.85em; word-break:break-all}

/* ---------- Layout ---------- */
.app{display:flex; min-height:100vh}
.sidebar{
  width:250px; flex:0 0 250px; background:var(--sidebar); color:#e5e7eb;
  display:flex; flex-direction:column; position:sticky; top:0; height:100vh; overflow-y:auto;
}
.brand{display:flex; gap:.65rem; align-items:center; padding:18px 18px 14px; border-bottom:1px solid rgba(255,255,255,.08)}
.brand-dot{width:12px;height:12px;border-radius:50%;background:linear-gradient(135deg,#6366f1,#22d3ee); box-shadow:0 0 0 4px rgba(99,102,241,.18)}
.brand strong{display:block; font-size:1rem; color:#fff}
.brand small{color:#9ca3af; font-size:.75rem}
.nav{padding:10px 8px; flex:1}
.nav-group{padding:14px 12px 6px; font-size:.68rem; letter-spacing:.09em; text-transform:uppercase; color:#6b7280}
.nav-link{
  display:flex; align-items:center; gap:.6rem; padding:10px 12px; border-radius:10px;
  color:#d1d5db; font-size:.92rem; margin-bottom:2px;
}
.nav-link:hover{background:var(--sidebar-2); color:#fff; text-decoration:none}
.nav-link.active{background:linear-gradient(90deg,rgba(79,70,229,.9),rgba(79,70,229,.55)); color:#fff}
.nav-link .icon{width:20px; text-align:center}
.nav-link .label{flex:1}
.pill{font-size:.7rem; padding:1px 7px; border-radius:99px; background:#374151; color:#fff}
.pill.warn{background:var(--warn)}
.pill.danger{background:var(--danger)}
.sidebar-foot{border-top:1px solid rgba(255,255,255,.08); padding:8px; margin-bottom:10px}

.main{flex:1; min-width:0; display:flex; flex-direction:column}
.topbar{
  display:flex; align-items:center; gap:.75rem; padding:12px 18px; background:var(--surface);
  border-bottom:1px solid var(--border); position:sticky; top:0; z-index:20;
}
.topbar h1{font-size:1.05rem; margin:0; flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
.topbar-right{display:flex; align-items:center; gap:.6rem}
.who{font-size:.82rem; color:var(--muted)}
.who em{font-style:normal; background:var(--surface-2); border:1px solid var(--border); border-radius:6px; padding:1px 6px; margin-left:4px}
.icon-btn{background:var(--surface-2); border:1px solid var(--border); border-radius:9px; padding:6px 10px; cursor:pointer; font-size:1rem}
.content{padding:18px; flex:1}
.foot{padding:14px 18px; color:var(--muted); font-size:.78rem; border-top:1px solid var(--border); background:var(--surface)}
.overlay{display:none}

/* ---------- Cards & grids ---------- */
.card{background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); box-shadow:var(--shadow); margin-bottom:18px; overflow:hidden}
.card-head{display:flex; align-items:center; gap:.6rem; padding:14px 16px; border-bottom:1px solid var(--border); flex-wrap:wrap}
.card-head h2,.card-head h3{font-size:.98rem; margin:0; flex:1}
.card-body{padding:16px}
.card-body.tight{padding:0}
.grid{display:grid; gap:14px; grid-template-columns:repeat(auto-fill,minmax(190px,1fr))}
.grid.two{grid-template-columns:repeat(auto-fit,minmax(320px,1fr))}

.stat{display:flex; gap:.8rem; align-items:center; background:var(--surface); border:1px solid var(--border);
  border-radius:var(--radius); padding:14px; box-shadow:var(--shadow)}
.stat-link{display:block}
.stat-link:hover{text-decoration:none}
.stat-icon{width:42px;height:42px;border-radius:12px;display:grid;place-items:center;font-size:1.25rem;background:#eef2ff}
.stat-body{display:flex; flex-direction:column}
.stat-value{font-size:1.3rem; font-weight:700}
.stat-label{font-size:.78rem; color:var(--muted)}
.stat.green .stat-icon{background:#dcfce7}
.stat.amber .stat-icon{background:#fef3c7}
.stat.red .stat-icon{background:#fee2e2}
.stat.blue .stat-icon{background:#e0f2fe}

/* ---------- Tables ---------- */
.table-wrap{width:100%; overflow-x:auto; -webkit-overflow-scrolling:touch}
table.data{width:100%; border-collapse:collapse; font-size:.87rem; min-width:640px}
table.data th,table.data td{padding:10px 12px; text-align:left; border-bottom:1px solid var(--border); vertical-align:top}
table.data th{background:var(--surface-2); font-size:.75rem; text-transform:uppercase; letter-spacing:.05em; color:var(--muted); position:sticky; top:0}
table.data tbody tr:hover{background:#fafbff}
table.data td .sub{display:block; color:var(--muted); font-size:.78rem}
.row-actions{display:flex; gap:6px; flex-wrap:wrap}

/* ---------- Badges / buttons ---------- */
.badge{display:inline-block; font-size:.72rem; padding:2px 8px; border-radius:99px; border:1px solid transparent; white-space:nowrap}
.badge.ok{background:#dcfce7; color:#166534; border-color:#bbf7d0}
.badge.warn{background:#fef3c7; color:#92400e; border-color:#fde68a}
.badge.danger{background:#fee2e2; color:#991b1b; border-color:#fecaca}
.badge.info{background:#e0f2fe; color:#075985; border-color:#bae6fd}
.badge.muted{background:#f3f4f6; color:#4b5563; border-color:#e5e7eb}

.btn{display:inline-block; background:var(--primary); color:#fff; border:1px solid var(--primary); border-radius:10px;
  padding:8px 14px; font-size:.86rem; cursor:pointer; font-weight:600}
.btn:hover{background:var(--primary-dark); color:#fff; text-decoration:none}
.btn.ghost{background:var(--surface); color:var(--text); border-color:var(--border)}
.btn.ghost:hover{background:var(--surface-2)}
.btn.danger{background:var(--danger); border-color:var(--danger)}
.btn.danger:hover{background:#b91c1c}
.btn.ok{background:var(--ok); border-color:var(--ok)}
.btn.ok:hover{background:#15803d}
.btn.small{padding:5px 10px; font-size:.78rem; border-radius:8px}
.btn.tiny{padding:3px 8px; font-size:.72rem; border-radius:7px; font-weight:500}

/* ---------- Forms ---------- */
form.stack .field{margin-bottom:14px}
.field label{display:block; font-size:.8rem; font-weight:600; margin-bottom:5px; color:#374151}
input[type=text],input[type=number],input[type=password],input[type=email],input[type=url],input[type=datetime-local],select,textarea{
  width:100%; padding:9px 11px; border:1px solid var(--border); border-radius:10px; background:var(--surface); color:var(--text); font-size:.9rem; font-family:inherit}
textarea{min-height:110px; resize:vertical}
input:focus,select:focus,textarea:focus{outline:none; border-color:var(--primary); box-shadow:0 0 0 3px rgba(79,70,229,.14)}
.checkbox{display:flex; align-items:center; gap:8px; font-size:.88rem}
.checkbox input{width:18px;height:18px}
.form-grid{display:grid; gap:14px; grid-template-columns:repeat(auto-fit,minmax(240px,1fr))}
.form-actions{display:flex; gap:10px; flex-wrap:wrap; margin-top:6px}
.help{font-size:.78rem; color:var(--muted); margin-top:4px}

.filters{display:grid; gap:10px; grid-template-columns:repeat(auto-fit,minmax(180px,1fr)); align-items:end;
  background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:12px; margin-bottom:14px}
.filters .field{margin:0}
.filters .actions{display:flex; gap:8px}

/* ---------- Alerts / empty ---------- */
.alert{padding:11px 14px; border-radius:10px; margin-bottom:14px; font-size:.88rem; border:1px solid}
.alert.success{background:#ecfdf5; color:#065f46; border-color:#a7f3d0}
.alert.danger{background:#fef2f2; color:#991b1b; border-color:#fecaca}
.alert.info{background:#eff6ff; color:#1e40af; border-color:#bfdbfe}
.alert.warning{background:#fffbeb; color:#92400e; border-color:#fde68a}
.empty{padding:34px 16px; text-align:center; color:var(--muted)}
.empty-icon{font-size:2rem; margin-bottom:6px}
.empty p{margin:0 0 4px; font-weight:600; color:var(--text)}

/* ---------- Pagination ---------- */
.pagination{display:flex; gap:6px; flex-wrap:wrap; padding:12px 16px; border-top:1px solid var(--border); background:var(--surface)}
.page-link{display:inline-block; padding:6px 11px; border:1px solid var(--border); border-radius:9px; font-size:.82rem; background:var(--surface); color:var(--text)}
.page-link:hover{background:var(--surface-2); text-decoration:none}
.page-link.active{background:var(--primary); color:#fff; border-color:var(--primary)}
.page-link.disabled{opacity:.5; cursor:default}

/* ---------- Misc ---------- */
.kv{display:grid; grid-template-columns:150px 1fr; gap:6px 12px; font-size:.88rem}
.kv dt{color:var(--muted)}
.kv dd{margin:0; word-break:break-word}
.toolbar{display:flex; gap:8px; flex-wrap:wrap; margin-bottom:12px}
.muted{color:var(--muted)}
.mono{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace}
.preview-box{border:1px dashed var(--border); border-radius:12px; padding:14px; background:var(--surface-2)}
.bar{height:8px; background:var(--surface-2); border-radius:99px; overflow:hidden}
.bar > span{display:block; height:100%; background:var(--primary)}

/* ---------- Login ---------- */
.login-page{display:grid; place-items:center; min-height:100vh; padding:18px; background:linear-gradient(160deg,#eef2ff,#f8fafc)}
.login-card{width:100%; max-width:400px; background:var(--surface); border:1px solid var(--border); border-radius:18px; box-shadow:var(--shadow); padding:26px}
.login-card h1{font-size:1.25rem; text-align:center}
.login-card .sub{text-align:center; color:var(--muted); font-size:.85rem; margin-bottom:18px}
.login-card .btn{width:100%; text-align:center}

/* ---------- Responsive ---------- */
@media (max-width: 992px){
  .sidebar{position:fixed; inset:0 auto 0 0; transform:translateX(-100%); transition:transform .22s ease; z-index:60; width:270px; flex-basis:270px}
  .sidebar.open{transform:translateX(0)}
  .overlay{display:block; position:fixed; inset:0; background:rgba(15,23,42,.45); opacity:0; pointer-events:none; transition:opacity .2s; z-index:50}
  .overlay.show{opacity:1; pointer-events:auto}
  .content{padding:14px}
  .kv{grid-template-columns:120px 1fr}
}
@media (max-width: 640px){
  .topbar{padding:10px 12px}
  .who{display:none}
  .stat-value{font-size:1.15rem}
  .card-head{padding:12px}
  .grid{grid-template-columns:repeat(auto-fill,minmax(150px,1fr))}
  table.data{min-width:560px}
  .row-actions .btn{flex:1 1 auto; text-align:center}
}
