:root {
  --primary: #ea580c;
  --primary-dark: #c2410c;
  --primary-soft: #fff7ed;
  --ink: #111827;
  --bg: #f6f5f2;
  --card: #ffffff;
  --border: #e7e5e4;
  --text: #1c1917;
  --text-light: #78716c;
  --success: #15803d;
  --error: #dc2626;
  --digital: #6d28d9;
  --physical: #0f766e;
  --radius: 12px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; background: var(--bg); color: var(--text); line-height: 1.5; }
a { color: var(--primary-dark); }
img { max-width: 100%; }
h1 { font-size: 1.7rem; margin: 0 0 6px; line-height: 1.2; letter-spacing: -0.01em; }
h2 { font-size: 1.2rem; margin: 0 0 10px; }
.container { max-width: 1180px; margin: 0 auto; padding: 24px 20px 48px; }
body.wide .container { max-width: 1280px; }
.narrow { max-width: 460px; margin: 0 auto; }
.mid { max-width: 760px; margin: 0 auto; }
.subtitle { color: var(--text-light); margin: 0 0 22px; }
.note { color: var(--text-light); font-size: 0.85rem; }
.muted { color: var(--text-light) !important; }

/* ---- header ---- */
.site-header { background: var(--ink); color: #fff; position: sticky; top: 0; z-index: 20; }
.hdr-inner { max-width: 1280px; margin: 0 auto; padding: 10px 20px; display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.logo { color: #fff; text-decoration: none; font-weight: 800; font-size: 1.25rem; display: flex; align-items: center; gap: 8px; letter-spacing: -0.02em; }
.logo-mark { background: var(--primary); width: 30px; height: 30px; border-radius: 8px; display: inline-grid; place-items: center; font-size: 1rem; transform: rotate(-8deg); }
.hdr-search { flex: 1; min-width: 200px; }
.hdr-search input { width: 100%; border: none; border-radius: 999px; padding: 9px 16px; font-size: 0.95rem; background: #fff; }
.hdr-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.hdr-nav a { color: #e7e5e4; text-decoration: none; font-weight: 600; font-size: 0.9rem; padding: 7px 11px; border-radius: 8px; }
.hdr-nav a:hover, .hdr-nav a.active { background: rgba(255,255,255,0.1); color: #fff; }
.hdr-nav a.cta { background: var(--primary); color: #fff; }
.hdr-nav a.cta:hover { background: var(--primary-dark); }

/* ---- footer ---- */
.site-footer { border-top: 1px solid var(--border); background: #fff; }
.ftr-inner { max-width: 1180px; margin: 0 auto; padding: 24px 20px; display: grid; gap: 8px; font-size: 0.9rem; }
.ftr-inner nav { display: flex; gap: 18px; flex-wrap: wrap; }
.ftr-inner nav a { color: var(--text); text-decoration: none; }

/* ---- generic ---- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; margin-bottom: 20px; }
label.field-label, .field > label { display: block; font-weight: 600; font-size: 0.88rem; margin: 16px 0 6px; }
.field:first-child > label { margin-top: 0; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=number], input[type=date], input[type=search], select, textarea {
  width: 100%; border: 1px solid #d6d3d1; border-radius: 8px; padding: 9px 12px; font: inherit; font-size: 0.95rem; background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid #fdba74; border-color: var(--primary); }
textarea { min-height: 110px; resize: vertical; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0 14px; }
button, .btn { background: var(--primary); color: #fff; border: none; padding: 10px 20px; border-radius: 8px; font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; display: inline-block; }
button:hover, .btn:hover { background: var(--primary-dark); }
.btn-secondary, button.secondary { background: #fff; color: var(--text); border: 1px solid #d6d3d1; }
.btn-secondary:hover, button.secondary:hover { background: #fafaf9; }
button.danger, .btn.danger { background: var(--error); }
button.small, .btn.small { padding: 5px 11px; font-size: 0.82rem; }
.error-msg, .success-msg, .info-msg { padding: 11px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 0.93rem; }
.error-msg { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.success-msg { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.info-msg { background: var(--primary-soft); color: #9a3412; border: 1px solid #fed7aa; }
.choice { display: flex; gap: 10px; flex-wrap: wrap; }
.choice label { flex: 1; min-width: 150px; border: 2px solid var(--border); border-radius: 10px; padding: 12px 14px; cursor: pointer; font-weight: 600; background: #fff; }
.choice label small { display: block; font-weight: 400; color: var(--text-light); }
.choice input { margin-right: 6px; }
.choice label:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.hp { position: absolute; left: -9999px; }

/* ---- home ---- */
.hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.hero p { margin: 0; color: var(--text-light); }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 12px; }
.tabs a { text-decoration: none; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--border); background: #fff; color: var(--text); font-weight: 600; font-size: 0.9rem; }
.tabs a.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 14px; scrollbar-width: thin; }
.chips a { white-space: nowrap; text-decoration: none; padding: 5px 12px; border-radius: 999px; background: #fff; border: 1px solid var(--border); font-size: 0.85rem; color: var(--text); }
.chips a.on { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-dark); font-weight: 700; }
.toolbar { display: flex; justify-content: space-between; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; font-size: 0.9rem; color: var(--text-light); }
.toolbar select { width: auto; padding: 6px 10px; }
.notice { background: var(--primary-soft); border: 1px solid #fed7aa; padding: 10px 14px; border-radius: 10px; margin-bottom: 16px; }

/* ---- deal cards ---- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.deal-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; transition: box-shadow .15s, transform .15s; }
.deal-card:hover { box-shadow: 0 6px 20px rgba(0,0,0,0.07); transform: translateY(-1px); }
.deal-card.featured { border-color: #fdba74; box-shadow: 0 0 0 2px #fed7aa; }
.thumb { text-decoration: none; position: relative; display: grid; place-items: center; aspect-ratio: 4/3; background: #fafaf9; border-bottom: 1px solid var(--border); overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: contain; padding: 10px; }
.thumb .ph, .thumb.noimg::before { font-size: 2.6rem; opacity: .8; }
.thumb.noimg::before { content: "🏷️"; }
.badge { position: absolute; top: 8px; left: 8px; background: var(--primary); color: #fff; font-weight: 800; font-size: 0.8rem; padding: 3px 8px; border-radius: 6px; }
.deal-card .body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.deal-card h3 { font-size: 0.95rem; margin: 0; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.deal-card h3 a { color: var(--text); text-decoration: none; }
.deal-card h3 a:hover { color: var(--primary-dark); }
.tags { display: flex; gap: 5px; }
.pt { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 2px 7px; border-radius: 5px; }
.pt-digital { background: #ede9fe; color: var(--digital); }
.pt-physical { background: #ccfbf1; color: var(--physical); }
.pt-code { background: #fef3c7; color: #92400e; }
.prices { margin-top: auto; padding-top: 4px; }
.price { font-weight: 800; font-size: 1.15rem; color: var(--primary-dark); }
.prices s { color: var(--text-light); font-size: 0.88rem; }
.meta { font-size: 0.8rem; color: var(--text-light); }
.score { color: var(--success); font-weight: 700; }
.empty { text-align: center; padding: 50px 20px; color: var(--text-light); background: #fff; border: 1px dashed #d6d3d1; border-radius: var(--radius); }
.pager { display: flex; gap: 6px; justify-content: center; margin: 26px 0 0; flex-wrap: wrap; }
.pager a, .pager .cur { padding: 7px 12px; border-radius: 8px; background: #fff; border: 1px solid var(--border); text-decoration: none; color: var(--text); font-size: 0.9rem; }
.pager .cur { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ---- deal page ---- */
.deal-page { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 24px; }
@media (max-width: 800px) { .deal-page { grid-template-columns: 1fr; } }
.deal-photo { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); display: grid; place-items: center; aspect-ratio: 1; overflow: hidden; }
.deal-photo img { width: 100%; height: 100%; object-fit: contain; padding: 18px; }
.deal-photo .ph { font-size: 5rem; }
.big-price { font-size: 2rem; font-weight: 800; color: var(--primary-dark); }
.big-price s { font-size: 1.1rem; color: var(--text-light); font-weight: 500; margin-left: 6px; }
.big-price .off { background: var(--primary); color: #fff; font-size: 0.95rem; padding: 3px 9px; border-radius: 7px; margin-left: 8px; vertical-align: middle; }
.code-box { display: flex; align-items: stretch; border: 2px dashed var(--primary); border-radius: 10px; overflow: hidden; margin: 14px 0; max-width: 420px; }
.code-box code { flex: 1; font-size: 1.25rem; font-weight: 800; letter-spacing: .08em; padding: 10px 14px; background: var(--primary-soft); }
.code-box button { border-radius: 0; }
.get-deal { font-size: 1.1rem; padding: 13px 28px; }
.vote-bar { display: flex; gap: 8px; align-items: center; margin: 16px 0; flex-wrap: wrap; }
.vote-bar button { background: #fff; color: var(--text); border: 1px solid #d6d3d1; padding: 6px 12px; font-weight: 600; }
.vote-bar button.on { border-color: var(--primary); background: var(--primary-soft); }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 0.92rem; margin: 16px 0; }
.facts dt { color: var(--text-light); }
.facts dd { margin: 0; }
.desc { white-space: pre-line; }

/* ---- tables (my deals, admin) ---- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
table.data th, table.data td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.data th { font-size: 0.75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-light); background: #fafaf9; position: sticky; top: 0; }
table.data tr:hover td { background: #fffbf7; }
.st { font-size: 0.72rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; text-transform: uppercase; white-space: nowrap; }
.st-pending { background: #fef3c7; color: #92400e; }
.st-approved, .st-ok, .st-active { background: #dcfce7; color: #166534; }
.st-rejected, .st-error, .st-suspended, .st-blocked { background: #fee2e2; color: #991b1b; }
.st-expired, .st-never, .st-empty { background: #f5f5f4; color: #57534e; }

/* ---- admin ---- */
.admin-nav { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 20px; padding: 6px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); }
.admin-nav a { text-decoration: none; color: var(--text); padding: 7px 12px; border-radius: 8px; font-weight: 600; font-size: 0.88rem; }
.admin-nav a.on { background: var(--ink); color: #fff; }
.admin-nav a .cnt { background: var(--primary); color: #fff; border-radius: 999px; padding: 0 7px; font-size: 0.75rem; margin-left: 4px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.stat b { display: block; font-size: 1.6rem; }
.stat span { color: var(--text-light); font-size: 0.85rem; }
.inline-form { display: inline; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.mono, code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
pre.sql { background: #1c1917; color: #fafaf9; padding: 12px; border-radius: 8px; overflow-x: auto; font-size: 0.82rem; white-space: pre-wrap; }
textarea.sql { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.88rem; min-height: 140px; }
.prob { padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 0.92rem; }
.prob:last-child { border-bottom: none; }
.prob code { display: block; margin-top: 4px; font-size: 0.78rem; color: var(--text-light); white-space: pre-wrap; overflow-wrap: anywhere; }
.mini-thumb { width: 54px; height: 54px; object-fit: contain; background: #fafaf9; border: 1px solid var(--border); border-radius: 6px; }
.cell-clip { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
details summary { cursor: pointer; font-weight: 600; }
