:root {
    --bg: #f4f6fa;
    --surface: #ffffff;
    --border: #e2e8f0;
    --text: #0f172a;
    --muted: #64748b;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --danger: #dc2626;
    --danger-hover: #b91c1c;
    --success-bg: #ecfdf5;
    --success-text: #065f46;
    --success-border: #a7f3d0;
    --error-bg: #fef2f2;
    --error-text: #991b1b;
    --error-border: #fecaca;
    --sidebar-bg: #0f172a;
    --sidebar-text: #cbd5e1;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
}

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

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
}

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

a:hover {
    text-decoration: underline;
}

/* ---------- Auth / Login Page ---------- */
.auth-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
}

.auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--surface);
    border-radius: 14px;
    padding: 32px 28px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
}

.auth-header {
    text-align: center;
    margin-bottom: 24px;
}

.auth-header h1 {
    margin: 12px 0 6px;
    font-size: 22px;
}

.auth-header p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

/* ---------- Brand Badge ---------- */
.brand-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 9px;
    background: var(--primary);
    color: #fff;
    font-weight: 700;
    font-size: 17px;
    flex-shrink: 0;
}

.brand-badge-lg {
    width: 46px;
    height: 46px;
    font-size: 21px;
    border-radius: 12px;
}

/* ---------- Admin Shell ---------- */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 240px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    padding: 20px 16px;
    flex-shrink: 0;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 8px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 16px;
}

.brand-title {
    color: #fff;
    font-weight: 700;
    font-size: 15px;
    line-height: 1.2;
}

.brand-sub {
    font-size: 12px;
    color: #94a3b8;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--sidebar-text);
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    text-decoration: none;
}

.nav-link.active {
    background: var(--primary);
    color: #fff;
}

.nav-icon {
    width: 18px;
    text-align: center;
    font-size: 15px;
}

.sidebar-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 16px;
    margin-top: 16px;
}

.admin-meta {
    margin-bottom: 12px;
    padding: 0 4px;
}

.admin-name {
    color: #fff;
    font-weight: 600;
    font-size: 13px;
}

.admin-email {
    color: #94a3b8;
    font-size: 12px;
    word-break: break-all;
}

.sidebar-footer .btn-outline {
    background: transparent;
    color: #e2e8f0;
    border-color: rgba(255, 255, 255, 0.2);
}

.sidebar-footer .btn-outline:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.main-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 16px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.page-heading {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
}

.content-body {
    padding: 24px 28px 40px;
    max-width: 1240px;
    width: 100%;
}

/* ---------- Cards & Grid ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.card-narrow {
    max-width: 780px;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.card-header h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}

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

.stat-label {
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.stat-value {
    font-size: 30px;
    font-weight: 700;
    margin: 6px 0 4px;
    line-height: 1.1;
}

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

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr);
    gap: 20px;
    align-items: start;
}

/* ---------- Date Breakdown ---------- */
.date-check-form {
    margin-bottom: 14px;
}

.date-check-form label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 6px;
}

.inline-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.inline-row input[type="date"] {
    flex: 1;
    min-width: 0;
}

.date-result-box {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e3a8a;
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 14px;
    font-size: 13px;
}

.date-list {
    list-style: none;
    margin: 0;
    padding: 0;
    border-top: 1px solid var(--border);
}

.date-list li a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 4px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
}

.date-list li a:hover {
    background: #f8fafc;
    text-decoration: none;
}

.count-pill {
    background: #eef2ff;
    color: #3730a3;
    font-weight: 700;
    font-size: 12px;
    padding: 2px 10px;
    border-radius: 999px;
}

/* ---------- Tables ---------- */
.table-wrap {
    overflow-x: auto;
}

.table-meta {
    font-size: 13px;
    color: var(--muted);
    margin: 12px 0;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    text-align: left;
    padding: 12px 10px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.data-table th {
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.data-table tbody tr:hover {
    background: #f8fafc;
}

.product-cell {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 200px;
}

.thumb {
    width: 46px;
    height: 46px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid var(--border);
    flex-shrink: 0;
    background: #f1f5f9;
}

.thumb-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: #94a3b8;
}

.product-title {
    font-weight: 600;
    color: var(--text);
}

.product-sub,
.product-desc {
    font-size: 12px;
    color: var(--muted);
}

.price-now {
    font-weight: 700;
    white-space: nowrap;
}

.price-old {
    font-size: 12px;
    color: var(--muted);
    text-decoration: line-through;
    white-space: nowrap;
}

.badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.badge-active {
    background: var(--success-bg);
    color: var(--success-text);
}

.badge-inactive {
    background: #f1f5f9;
    color: #475569;
}

.text-right {
    text-align: right;
}

.text-muted {
    color: var(--muted);
}

.link-subtle {
    font-size: 13px;
    font-weight: 500;
}

.action-group {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.inline-form {
    display: inline;
    margin: 0;
}

/* ---------- Forms & Filter Bar ---------- */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.filter-input {
    flex: 1;
    min-width: 200px;
}

.filter-select,
.filter-date {
    width: auto;
}

.form-stack {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-weight: 600;
    font-size: 13px;
}

.label-hint {
    font-weight: 400;
    color: var(--muted);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="url"],
input[type="date"],
input[type="file"],
select,
textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font: inherit;
    color: var(--text);
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

textarea {
    resize: vertical;
}

.help-text {
    font-size: 12px;
    color: var(--muted);
}

.form-actions {
    display: flex;
    gap: 10px;
    padding-top: 6px;
}

.current-image-box {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #f8fafc;
}

.image-preview {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.preview-label {
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 4px;
}

.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 400;
    font-size: 13px;
    color: var(--danger);
    cursor: pointer;
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 16px;
    border-radius: 8px;
    border: 1px solid transparent;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    white-space: nowrap;
}

.btn:hover {
    text-decoration: none;
}

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

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-outline {
    background: #fff;
    color: var(--text);
    border-color: #cbd5e1;
}

.btn-outline:hover {
    background: #f8fafc;
}

.btn-ghost {
    background: transparent;
    color: var(--muted);
}

.btn-ghost:hover {
    background: #f1f5f9;
    color: var(--text);
}

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

.btn-danger:hover {
    background: var(--danger-hover);
}

.btn-sm {
    padding: 7px 13px;
    font-size: 13px;
}

.btn-xs {
    padding: 5px 10px;
    font-size: 12px;
}

.btn-block {
    width: 100%;
}

/* ---------- Alerts & Empty States ---------- */
.alert {
    padding: 12px 14px;
    border-radius: 8px;
    margin-bottom: 18px;
    font-size: 13px;
    border: 1px solid transparent;
}

.alert-success {
    background: var(--success-bg);
    color: var(--success-text);
    border-color: var(--success-border);
}

.alert-error {
    background: var(--error-bg);
    color: var(--error-text);
    border-color: var(--error-border);
}

.error-list {
    margin: 0;
    padding-left: 18px;
}

.empty-state {
    text-align: center;
    padding: 36px 16px;
    color: var(--muted);
}

.empty-state p {
    margin: 0 0 12px;
}

.empty-inline {
    margin: 8px 0 0;
    font-size: 13px;
}

/* ---------- Categories, HTML Editor & Product Detail ---------- */
.categories-grid {
    display: grid;
    grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}

.stat-card-link {
    display: block;
    color: inherit;
    text-decoration: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.stat-card-link:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.08);
    text-decoration: none;
}

.product-title-link {
    color: var(--text);
}

.product-title-link:hover {
    color: var(--primary);
}

.cat-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 9px;
    border-radius: 999px;
    background: #f1f5f9;
    color: #334155;
    font-size: 12px;
    font-weight: 600;
}

.cat-chip-img {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.editor-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.editor-tabs {
    display: inline-flex;
    border: 1px solid #cbd5e1;
    border-radius: 7px;
    overflow: hidden;
    background: #f8fafc;
}

.editor-tab {
    border: 0;
    background: transparent;
    padding: 4px 10px;
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    cursor: pointer;
}

.editor-tab.active {
    background: var(--primary);
    color: #fff;
}

.html-editor {
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

.html-editor:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    padding: 6px 8px;
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
}

.toolbar-btn {
    border: 1px solid transparent;
    background: transparent;
    color: var(--text);
    padding: 4px 8px;
    border-radius: 5px;
    font: inherit;
    font-size: 12px;
    cursor: pointer;
}

.toolbar-btn:hover {
    background: #e2e8f0;
}

.toolbar-sep {
    width: 1px;
    height: 18px;
    background: #cbd5e1;
    margin: 0 4px;
}

.editor-textarea {
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 13px;
    min-height: 150px;
    display: block;
}

.editor-preview {
    padding: 14px;
    min-height: 150px;
    background: #fff;
}

.rendered-html {
    line-height: 1.65;
    color: var(--text);
    word-break: break-word;
}

.rendered-html > :first-child {
    margin-top: 0;
}

.rendered-html > :last-child {
    margin-bottom: 0;
}

.rendered-html h1,
.rendered-html h2,
.rendered-html h3,
.rendered-html h4 {
    margin: 14px 0 6px;
    line-height: 1.3;
}

.rendered-html p {
    margin: 0 0 10px;
}

.rendered-html ul,
.rendered-html ol {
    margin: 0 0 10px;
    padding-left: 22px;
}

.rendered-html blockquote {
    margin: 10px 0;
    padding: 8px 14px;
    border-left: 3px solid var(--primary);
    background: #f8fafc;
    color: #334155;
}

.rendered-html img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
}

.rendered-html table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0;
}

.rendered-html th,
.rendered-html td {
    border: 1px solid var(--border);
    padding: 6px 10px;
    text-align: left;
}

.product-detail-top {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.product-detail-img {
    width: 170px;
    height: 170px;
    border-radius: 10px;
    object-fit: cover;
    border: 1px solid var(--border);
    flex-shrink: 0;
    background: #f1f5f9;
}

.product-detail-meta {
    flex: 1;
    min-width: 0;
}

.detail-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 12px;
}

.detail-price-row {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 14px;
}

.detail-price {
    font-size: 26px;
    font-weight: 700;
}

.detail-link-row {
    margin: 0 0 12px;
}

.detail-dates {
    font-size: 12px;
}

.detail-section {
    padding-top: 18px;
}

.detail-section h3 {
    margin: 0 0 10px;
    font-size: 15px;
}

/* ---------- Redesigned Categories Page ---------- */
.cat-hero-bar {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.cat-hero-metrics {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}

.cat-metric {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.cat-metric-num {
    font-size: 22px;
    font-weight: 800;
    color: var(--text);
    line-height: 1;
}

.cat-metric-lbl {
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.cat-metric-divider {
    width: 1px;
    height: 24px;
    background: var(--border);
}

.cat-hero-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.cat-search-input {
    width: 240px !important;
    padding: 8px 12px !important;
    font-size: 13px !important;
}

.cat-studio-layout {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 22px;
    align-items: start;
}

.cat-create-card {
    position: sticky;
    top: 20px;
}

.cat-create-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}

.cat-create-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: #eff6ff;
    color: var(--primary);
    font-size: 20px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.cat-create-head h2 {
    margin: 0;
    font-size: 16px;
    line-height: 1.2;
}

.cat-create-head p {
    margin: 2px 0 0;
    font-size: 12px;
    color: var(--muted);
}

.cat-live-preview {
    width: 100%;
    height: 128px;
    border-radius: 10px;
    border: 1.5px dashed #cbd5e1;
    background: #f8fafc;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cat-live-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.cat-live-preview-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: var(--muted);
    font-size: 12px;
}

.cat-preview-glyph {
    font-size: 22px;
    opacity: 0.7;
}

.cat-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(245px, 1fr));
    gap: 18px;
}

.cat-visual-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.cat-visual-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
    border-color: #cbd5e1;
}

.cat-card-cover {
    position: relative;
    height: 138px;
    background: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.cat-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.cat-card-initial {
    font-size: 46px;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.88);
    letter-spacing: -0.03em;
    user-select: none;
}

.cat-card-count-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(15, 23, 42, 0.78);
    backdrop-filter: blur(4px);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 999px;
    text-decoration: none;
}

.cat-card-count-badge:hover {
    background: var(--primary);
    color: #fff;
    text-decoration: none;
}

.cat-card-body {
    padding: 15px 16px 12px;
    flex: 1;
}

.cat-card-title-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
}

.cat-card-title {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
}

.cat-card-slug {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 11px;
    color: var(--muted);
    white-space: nowrap;
}

.cat-card-desc {
    margin: 0;
    font-size: 13px;
    color: #475569;
    line-height: 1.45;
}

.cat-card-footer {
    padding: 10px 14px;
    background: #f8fafc;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.cat-card-date {
    font-size: 11.5px;
    color: var(--muted);
}

/* ---------- Dashboard Flutter / Dart API Card ---------- */
.dart-api-card {
    margin-top: 22px;
}

.card-subtitle {
    margin: 4px 0 0;
    font-size: 12.5px;
    color: var(--muted);
}

.api-endpoint-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.api-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 11px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #f8fafc;
    color: var(--text);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.api-pill:hover {
    border-color: var(--primary);
    background: #eff6ff;
}

.api-pill-method {
    background: #dcfce7;
    color: #166534;
    font-weight: 800;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 5px;
}

.dart-code-block {
    margin: 0;
    padding: 16px;
    border-radius: 10px;
    background: #0f172a;
    color: #e2e8f0;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12.5px;
    line-height: 1.55;
    overflow-x: auto;
    max-height: 360px;
}

/* ---------- Product URL Extractor Panel ---------- */
.extractor-card {
    margin-bottom: 20px;
}

.extractor-input-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.extractor-input-row input[type="url"] {
    flex: 1;
    min-width: 0;
}

.extractor-progress {
    height: 4px;
    width: 100%;
    background: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
    margin-top: 12px;
}

.extractor-progress-bar {
    height: 100%;
    width: 40%;
    background: var(--primary);
    border-radius: 999px;
    animation: extractorSlide 1.1s ease-in-out infinite;
}

@keyframes extractorSlide {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(300%); }
}

.extractor-card .alert {
    margin-top: 14px;
    margin-bottom: 0;
}

.extractor-summary {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.extractor-fields-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 12.5px;
}

.field-group-label {
    font-weight: 700;
    color: var(--muted);
    margin-right: 4px;
}

.field-chip {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
    margin: 2px 2px 2px 0;
}

.field-chip-ok {
    background: var(--success-bg);
    color: var(--success-text);
}

.field-chip-miss {
    background: #fef3c7;
    color: #92400e;
}

.extractor-gallery-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.extractor-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
    gap: 10px;
}

.extractor-thumb-btn {
    position: relative;
    padding: 0;
    border: 2px solid var(--border);
    border-radius: 8px;
    background: #f8fafc;
    overflow: hidden;
    cursor: pointer;
    aspect-ratio: 1 / 1;
    transition: border-color 0.15s, transform 0.15s;
}

.extractor-thumb-btn:hover {
    border-color: var(--primary);
    transform: translateY(-1px);
}

.extractor-thumb-btn.selected {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.25);
}

.extractor-thumb-btn img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.extractor-thumb-tag {
    position: absolute;
    left: 4px;
    right: 4px;
    bottom: 4px;
    background: rgba(15, 23, 42, 0.78);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 4px;
    border-radius: 4px;
    text-align: center;
}

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .dashboard-grid,
    .categories-grid,
    .cat-studio-layout {
        grid-template-columns: 1fr;
    }
    .cat-create-card {
        position: static;
    }
    .cat-search-input {
        width: 100% !important;
    }
}

@media (max-width: 720px) {
    .product-detail-top {
        flex-direction: column;
    }
    .product-detail-img {
        width: 100%;
        height: 220px;
    }
    .admin-layout {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        padding: 14px 16px;
    }
    .sidebar-nav {
        flex-direction: row;
        flex-wrap: wrap;
    }
    .sidebar-footer {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
    }
    .sidebar-footer .admin-meta {
        margin-bottom: 0;
    }
    .sidebar-footer .btn-block {
        width: auto;
    }
    .topbar,
    .content-body {
        padding-left: 16px;
        padding-right: 16px;
    }
    .form-row {
        grid-template-columns: 1fr;
    }
    .stats-grid {
        grid-template-columns: 1fr;
    }
}
