:root {
  --bg: #f3f5f2;
  --panel: #ffffff;
  --side: #06110b;
  --line: #e4e8e3;
  --text: #13201a;
  --muted: #6b7a71;
  --green: #00a651;
  --green-d: #008a43;
  --red: #e4252b;
  --yellow: #ffe500;
  --radius: 14px;
  --display: "Barlow Condensed", Impact, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: "Inter", system-ui, sans-serif; background: var(--bg); color: var(--text); font-size: 15px; }
a { color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
h1, h2, h3 { font-family: var(--display); text-transform: uppercase; letter-spacing: .4px; margin: 0; }

.btn { display: inline-flex; align-items: center; gap: 8px; border: 0; border-radius: 10px; padding: 10px 16px; font: 600 14px "Inter", sans-serif; cursor: pointer; text-decoration: none; transition: background .15s, transform .15s; white-space: nowrap; }
.btn.primary { background: var(--green); color: #fff; }
.btn.primary:hover { background: var(--green-d); }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: inherit; }
.btn.ghost:hover { background: rgba(0, 0, 0, .04); }
.btn.danger { background: #fdeceb; color: var(--red); }
.btn.small { padding: 7px 12px; font-size: 13px; }
.btn:disabled { opacity: .6; cursor: wait; }
.icon-btn { background: none; border: 0; font-size: 20px; cursor: pointer; padding: 6px 10px; border-radius: 8px; color: inherit; }
.icon-btn:hover { background: rgba(0, 0, 0, .06); }
.link { background: none; border: 0; color: var(--green-d); text-decoration: underline; cursor: pointer; font: inherit; padding: 0; }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(circle at 20% 10%, #0d3a23, #050d09 60%); }
.login-card { width: 100%; max-width: 400px; background: #fff; border-radius: 22px; padding: 36px; display: grid; gap: 14px; box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .6); }
.login-card img { width: 150px; margin: 0 auto 4px; }
.login-card h1 { text-align: center; font-size: 34px; }
.login-card p { text-align: center; margin: -6px 0 6px; }
.login-card .btn { justify-content: center; padding: 13px; }
.login-card a { text-align: center; text-decoration: none; }
.error { color: var(--red); font-size: 14px; min-height: 18px; text-align: center; }

/* Shell */
.shell { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.side { background: var(--side); color: #dfe8e2; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side-brand { display: flex; align-items: center; gap: 10px; padding: 20px 20px 14px; text-decoration: none; }
.side-brand img { height: 44px; }
.side-brand span { font-family: var(--display); font-weight: 800; font-size: 22px; text-transform: uppercase; letter-spacing: 1px; color: var(--yellow); }
.side nav { padding: 6px 12px; flex: 1; }
.side .grp { font-size: 11px; letter-spacing: 2px; text-transform: uppercase; color: #6f8a7b; padding: 16px 12px 6px; font-weight: 700; }
.side nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px; text-decoration: none; font-weight: 500; color: #c9d6ce; font-size: 14px; }
.side nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.side nav a.active { background: var(--green); color: #fff; }
.side nav a .ic { width: 20px; text-align: center; opacity: .9; }
.side-foot { padding: 16px 20px 20px; border-top: 1px solid rgba(255, 255, 255, .08); display: grid; gap: 10px; }
.side-foot .who { font-size: 12px; color: #8ea89a; word-break: break-all; }
.side-foot .btn { color: #fff; border-color: rgba(255, 255, 255, .2); justify-content: center; }

.main { min-width: 0; }
.top { display: flex; align-items: center; gap: 14px; padding: 22px 32px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.top h2 { font-size: 30px; }
.top p { margin: 2px 0 0; }
.top-actions { margin-left: auto; display: flex; gap: 10px; flex-wrap: wrap; }
.menu { display: none; }
.view { padding: 28px 32px 60px; }
.demo-note { margin: 20px 32px 0; padding: 12px 16px; background: #fff8c4; border: 1px solid #f0e07a; border-radius: 10px; font-size: 14px; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 40; width: 270px; transform: translateX(-100%); transition: transform .25s; }
  .side.open { transform: none; box-shadow: 20px 0 60px rgba(0, 0, 0, .4); }
  .menu { display: block; }
  .top { padding: 14px 16px; flex-wrap: wrap; }
  .top-actions { width: 100%; margin-left: 0; }
  .view { padding: 18px 16px 50px; }
  .demo-note { margin: 14px 16px 0; }
}

/* Cards / tables */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; }
.kpi { padding: 20px; text-decoration: none; display: block; transition: transform .15s, box-shadow .15s; }
.kpi:hover { transform: translateY(-2px); box-shadow: 0 10px 24px -14px rgba(0, 0, 0, .3); }
.kpi b { display: block; font-family: var(--display); font-size: 42px; line-height: 1; }
.kpi span { color: var(--muted); font-size: 13px; font-weight: 600; }
.kpi .ic { float: right; font-size: 22px; }

.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar input[type=search], .toolbar select { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font: inherit; background: #fff; min-width: 220px; }
.table-wrap { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; }
table.list th, table.list td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list th { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); font-weight: 700; background: #fafbf9; }
table.list tr:last-child td { border-bottom: 0; }
table.list tr:hover td { background: #fafcfa; }
table.list td.actions { text-align: right; white-space: nowrap; }
table.list .thumb { width: 54px; height: 54px; border-radius: 10px; object-fit: cover; background: #eef1ed; display: block; }
table.list .thumb.round { border-radius: 50%; }
table.list .ph { width: 54px; height: 54px; border-radius: 10px; background: #e9eee9; display: grid; place-items: center; font-family: var(--display); font-weight: 800; color: #93a39a; }
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #eef2ee; color: #3d4d43; }
.pill.green { background: #dff5e8; color: #0b7a3e; }
.pill.red { background: #fde4e3; color: #b81c21; }
.pill.yellow { background: #fff6b3; color: #6b5d00; }
.pill.grey { background: #eceeed; color: #6b7a71; }
.empty { padding: 50px 20px; text-align: center; color: var(--muted); }
.score-ctl { display: inline-flex; align-items: center; gap: 6px; }
.score-ctl b { font-family: var(--display); font-size: 22px; min-width: 64px; text-align: center; }
.score-ctl button { width: 26px; height: 26px; border-radius: 7px; border: 1px solid var(--line); background: #fff; cursor: pointer; font-weight: 700; }

/* Switch */
.switch { position: relative; display: inline-block; width: 40px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #cfd6d1; border-radius: 22px; transition: .2s; cursor: pointer; }
.switch span::before { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); }
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::before { transform: translateX(18px); }

/* Drawer + forms */
.drawer-bg { position: fixed; inset: 0; background: rgba(6, 17, 11, .45); opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 60; }
.drawer-bg.open { opacity: 1; pointer-events: auto; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(620px, 100vw); background: #fff; z-index: 61; transform: translateX(100%); transition: transform .25s ease; display: flex; flex-direction: column; }
.drawer.open { transform: none; box-shadow: -20px 0 60px rgba(0, 0, 0, .25); }
.drawer header { display: flex; align-items: center; justify-content: space-between; padding: 18px 24px; border-bottom: 1px solid var(--line); }
.drawer header h3 { font-size: 26px; }
.drawer footer { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 24px; border-top: 1px solid var(--line); background: #fafbf9; }
.drawer .form { flex: 1; overflow-y: auto; padding: 22px 24px; }

.form { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 18px; align-content: start; align-items: end; }
.form .full { grid-column: 1 / -1; }
.form label.f { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: #34443b; }
.form label.f .hint { font-weight: 400; color: var(--muted); font-size: 12px; }
.form input[type=text], .form input[type=number], .form input[type=email], .form input[type=url], .form input[type=date], .form input[type=datetime-local], .form select, .form textarea {
  width: 100%; padding: 10px 12px; border: 1px solid #d6ddd7; border-radius: 10px; font: 400 15px "Inter", sans-serif; background: #fff; color: var(--text);
}
.form textarea { resize: vertical; min-height: 90px; line-height: 1.5; }
.form textarea.tall { min-height: 260px; }
.form input:focus, .form select:focus, .form textarea:focus { outline: 2px solid rgba(0, 166, 81, .35); border-color: var(--green); }
.form .check { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; padding-top: 8px; }
@media (max-width: 560px) { .form { grid-template-columns: 1fr; } }

.img-field { display: grid; grid-template-columns: 110px 1fr; gap: 14px; align-items: center; }
.img-field .prev { width: 110px; height: 82px; border-radius: 10px; background: #eef1ed center/cover no-repeat; border: 1px dashed #c9d2cb; display: grid; place-items: center; color: #9aa79f; font-size: 12px; }
.img-field .ctrls { display: grid; gap: 8px; }
.img-field .upl { position: relative; overflow: hidden; }
.img-field .upl input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(30px); background: #0d1b14; color: #fff; padding: 12px 20px; border-radius: 12px; font-weight: 600; font-size: 14px; opacity: 0; transition: all .25s; z-index: 80; pointer-events: none; }
.toast.show { opacity: 1; transform: translateX(-50%); }
.toast.err { background: var(--red); }

.settings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.set-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: #fff; font-weight: 600; }
.help { background: #f6faf7; border: 1px solid #dcebe1; border-radius: 12px; padding: 14px 16px; font-size: 14px; color: #33463b; margin-bottom: 18px; }
.help code { background: #e7f1ea; padding: 1px 6px; border-radius: 5px; }
.gallery-admin { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.g-item { background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.g-item img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; }
.g-item .b { padding: 10px 12px; display: flex; justify-content: space-between; gap: 8px; align-items: center; font-size: 13px; }
.g-item .b span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.login-card label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: #34443b; }
.login-card input { width: 100%; padding: 12px 14px; border: 1px solid #d6ddd7; border-radius: 10px; font: 400 15px "Inter", sans-serif; }
.login-card input:focus { outline: 2px solid rgba(0, 166, 81, .35); border-color: var(--green); }
