/* Magic Velónes staff portal */
:root {
  --ink: #15120f; --ink2: #2b2520; --side: #17130f; --bg: #f6f2ea; --card: #fff; --line: #e7dfd1; --muted: #7a6f62;
  --gold: #b8860b; --gold2: #d6b46a; --goldbg: #fbf4e3;
  --ok: #2f7a4a; --okbg: #e7f3ea; --warn: #9a6a00; --warnbg: #fdf3d8; --bad: #b23b2b; --badbg: #fbe9e6; --info: #2c5d8f; --infobg: #e6eef8;
  --r: 10px; --sh: 0 1px 2px rgba(21,18,15,.06), 0 8px 24px -12px rgba(21,18,15,.18);
  --font: 'Segoe UI', system-ui, -apple-system, Roboto, 'Helvetica Neue', Arial, sans-serif;
  --serif: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { font: 14.5px/1.5 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--gold); }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.boot { height: 100vh; display: grid; place-items: center; background: var(--ink); }
.boot img { width: 64px; opacity: .8; animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: .35; } }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 38px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--card); cursor: pointer; font-weight: 500; text-decoration: none; color: var(--ink); white-space: nowrap; }
.btn:hover { border-color: var(--ink); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.primary:hover { background: var(--gold); border-color: var(--gold); }
.btn.gold { background: var(--gold); border-color: var(--gold); color: #fff; }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: rgba(0,0,0,.05); }
.btn.sm { min-height: 30px; padding: 0 10px; font-size: .85rem; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.linkbtn { background: none; border: 0; color: var(--gold); cursor: pointer; padding: 0; text-decoration: underline; }
.stack { display: grid; gap: 10px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.grow { flex: 1; }

/* sign-in */
body.auth { background: radial-gradient(circle at 50% 0, #2b241d, #15120f 70%); min-height: 100vh; }
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.lcard { width: min(400px, 100%); background: var(--card); border-radius: 16px; padding: 34px 30px 26px; box-shadow: 0 30px 80px -30px rgba(0,0,0,.6); text-align: center; }
.lcard form { text-align: left; display: grid; gap: 14px; margin-top: 22px; }
.lcrest { width: 44px; margin: 0 auto 12px; }
.lwm { width: 190px; margin: 0 auto; display: block; }
.lsub { letter-spacing: .3em; text-transform: uppercase; font-size: .7rem; color: var(--muted); margin: 8px 0 0; }
.lfoot { font-size: .86rem; margin: 18px 0 0; color: var(--muted); }
.lcard h2 { margin-bottom: 8px; }

/* form fields */
.fld { display: grid; gap: 5px; }
.fld > span { font-size: .78rem; font-weight: 600; color: var(--ink2); letter-spacing: .01em; }
.fld small { color: var(--muted); font-size: .78rem; }
input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea {
  width: 100%; min-height: 40px; padding: 8px 11px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(184,134,11,.15); }
textarea { min-height: 80px; resize: vertical; }
.check { display: flex; gap: 8px; align-items: center; font-size: .9rem; cursor: pointer; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 720px) { .grid2, .grid3, .grid4 { grid-template-columns: 1fr; } }
.span2 { grid-column: span 2; }
@media (max-width: 720px) { .span2 { grid-column: auto; } }
.dlg-err { color: var(--bad); font-size: .88rem; min-height: 1px; }
.dlg-err:empty { display: none; }

/* app shell */
body.app #root { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.side { background: var(--side); color: #d8cfc1; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow: auto; }
.side .brand { display: flex; gap: 12px; align-items: center; padding: 22px 20px; border-bottom: 1px solid rgba(214,180,106,.15); }
.side .brand > img { width: 26px; }
.side .brand div img { width: 140px; display: block; }
.side .brand small { display: block; font-size: .62rem; letter-spacing: .3em; text-transform: uppercase; color: var(--gold2); margin-top: 6px; }
.side nav { padding: 12px 10px; display: grid; gap: 2px; flex: 1; }
.side nav a, .side-out { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 8px; color: #d8cfc1; text-decoration: none; font-size: .92rem; background: none; border: 0; cursor: pointer; width: 100%; text-align: left; }
.side nav a:hover, .side-out:hover { background: rgba(255,255,255,.06); color: #fff; }
.side nav a.on { background: rgba(214,180,106,.14); color: var(--gold2); }
.side svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.side-out { margin: 10px; width: auto; }
.main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 20; background: rgba(246,242,234,.92); backdrop-filter: blur(8px); display: flex; align-items: center; gap: 14px; padding: 14px 28px; border-bottom: 1px solid var(--line); }
.top h1 { font-size: 1.25rem; flex: 1; }
.burger { display: none; background: none; border: 0; font-size: 1.4rem; cursor: pointer; }
.me { display: flex; align-items: center; gap: 10px; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--ink); color: var(--gold2); display: grid; place-items: center; font-weight: 600; text-decoration: none; overflow: hidden; font-size: .85rem; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.who { display: grid; line-height: 1.2; }
.who small { color: var(--muted); font-size: .75rem; }
.clockbtn.in { background: var(--ok); border-color: var(--ok); color: #fff; }
.clockbtn.out { background: var(--card); border-color: var(--ok); color: var(--ok); }
.page { padding: 26px 28px 80px; outline: none; max-width: 1400px; width: 100%; }
.scrim { display: none; }
@media (max-width: 900px) {
  body.app #root { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 50; transform: translateX(-100%); transition: transform .25s; }
  body.menu .side { transform: none; }
  body.menu .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 40; }
  .burger { display: block; }
  .who { display: none; }
  .top { padding: 12px 16px; }
  .page { padding: 18px 14px 80px; }
}

/* cards, stats, tables */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; box-shadow: var(--sh); }
.card > h3 { font-size: 1rem; margin-bottom: 12px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.section { margin-top: 22px; }
.section > h2 { font-size: 1.05rem; margin-bottom: 12px; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
.stat b { display: block; font-size: 1.7rem; line-height: 1.1; font-weight: 600; }
.stat span { color: var(--muted); font-size: .82rem; }
.stat.gold { background: var(--ink); color: #fff; border-color: var(--ink); }
.stat.gold span { color: var(--gold2); }
.tbl-wrap { overflow: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); }
table.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tbl th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line); background: #fcfaf6; position: sticky; top: 0; white-space: nowrap; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: #fcf8ef; }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl input, .tbl select { min-height: 32px; padding: 4px 8px; }
.tbl input[type=number] { width: 90px; text-align: right; }
.chip { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: .76rem; font-weight: 600; background: #efe9de; color: var(--ink2); white-space: nowrap; }
.chip.ok { background: var(--okbg); color: var(--ok); } .chip.warn { background: var(--warnbg); color: var(--warn); }
.chip.bad { background: var(--badbg); color: var(--bad); } .chip.info { background: var(--infobg); color: var(--info); } .chip.muted { background: #eee; color: #777; }
.chip.gold { background: var(--goldbg); color: var(--gold); }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty b { color: var(--ink); display: block; margin-bottom: 4px; font-size: 1rem; }
.loading { padding: 40px; text-align: center; color: var(--muted); }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin-bottom: 16px; }
.toolbar .fld { min-width: 150px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs button { background: none; border: 0; padding: 10px 14px; cursor: pointer; border-bottom: 2px solid transparent; font-weight: 500; color: var(--muted); white-space: nowrap; }
.tabs button.on { color: var(--ink); border-color: var(--gold); }
.note { background: var(--goldbg); border: 1px solid #efdfb6; border-radius: 8px; padding: 10px 14px; font-size: .88rem; }
.note.bad { background: var(--badbg); border-color: #f1c9c2; color: var(--bad); }

/* clock card */
.clockcard { background: var(--ink); color: #fff; border-radius: 14px; padding: 22px; display: grid; gap: 6px; }
.clockcard .t { font-size: 2.4rem; font-weight: 300; letter-spacing: -.02em; }
.clockcard small { color: var(--gold2); letter-spacing: .14em; text-transform: uppercase; font-size: .7rem; }
.clockcard .btn { margin-top: 10px; }

/* production board */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(240px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 10px; }
.lane { background: #efe9de; border-radius: var(--r); padding: 10px; min-height: 200px; }
.lane h4 { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink2); padding: 4px 6px 10px; display: flex; justify-content: space-between; }
.piece { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; cursor: pointer; display: grid; gap: 4px; font-size: .88rem; }
.piece:hover { border-color: var(--gold); }
.piece.express { border-left: 3px solid var(--bad); }
.piece .top2 { display: flex; justify-content: space-between; gap: 6px; font-weight: 600; }
.piece small { color: var(--muted); }
.piece.late .due { color: var(--bad); font-weight: 600; }

/* product grid in portal */
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.pcell { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; cursor: pointer; }
.pcell:hover { border-color: var(--gold); }
.pcell .ph { aspect-ratio: 3/4; background: #efe9de; display: grid; place-items: center; }
.pcell .ph img { width: 100%; height: 100%; object-fit: cover; }
.pcell .ph .ph0 { width: 30%; opacity: .25; }
.pcell .b { padding: 10px 12px; display: grid; gap: 2px; }
.pcell .b b { font-size: .92rem; }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.thumb { position: relative; width: 84px; height: 108px; border-radius: 6px; overflow: hidden; background: #efe9de; border: 1px solid var(--line); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb button { position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; cursor: pointer; font-size: .7rem; }
.thumb .mv { position: absolute; bottom: 3px; left: 3px; display: flex; gap: 2px; }
.thumb .mv button { position: static; width: 20px; height: 20px; }
.addimg { width: 84px; height: 108px; border-radius: 6px; border: 1px dashed var(--muted); display: grid; place-items: center; cursor: pointer; color: var(--muted); font-size: .8rem; text-align: center; background: #fff; }
.addimg input { display: none; }

/* website editor */
.editor { display: grid; grid-template-columns: minmax(380px, 1fr) 1.15fr; gap: 18px; align-items: start; }
@media (max-width: 1200px) { .editor { grid-template-columns: 1fr; } }
.ed-panel { display: grid; gap: 14px; }
.ed-sec { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); }
.ed-sec > summary { padding: 14px 16px; cursor: pointer; font-weight: 600; list-style: none; display: flex; justify-content: space-between; }
.ed-sec > summary::after { content: '▾'; color: var(--muted); }
.ed-sec[open] > summary { border-bottom: 1px solid var(--line); }
.ed-body { padding: 16px; display: grid; gap: 12px; }
.ed-item { border: 1px solid var(--line); border-radius: 8px; padding: 12px; display: grid; gap: 10px; background: #fdfbf7; }
.ed-item .row.between b { font-size: .85rem; }
.preview { position: sticky; top: 80px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.preview header { display: flex; gap: 8px; padding: 8px 10px; border-bottom: 1px solid var(--line); align-items: center; }
.preview iframe { width: 100%; height: calc(100vh - 180px); border: 0; display: block; background: #fff; margin: 0 auto; }
.preview.phone iframe { width: 390px; max-width: 100%; }
.imgpick { display: flex; gap: 10px; align-items: center; }
.imgpick .pv { width: 64px; height: 64px; border-radius: 6px; background: #efe9de; overflow: hidden; flex: none; border: 1px solid var(--line); }
.imgpick .pv img { width: 100%; height: 100%; object-fit: cover; }
.imgpick input[type=file] { display: none; }

/* dialogs */
dialog.dlg { border: 0; border-radius: 14px; padding: 0; width: min(560px, calc(100% - 24px)); box-shadow: 0 30px 80px -20px rgba(0,0,0,.45); max-height: calc(100vh - 40px); }
dialog.dlg.wide { width: min(920px, calc(100% - 24px)); }
dialog.dlg::backdrop { background: rgba(21,18,15,.5); }
dialog.dlg form { display: flex; flex-direction: column; max-height: calc(100vh - 40px); }
dialog.dlg header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
dialog.dlg header .x { background: none; border: 0; font-size: 1.1rem; cursor: pointer; color: var(--muted); }
dialog.dlg .dlg-body { padding: 18px 20px; overflow: auto; display: grid; gap: 12px; }
dialog.dlg .dlg-err { padding: 0 20px 6px; }
dialog.dlg footer { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--line); }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 160%); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 10px; z-index: 100; transition: transform .25s, visibility .25s; visibility: hidden; max-width: calc(100% - 30px); box-shadow: var(--sh); }
.toast.on { transform: translate(-50%, 0); visibility: visible; }
.toast.ok { background: var(--ok); } .toast.bad { background: var(--bad); }

/* printable payslip */
.slip { max-width: 760px; margin: 0 auto; background: #fff; padding: 36px; border: 1px solid var(--line); }
.slip .hd { display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid var(--ink); padding-bottom: 14px; margin-bottom: 18px; }
.slip .hd img { height: 46px; }
.slip table { width: 100%; border-collapse: collapse; margin: 12px 0; }
.slip td { padding: 7px 4px; border-bottom: 1px solid var(--line); }
.slip td:last-child { text-align: right; }
.slip .net td { font-weight: 700; font-size: 1.1rem; border-top: 2px solid var(--ink); }
@media print {
  body.app, body.app #root { display: block; background: #fff; }
  .side, .top, .noprint, .toast { display: none !important; }
  .page { padding: 0; }
  .slip { border: 0; }
}
