:root {
    --ink: #0f172a;
    --ink-2: #334155;
    --muted: #64748b;
    --line: #e2e8f0;
    --bg: #f8fafc;
    --card: #ffffff;
    --brand: #1d4ed8;
    --brand-2: #1e40af;
    --accent: #f59e0b;
    --ok: #059669;
    --radius: 14px;
    --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px rgba(15, 23, 42, .06);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color: var(--ink);
    background: var(--bg);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
body > main { flex: 1; }
input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number] { -moz-appearance: textfield; }
a { color: var(--brand); text-decoration: none; }
button, input, select { font: inherit; color: inherit; }

/* Header */
.site-header { background: #fff; border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 68px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; color: var(--ink); letter-spacing: -.02em; }
.logo-mark { width: 34px; height: 34px; border-radius: 9px; background: linear-gradient(135deg, var(--brand), #3b82f6); display: grid; place-items: center; color: #fff; font-size: 15px; }
.nav { display: flex; gap: 28px; font-size: 15px; font-weight: 500; }
.nav a { color: var(--ink-2); }
.cart-link { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--ink); }
.cart-count { background: var(--brand); color: #fff; font-size: 12px; min-width: 22px; height: 22px; border-radius: 11px; display: grid; place-items: center; padding: 0 6px; }

.wrap { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 24px; }
.crumbs { font-size: 14px; color: var(--muted); padding: 22px 0 6px; }
.crumbs a { color: var(--muted); }

/* Product layout */
.product { display: grid; grid-template-columns: 1.1fr 1fr; gap: 40px; padding: 18px 0 64px; align-items: start; }

.preview-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 26px; position: sticky; top: 24px; }
.stage { height: 380px; border-radius: 10px; background:
        linear-gradient(#eef2f7 1px, transparent 1px) 0 0 / 24px 24px,
        linear-gradient(90deg, #eef2f7 1px, transparent 1px) 0 0 / 24px 24px, #f8fafc;
    display: grid; place-items: center; position: relative; overflow: hidden; }
.banner {
    position: relative; background: linear-gradient(135deg, #1e3a8a, #2563eb 60%, #3b82f6);
    border-radius: 4px; box-shadow: 0 14px 30px rgba(29, 78, 216, .28);
    display: grid; place-items: center; color: #fff; text-align: center;
    transition: width .25s ease, height .25s ease, background .25s ease;
}
.banner.mesh { background:
        radial-gradient(circle, rgba(255,255,255,.22) 1.2px, transparent 1.6px) 0 0 / 7px 7px,
        linear-gradient(135deg, #1e3a8a, #2563eb 60%, #3b82f6); }
.banner.sticker { border-radius: 14px; background: linear-gradient(135deg, #7c3aed, #c026d3 55%, #db2777); box-shadow: 0 14px 30px rgba(124, 58, 237, .28); }
.banner.matte { filter: saturate(.8); }
.banner .grommet { position: absolute; width: 8px; height: 8px; border-radius: 50%; background: #e2e8f0; box-shadow: inset 0 0 0 2px #94a3b8; }
.banner.sticker .grommet { display: none; }
.banner-text { font-weight: 800; letter-spacing: -.02em; line-height: 1.05; padding: 8px; font-size: clamp(12px, 2.2vw, 26px); text-shadow: 0 2px 6px rgba(0,0,0,.18); }
.dim { position: absolute; font-size: 12px; font-weight: 600; color: var(--ink-2); background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 2px 8px; white-space: nowrap; }
.dim-w { left: 50%; transform: translateX(-50%); top: -30px; }
.dim-h { top: 50%; right: -14px; transform: translate(100%, -50%); }

.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 18px; }
.feature { border: 1px solid var(--line); border-radius: 10px; padding: 12px; font-size: 13px; color: var(--ink-2); }
.feature b { display: block; color: var(--ink); font-size: 14px; }

.info h1 { font-size: 34px; line-height: 1.15; letter-spacing: -.03em; margin: 0 0 8px; }
.lede { color: var(--ink-2); margin: 0 0 22px; font-size: 16px; }
.from { display: inline-flex; gap: 8px; align-items: center; background: #eff6ff; color: var(--brand-2); font-weight: 600; font-size: 14px; border-radius: 999px; padding: 6px 12px; margin-bottom: 22px; }

.calc { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 26px; }
.step { margin-bottom: 22px; }
.step-label { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; margin-bottom: 10px; }
.step-num { width: 24px; height: 24px; border-radius: 50%; background: var(--brand); color: #fff; font-size: 13px; display: grid; place-items: center; }

select, .num input {
    width: 100%; height: 50px; border: 1.5px solid var(--line); border-radius: 10px; background: #fff;
    padding: 0 14px; font-size: 16px; outline: none; transition: border-color .15s, box-shadow .15s;
}
select:focus, .num input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(29, 78, 216, .12); }
.material-note { font-size: 13px; color: var(--muted); margin-top: 8px; }

.dims { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: end; }
.num label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; font-weight: 500; }
.num .field { position: relative; }
.num .unit { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 14px; pointer-events: none; }
.times { height: 50px; display: grid; place-items: center; color: var(--muted); font-size: 18px; }
.error { color: #dc2626; font-size: 13px; margin-top: 8px; min-height: 0; }

.summary { border-top: 1px dashed var(--line); padding-top: 18px; margin-top: 4px; }
.row { display: flex; justify-content: space-between; font-size: 15px; padding: 5px 0; color: var(--ink-2); }
.row span:last-child { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.total { display: flex; justify-content: space-between; align-items: baseline; margin-top: 12px; padding: 16px 18px; background: #0f172a; color: #fff; border-radius: 12px; }
.total .label { font-size: 15px; opacity: .8; }
.total .amount { font-size: 32px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }

.qty-row { display: flex; gap: 12px; margin-top: 18px; }
.qty { width: 110px; }
.qty input { text-align: center; }
.btn {
    flex: 1; height: 54px; border: 0; border-radius: 12px; background: var(--accent); color: #111827;
    font-weight: 800; font-size: 17px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
    transition: transform .05s, filter .15s;
}
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-dark { background: var(--brand); color: #fff; }
.assure { display: flex; gap: 18px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin-top: 14px; }
.assure span::before { content: "✓ "; color: var(--ok); font-weight: 700; }

/* Cart */
.page-title { font-size: 30px; letter-spacing: -.02em; margin: 6px 0 22px; }
.cart-grid { display: grid; grid-template-columns: 1fr 360px; gap: 28px; padding-bottom: 64px; align-items: start; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; }
table.cart { width: 100%; border-collapse: collapse; }
table.cart th { text-align: left; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: 0 0 12px; border-bottom: 1px solid var(--line); }
table.cart td { padding: 18px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
table.cart td.r, table.cart th.r { text-align: right; }
.item-name { font-weight: 700; margin-bottom: 6px; }
.meta { font-size: 14px; color: var(--ink-2); display: grid; gap: 2px; }
.meta b { color: var(--ink); font-weight: 600; }
.item-actions { display: flex; gap: 18px; align-items: center; margin-top: 10px; }
.item-actions form { margin: 0; }
.edit { font-size: 14px; font-weight: 600; color: var(--brand); }
.remove { font-size: 14px; color: #dc2626; background: none; border: 0; padding: 0; cursor: pointer; }
.empty { text-align: center; padding: 40px 0; color: var(--muted); }
.notice { background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46; border-radius: 10px; padding: 12px 16px; margin-bottom: 18px; font-size: 15px; }

/* Admin */
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th { text-align: left; font-size: 13px; color: var(--muted); font-weight: 600; padding: 0 8px 10px; }
.admin-table td { padding: 6px 8px; }
.admin-table input { width: 100%; height: 42px; border: 1.5px solid var(--line); border-radius: 8px; padding: 0 10px; font-size: 15px; }
.admin-table input:focus { outline: none; border-color: var(--brand); }
.admin-table .rate { width: 130px; }
.icon-btn { width: 42px; height: 42px; border-radius: 8px; border: 1.5px solid var(--line); background: #fff; cursor: pointer; color: #dc2626; font-size: 18px; }
.btn-ghost { height: 44px; border-radius: 10px; border: 1.5px dashed #94a3b8; background: #fff; padding: 0 16px; cursor: pointer; font-weight: 600; color: var(--ink-2); }
.settings { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 26px; }
.settings label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
.settings input { width: 100%; height: 44px; border: 1.5px solid var(--line); border-radius: 8px; padding: 0 12px; font-size: 15px; }
.admin-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 22px; gap: 12px; flex-wrap: wrap; }
.admin-actions .btn { flex: 0 0 auto; padding: 0 26px; }
.badge { display: inline-block; font-size: 12px; font-weight: 700; background: #fef3c7; color: #92400e; padding: 3px 8px; border-radius: 6px; margin-left: 8px; vertical-align: middle; }
.hint { font-size: 14px; color: var(--muted); margin: -10px 0 22px; }

.site-footer { border-top: 1px solid var(--line); background: #fff; color: var(--muted); font-size: 14px; padding: 22px 0; }

/* Nav admin link */
.nav .nav-admin { color: var(--brand); font-weight: 600; }

/* Admin area */
.admin-body { background: #f1f5f9; }
.login-wrap { flex: 1; display: grid; place-items: center; padding: 40px 16px; }
.login-card { width: 100%; max-width: 400px; background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); padding: 34px 30px; text-align: center; }
.login-card h1 { font-size: 24px; margin: 14px 0 4px; letter-spacing: -.02em; }
.login-card p { color: var(--muted); margin: 0 0 22px; font-size: 15px; }
.login-card label { display: block; text-align: left; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.login-card input { width: 100%; height: 48px; border: 1.5px solid var(--line); border-radius: 10px; padding: 0 14px; font-size: 16px; margin-bottom: 16px; }
.login-card input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(29,78,216,.12); }
.login-card .btn { width: 100%; }
.login-error { background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c; border-radius: 10px; padding: 10px 12px; font-size: 14px; margin-bottom: 16px; }
.back-store { display: inline-block; margin-top: 18px; font-size: 14px; color: var(--muted); }

.admin-layout { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.sidebar { background: #0f172a; color: #cbd5e1; padding: 22px 16px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.side-logo { color: #fff; margin: 0 8px 26px; }
.side-label { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: #64748b; margin: 0 10px 8px; font-weight: 700; }
.side-nav { display: grid; gap: 4px; }
.side-nav a, .side-logout { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 9px; color: #cbd5e1; font-size: 15px; font-weight: 500; }
.side-nav a:hover, .side-logout:hover { background: rgba(255,255,255,.06); color: #fff; }
.side-nav a.active { background: var(--brand); color: #fff; }
.side-logout { margin-top: auto; color: #fca5a5; }
.admin-main { padding: 34px 40px 60px; max-width: 1200px; width: 100%; }
.admin-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 24px; }
.panel-title { font-size: 16px; margin: 0 0 14px; }

/* Responsive */
@media (max-width: 960px) {
    .product, .cart-grid { grid-template-columns: 1fr; gap: 22px; }
    .preview-card { position: static; }
    .nav { gap: 16px; }
    .nav a:not(.nav-admin) { display: none; }
    .admin-layout { grid-template-columns: 1fr; }
    .sidebar { position: static; height: auto; flex-direction: row; align-items: center; flex-wrap: wrap; gap: 8px; padding: 12px 16px; }
    .side-logo { margin: 0 auto 0 0; }
    .side-label { display: none; }
    .side-nav { display: flex; }
    .side-logout { margin-top: 0; }
    .admin-main { padding: 22px 16px 40px; }
    .admin-top .btn-ghost { display: none !important; }
}
@media (max-width: 560px) {
    .wrap { padding: 0 16px; }
    .info h1 { font-size: 26px; }
    .stage { height: 240px; }
    .preview-card, .calc, .panel { padding: 18px; }
    .features { grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
    .feature { padding: 10px 8px; font-size: 12px; }
    .feature b { font-size: 13px; }
    .total .amount { font-size: 28px; }
    .settings { grid-template-columns: 1fr; }
    .admin-table thead { display: none; }
    .admin-table tr { display: grid; grid-template-columns: 1fr 1fr auto; gap: 6px; padding: 10px 0; border-bottom: 1px solid var(--line); }
    .admin-table td { padding: 0; }
    .admin-table td:first-child { grid-column: 1 / -1; }
    .admin-table .rate { width: 100%; }
    table.cart thead { display: none; }
    table.cart tr { display: block; border-bottom: 1px solid var(--line); padding: 14px 0; }
    table.cart td { display: block; border: 0; padding: 2px 0; text-align: left !important; }
}
