/* Passion Box — control panel */
:root {
  --plum: #2A1027; --rasp: #B0275F; --rasp-dark: #8C1B4A; --lilac: #D8B8D4; --wash: #F6F2F6; --card: #fff;
  --ink: #241521; --muted: #75687A; --line: #E8E0E8; --ok: #17845A; --warn: #B35C00; --err: #C0213C;
  --r: 12px; --text: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font: 15px/1.5 var(--text); color: var(--ink); background: var(--wash); }
a { color: var(--rasp); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }
img { max-width: 100%; }
:focus-visible { outline: 3px solid var(--rasp); outline-offset: 2px; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }

/* shell */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.side { background: var(--plum); color: #E8D9E4; padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; }
.side .logo { display: block; padding: 6px 10px 18px; }
.side .logo img { height: 44px; width: auto; }
.side nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: #E8D9E4; text-decoration: none; font-weight: 600; }
.side nav a:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.side nav a.on { background: var(--rasp); color: #fff; }
.side nav svg { width: 20px; height: 20px; flex: 0 0 20px; }
.side .sep { height: 1px; background: rgba(255, 255, 255, .1); margin: 10px 8px; }
.side .pill { margin-left: auto; background: #fff; color: var(--plum); font-size: .75rem; font-weight: 800; border-radius: 99px; padding: 1px 8px; }
.side .foot { margin-top: auto; padding: 12px; font-size: .84rem; color: #BBA9B8; }
.side .foot a { color: #fff; }
.main { min-width: 0; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 28px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.top h1 { margin: 0; font-size: 1.35rem; }
.top .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn.menu-toggle { display: none; }
.content { padding: 24px 28px 60px; max-width: 1300px; }

/* blocks */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; margin-bottom: 20px; }
.card > h2:first-child { margin-top: 0; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.card-head h2 { margin: 0; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; }
.kpi .v { font-size: 1.7rem; font-weight: 800; letter-spacing: -.02em; }
.kpi .l { color: var(--muted); font-size: .9rem; }
.kpi.hot { background: var(--plum); color: #fff; border-color: var(--plum); }
.kpi.hot .l { color: #D8C6D4; }
.kpi.hot a { color: #fff; }
.cols { display: grid; grid-template-columns: 1.6fr 1fr; gap: 20px; align-items: start; }
.cols.even { grid-template-columns: 1fr 1fr; }
.chart { width: 100%; height: 200px; display: block; }
.chart rect.bar { fill: var(--lilac); }
.chart rect.bar.today { fill: var(--rasp); }
.chart rect.bar:hover { fill: var(--rasp-dark); }
.chart text { font-size: 11px; fill: var(--muted); }

/* tables */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: .93rem; }
.t th { text-align: left; font-weight: 700; color: var(--muted); font-size: .82rem; padding: 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.t td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.t tr:hover td { background: #FCFAFC; }
.t .thumb { width: 48px; height: 48px; object-fit: contain; border-radius: 8px; background: var(--wash); display: block; }
.t a.row-link { color: var(--ink); font-weight: 700; text-decoration: none; }
.t a.row-link:hover { color: var(--rasp); }
.num { text-align: right !important; white-space: nowrap; }
.status { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: .78rem; font-weight: 700; background: #EEE; color: #444; white-space: nowrap; }
.status.paid, .status.processing { background: #FFF1DE; color: #8A4B00; }
.status.dispatched, .status.completed { background: #E3F4EC; color: #0E5E3F; }
.status.cancelled, .status.refunded { background: #F6E3E7; color: #8F1630; }
.status.test { background: #E9E4F7; color: #4B2E9B; }
.status.on { background: #E3F4EC; color: #0E5E3F; }
.status.off { background: #EEE; color: #666; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.tab { padding: 7px 14px; border-radius: 99px; border: 1px solid var(--line); background: #fff; text-decoration: none; color: var(--ink); font-weight: 600; font-size: .9rem; }
.tab.on { background: var(--plum); border-color: var(--plum); color: #fff; }
.tab .n { opacity: .7; margin-left: 4px; }

/* forms */
label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: 12px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], input[type=datetime-local], input[type=tel], input[type=url], input:not([type]), select, textarea {
  display: block; width: 100%; margin-top: 5px; min-height: 42px; padding: 9px 12px; border: 1.5px solid #DCCFDB; border-radius: 10px; font: inherit; font-weight: 400; background: #fff; color: var(--ink); }
textarea { min-height: 140px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--rasp); }
.hint { display: block; font-weight: 400; color: var(--muted); font-size: .84rem; margin-top: 4px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.check { display: flex; align-items: flex-start; gap: 10px; font-weight: 600; }
.check input { width: 20px; height: 20px; accent-color: var(--rasp); margin: 1px 0 0; flex: 0 0 20px; }
.switch { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; cursor: pointer; }
.switch input { appearance: none; width: 46px; height: 26px; border-radius: 99px; background: #D6CBD5; position: relative; cursor: pointer; transition: .2s; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: .2s; }
.switch input:checked { background: var(--ok); }
.switch input:checked::after { left: 23px; }
.field-err { color: var(--err); font-weight: 600; font-size: .88rem; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px 16px; border-radius: 10px; border: 1.5px solid var(--rasp); background: var(--rasp); color: #fff; font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--rasp-dark); border-color: var(--rasp-dark); }
.btn.ghost { background: #fff; color: var(--ink); border-color: #D6CBD5; }
.btn.ghost:hover { border-color: var(--ink); }
.btn.dark { background: var(--plum); border-color: var(--plum); }
.btn.danger { background: #fff; color: var(--err); border-color: #EBC3CB; }
.btn.danger:hover { background: var(--err); color: #fff; }
.btn.small { min-height: 32px; padding: 4px 10px; font-size: .86rem; border-radius: 8px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; }
.inline { display: inline; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; font-weight: 600; }
.alert.ok { background: #E3F4EC; color: #0E5E3F; }
.alert.err { background: #FBE7EA; color: #8F1630; }
.alert.info { background: #F1E8F0; color: var(--plum); }
.alert.warn { background: #FFF1DE; color: #8A4B00; }
.empty { text-align: center; padding: 30px; color: var(--muted); }
.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.checklist li:last-child { border: 0; }
.checklist .dot { width: 22px; height: 22px; border-radius: 50%; border: 2px solid #D6CBD5; flex: 0 0 22px; display: grid; place-items: center; color: #fff; font-size: .8rem; }
.checklist .done .dot { background: var(--ok); border-color: var(--ok); }
.checklist .done span { color: var(--muted); text-decoration: line-through; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 700; letter-spacing: .04em; }
.copybox { display: flex; gap: 8px; align-items: center; background: var(--wash); border: 1px dashed #CDBBCB; border-radius: 10px; padding: 8px 10px; font-family: ui-monospace, Menlo, monospace; font-size: .86rem; word-break: break-all; }

/* product editor */
.editor { display: grid; grid-template-columns: 1.5fr 1fr; gap: 20px; align-items: start; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; }
.photo { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--wash); border: 2px solid var(--line); }
.photo img { width: 100%; height: 100%; object-fit: contain; }
.photo.main { border-color: var(--rasp); }
.photo .main-tag { position: absolute; left: 6px; top: 6px; background: var(--rasp); color: #fff; font-size: .72rem; font-weight: 800; padding: 2px 8px; border-radius: 99px; }
.photo .tools { position: absolute; right: 6px; top: 6px; display: flex; gap: 4px; }
.photo .tools button { width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .92); cursor: pointer; font-weight: 800; }
.photo.add { display: grid; place-items: center; text-align: center; border-style: dashed; cursor: pointer; color: var(--rasp); font-weight: 700; padding: 8px; background: #fff; }
.photo.add svg { width: 30px; height: 30px; display: block; margin: 0 auto 4px; }
.photo .remote { position: absolute; left: 6px; bottom: 6px; background: #FFF1DE; color: #8A4B00; font-size: .7rem; font-weight: 700; padding: 2px 6px; border-radius: 6px; }
.sticky-save { position: sticky; bottom: 0; background: rgba(255, 255, 255, .95); backdrop-filter: blur(6px); border-top: 1px solid var(--line); padding: 12px 0; display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 10px; }
.preview-card { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: #fff; }
.preview-card .pic { aspect-ratio: 1; background: #FAF5F9; }
.preview-card .pic img { width: 100%; height: 100%; object-fit: contain; }
.preview-card .body { padding: 14px; }
.preview-card .name { font-weight: 700; }
.preview-card .price { font-weight: 800; font-size: 1.2rem; }
.preview-card .desc { color: var(--muted); font-size: .88rem; max-height: 6.5em; overflow: hidden; }

/* photo studio */
.studio { position: fixed; inset: 0; z-index: 50; background: rgba(36, 21, 33, .6); display: none; padding: 20px; overflow: auto; }
.studio.open { display: block; }
.studio-panel { background: #fff; border-radius: 18px; max-width: 1180px; margin: 0 auto; overflow: hidden; }
.studio-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.studio-head h2 { margin: 0; }
.steps { display: flex; gap: 6px; list-style: none; margin: 0; padding: 0; flex-wrap: wrap; }
.steps li { padding: 5px 12px; border-radius: 99px; background: var(--wash); color: var(--muted); font-weight: 700; font-size: .84rem; }
.steps li.on { background: var(--plum); color: #fff; }
.steps li.done { background: #E3F4EC; color: #0E5E3F; }
.studio-body { display: grid; grid-template-columns: 1.3fr 1fr; gap: 0; min-height: 560px; }
.stage { background: repeating-conic-gradient(#EFEAEE 0 25%, #fff 0 50%) 0 0 / 22px 22px; display: grid; place-items: center; padding: 20px; position: relative; }
.stage canvas { max-width: 100%; max-height: 70vh; border-radius: 10px; box-shadow: 0 10px 30px -15px rgba(0, 0, 0, .35); touch-action: none; background: transparent; }
.stage .busy { position: absolute; inset: 0; background: rgba(255, 255, 255, .86); display: none; place-items: center; text-align: center; padding: 30px; font-weight: 700; }
.stage .busy.on { display: grid; }
.progress { width: 260px; height: 10px; border-radius: 99px; background: #EEE; overflow: hidden; margin: 12px auto 0; }
.progress i { display: block; height: 100%; width: 0; background: var(--rasp); transition: width .2s; }
.controls { padding: 20px; border-left: 1px solid var(--line); overflow-y: auto; max-height: 80vh; }
.controls section { margin-bottom: 20px; }
.controls h3 { margin-bottom: 8px; }
.pick { display: grid; gap: 10px; }
.pick label.btn { margin: 0; }
.pick input[type=file] { display: none; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatches button { width: 44px; height: 44px; border-radius: 10px; border: 2px solid var(--line); cursor: pointer; }
.swatches button[aria-pressed="true"] { border-color: var(--rasp); box-shadow: 0 0 0 3px rgba(176, 39, 95, .2); }
.range { display: grid; grid-template-columns: 110px 1fr 40px; gap: 10px; align-items: center; font-size: .9rem; font-weight: 600; margin-bottom: 6px; }
.range input { width: 100%; accent-color: var(--rasp); }
.seg { display: inline-flex; border: 1.5px solid #D6CBD5; border-radius: 10px; overflow: hidden; }
.seg button { border: 0; background: #fff; padding: 8px 12px; font: inherit; font-weight: 700; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--plum); color: #fff; }
.studio-foot { display: flex; justify-content: space-between; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--line); flex-wrap: wrap; }

/* auth */
body.auth { display: grid; place-items: center; min-height: 100vh; padding: 20px; background: var(--plum) url("../img/bloom.webp") center / 900px no-repeat; }
.auth-card { width: 100%; max-width: 420px; background: #fff; border-radius: 18px; padding: 30px; box-shadow: 0 30px 60px -30px rgba(0, 0, 0, .5); }
.auth-logo { height: 60px; width: auto; display: block; margin-bottom: 16px; }
.checks { list-style: none; padding: 0; margin: 0 0 16px; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; font-size: .88rem; }
.checks .ok { color: var(--ok); } .checks .bad { color: var(--err); font-weight: 700; }

@media (max-width: 1100px) { .kpis { grid-template-columns: repeat(2, 1fr); } .cols, .cols.even, .editor { grid-template-columns: 1fr; } .studio-body { grid-template-columns: 1fr; } .controls { border-left: 0; border-top: 1px solid var(--line); max-height: none; } }
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 30; left: 0; width: 260px; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .35); }
  .btn.menu-toggle { display: inline-flex; }
  .top { padding: 12px 16px; }
  .content { padding: 16px 14px 60px; }
  .grid2, .grid3 { grid-template-columns: 1fr; gap: 0; }
  .studio { padding: 0; }
  .studio-panel { border-radius: 0; }
  .hide-sm { display: none; }
}
input[name=code]::placeholder { text-transform: none; letter-spacing: 0; }
.cols > *, .editor > *, .kpis > *, .grid2 > *, .grid3 > * { min-width: 0; }
@media (max-width: 820px) { .top { flex-wrap: wrap; } .top .actions .btn { min-height: 36px; padding: 6px 12px; font-size: .88rem; } .kpi .v { font-size: 1.35rem; } .card { padding: 16px; } }
@media (max-width: 820px) { .sticky-save .btn[name=next] { display: none; } }
@media print { .side, .top .actions, .menu-toggle, form, .btn, .studio { display: none !important; } .shell { display: block; } body { background: #fff; } .card { border: 0; padding: 0; } .cols { display: block; } }
