/* ===== Admin Panel — CSS ===== */
:root {
    --admin-primary: #1A3F22;
    --admin-primary-light: #58761B;
    --admin-primary-dark: #0F2614;
    --admin-secondary: #D99201;
    --admin-secondary-light: #F5B301;
    --admin-accent: #06D6A0;
    --admin-bg: #f0f2f5;
    --admin-sidebar: #0F2614;
    --admin-sidebar-hover: #1A3F22;
    --admin-sidebar-active: #58761B;
    --admin-card: #ffffff;
    --admin-text: #1a2e1d;
    --admin-text-muted: #6c757d;
    --admin-border: #dee2e6;
    --admin-radius: 10px;
    --admin-shadow: 0 2px 12px rgba(0,0,0,0.08);
    --admin-sidebar-width: 260px;
    --admin-header-height: 60px;
    --font-thai: 'Noto Sans Thai', 'Inter', -apple-system, sans-serif;
}

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

body {
    font-family: var(--font-thai);
    background: var(--admin-bg);
    color: var(--admin-text);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ===== Login Page ===== */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0A1F0E 0%, #1A3F22 40%, #2D5A1E 100%);
    padding: 20px;
}

.login-card {
    background: var(--admin-card);
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-logo {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo h1 {
    font-size: 1.5rem;
    color: var(--admin-primary);
    font-weight: 700;
}

.login-logo .subtitle {
    color: var(--admin-text-muted);
    font-size: 0.875rem;
    margin-top: 4px;
}

.login-card .form-control {
    padding: 12px 16px;
    border-radius: 8px;
    border: 1.5px solid var(--admin-border);
    font-size: 0.95rem;
    transition: border-color 0.2s;
}

.login-card .form-control:focus {
    border-color: var(--admin-primary);
    box-shadow: 0 0 0 3px rgba(26,63,34,0.1);
}

.login-card .btn-login {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #1A3F22, #58761B);
    border: none;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.1s;
}

.login-card .btn-login:hover { opacity: 0.9; }
.login-card .btn-login:active { transform: scale(0.98); }
.login-card .btn-login:disabled { opacity: 0.6; cursor: not-allowed; }

.login-error {
    display: none;
    background: #fee2e2;
    color: #dc2626;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.875rem;
    margin-bottom: 16px;
}

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

/* Sidebar */
.admin-sidebar {
    width: var(--admin-sidebar-width);
    background: var(--admin-sidebar);
    color: #fff;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    overflow-y: auto;
}

.admin-sidebar.collapsed {
    transform: translateX(-100%);
}

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

.sidebar-brand .brand-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--admin-secondary), var(--admin-secondary-light));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.sidebar-brand h2 {
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1.2;
}

.sidebar-brand small {
    font-size: 0.7rem;
    opacity: 0.6;
    font-weight: 400;
}

.sidebar-nav {
    flex: 1;
    padding: 10px 0;
}

.sidebar-section {
    padding: 8px 20px 4px;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    opacity: 0.4;
    font-weight: 600;
    margin-top: 8px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.sidebar-nav a:hover {
    background: var(--admin-sidebar-hover);
    color: #fff;
}

.sidebar-nav a.active {
    background: rgba(88,118,27,0.2);
    color: var(--admin-secondary-light);
    border-left-color: var(--admin-secondary-light);
    font-weight: 600;
}

.sidebar-nav a i {
    width: 20px;
    text-align: center;
    font-size: 1rem;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    font-size: 0.8rem;
    opacity: 0.5;
}

/* Main Content */
.admin-main {
    flex: 1;
    min-width: 0;
    margin-left: var(--admin-sidebar-width);
    min-height: 100vh;
    transition: margin-left 0.3s ease;
    overflow-x: hidden;
}

.admin-header {
    background: var(--admin-card);
    height: var(--admin-header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    border-bottom: 1px solid var(--admin-border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.admin-header .header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.admin-header .header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.toggle-sidebar {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--admin-text);
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    display: none;
}

.toggle-sidebar:hover { background: var(--admin-bg); }

.page-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--admin-text);
}

.admin-header .user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 14px;
    background: var(--admin-bg);
    border-radius: 8px;
    cursor: pointer;
}

.admin-header .user-info .user-avatar {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--admin-primary), var(--admin-primary-light));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.8rem;
    font-weight: 600;
}

.admin-header .user-name {
    font-size: 0.85rem;
    font-weight: 600;
}

.admin-header .user-role {
    font-size: 0.72rem;
    color: var(--admin-text-muted);
}

.btn-logout {
    background: none;
    border: 1px solid var(--admin-border);
    color: var(--admin-text-muted);
    padding: 6px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.btn-logout:hover {
    border-color: #dc3545;
    color: #dc3545;
    background: #fff5f5;
}

/* Content Area */
.admin-content {
    padding: 24px;
}

/* ===== Cards ===== */
.stat-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--admin-card);
    border-radius: var(--admin-radius);
    padding: 20px;
    box-shadow: var(--admin-shadow);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: transform 0.2s, box-shadow 0.2s;
}

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

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    color: #fff;
    flex-shrink: 0;
}

.stat-icon.green { background: linear-gradient(135deg, #1A3F22, #58761B); }
.stat-icon.gold { background: linear-gradient(135deg, #D99201, #F5B301); }
.stat-icon.blue { background: linear-gradient(135deg, #2563eb, #3b82f6); }
.stat-icon.red { background: linear-gradient(135deg, #dc2626, #ef4444); }
.stat-icon.purple { background: linear-gradient(135deg, #7c3aed, #8b5cf6); }
.stat-icon.teal { background: linear-gradient(135deg, #0d9488, #14b8a6); }

.stat-card .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--admin-text);
    line-height: 1;
}

.stat-card .stat-label {
    font-size: 0.8rem;
    color: var(--admin-text-muted);
    margin-top: 4px;
}

/* ===== Data Panels ===== */
.data-panel {
    background: var(--admin-card);
    border-radius: var(--admin-radius);
    box-shadow: var(--admin-shadow);
    margin-bottom: 24px;
    overflow: hidden;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--admin-border);
    flex-wrap: wrap;
    gap: 12px;
}

.panel-header h3 {
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.panel-header h3 i {
    color: var(--admin-primary);
}

.panel-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.panel-body {
    padding: 0;
}

.panel-body.padded {
    padding: 20px;
}

/* ===== Buttons ===== */
.btn-admin {
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
    font-family: var(--font-thai);
}

.btn-primary-admin {
    background: linear-gradient(135deg, #1A3F22, #58761B);
    color: #fff;
}
.btn-primary-admin:hover { opacity: 0.9; }

.btn-success-admin { background: #059669; color: #fff; }
.btn-success-admin:hover { background: #047857; }

.btn-warning-admin { background: #D99201; color: #fff; }
.btn-warning-admin:hover { background: #b57a01; }

.btn-danger-admin { background: #dc2626; color: #fff; }
.btn-danger-admin:hover { background: #b91c1c; }

.btn-outline-admin {
    background: transparent;
    border: 1.5px solid var(--admin-border);
    color: var(--admin-text);
}
.btn-outline-admin:hover {
    border-color: var(--admin-primary);
    color: var(--admin-primary);
    background: #f0fdf4;
}

.btn-sm { padding: 5px 10px; font-size: 0.78rem; }
.btn-xs { padding: 3px 8px; font-size: 0.72rem; border-radius: 6px; }

/* ===== Tables ===== */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.admin-table thead {
    background: #f8fafb;
    border-bottom: 2px solid var(--admin-border);
}

.admin-table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: var(--admin-text-muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.admin-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}

.admin-table tbody tr:hover {
    background: #f8fdf9;
}

.admin-table .actions {
    display: flex;
    gap: 6px;
    white-space: nowrap;
}

/* ===== Badges ===== */
.badge-admin {
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    display: inline-block;
}

.badge-green { background: #dcfce7; color: #166534; }
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-blue { background: #dbeafe; color: #1e40af; }
.badge-gold { background: #fef3c7; color: #92400e; }
.badge-gray { background: #f3f4f6; color: #374151; }
.badge-purple { background: #ede9fe; color: #5b21b6; }

/* ===== Forms ===== */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--admin-text);
}

.form-group label .required {
    color: #dc2626;
}

.form-input {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--admin-border);
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: var(--font-thai);
    transition: border-color 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: var(--admin-primary);
    box-shadow: 0 0 0 3px rgba(26,63,34,0.1);
}

.form-input.error { border-color: #dc2626; }

select.form-input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 14px;
    padding-right: 36px;
}

textarea.form-input { resize: vertical; min-height: 80px; }

/* ===== Auto-calc fields (sumberdee/berdee) ===== */
.form-input.auto-calc-field {
    background-color: #f0fdf4;
    border-color: #86efac;
    font-weight: 600;
    color: #166534;
    cursor: default;
}
.auto-calc-badge {
    display: inline-block;
    font-size: 10px;
    background: #16a34a;
    color: #fff;
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 600;
    margin-left: 6px;
    vertical-align: middle;
}
.sum-calc-preview {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 13px;
    color: #166534;
    margin-top: -4px;
    margin-bottom: 8px;
    line-height: 1.7;
}
.form-hint {
    display: block;
    font-size: 12px;
    color: #9ca3af;
    margin-top: 4px;
}

.auto-categories-display {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}

.category-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid #bbf7d0;
    background: #f0fdf4;
    color: #166534;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
}

/* ===== Modals ===== */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-box {
    background: var(--admin-card);
    border-radius: 16px;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    transform: translateY(20px);
    transition: transform 0.2s;
}

.modal-overlay.active .modal-box {
    transform: translateY(0);
}

.modal-box.large { max-width: 800px; }

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--admin-border);
}

.modal-header h3 {
    font-size: 1.05rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    color: var(--admin-text-muted);
    padding: 4px;
    line-height: 1;
}

.modal-close:hover { color: #dc2626; }

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--admin-border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ===== Search & Filters ===== */
.search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--admin-bg);
    border-radius: 8px;
    padding: 6px 12px;
    border: 1.5px solid var(--admin-border);
    transition: border-color 0.2s;
}

.search-box:focus-within {
    border-color: var(--admin-primary);
}

.search-box i { color: var(--admin-text-muted); font-size: 0.85rem; }

.search-box input {
    border: none;
    background: transparent;
    font-size: 0.85rem;
    outline: none;
    width: 180px;
    font-family: var(--font-thai);
}

.filter-select {
    padding: 7px 30px 7px 12px;
    border: 1.5px solid var(--admin-border);
    border-radius: 8px;
    font-size: 0.85rem;
    font-family: var(--font-thai);
    background: #fff;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 12px;
    cursor: pointer;
}

/* ===== Pagination ===== */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    border-top: 1px solid var(--admin-border);
    flex-wrap: wrap;
    gap: 8px;
}

.pagination-info {
    font-size: 0.82rem;
    color: var(--admin-text-muted);
}

.pagination-buttons {
    display: flex;
    gap: 4px;
}

.pagination-buttons button {
    width: 34px;
    height: 34px;
    border: 1px solid var(--admin-border);
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.pagination-buttons button:hover:not(:disabled) {
    border-color: var(--admin-primary);
    color: var(--admin-primary);
}

.pagination-buttons button.active {
    background: var(--admin-primary);
    color: #fff;
    border-color: var(--admin-primary);
}

.pagination-buttons button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ===== Tabs ===== */
.admin-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--admin-border);
    padding: 0 20px;
    overflow-x: auto;
    background: var(--admin-card);
    border-radius: var(--admin-radius) var(--admin-radius) 0 0;
}

.admin-tabs button {
    padding: 12px 18px;
    border: none;
    background: none;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--admin-text-muted);
    cursor: pointer;
    position: relative;
    white-space: nowrap;
    font-family: var(--font-thai);
    transition: color 0.2s;
}

.admin-tabs button:hover { color: var(--admin-text); }

.admin-tabs button.active {
    color: var(--admin-primary);
    font-weight: 600;
}

.admin-tabs button.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--admin-primary);
    border-radius: 2px 2px 0 0;
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ===== Alerts ===== */
.alert-admin {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.85rem;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.alert-info { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }

/* ===== Toast ===== */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 14px 20px;
    border-radius: 10px;
    color: #fff;
    font-size: 0.87rem;
    box-shadow: 0 8px 30px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    gap: 10px;
    animation: toastIn 0.3s ease;
    min-width: 280px;
    max-width: 420px;
}

.toast.success { background: #059669; }
.toast.error { background: #dc2626; }
.toast.warning { background: #D99201; }
.toast.info { background: #2563eb; }

.toast.removing { animation: toastOut 0.3s ease forwards; }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(60px); }
    to { opacity: 1; transform: translateX(0); }
}
@keyframes toastOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(60px); }
}

/* ===== Loading ===== */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2.5px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.spinner.dark {
    border-color: rgba(0,0,0,0.1);
    border-top-color: var(--admin-primary);
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255,255,255,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: var(--admin-radius);
}

.table-loading {
    text-align: center;
    padding: 40px;
    color: var(--admin-text-muted);
}

.table-empty {
    text-align: center;
    padding: 40px;
    color: var(--admin-text-muted);
}

.table-empty i { font-size: 2rem; margin-bottom: 10px; opacity: 0.3; }

/* ===== Charts area ===== */
.chart-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

.chart-card {
    background: var(--admin-card);
    border-radius: var(--admin-radius);
    padding: 20px;
    box-shadow: var(--admin-shadow);
}

.chart-card h4 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--admin-text);
}

/* ===== Dashboard — Bar chart rows ===== */
.bar-row {
    display: grid;
    grid-template-columns: minmax(100px, 1fr) auto 1fr;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.bar-row:last-child { margin-bottom: 0; }

.bar-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    font-weight: 500;
    white-space: nowrap;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bar-label i { flex-shrink: 0; }

.bar-meta {
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.bar-count {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--admin-text);
}

.bar-pct {
    font-size: 0.72rem;
    color: var(--admin-text-muted);
}

.bar-track {
    height: 8px;
    background: #f0f0f0;
    border-radius: 4px;
    overflow: hidden;
    min-width: 40px;
}

.bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.6s ease;
}

.cat-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

/* ===== Dashboard — Price stats ===== */
.price-stats-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
}

.price-stat-item {
    text-align: center;
    padding: 16px 8px;
    border-radius: 10px;
    background: var(--admin-bg);
    transition: transform 0.2s;
}

.price-stat-item:hover { transform: translateY(-2px); }

.price-stat-number {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--admin-text);
    line-height: 1.2;
    word-break: break-all;
}

.price-stat-number.highlight { color: var(--admin-primary); }
.price-stat-number.gold-text { color: var(--admin-secondary); }

.price-stat-desc {
    font-size: 0.75rem;
    color: var(--admin-text-muted);
    margin-top: 6px;
}

/* ===== Dashboard — Recent plates list ===== */
.recent-list { }

.recent-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    border-bottom: 1px solid #f0f0f0;
    text-decoration: none;
    color: var(--admin-text);
    transition: background 0.15s;
}

.recent-item:last-child { border-bottom: none; }
.recent-item:hover { background: #f8fdf9; }

.recent-plate-number {
    font-weight: 700;
    font-size: 0.92rem;
    min-width: 100px;
    white-space: nowrap;
}

.recent-details {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    flex-wrap: wrap;
}

.recent-price {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--admin-primary);
}

.recent-time {
    font-size: 0.75rem;
    color: var(--admin-text-muted);
    white-space: nowrap;
}

/* ===== Dashboard — Misc helpers ===== */
.mb-panel { margin-bottom: 24px; }

.text-muted-sm {
    font-size: 0.78rem;
    color: var(--admin-text-muted);
}

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    max-width: 100%;
}
.table-responsive .admin-table {
    min-width: 800px;
    width: 100%;
}

/* ===== Sidebar backdrop overlay (mobile) ===== */
.sidebar-backdrop {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.45);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.sidebar-backdrop.active {
    opacity: 1;
    visibility: visible;
}

/* ===== Settings ===== */
.settings-group {
    margin-bottom: 24px;
}

.settings-group h4 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--admin-border);
    display: flex;
    align-items: center;
    gap: 8px;
}

.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
    gap: 16px;
}

.setting-row:last-child { border-bottom: none; }

.setting-info { flex: 1; min-width: 0; }

.setting-info .setting-label {
    font-weight: 500;
    font-size: 0.88rem;
}

.setting-info .setting-desc {
    font-size: 0.78rem;
    color: var(--admin-text-muted);
    margin-top: 2px;
}

.setting-value { width: 300px; flex-shrink: 0; }
.setting-value input, .setting-value select, .setting-value textarea {
    width: 100%;
}

/* ===== Sync Log ===== */
.sync-status { display: flex; align-items: center; gap: 6px; }
.sync-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}
.sync-dot.success { background: #059669; }
.sync-dot.error { background: #dc2626; }
.sync-dot.running { background: #D99201; animation: pulse 1s infinite; }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ===== Filter bar ===== */
.filter-bar {
    padding: 12px 20px;
    border-bottom: 1px solid var(--admin-border);
    background: var(--admin-bg);
}
.filter-form {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}
.filter-row {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    width: 100%;
}
.btn-clear-filter {
    color: #dc2626 !important;
    border-color: #dc2626 !important;
}
.btn-clear-filter:hover {
    background: #dc2626 !important;
    color: #fff !important;
}

/* ===== Plate background thumbnail (index list) ===== */
.plate-bg-thumb {
    width: 72px;
    height: 44px;
    background-size: cover;
    background-position: center;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--admin-border);
    position: relative;
    overflow: hidden;
}
.plate-bg-number {
    font-size: 0.65rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0,0,0,0.6);
    z-index: 1;
}

/* ===== Plate show page hero ===== */
.plate-show-hero {
    display: flex;
    gap: 24px;
    align-items: center;
    margin-bottom: 28px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--admin-border);
    flex-wrap: wrap;
}
.plate-bg-preview {
    width: 220px;
    height: 130px;
    background-size: cover;
    background-position: center;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    flex-shrink: 0;
}
.plate-bg-hero-number {
    font-size: 1.4rem;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 2px 6px rgba(0,0,0,0.5);
}
.plate-hero-info {
    flex: 1;
    min-width: 200px;
}
.plate-hero-price {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--admin-primary);
    margin-bottom: 10px;
}
.plate-hero-sale {
    font-size: 0.9rem;
    font-weight: 500;
    color: #dc2626;
    text-decoration: line-through;
    margin-left: 8px;
}
.plate-hero-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ===== Detail grid (show page) ===== */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}
.detail-item {
    padding: 10px 0;
    border-bottom: 1px solid #f3f4f6;
}
.detail-label {
    font-size: 0.75rem;
    color: var(--admin-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 4px;
}
.detail-value {
    font-size: 0.92rem;
    font-weight: 500;
    color: var(--admin-text);
}
.detail-section {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--admin-border);
}
.detail-section h4 {
    font-size: 0.88rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--admin-text);
}
.detail-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

/* ===== Show page 2-column layout ===== */
.show-layout-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 28px;
    align-items: start;
}
.show-col { min-width: 0; }
.show-section {
    margin-bottom: 20px;
    padding: 16px;
    background: var(--admin-bg);
    border: 1px solid var(--admin-border);
    border-radius: 10px;
}
.show-section-title {
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--admin-primary);
    margin: 0 0 12px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--admin-border);
    display: flex;
    align-items: center;
    gap: 6px;
}
.show-section-title i {
    font-size: 0.78rem;
    opacity: 0.7;
}
.show-table {
    width: 100%;
    border-collapse: collapse;
}
.show-table tr + tr { border-top: 1px solid #f3f4f6; }
.show-table td { padding: 8px 0; vertical-align: top; }
.show-label {
    width: 120px;
    font-size: 0.75rem;
    color: var(--admin-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    font-weight: 500;
    white-space: nowrap;
    padding-right: 12px;
}
.show-value {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--admin-text);
    word-break: break-word;
}

/* ===== Background preview in form ===== */
.plate-bg-preview-form {
    width: 280px;
    height: 160px;
    background-size: cover;
    background-position: center;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--admin-border);
    transition: background-image 0.3s;
}
.bg-legend {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}
.bg-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    color: var(--admin-text-muted);
}
.bg-legend-thumb {
    width: 40px;
    height: 24px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid var(--admin-border);
}

/* ===== Plate Simulator (form preview) ===== */
.admin-plate-simulator {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.sim-plate-display {
    position: relative;
    width: 280px;
    aspect-ratio: 2 / 1;
    border: 2px solid #1a3f22;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    transition: border-color 0.3s, aspect-ratio 0.3s;
}
.sim-plate-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    z-index: 0;
    pointer-events: none;
}
.sim-stars-tl {
    position: absolute;
    top: 6px;
    left: 6px;
    z-index: 5;
    display: flex;
    gap: 1px;
    font-size: 10px;
    color: #E8A317;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,.25));
}
.sim-status-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 5;
    font-size: 9px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.sim-badge-sale { background: #dc2626; color: #fff; }
.sim-badge-new { background: #2563eb; color: #fff; }
.sim-plate-center {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    flex: 1;
}
.sim-plate-number {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-family: "Sarabun", sans-serif;
    margin-top: -8px;
}
.sim-chars, .sim-nums {
    font-size: 28px;
    font-weight: 700;
    color: #111;
    line-height: 1;
    letter-spacing: 1px;
}
.sim-province-bc {
    position: absolute;
    bottom: 6px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 5;
    font-size: 13px;
    font-weight: 700;
    color: #111;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 80%;
    text-align: center;
    font-family: "Sarabun", sans-serif;
}
.sim-province-mid {
    font-size: 11px;
    font-weight: 700;
    color: #000;
    display: block;
    text-align: center;
    font-family: "Sarabun", sans-serif;
    line-height: 1.2;
}
.sim-sum-badge {
    position: absolute;
    bottom: 6px;
    right: 6px;
    z-index: 5;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #1B3A8A;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0,0,0,.3);
}
.sim-sum-badge span {
    color: #fff;
    font-size: 10px;
    font-weight: 700;
}
.sim-price-bar {
    margin-top: 8px;
    text-align: center;
    font-family: "Sarabun", sans-serif;
}
.sim-price-current { font-size: 16px; font-weight: 700; color: #111; }
.sim-price-old { font-size: 12px; color: #9ca3af; text-decoration: line-through; }
.sim-price-sale { font-size: 16px; font-weight: 700; color: #CB1818; }

/* Simulator theme variants */
.sim-theme-gold .sim-chars, .sim-theme-gold .sim-nums { color: #000; }
.sim-theme-gold .sim-province-bc { color: #000; }
.sim-theme-gold .sim-stars-tl { color: #E8A317; filter: drop-shadow(0 1px 2px rgba(255,255,255,.4)); }

.sim-theme-bw { border-color: #333; }
.sim-theme-bw .sim-chars, .sim-theme-bw .sim-nums { color: #000; }
.sim-theme-bw .sim-province-bc { color: #000; }

.sim-theme-van { border-color: #1e40af; }
.sim-theme-van .sim-chars, .sim-theme-van .sim-nums { color: #1e40af; }
.sim-theme-van .sim-province-bc { color: #1e40af; }

.sim-theme-pickup { border-color: #16a34a; }
.sim-theme-pickup .sim-chars, .sim-theme-pickup .sim-nums { color: #16a34a; }
.sim-theme-pickup .sim-province-bc { color: #16a34a; }

.sim-theme-motorcycle {
    aspect-ratio: 1 / 1;
    max-width: 160px;
    border-color: #333;
    background: #fff;
    border-radius: 10px;
    border-width: 3px;
}
.sim-theme-motorcycle .sim-plate-number {
    flex-direction: column;
    gap: 0;
    margin-top: 0;
}
.sim-theme-motorcycle .sim-chars,
.sim-theme-motorcycle .sim-nums { color: #000; font-size: 22px; }
.sim-theme-motorcycle .sim-province-bc { color: #000; }
.sim-theme-motorcycle .sim-province-mid { color: #000; font-size: 12px; font-weight: 700; display: block; text-align: center; margin: 4px 0; }

/* Gold variant toggle inline style */
.toggle-inline {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 10px 14px;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 8px;
}
.toggle-inline input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #D99201;
    cursor: pointer;
}
.toggle-label-text {
    font-size: 0.88rem;
    font-weight: 500;
    color: #92400e;
}

/* ===== Tom Select overrides ===== */
.ts-wrapper {
    min-width: 180px;
}
.ts-wrapper.multi .ts-control {
    padding: 4px 8px;
    border: 1px solid var(--admin-border);
    border-radius: 8px;
    background: #fff;
    min-height: 36px;
    font-size: 0.82rem;
}
.ts-wrapper.multi .ts-control .item {
    background: var(--admin-primary);
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 0.78rem;
}
.ts-wrapper .ts-dropdown {
    border-radius: 8px;
    border: 1px solid var(--admin-border);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.ts-wrapper .ts-dropdown .option {
    font-size: 0.82rem;
    padding: 8px 12px;
}
.ts-wrapper .ts-dropdown .option.active {
    background: var(--admin-primary);
    color: #fff;
}

/* ===== Responsive ===== */

/* ─── Tablet landscape (1024px) ─── */
@media (max-width: 1024px) {
    .stat-cards {
        grid-template-columns: repeat(3, 1fr);
    }
    .price-stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .chart-grid {
        grid-template-columns: 1fr;
    }
    .bar-row {
        grid-template-columns: minmax(90px, 1fr) auto 1fr;
    }
    .setting-value { width: 220px; }
}

/* ─── Tablet portrait & large phones (768px) ─── */
@media (max-width: 768px) {
    .admin-sidebar {
        transform: translateX(-100%);
    }
    .admin-sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 20px rgba(0,0,0,0.3);
    }
    .admin-main {
        margin-left: 0;
    }
    .toggle-sidebar {
        display: flex;
    }
    .stat-cards {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    .stat-card {
        padding: 16px;
    }
    .stat-card .stat-value {
        font-size: 1.25rem;
    }
    .price-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .price-stat-item {
        padding: 12px 8px;
    }
    .price-stat-number {
        font-size: 1rem;
    }
    .panel-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .panel-actions {
        width: 100%;
    }
    .search-box { flex: 1; min-width: 0; }
    .search-box input { width: 100%; }
    .setting-row { flex-direction: column; align-items: flex-start; }
    .setting-value { width: 100%; }
    .admin-header .user-info > div { display: none; }
    .admin-header .user-info { padding: 6px; }
    .modal-box { margin: 10px; }
    .admin-content { padding: 16px; }
    .recent-plate-number { min-width: 80px; }
    .bar-row {
        grid-template-columns: minmax(80px, 0.8fr) auto 1fr;
        gap: 8px;
    }
    .form-actions {
        flex-direction: column;
    }
    .form-actions .btn-admin {
        width: 100%;
        justify-content: center;
    }
    /* Plate specific */
    .filter-row { gap: 6px; }
    .filter-select { min-width: 0; flex: 1; font-size: 0.78rem; }
    .ts-wrapper { min-width: 140px; flex: 1; }
    .plate-bg-thumb { width: 56px; height: 34px; }
    .plate-bg-number { font-size: 0.55rem; }
    .plate-show-hero { gap: 16px; }
    .plate-bg-preview { width: 180px; height: 110px; }
    .plate-hero-price { font-size: 1.4rem; }
    .detail-grid { grid-template-columns: repeat(2, 1fr); }
    .plate-bg-preview-form { width: 220px; height: 130px; }
    .bg-legend { gap: 10px; }
}

/* ─── Small phones (480px) ─── */
@media (max-width: 480px) {
    :root {
        --admin-header-height: 52px;
    }
    .stat-cards {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    .stat-card {
        padding: 14px;
    }
    .stat-card .stat-icon {
        width: 42px;
        height: 42px;
        font-size: 1.1rem;
        border-radius: 10px;
    }
    .stat-card .stat-value {
        font-size: 1.15rem;
    }
    .price-stats-grid {
        grid-template-columns: 1fr 1fr;
    }
    .price-stat-item:last-child {
        grid-column: 1 / -1;
    }
    .price-stat-number {
        font-size: 0.92rem;
    }
    .admin-content {
        padding: 12px;
    }
    .admin-table { font-size: 0.78rem; }
    .admin-table th, .admin-table td { padding: 8px 10px; }
    .page-title { font-size: 0.95rem; }
    .admin-header { padding: 0 12px; }
    .panel-header { padding: 12px 16px; }
    .panel-body.padded { padding: 16px; }
    .bar-row {
        grid-template-columns: 1fr;
        gap: 4px;
        margin-bottom: 16px;
        padding-bottom: 12px;
        border-bottom: 1px solid #f0f0f0;
    }
    .bar-row:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
    .bar-label { font-size: 0.8rem; }
    .bar-meta { justify-content: flex-start; }
    .bar-track { min-width: 0; }
    .recent-item {
        flex-wrap: wrap;
        gap: 8px;
        padding: 10px 16px;
    }
    .recent-plate-number { min-width: auto; }
    .recent-details { gap: 4px; }
    .recent-time { width: 100%; text-align: right; }
    .btn-logout span { display: none; }
    .btn-logout { padding: 6px 10px; }
    .data-panel { border-radius: 8px; }
    .stat-card { border-radius: 8px; }
    .flag-grid { grid-template-columns: 1fr 1fr; }
    .category-grid { grid-template-columns: 1fr 1fr; }
    /* Plate specific */
    .filter-bar { padding: 10px 12px; }
    .filter-row { flex-direction: column; }
    .filter-select { width: 100%; }
    .ts-wrapper { width: 100%; min-width: 0; }
    .plate-bg-thumb { width: 48px; height: 30px; }
    .plate-show-hero { flex-direction: column; align-items: flex-start; }
    .plate-bg-preview { width: 100%; max-width: 280px; height: 140px; }
    .plate-hero-price { font-size: 1.2rem; }
    .detail-grid { grid-template-columns: 1fr; }
    .plate-bg-preview-form { width: 100%; max-width: 260px; height: 140px; }
    .bg-legend { flex-direction: column; gap: 6px; }
}

/* ===== Confirm dialog ===== */
.confirm-dialog .modal-body {
    text-align: center;
    padding: 30px 24px;
}

.confirm-dialog .confirm-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #fee2e2;
    color: #dc2626;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin: 0 auto 16px;
}

.confirm-dialog .confirm-text {
    font-size: 0.95rem;
    margin-bottom: 8px;
}

.confirm-dialog .confirm-sub {
    font-size: 0.82rem;
    color: var(--admin-text-muted);
}

/* ===== Misc ===== */
.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.text-mono {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.82rem;
}

.flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.gap-sm { gap: 8px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.hidden { display: none !important; }

/* ===== Plate Form — Sections ===== */
.form-section {
    border: 1.5px solid var(--admin-border);
    border-radius: var(--admin-radius);
    padding: 20px 24px 16px;
    margin-bottom: 20px;
    background: #fafbfc;
}

.form-section legend {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--admin-primary);
    padding: 0 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-section legend i {
    font-size: 0.85rem;
    opacity: 0.7;
}

/* ─── Two-column form master layout ─── */
.form-layout-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 24px;
    align-items: start;
}
.form-col-left, .form-col-right {
    min-width: 0;
}
.form-col-full {
    grid-column: 1 / -1;
}
@media (max-width: 900px) {
    .form-layout-2col { grid-template-columns: 1fr; }
    .show-layout-2col { grid-template-columns: 1fr; }
}

/* ─── Grid helpers for form ─── */
.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

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

@media (max-width: 640px) {
    .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
}

/* ─── Price +/- buttons ─── */
.input-with-btns {
    display: flex;
    align-items: stretch;
    gap: 0;
}

.input-with-btns .form-input {
    border-radius: 0;
    text-align: center;
    flex: 1;
    min-width: 0;
}

.btn-adjust {
    width: 40px;
    border: 1.5px solid var(--admin-border);
    background: #f3f4f6;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    color: var(--admin-text);
    transition: background 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-adjust:first-child { border-radius: 8px 0 0 8px; border-right: none; }
.btn-adjust:last-child  { border-radius: 0 8px 8px 0; border-left: none; }
.btn-adjust:hover       { background: #e5e7eb; }
.btn-adjust:active      { background: #d1d5db; }

/* ─── Category multi-select checkboxes ─── */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 8px;
}

.checkbox-card {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border: 1.5px solid var(--admin-border);
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    font-size: 0.82rem;
    background: #fff;
}

.checkbox-card:hover {
    border-color: var(--admin-primary-light);
    background: #f0fdf4;
}

.checkbox-card input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--admin-primary);
    cursor: pointer;
    flex-shrink: 0;
}

.checkbox-card input[type="checkbox"]:checked + .checkbox-label {
    font-weight: 600;
    color: var(--admin-primary);
}

/* ─── Toggle switches ─── */
.flag-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
}

.toggle-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border: 1.5px solid var(--admin-border);
    border-radius: 8px;
    background: #fff;
    cursor: default;
}

.toggle-label {
    font-size: 0.82rem;
    font-weight: 500;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 42px;
    height: 24px;
    flex-shrink: 0;
}

.toggle-switch.big {
    width: 54px;
    height: 28px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #ccc;
    transition: 0.25s;
    border-radius: 24px;
}

.toggle-slider::before {
    content: "";
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: white;
    transition: 0.25s;
    border-radius: 50%;
}

.toggle-switch.big .toggle-slider::before {
    height: 22px;
    width: 22px;
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--admin-primary);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(18px);
}

.toggle-switch.big input:checked + .toggle-slider::before {
    transform: translateX(26px);
}

/* ─── Active toggle row ─── */
.active-toggle-row {
    display: flex;
    align-items: center;
    gap: 16px;
}

.active-label {
    font-size: 1rem;
    font-weight: 600;
}

.active-status {
    font-size: 0.95rem;
}

/* ─── Image upload area ─── */
.image-upload-area {
    border: 2px dashed var(--admin-border);
    border-radius: var(--admin-radius);
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    position: relative;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-upload-area:hover,
.image-upload-area.dragover {
    border-color: var(--admin-primary);
    background: #f0fdf4;
}

.upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--admin-text-muted);
}

.upload-placeholder i {
    font-size: 2rem;
    opacity: 0.5;
}

.upload-placeholder span {
    font-size: 0.85rem;
}

.image-preview {
    position: relative;
    display: inline-block;
    max-width: 300px;
}

.image-preview img {
    max-width: 100%;
    max-height: 200px;
    border-radius: 8px;
    display: block;
}

.btn-remove-img {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid #fff;
    background: #dc2626;
    color: #fff;
    font-size: 0.75rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.btn-remove-img:hover { background: #b91c1c; }

/* ─── Form actions ─── */
.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--admin-border);
}

/* Color picker inline group */
.color-input-group{display:flex;align-items:center;gap:8px}
.color-input-group .color-picker{width:36px;height:36px;padding:2px;border:1px solid var(--admin-border);border-radius:4px;cursor:pointer;background:none}
.color-input-group .form-input{flex:1}

/* Plate mini display (index table) */
.plate-mini-display{position:relative;width:120px;height:56px;border-radius:4px;overflow:hidden;display:flex;align-items:center;justify-content:center;gap:4px;border:2px solid #ccc}
.plate-mini-display .plate-mini-bg{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;z-index:0}
.plate-mini-display .plate-mini-chars,.plate-mini-display .plate-mini-nums{position:relative;z-index:1;font-weight:700;font-size:13px;color:#000}
.plate-mini-display.plate-mini-portrait{width:56px;height:56px;flex-direction:column;gap:0}
.plate-mini-portrait .plate-mini-chars,.plate-mini-portrait .plate-mini-nums{font-size:11px}
.plate-mini-stars{position:absolute;top:1px;left:3px;z-index:2;display:flex;gap:1px}
.plate-mini-stars i{font-size:7px;color:#D99201;filter:drop-shadow(0 0 1px rgba(0,0,0,.3))}
.plate-mini-sum{position:absolute;bottom:1px;right:3px;z-index:2;font-size:8px;font-weight:700;color:#D99201;background:rgba(0,0,0,.5);padding:0 3px;border-radius:2px;line-height:1.4}

/* Star badge */
.star-badge{display:inline-flex;align-items:center;gap:3px;font-size:0.75rem;font-weight:600;padding:2px 6px;border-radius:4px}
.star-badge.star-5{color:#92400e;background:#fef3c7}
.star-badge.star-5 i{color:#D99201}
.star-badge.star-4{color:#78350f;background:#fef9c3}
.star-badge.star-4 i{color:#F5B301}

/* Type label */
.type-label{font-size:0.78rem;color:var(--admin-text-muted);white-space:nowrap}
.type-label i{margin-right:2px}

/* Badge outline */
.badge-admin.badge-outline{background:transparent;border:1px solid var(--admin-border);color:var(--admin-text-muted);font-size:0.68rem;padding:1px 5px;margin:1px 0}

/* Plate show hero — split chars/nums/province */
.plate-bg-preview .plate-bg-hero-chars,.plate-bg-preview .plate-bg-hero-nums{font-weight:700;font-size:24px;color:#000;text-shadow:0 1px 2px rgba(255,255,255,.5)}
.plate-bg-preview .plate-bg-hero-province{font-size:11px;color:#000;font-weight:600;display:block;text-align:center}
