/* =========================================================
   KEDSUN Admin Panel
   ========================================================= */
:root {
    --green-dark: #064f3f;
    --green:      #137a4c;
    --green-600:  #0f6c42;
    --orange:     #ff6328;
    --mint:       #eef8f2;
    --mint-100:   #e6f3ec;
    --text:       #16251e;
    --muted:      #60736a;
    --line:       #e5ece8;
    --bg:         #f4f8f5;
    --radius:     10px;
    --shadow:     0 6px 18px rgba(16,60,42,.06);
    --font: 'Poppins', 'Segoe UI', system-ui, sans-serif;
}

* , *::before, *::after { box-sizing: border-box; }
body { margin: 0; font-family: var(--font); font-size: 13.5px; color: var(--text); background: var(--bg); }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
h1, h2, h3 { margin: 0; }

.admin-shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }

/* ---------- Sidebar ---------- */
.sidebar {
    background: linear-gradient(175deg, var(--green-dark), #073a2e);
    color: #cfe0d7; padding: 18px 12px; display: flex; flex-direction: column;
    position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 800; font-size: 17px; padding: 4px 8px 16px; }
.brand small { display: block; font-size: 9px; letter-spacing: 2px; color: #9ec2b1; font-weight: 600; }
.brand-mark {
    width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0;
    background: linear-gradient(135deg, var(--orange), #ff8548);
    display: grid; place-items: center; color: #fff; font-size: 16px;
}
.side-group { font-size: 10px; font-weight: 700; letter-spacing: 1.6px; text-transform: uppercase; color: #7ea896; padding: 14px 10px 6px; }
.side-link {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 10px; border-radius: 9px; font-size: 12.8px; font-weight: 500;
    color: #cfe0d7; transition: .15s;
}
.side-link i { width: 17px; text-align: center; font-size: 13px; color: #8fb8a5; transition: .15s; }
.side-link:hover { background: rgba(255,255,255,.07); color: #fff; }
.side-link.on { background: rgba(255,255,255,.12); color: #fff; font-weight: 600; }
.side-link.on i { color: var(--orange); }
.side-bottom { margin-top: auto; border-top: 1px solid rgba(255,255,255,.12); padding-top: 10px; }

/* ---------- Topbar / content ---------- */
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
    background: #fff; border-bottom: 1px solid var(--line);
    padding: 14px 26px; display: flex; align-items: center; justify-content: space-between; gap: 14px;
    position: sticky; top: 0; z-index: 50;
}
.topbar h1 { font-size: 17px; font-weight: 800; color: var(--green-dark); }
.top-actions { display: flex; align-items: center; gap: 14px; }
.who { font-size: 12.5px; color: var(--muted); display: flex; gap: 7px; align-items: center; }
.content { padding: 24px 26px 60px; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; gap: 8px; border: none; cursor: pointer;
    padding: 9px 16px; border-radius: 999px; font-family: inherit;
    font-size: 12.5px; font-weight: 700; transition: .15s;
}
.btn:hover { transform: translateY(-1px); }
.btn-green  { background: linear-gradient(135deg, #17925b, var(--green-600)); color: #fff; }
.btn-green:hover { box-shadow: 0 6px 14px rgba(15,108,66,.3); }
.btn-orange { background: linear-gradient(135deg, var(--orange), #ff8548); color: #fff; }
.btn-orange:hover { box-shadow: 0 6px 14px rgba(255,99,40,.3); }
.btn-ghost  { background: #fff; color: var(--green-dark); border: 1.5px solid var(--line); }
.btn-ghost:hover { border-color: var(--green); color: var(--green); }
.btn-danger { background: #fdeeee; color: #c53030; }
.btn-danger:hover { background: #c53030; color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 11.5px; }

/* ---------- Cards / tables ---------- */
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card + .card { margin-top: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card-head h2 { font-size: 14.5px; font-weight: 800; color: var(--green-dark); }
.card-head .hint { font-size: 11.5px; color: var(--muted); width: 100%; }
.card-body { padding: 18px; }

table.list { width: 100%; border-collapse: collapse; }
.list th {
    text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .8px;
    color: var(--muted); padding: 11px 14px; border-bottom: 1px solid var(--line); background: #fafcfa;
}
.list td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; font-size: 12.8px; }
.list tr:last-child td { border-bottom: none; }
.list tr:hover td { background: #fafdfb; }
.row-thumb { width: 40px; height: 40px; object-fit: contain; border-radius: 8px; border: 1px solid var(--line); background: #fff; padding: 2px; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }

.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 10.5px; font-weight: 700; }
.badge-on   { background: var(--mint-100); color: var(--green-600); }
.badge-off  { background: #f2f2f2; color: #888; }
.badge-rx   { background: #eaf1fc; color: #2f6fce; }
.badge-feat { background: #fff0e8; color: var(--orange); }
.icon-chip { width: 30px; height: 30px; border-radius: 8px; display: inline-grid; place-items: center; background: var(--mint); color: var(--green); }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.form-grid .full { grid-column: 1 / -1; }
label.f { display: block; font-size: 11.5px; font-weight: 700; color: var(--green-dark); margin-bottom: 5px; }
label.f small { font-weight: 500; color: var(--muted); }
.in, textarea.in, select.in {
    width: 100%; font-family: inherit; font-size: 13px; color: var(--text);
    border: 1.5px solid var(--line); border-radius: 9px; padding: 9px 12px;
    outline: none; background: #fff; transition: border-color .15s;
}
.in:focus { border-color: var(--green); }
textarea.in { resize: vertical; min-height: 74px; }
input[type="color"].in { padding: 3px; height: 40px; width: 70px; }
.check-row { display: flex; gap: 22px; flex-wrap: wrap; align-items: center; padding-top: 4px; }
.check-row label { display: flex; gap: 7px; align-items: center; font-size: 12.5px; cursor: pointer; }
.check-row input { accent-color: var(--green); width: 15px; height: 15px; }
.form-actions { display: flex; gap: 10px; margin-top: 20px; align-items: center; flex-wrap: wrap; }

.img-pick { display: flex; gap: 14px; align-items: center; }
.img-pick .preview {
    width: 74px; height: 74px; border: 1.5px dashed var(--line); border-radius: 10px;
    display: grid; place-items: center; overflow: hidden; background: #fafcfa; color: var(--muted); font-size: 18px;
}
.img-pick .preview img { width: 100%; height: 100%; object-fit: contain; }

/* Repeater rows (announcements, nav, footer links, sections…) */
.rep-rows { display: flex; flex-direction: column; gap: 10px; }
.rep-row {
    display: grid; gap: 10px; align-items: start;
    background: #fafcfa; border: 1px solid var(--line); border-radius: 10px; padding: 12px;
}
.rep-row .rm { justify-self: end; }
.rep-add { margin-top: 12px; }
.drag-hint { font-size: 11px; color: var(--muted); margin-top: 8px; }

/* ---------- Flash ---------- */
.flash {
    margin: 16px 26px -6px; padding: 11px 16px; border-radius: 10px;
    display: flex; gap: 10px; align-items: center; font-size: 12.8px; font-weight: 600;
}
.flash-ok  { background: #e8f6ee; color: var(--green-600); border: 1px solid #cdebd9; }
.flash-err { background: #fdeeee; color: #c53030; border: 1px solid #f5cccc; }

/* ---------- Dashboard ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.stat-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; display: flex; gap: 14px; align-items: center; }
.stat-card .ic { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; font-size: 18px; }
.stat-card b { font-size: 22px; display: block; line-height: 1.1; }
.stat-card span { font-size: 11.5px; color: var(--muted); }
.quick-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.quick-link { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; gap: 12px; align-items: center; transition: .15s; box-shadow: var(--shadow); }
.quick-link:hover { border-color: var(--green); transform: translateY(-2px); }
.quick-link i { width: 38px; height: 38px; border-radius: 10px; background: var(--mint); color: var(--green); display: grid; place-items: center; font-size: 15px; }
.quick-link b { display: block; font-size: 13px; }
.quick-link span { font-size: 11px; color: var(--muted); }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(135deg, var(--green-dark), #0a5e43); padding: 20px; }
.login-card { width: 100%; max-width: 380px; background: #fff; border-radius: 16px; padding: 34px 30px; box-shadow: 0 24px 60px rgba(0,0,0,.25); }
.login-card .brand { color: var(--green-dark); padding: 0 0 6px; }
.login-card .brand small { color: var(--muted); }
.login-card h1 { font-size: 19px; margin: 10px 0 4px; }
.login-card p.sub { margin: 0 0 20px; font-size: 12.5px; color: var(--muted); }
.login-card .in { margin-bottom: 12px; }
.login-note { margin-top: 16px; font-size: 11.5px; color: var(--muted); background: var(--mint); border-radius: 9px; padding: 10px 12px; }

/* ---------- Responsive-ish ---------- */
@media (max-width: 900px) {
    .admin-shell { grid-template-columns: 1fr; }
    .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 2px; }
    .sidebar nav { display: flex; flex-wrap: wrap; gap: 2px; }
    .side-group { display: none; }
    .side-bottom { margin: 0; border: none; padding: 0; display: flex; }
    .form-grid { grid-template-columns: 1fr; }
    .stat-grid, .quick-grid { grid-template-columns: 1fr 1fr; }
    .content { padding: 16px; }
    .flash { margin: 12px 16px -4px; }
}
