/* ============================================================
   AVISSEE — Admin panel theme
   ============================================================ */
:root {
  --bg: #f5f3f0;
  --surface: #ffffff;
  --ink: #241f1c;
  --muted: #857a70;
  --line: #e7e0d7;
  --accent: #9c3f5c;
  --accent-dark: #7d2f48;
  --accent-soft: #f6e7ec;
  --success: #2e7d5b;
  --success-soft: #e4f1ea;
  --danger: #b3392f;
  --danger-soft: #fbeae7;
  --info: #3a6ea5;
  --info-soft: #e7f0f9;
  --warn: #b07a2c;
  --warn-soft: #fbf1e0;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(36,31,28,.05);
  --font: 'Plus Jakarta Sans', system-ui, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--ink); font-size: 14.5px; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
input, select, textarea, button { font-family: inherit; font-size: 14px; }
h1, h2, h3 { line-height: 1.25; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); }
.hidden { display: none !important; }
.line-through { text-decoration: line-through; }
.sale-price { color: var(--accent); font-weight: 700; }
.spacer { flex: 1; }

/* ---------- Shell ---------- */
.admin-shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.admin-side { background: #241f1c; color: #cfc6bb; padding: 22px 16px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.admin-brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 20px; border-bottom: 1px solid rgba(255,255,255,.12); margin-bottom: 16px; color: #fff; font-family: 'Quicksand', sans-serif; font-weight: 700; font-size: 17px; }
.admin-brand .logo-mark { width: 36px; height: 36px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 19px; font-weight: 800; }
.admin-brand .logo-mark.logo-img, .admin-login-brand .logo-mark.logo-img { background: transparent; border-radius: 6px; object-fit: contain; }
.admin-brand small { display: block; font-size: 10px; letter-spacing: .2em; text-transform: uppercase; color: #9c9084; font-weight: 600; }
.admin-nav { display: flex; flex-direction: column; gap: 3px; }
.admin-nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; font-weight: 600; font-size: 14px; color: #cfc6bb; }
.admin-nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.admin-nav a.on { background: var(--accent); color: #fff; }
.nav-ico { width: 20px; text-align: center; font-size: 16px; opacity: .9; }
.admin-side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 2px; border-top: 1px solid rgba(255,255,255,.12); padding-top: 14px; }
.admin-side-foot a { padding: 8px 12px; border-radius: 8px; font-size: 13px; color: #b3a89c; }
.admin-side-foot a:hover { color: #fff; background: rgba(255,255,255,.06); }

.admin-main { display: flex; flex-direction: column; min-width: 0; }
.admin-topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 20px 28px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.admin-topbar h1 { font-size: 20px; }
.admin-topbar p { color: var(--muted); font-size: 13px; }
.admin-user { display: flex; align-items: center; gap: 10px; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 800; }
.admin-user strong, .admin-user small { display: block; }
.admin-user small { color: var(--muted); font-size: 12px; }

.admin-content { padding: 26px 28px 40px; flex: 1; }
.admin-footer { padding: 16px 28px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12.5px; background: var(--surface); }

/* ---------- Cards / grids ---------- */
.card-section { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin-bottom: 20px; box-shadow: var(--shadow); }
.card-section h2 { font-size: 16px; margin-bottom: 16px; }
.card-section h3 { font-size: 14px; }
.admin-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.admin-grid-2 > * { min-width: 0; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.stat-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.stat-card span { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.stat-card strong { display: block; font-size: 26px; margin-top: 4px; }
.stat-card small { font-size: 12px; color: var(--muted); }
.stat-card.warn { border-color: var(--warn); }
.stat-card.warn strong { color: var(--warn); }

.section-head { margin-bottom: 16px; }
.section-head h2 { margin-bottom: 0; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.row-between h2 { margin-bottom: 0; }

/* ---------- Tables ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 8px 10px; border-bottom: 2px solid var(--line); }
.table td { padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table small { display: block; color: var(--muted); font-size: 12px; }
.table tr:hover td { background: #fcfaf7; }
.table .thumb-img { width: 44px; height: 52px; object-fit: cover; border-radius: 8px; }
.row-muted td { opacity: .55; }
.row-danger td { background: var(--danger-soft) !important; }
.total-row td { font-weight: 700; background: transparent !important; }
.total-row.grand td { font-size: 15px; border-top: 2px solid var(--ink); }
.cancelled-row td { opacity: .5; }
.cancelled-row td:first-child { opacity: 1; }
.row-actions { white-space: nowrap; vertical-align: middle; text-align: right; }
.row-actions > .btn, .row-actions > .inline-form { vertical-align: middle; margin-left: 6px; }
.row-actions > .inline-form:first-child, .row-actions > .btn:first-child { margin-left: 0; }
.inline-form { display: inline-flex; align-items: center; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 0; border-radius: 9px; padding: 10px 18px; font-weight: 700; font-size: 13.5px; cursor: pointer; transition: all .15s; white-space: nowrap; }
.btn-sm { padding: 7px 12px; font-size: 12.5px; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-outline { background: transparent; border: 1.5px solid var(--accent); color: var(--accent); }
.btn-outline:hover { background: var(--accent-soft); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.w-100 { width: 100%; }
.text-link { color: var(--accent); font-weight: 700; font-size: 13px; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.toolbar-inline { display: flex; gap: 10px; margin-top: 14px; }
.section-head .toolbar-inline { margin-top: 0; align-items: center; }
.toolbar-form { display: flex; gap: 8px; flex-wrap: wrap; }
.toolbar-form input, .toolbar-form select { border: 1px solid var(--line); border-radius: 9px; padding: 9px 12px; background: var(--surface); }
.admin-form .field { margin-bottom: 14px; }

/* ---------- Forms ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; font-weight: 700; margin-bottom: 6px; }
.field input, .field select, .field textarea, .auth-card input {
  width: 100%; border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; background: var(--surface);
}
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13.5px; cursor: pointer; margin: 4px 0; }
.check input { width: auto; }
.inline-checks { display: flex; gap: 22px; margin-top: 4px; }

.upload-box { border: 1.5px dashed var(--line); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.upload-box img { width: 100%; max-width: 240px; aspect-ratio: 1/1; object-fit: cover; border-radius: 10px; background: var(--bg); }
.upload-box input[type=file] { font-size: 12.5px; }
.upload-box small { text-align: center; }

/* ---------- Gallery manager ---------- */
.gallery-manage { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 10px; }
.gallery-thumb { position: relative; width: 88px; cursor: pointer; }
.gallery-thumb img { width: 88px; height: 106px; object-fit: cover; border-radius: 10px; border: 2px solid var(--line); background: var(--bg); transition: border-color .15s; }
.gallery-thumb input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.gallery-thumb .gallery-remove-label { position: absolute; left: 6px; bottom: 6px; background: rgba(0,0,0,.65); color: #fff; font-size: 10.5px; padding: 2px 7px; border-radius: 999px; opacity: .85; }
.gallery-thumb input:checked + .gallery-remove-label { background: var(--danger); opacity: 1; }
.gallery-thumb input:checked ~ img, .gallery-thumb:has(input:checked) img { border-color: var(--danger); }
.file-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.file-list li { background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; font-size: 11.5px; color: var(--muted); }

/* ---------- Toggle switch ---------- */
.switch { position: relative; width: 40px; height: 22px; background: #ddd6cc; border: 0; border-radius: 999px; cursor: pointer; transition: background .2s; }
.switch span { position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: left .2s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.switch.on { background: var(--success); }
.switch.on span { left: 21px; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-muted { background: var(--bg); color: var(--muted); }
.badge-super { background: #f3e5f5; color: #7b1fa2; }

.alert { padding: 12px 15px; border-radius: 10px; font-size: 13.5px; margin-bottom: 16px; }
.alert a { color: inherit; font-weight: 700; }
.alert code { background: rgba(0,0,0,.08); padding: 2px 6px; border-radius: 5px; }
.alert-success { background: var(--success-soft); color: var(--success); }
.alert-error { background: var(--danger-soft); color: var(--danger); }
.alert-info { background: var(--info-soft); color: var(--info); }

/* ---------- Tabs ---------- */
.tab-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.tab { padding: 8px 14px; border-radius: 9px; font-size: 13px; font-weight: 600; color: var(--muted); }
.tab:hover { background: var(--surface); }
.tab.on { background: var(--ink); color: #fff; }

/* ---------- Stock pill ---------- */
.stock-pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-weight: 700; font-size: 12.5px; }
.stock-pill.ok { background: var(--success-soft); color: var(--success); }
.stock-pill.low { background: var(--warn-soft); color: var(--warn); }

/* ---------- Biz tile grid ---------- */
.biz-tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 18px; }
.biz-tile { display: flex; flex-direction: column; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); transition: border-color .15s, box-shadow .15s; text-decoration: none; color: inherit; }
.biz-tile:hover { border-color: var(--accent); box-shadow: 0 4px 20px rgba(156,63,92,.1); }
.biz-tile-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.biz-tile-head strong { font-size: 16px; line-height: 1.3; }
.biz-tile-meta { display: flex; flex-direction: column; gap: 3px; }
.biz-tile-tag { font-size: 12.5px; color: var(--muted); }
.biz-tile-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.biz-tile-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; border-top: 1px solid var(--line); padding-top: 12px; }
.biz-tile-stats span { display: block; font-size: 11px; color: var(--muted); font-weight: 600; }
.biz-tile-stats strong { display: block; font-size: 15px; margin-top: 2px; }
.biz-tile-foot { margin-top: auto; padding-top: 4px; }

/* ---------- Order banner ---------- */
.order-banner { display: flex; align-items: center; justify-content: space-between; gap: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 24px; margin-bottom: 20px; box-shadow: var(--shadow); }
.order-banner-badges { display: flex; gap: 8px; }
.status-form select { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: var(--surface); font-size: 13px; }

/* ---------- Login ---------- */
.admin-login-body { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(160deg, #241f1c, #3d2c34); padding: 20px; }
.admin-login { width: 100%; max-width: 380px; background: #fff; border-radius: 16px; padding: 34px; box-shadow: 0 30px 60px rgba(0,0,0,.3); }
.admin-login-brand { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 26px; font-family: 'Quicksand', sans-serif; font-size: 18px; }
.admin-login-brand .logo-mark { width: 42px; height: 42px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 22px; font-weight: 800; }
.admin-login-hint { text-align: center; margin-top: 16px; font-size: 12px; }

.empty-note { color: var(--muted); padding: 14px 0; }
.empty-note a { color: var(--accent); font-weight: 700; }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .admin-shell { grid-template-columns: 1fr; }
  .admin-side { position: static; height: auto; flex-direction: row; align-items: center; padding: 12px 16px; overflow-x: auto; }
  .admin-brand { border-bottom: 0; padding: 0 12px 0 0; margin: 0; }
  .admin-nav { flex-direction: row; }
  .admin-side-foot { flex-direction: row; margin-top: 0; border-top: 0; padding: 0; margin-left: auto; }
  .admin-nav a { padding: 8px 10px; font-size: 12.5px; }
  .nav-ico { display: none; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .admin-grid-2 { grid-template-columns: 1fr; }
  .admin-topbar { flex-wrap: wrap; }
  .admin-topbar h1 { font-size: 18px; }
}
@media (max-width: 640px) {
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .row-2, .row-3 { grid-template-columns: 1fr; }
  .admin-content { padding: 18px; }
  .admin-topbar { padding: 14px 18px; gap: 12px; }
  .admin-topbar h1 { font-size: 16px; }
  .admin-user div { display: none; }
  .table-products { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .toolbar { flex-direction: column; align-items: stretch; gap: 10px; }
  .toolbar-form { flex-wrap: wrap; }
  .toolbar-form input[type=search], .toolbar-form select { flex: 1 1 140px; min-width: 0; }
  .order-banner { flex-direction: column; align-items: flex-start; gap: 12px; padding: 16px; }
  .order-banner-badges { flex-wrap: wrap; }
  .card-section { padding: 16px; }
  .card-section h2 { font-size: 15px; }
  .gallery-thumb { width: 64px; }
  .gallery-thumb img { width: 64px; height: 78px; }
  .admin-login { padding: 24px; }
  .admin-login-brand { font-size: 16px; }
  .admin-login-brand .logo-mark { width: 36px; height: 36px; font-size: 18px; }
  .tab-nav { gap: 2px; }
  .tab { padding: 6px 10px; font-size: 12px; }
}
