:root {
    --bg: #f4f5f7;
    --surface: #ffffff;
    --text: #1a1a2e;
    --muted: #6b7280;
    --line: #e5e7eb;
    --accent: #b8860b;
    --accent-hover: #9a7209;
    --accent-light: #fef9ec;
    --success-bg: #ecfdf5;
    --success-border: #a7f3d0;
    --success-text: #065f46;
    --danger-bg: #fef2f2;
    --danger-border: #fecaca;
    --danger-text: #991b1b;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 4px 12px rgba(0, 0, 0, 0.04);
    --radius: 10px;
    --font: 'Segoe UI', system-ui, -apple-system, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    line-height: 1.5;
    min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

.wrap {
    width: min(1250px, 94%);
    margin: 0 auto;
    padding-bottom: 40px;
}

/* ── Header ── */
.top {
    height: 72px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 0 3%;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 50;
}

.top img { width: 130px; height: auto; }

.top strong { font-size: 16px; color: var(--text); }

.top .subtitle {
    color: var(--muted);
    font-size: 12px;
    margin-top: 2px;
}

.top .right {
    margin-left: auto;
    display: flex;
    gap: 10px;
}

/* ── Buttons ── */
.btn {
    display: inline-block;
    padding: 10px 18px;
    background: var(--accent);
    color: #fff;
    font-weight: 600;
    font-size: 13px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
    text-align: center;
}

.btn:hover {
    background: var(--accent-hover);
    color: #fff;
}

.btn.outline {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--line);
}

.btn.outline:hover {
    background: var(--bg);
    color: var(--text);
}

.btn.danger {
    background: var(--danger-bg);
    color: var(--danger-text);
    border: 1px solid var(--danger-border);
}

.btn.danger:hover {
    background: #fee2e2;
}

/* ── Tabs ── */
.tabs {
    display: flex;
    gap: 8px;
    overflow: auto;
    margin: 28px 0 24px;
    padding-bottom: 4px;
}

.tab {
    padding: 10px 16px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--muted);
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.tab i { font-size: 14px; opacity: 0.85; }

.tab:hover {
    border-color: #d1d5db;
    color: var(--text);
}

.tab.active {
    background: var(--accent-light);
    border-color: var(--accent);
    color: var(--accent);
    font-weight: 600;
}

.panel { display: none; }
.panel.active { display: block; }

/* ── Typography ── */
h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 20px;
}

h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    margin: 0 0 12px;
}

/* ── Stats ── */
.stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.stats-6 {
    grid-template-columns: repeat(3, 1fr);
}

.stat {
    padding: 24px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.stat-new b { color: #2563eb; }
.stat-deal b { color: var(--success-text); }

.stat b {
    font-size: 32px;
    font-weight: 700;
    color: var(--accent);
    display: block;
    line-height: 1;
    margin-bottom: 8px;
}

.stat span {
    color: var(--muted);
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.stat span i {
    color: var(--accent);
    font-size: 12px;
    opacity: 0.7;
}

/* ── Quick Links ── */
.quick-links {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 8px;
}

.quick-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 20px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: all 0.2s;
    color: var(--text);
}

.quick-card:hover {
    border-color: var(--accent);
    box-shadow: 0 4px 16px rgba(184, 134, 11, 0.12);
    transform: translateY(-2px);
    color: var(--text);
}

.quick-card i {
    font-size: 22px;
    color: var(--accent);
    margin-bottom: 4px;
}

.quick-card strong {
    font-size: 14px;
}

.quick-card span {
    font-size: 12px;
    color: var(--muted);
    line-height: 1.5;
}

/* ── Workflow ── */
.workflow-list {
    margin: 0;
    padding-left: 20px;
    color: var(--muted);
    line-height: 2;
}

.workflow-list a {
    font-weight: 600;
}

.box h2 i {
    margin-right: 8px;
    color: var(--accent);
}

.notice i {
    margin-right: 8px;
}

.err-notice {
    background: var(--danger-bg);
    border-color: var(--danger-border);
    color: var(--danger-text);
}

.current-image {
    font-size: 12px;
    color: var(--muted);
    margin: 0 0 14px;
    padding: 8px 10px;
    background: #f9fafb;
    border-radius: 6px;
    border: 1px solid var(--line);
}

.current-image code {
    font-size: 11px;
}

.field input[type="file"] {
    padding: 8px;
    background: #f9fafb;
    cursor: pointer;
}

.field input[type="file"]::file-selector-button {
    padding: 8px 14px;
    margin-right: 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text);
    font-weight: 600;
    cursor: pointer;
}

.field input[type="file"]::file-selector-button:hover {
    background: var(--accent-light);
    border-color: var(--accent);
}

/* ── Testimonial cards ── */
.testimonial-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.tcard {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.tcard-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.tcard-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f5d77b, #b8860b);
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.tcard-head strong {
    font-size: 15px;
    display: block;
}

.tcard-role {
    font-size: 12px;
    color: var(--muted);
}

.tcard-stars {
    margin-left: auto;
    color: var(--accent);
    font-size: 11px;
    letter-spacing: 2px;
}

.tcard-preview {
    font-size: 13px;
    color: var(--muted);
    font-style: italic;
    line-height: 1.6;
    margin: 0 0 14px;
    padding: 12px;
    background: #f9fafb;
    border-radius: 6px;
    border-left: 3px solid var(--accent);
}

/* ── Box / Card ── */
.box {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 24px;
    margin-top: 20px;
    box-shadow: var(--shadow);
}

.box p {
    color: var(--muted);
    line-height: 1.7;
    margin: 0;
}

/* ── Table ── */
.tablewrap { overflow: auto; }

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 850px;
}

th, td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
    font-size: 13px;
}

th {
    background: #f9fafb;
    color: var(--muted);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

tr:hover td { background: #fafafa; }

td strong { color: var(--text); }

/* ── Forms ── */
.field { margin-bottom: 16px; }

.field label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.field input,
.field textarea,
.field select {
    width: 100%;
    padding: 10px 12px;
    background: var(--surface);
    border: 1px solid var(--line);
    color: var(--text);
    border-radius: 6px;
    font-family: inherit;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(184, 134, 11, 0.12);
}

.field textarea { min-height: 90px; resize: vertical; }

.grid2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.hint {
    color: var(--muted);
    font-size: 12px;
    margin-top: 6px;
}

/* ── Notice ── */
.notice {
    padding: 14px 18px;
    background: var(--success-bg);
    border: 1px solid var(--success-border);
    color: var(--success-text);
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 14px;
    font-weight: 500;
}

/* ── Product grid ── */
.prodgrid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.pcard {
    background: var(--surface);
    border: 1px solid var(--line);
    padding: 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.pcard img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 6px;
    margin-bottom: 14px;
}

.pcard h2 {
    font-size: 20px;
    margin-bottom: 6px;
}

.pcard .tagline {
    color: var(--accent);
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.pcard .desc {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.6;
    margin-bottom: 8px;
}

.pcard .price {
    font-weight: 700;
    font-size: 16px;
    margin-bottom: 16px;
}

.panel-desc {
    color: var(--muted);
    font-size: 14px;
    line-height: 1.7;
    margin: -8px 0 24px;
    max-width: 720px;
}

.section-label {
    font-size: 16px;
    font-weight: 600;
    margin: 32px 0 16px;
    color: var(--text);
}

.add-product-box {
    border: 2px dashed var(--line);
    background: #fafbfc;
}

.add-product-box h2 {
    font-size: 16px;
    color: var(--accent);
    margin-bottom: 16px;
}

.product-form .form-actions {
    margin-top: 4px;
}

.delete-form {
    margin-top: 10px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}

.pcard-meta {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.badge-status,
.badge-order {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
    letter-spacing: 0.02em;
}

.badge-status.active {
    background: var(--success-bg);
    color: var(--success-text);
    border: 1px solid var(--success-border);
}

.badge-status.inactive {
    background: #f3f4f6;
    color: var(--muted);
    border: 1px solid var(--line);
}

.badge-order {
    background: var(--accent-light);
    color: var(--accent);
    border: 1px solid #f0dfa0;
}

.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--muted);
}

code {
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
}

.divider {
    border: none;
    border-top: 1px solid var(--line);
    margin: 28px 0;
}

.logo-preview {
    display: block;
    max-width: 180px;
    max-height: 80px;
    object-fit: contain;
    margin-top: 10px;
    padding: 8px;
    background: #f9fafb;
    border: 1px solid var(--line);
    border-radius: 6px;
}

.bg-preview {
    display: block;
    width: 100%;
    max-width: 420px;
    max-height: 180px;
    object-fit: cover;
    margin-top: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.checkbox-remove {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    font-size: 13px;
    color: var(--muted);
    cursor: pointer;
}

.checkbox-remove input {
    width: auto;
    margin: 0;
}

/* ── Login page ── */
body.login-page {
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #f0f2f5 0%, #e8eaed 100%);
}

.login-box {
    width: min(420px, 90%);
    padding: 40px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
}

.login-box img {
    width: 160px;
    display: block;
    margin: 0 auto;
}

.login-logo {
    display: block;
    width: fit-content;
    margin: 0 auto 20px;
    transition: opacity 0.2s, transform 0.2s;
}

.login-logo:hover {
    opacity: 0.85;
    transform: scale(1.02);
}

.top .login-logo {
    margin: 0;
}

.top .login-logo img {
    width: 130px;
    margin: 0;
}

.login-box h1 {
    text-align: center;
    font-size: 24px;
    margin-bottom: 6px;
}

.login-box .sub {
    text-align: center;
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 28px;
}

.login-box .btn {
    width: 100%;
    padding: 13px;
    margin-top: 8px;
}

.login-box .btn-back {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 14px;
    background: transparent;
    color: var(--text);
    border: 1px solid var(--line);
    box-shadow: none;
    text-decoration: none;
    font-weight: 600;
}

.login-box .btn-back:hover {
    background: #f9fafb;
    border-color: #ccc;
}

.login-box small {
    display: block;
    text-align: center;
    color: var(--muted);
    font-size: 12px;
    margin-top: 20px;
    line-height: 1.6;
}

.err {
    padding: 12px 14px;
    background: var(--danger-bg);
    border: 1px solid var(--danger-border);
    color: var(--danger-text);
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 14px;
}

/* ── Responsive ── */
@media (max-width: 850px) {
    .stats, .stats-6, .prodgrid, .grid2, .quick-links, .testimonial-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 560px) {
    .stats, .stats-6, .prodgrid, .grid2, .quick-links, .testimonial-grid { grid-template-columns: 1fr; }
    .top { flex-wrap: wrap; height: auto; padding: 16px 3%; }
    .tabs { gap: 6px; }
    .tab { padding: 8px 12px; font-size: 12px; }
}
