/* ===== Admin ===== */
body.admin { background: #f6f3ee; }
.admin-shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar { background: var(--ink); color: #cfc6bc; padding: 26px 16px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px; }
.sidebar .brand { color: #fff; padding: 0 12px 4px; font-size: 2.4rem; }
.sidebar .brand-sub { padding: 0 12px 22px; font-size: .7rem; letter-spacing: .2em; text-transform: uppercase; color: #8f857b; }
.sidebar a.nav-item { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 10px; font-size: .92rem; transition: .15s; }
.sidebar a.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; opacity: .8; }
.sidebar a.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar a.nav-item.active { background: rgba(255,255,255,.1); color: #fff; }
.sidebar a.nav-item .badge { margin-left: auto; background: var(--accent); color: #fff; font-size: .7rem; padding: 2px 8px; border-radius: 999px; }
.sidebar .spacer { flex: 1; }
.sidebar form button { background: none; border: 0; color: #8f857b; font: inherit; font-size: .85rem; padding: 10px 12px; cursor: pointer; text-align: left; width: 100%; border-radius: 10px; }
.sidebar form button:hover { color: #fff; background: rgba(255,255,255,.06); }
.admin-main { padding: 28px clamp(16px, 3vw, 40px) 60px; min-width: 0; }
.admin-top { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 26px; flex-wrap: wrap; }
.admin-top h1 { font-size: clamp(2rem, 3.4vw, 2.6rem); margin: 0; }
.admin-top .actions { display: flex; gap: 10px; flex-wrap: wrap; }
.mobile-bar { display: none; }
@media (max-width: 900px) {
  .admin-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 60; transform: translateX(-100%); transition: transform .25s; }
  .sidebar.open { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.35); }
  .mobile-bar { display: flex; align-items: center; justify-content: space-between; padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px; background: var(--ink); color: #fff; position: sticky; top: 0; z-index: 50; }
  .mobile-bar .brand { color: #fff; font-size: 2rem; }
  .mobile-bar button { background: none; border: 0; color: #fff; padding: 6px; }
}

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 22px; }
.panel + .panel { margin-top: 18px; }
.panel h2, .panel h3 { font-size: 1.45rem; margin-bottom: 14px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.panel-head h2, .panel-head h3 { margin: 0; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.cols-3 { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 1100px) { .cols, .cols-3 { grid-template-columns: 1fr; } }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 18px 20px; }
.stat span { font-size: .75rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.stat b { display: block; font-family: var(--serif); font-size: 2.1rem; font-weight: 500; line-height: 1.15; margin-top: 4px; }
.stat small { color: var(--muted); font-size: .8rem; }
.stat.accent { background: var(--ink); border-color: var(--ink); color: #fff; }
.stat.accent span, .stat.accent small { color: #bdb3a8; }

.table-wrap { overflow-x: auto; margin: 0 -22px; padding: 0 22px; }
table.t { width: 100%; border-collapse: collapse; font-size: .9rem; }
.t th { text-align: left; font-weight: 500; font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.t td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.t tr:last-child td { border-bottom: 0; }
.t tr.clickable { cursor: pointer; transition: background .15s; }
.t tr.clickable:hover { background: var(--bg); }
.t .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.t .thumb { width: 44px; height: 60px; border-radius: 8px; object-fit: cover; background: var(--bg-2); }
.t .strong { font-weight: 500; }

.pill { display: inline-block; font-size: .72rem; padding: 4px 10px; border-radius: 999px; font-weight: 500; white-space: nowrap; background: var(--bg-2); color: var(--ink-2); }
.pill.new { background: #e8eefc; color: #2747a8; }
.pill.confirmed { background: #f3e9fb; color: #6b2c9c; }
.pill.in_progress { background: #fdf1df; color: #94570a; }
.pill.ready { background: #e3f4ea; color: #1f6b41; }
.pill.delivered { background: #ece9e4; color: #4a423c; }
.pill.cancelled { background: #fbe9ec; color: #a1203a; }
.pill.hidden { background: #ece9e4; color: #6f675f; }
.pill.active { background: #e3f4ea; color: #1f6b41; }
.pill.low { background: #fdf1df; color: #94570a; }
.pill.out { background: #fbe9ec; color: #a1203a; }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.tabs a { padding: 8px 14px; border-radius: 999px; font-size: .85rem; border: 1px solid var(--line); background: var(--surface); }
.tabs a.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.tabs a small { opacity: .6; margin-left: 4px; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.toolbar input[type=search], .toolbar select { width: auto; min-width: 200px; background: var(--surface); }

.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; background: var(--surface); }
.stepper button { border: 0; background: none; width: 30px; height: 30px; cursor: pointer; font-size: 1rem; color: var(--ink-2); }
.stepper button:hover { background: var(--bg-2); }
.stepper b { min-width: 28px; text-align: center; font-weight: 500; font-variant-numeric: tabular-nums; }

.kv { display: grid; grid-template-columns: 150px 1fr; gap: 8px 16px; font-size: .92rem; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }
.mgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.mcell { background: var(--bg); border-radius: 10px; padding: 10px 12px; }
.mcell span { display: block; font-size: .72rem; color: var(--muted); letter-spacing: .03em; }
.mcell b { font-weight: 500; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.img-row { display: flex; gap: 10px; flex-wrap: wrap; }
.img-row .im { position: relative; width: 110px; }
.img-row .im img { width: 110px; aspect-ratio: 2/3; object-fit: cover; border-radius: 10px; background: var(--bg-2); }
.img-row .im .file { width: 110px; aspect-ratio: 2/3; border-radius: 10px; background: var(--bg-2); display: grid; place-items: center; font-size: .75rem; text-align: center; padding: 6px; word-break: break-all; }
.img-row .im form { position: absolute; top: 6px; right: 6px; }
.img-row .im .cover-badge { position: absolute; left: 6px; top: 6px; font-size: .65rem; background: var(--ink); color: #fff; padding: 2px 8px; border-radius: 999px; }
.icon-btn { width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(255,255,255,.92); cursor: pointer; display: grid; place-items: center; font-size: .9rem; box-shadow: 0 1px 4px rgba(0,0,0,.15); }
.icon-btn:hover { background: var(--err); color: #fff; }
.mini-btn { font: inherit; font-size: .72rem; border: 1px solid var(--line); background: var(--surface); padding: 3px 8px; border-radius: 999px; cursor: pointer; margin-top: 6px; }
.mini-btn:hover { border-color: var(--ink); }
.btn-danger { background: transparent; color: var(--err); border-color: #f0c9cf; }
.btn-danger:hover { background: var(--err); color: #fff; border-color: var(--err); }
.balance { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: .95rem; }
.balance:last-child { border-bottom: 0; }
.balance.total { font-weight: 500; font-size: 1.1rem; }
.bars { display: flex; align-items: flex-end; gap: 18px; height: 180px; padding-top: 10px; }
.bars .b { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bars .pair { display: flex; gap: 4px; align-items: flex-end; height: 100%; width: 100%; justify-content: center; }
.bars .pair i { width: 40%; max-width: 26px; border-radius: 6px 6px 2px 2px; display: block; min-height: 2px; }
.bars .inc { background: var(--accent); }
.bars .exp { background: #d8cbb9; }
.bars small { font-size: .75rem; color: var(--muted); }
.legend { display: flex; gap: 16px; font-size: .8rem; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.check { display: flex; gap: 10px; align-items: center; font-size: .92rem; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(circle at 20% 10%, var(--accent-soft), transparent 50%), var(--bg); }
.login-card { width: 100%; max-width: 400px; }
.empty-sm { color: var(--muted); font-size: .9rem; padding: 20px 0; text-align: center; }

/* Admin uses the storefront order form; tighten it */
.admin .form-card { border-radius: 16px; padding: 22px; }
.admin .form-step-head h2 { font-size: 1.5rem; }

/* Print job sheet */
@media print {
  .no-print { display: none !important; }
  body { background: #fff; }
}

/* Photo Studio */
.studio { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 18px; align-items: start; }
.studio-controls .panel + .panel { margin-top: 14px; }
.studio-preview { position: sticky; top: 20px; }
.preview-frame { position: relative; border-radius: 16px; overflow: hidden; background: var(--bg-2); border: 1px solid var(--line); aspect-ratio: 2 / 3; }
.preview-frame canvas { width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
.preview-frame canvas.dragging { cursor: grabbing; }
.preview-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: .9rem; background: rgba(243,237,228,.75); }
.step-num { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--ink); color: #fff; font: 500 .8rem var(--sans); margin-right: 8px; vertical-align: 3px; }
.cutout-wrap { border-radius: 12px; overflow: hidden; text-align: center; padding: 8px;
  background: repeating-conic-gradient(#ece6dd 0% 25%, #faf7f2 0% 50%) 50% / 18px 18px; }
.cutout { max-width: 100%; max-height: 380px; width: auto; height: auto; display: inline-block; }
.tpl-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tpl { cursor: pointer; position: relative; }
.tpl input { position: absolute; opacity: 0; }
.tpl > span { display: block; border: 2px solid transparent; border-radius: 12px; padding: 4px; transition: .2s; height: 100%; }
.tpl img { width: 100%; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 8px; }
.tpl b { display: block; font-weight: 500; font-size: .88rem; margin: 6px 2px 0; }
.tpl small { display: block; color: var(--muted); font-size: .74rem; line-height: 1.35; margin: 2px 2px 4px; }
.tpl input:checked + span { border-color: var(--accent); background: var(--accent-soft); }
.tpl input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 3px; background: var(--bg); margin-bottom: 6px; }
.seg input { display: none; }
.seg span { display: block; padding: 6px 14px; border-radius: 999px; font-size: .82rem; cursor: pointer; }
.seg input:checked + span { background: var(--ink); color: #fff; }
input[type=range] { width: 100%; accent-color: var(--accent); }
@media (max-width: 1000px) { .studio { grid-template-columns: 1fr; } .studio-preview { position: static; order: -1; } }
.ai-status { margin: -4px 0 10px; font-size: .88rem; color: var(--accent); min-height: 1.3em; }
