/* ============================================================
   Pombo3D — painel admin
   ============================================================ */
:root {
  --bg: #0c0d13; --surface: #171a26; --surface-2: #1e2230;
  --text: #eaecf5; --muted: #8c92a8; --line: rgba(255,255,255,.09);
  --accent: #ff4d7d; --accent-2: #ffa23a; --good: #35d07f; --warn: #ffb020; --bad: #ff5a5a;
  --grad: linear-gradient(120deg, #ffa23a, #ff4d7d 55%, #9b5cff);
  --font: "Sora", system-ui, sans-serif; --mono: "JetBrains Mono", ui-monospace, monospace;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body.admin { font-family: var(--font); background: var(--bg); color: var(--text); min-height: 100vh; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
h1 { font-size: 1.7rem; letter-spacing: -.02em; }
input, select, textarea, button { font-family: inherit; font-size: 1rem; }
.brand { display: flex; align-items: center; gap: .5rem; font-weight: 800; }
.brand-mark { background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.muted { color: var(--muted); } .sm { font-size: .85rem; }
.hint { font-family: var(--mono); font-size: .72rem; color: var(--muted); font-weight: 400; }

/* layout */
body.admin { display: grid; grid-template-columns: 250px 1fr; }
.sidebar {
  background: var(--surface); border-right: 1px solid var(--line); padding: 1.6rem 1.2rem;
  display: flex; flex-direction: column; gap: 1.5rem; position: sticky; top: 0; height: 100vh;
}
.side-nav { display: flex; flex-direction: column; gap: .3rem; margin-top: .5rem; }
.side-nav a { padding: .7rem .9rem; border-radius: 11px; color: var(--muted); font-weight: 600; font-size: .95rem; transition: .2s; }
.side-nav a:hover { background: var(--surface-2); color: var(--text); }
.side-nav a.on { background: var(--grad); color: #140a10; }
.logout-form { margin-top: auto; }
.btn-logout { width: 100%; padding: .6rem; background: none; border: 1px solid var(--line); color: var(--muted); border-radius: 10px; cursor: pointer; }
.btn-logout:hover { color: var(--bad); border-color: var(--bad); }
.admin-main { padding: 2.2rem clamp(1.2rem, 4vw, 3rem); max-width: 1100px; }
.admin-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 2rem; gap: 1rem; flex-wrap: wrap; }

/* buttons */
.btn-primary { background: var(--grad); color: #140a10; border: 0; padding: .7rem 1.3rem; border-radius: 999px; font-weight: 700; cursor: pointer; transition: transform .15s; }
.btn-primary:hover { transform: translateY(-2px); }
.btn-ghost-sm { border: 1px solid var(--line); color: var(--muted); padding: .65rem 1.1rem; border-radius: 999px; font-weight: 600; cursor: pointer; }
.btn-ghost-sm:hover { color: var(--text); }

/* stats */
.stats, .sales-totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 1.1rem 1.3rem; display: flex; flex-direction: column; gap: .2rem; }
.stat-label { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-family: var(--mono); }
.stat-val { font-size: 1.6rem; font-weight: 800; }
.stat-sub { font-size: .8rem; color: var(--muted); }
.stat-good .stat-val { color: var(--good); }
.stat-warn .stat-val { color: var(--warn); }

/* tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; }
.tbl { width: 100%; border-collapse: collapse; background: var(--surface); min-width: 620px; }
.tbl th { text-align: left; padding: .9rem 1rem; font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); border-bottom: 1px solid var(--line); font-family: var(--mono); font-weight: 600; }
.tbl td { padding: .8rem 1rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl-link { font-weight: 700; } .tbl-link:hover { color: var(--accent); }
.tbl-thumb img, .tbl-thumb .noimg-sm { width: 44px; height: 44px; border-radius: 9px; object-fit: cover; background: var(--surface-2); display: grid; place-items: center; color: var(--muted); }
.tbl-actions { display: flex; gap: .5rem; align-items: center; white-space: nowrap; }
.mini { background: none; border: 1px solid var(--line); color: var(--muted); padding: .35rem .7rem; border-radius: 8px; cursor: pointer; font-size: .82rem; }
.mini:hover { color: var(--text); }
.mini-danger:hover { color: var(--bad); border-color: var(--bad); }
.mini-print { text-decoration: none; white-space: nowrap; }
.mini-print:hover { color: var(--accent); border-color: var(--accent); }
.pos { color: var(--good); } .neg { color: var(--bad); }

/* pills */
.pill { font-size: .72rem; font-weight: 700; padding: .25rem .6rem; border-radius: 999px; text-transform: uppercase; letter-spacing: .04em; }
.pill-active { background: rgba(53,208,127,.15); color: var(--good); }
.pill-draft { background: rgba(140,146,168,.15); color: var(--muted); }
.pill-sold_out { background: rgba(255,90,90,.15); color: var(--bad); }
.pill-hot { background: var(--grad); color: #140a10; }
.status-sel { border: 1px solid var(--line); background: var(--surface-2); color: var(--text); padding: .3rem .5rem; border-radius: 8px; cursor: pointer; }
.pill-sale-awaiting { color: var(--warn); } .pill-sale-paid { color: var(--good); } .pill-sale-shipped { color: var(--accent); } .pill-sale-cancelled { color: var(--muted); }

/* forms */
.form-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 1.6rem; margin-bottom: 1.5rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem; }
.form-grid label, .form-card > label { display: flex; flex-direction: column; gap: .4rem; font-size: .85rem; color: var(--muted); font-weight: 600; }
.form-grid .span2 { grid-column: 1 / -1; }
input, select, textarea { background: var(--surface-2); border: 1px solid var(--line); color: var(--text); padding: .7rem .85rem; border-radius: 10px; width: 100%; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
textarea { resize: vertical; }
.check { flex-direction: row !important; align-items: center; gap: .6rem !important; }
.check input { width: auto; }
.form-actions { display: flex; align-items: center; gap: 1rem; margin-top: 1.4rem; }
.upload-block { margin-top: 1.2rem; }
.block-title { font-size: 1.2rem; margin: 2rem 0 1rem; }
.empty-admin { background: var(--surface); border: 1px dashed var(--line); border-radius: 14px; padding: 2.5rem; text-align: center; color: var(--muted); }
.empty-admin a { color: var(--accent); }

/* image manager */
.img-manager { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: .9rem; }
.img-tile { position: relative; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); aspect-ratio: 1; background: var(--surface-2); }
.img-tile img { width: 100%; height: 100%; object-fit: cover; }
.img-del { position: absolute; top: .4rem; right: .4rem; background: rgba(0,0,0,.65); border: 0; color: #fff; width: 26px; height: 26px; border-radius: 50%; cursor: pointer; }
.img-del:hover { background: var(--bad); }

/* calculator */
.calc { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; align-items: start; }
.calc-print, .calc-base { margin-bottom: 0; }
.calc-out { grid-column: 1 / -1; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 1.6rem; }
.breakdown { list-style: none; display: flex; flex-direction: column; gap: .1rem; }
.breakdown li { display: flex; justify-content: space-between; padding: .6rem 0; border-bottom: 1px solid var(--line); }
.breakdown li span { color: var(--muted); }
.breakdown li b { font-variant-numeric: tabular-nums; }
.brk-total { border-top: 2px solid var(--line); margin-top: .4rem; }
.brk-total span, .brk-total b { font-size: 1.1rem; font-weight: 800; color: var(--text) !important; }
.calc-price { display: flex; gap: 3rem; margin-top: 1.5rem; flex-wrap: wrap; }
.big-price { font-size: 2.4rem; font-weight: 800; background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.big-profit { font-size: 2.4rem; font-weight: 800; color: var(--good); }
.saved-msg { color: var(--good); font-size: .85rem; }

/* login */
body.admin.login-page { display: grid; place-items: center; grid-template-columns: 1fr; min-height: 100vh; }
.login-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 2.5rem; width: min(380px, 90vw); display: flex; flex-direction: column; gap: 1.1rem; box-shadow: 0 25px 60px -25px #000; }
.login-card h1 { font-size: 1.4rem; }
.login-card label { display: flex; flex-direction: column; gap: .5rem; font-size: .85rem; color: var(--muted); font-weight: 600; }
.login-card .btn-primary { margin-top: .5rem; }
.form-error { background: rgba(255,90,90,.12); color: var(--bad); padding: .7rem 1rem; border-radius: 10px; font-size: .9rem; }
.back-link { color: var(--muted); font-size: .85rem; text-align: center; }

@media (max-width: 820px) {
  body.admin { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .side-nav { flex-direction: row; flex-wrap: wrap; margin-top: 0; }
  .logout-form { margin-left: auto; width: auto; }
  .form-grid, .calc { grid-template-columns: 1fr; }
}
