/* ════════════════════════════════════════════
   KwoTit Dashboard — Complete Styles
   Theme: Lime Green (#7ED957)
   ════════════════════════════════════════════ */

/* ─── CSS Variables ─── */
:root {
    --primary: #7ED957;
    --primary-dark: #5fb83e;
    --primary-light: #a8f0c6;
    --primary-bg: rgba(126, 217, 87, 0.1);
    --secondary: #ffffff;
    --dark: #111111;
    --bg: #F8F9FA;
    --bg-alt: #f1f3f5;
    --text: #1a1a2e;
    --text-muted: #6b7280;
    --border: #E5E7EB;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
    --shadow-hover: 0 8px 40px rgba(0, 0, 0, 0.10);
    --transition: all 0.25s ease;
    --danger: #DC2626;
    --success: #16A34A;
    --warning: #F59E0B;
}

/* ─── Dark Mode ─── */
[data-theme="dark"] {
    --bg: #0f1117;
    --bg-alt: #1a1d26;
    --text: #e8eaf0;
    --text-muted: #8b90a0;
    --border: #2e3244;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    --shadow-hover: 0 8px 40px rgba(0, 0, 0, 0.5);
}

/* ─── Reset ─── */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg);
    color: var(--text);
    transition: background 0.3s, color 0.3s;
    line-height: 1.6;
    min-height: 100vh;
}

/* ─── Scrollbar ─── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-alt); }
::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 4px; }

/* ─── Layout ─── */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* ─── Sidebar ─── */
.sidebar {
    width: 260px;
    background: var(--secondary);
    border-right: 1px solid var(--border);
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: transform 0.3s ease;
}

[data-theme="dark"] .sidebar {
    background: var(--bg-alt);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 8px 24px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
}

.sidebar-brand .brand-icon {
    width: 40px;
    height: 40px;
    background: var(--primary);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.2rem;
    font-weight: 800;
}

.sidebar-brand h1 {
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.sidebar-brand h1 span {
    color: var(--primary);
}

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

.sidebar-nav .nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

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

.sidebar-nav .nav-item:hover {
    background: var(--primary-bg);
    color: var(--primary);
}

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

.sidebar-nav .nav-item.active i {
    color: #fff;
}

.sidebar-nav .nav-divider {
    height: 1px;
    background: var(--border);
    margin: 8px 0;
}

.sidebar-footer {
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.sidebar-footer .user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 4px;
}

.sidebar-footer .user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 0.9rem;
}

.sidebar-footer .user-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.sidebar-footer .user-email {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ─── Main Content ─── */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 24px 32px 40px;
    min-height: 100vh;
}

/* ─── Top Bar ─── */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0 24px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 28px;
}

.top-bar h2 {
    font-size: 1.4rem;
    font-weight: 700;
}

.top-bar .breadcrumb {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.top-bar .breadcrumb span {
    color: var(--text);
}

.top-bar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.top-bar-actions .theme-toggle {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    cursor: pointer;
    color: var(--text-muted);
    transition: var(--transition);
}

.top-bar-actions .theme-toggle:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* ─── Stats Cards ─── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

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

.stat-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

[data-theme="dark"] .stat-card {
    background: var(--bg-alt);
}

.stat-card .stat-label {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 800;
    margin-top: 4px;
    color: var(--text);
}

.stat-card .stat-change {
    font-size: 0.8rem;
    font-weight: 600;
    margin-top: 6px;
}

.stat-card .stat-change.positive { color: var(--success); }
.stat-card .stat-change.negative { color: var(--danger); }

.stat-card .stat-icon {
    float: right;
    font-size: 1.8rem;
    color: var(--primary);
    opacity: 0.3;
}

/* ─── Cards ─── */
.card {
    background: var(--secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
}

[data-theme="dark"] .card {
    background: var(--bg-alt);
}

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

.card-header h3 {
    font-size: 1rem;
    font-weight: 700;
}

.card-header .card-action {
    color: var(--primary);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
}

.card-header .card-action:hover {
    text-decoration: underline;
}

/* ─── Buttons ─── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.9rem;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    font-family: inherit;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(126, 217, 87, 0.35);
}

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

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

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
}

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

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

.btn-danger:hover {
    background: #b91c1c;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.8rem;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

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

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

.form-group label .required {
    color: var(--danger);
    margin-left: 2px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--text);
    font-size: 0.95rem;
    transition: var(--transition);
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-bg);
}

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

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

@media (max-width: 600px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

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

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

table th {
    text-align: left;
    padding: 10px 12px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border);
    font-weight: 700;
}

table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

table tr:hover td {
    background: var(--primary-bg);
}

table .actions {
    display: flex;
    gap: 6px;
}

table .actions button {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px 6px;
    border-radius: 4px;
    transition: var(--transition);
    font-size: 0.85rem;
}

table .actions button:hover {
    background: var(--primary-bg);
    color: var(--primary);
}

table .actions button.delete:hover {
    background: #fee2e2;
    color: var(--danger);
}

/* ─── Status Badges ─── */
.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.badge-draft { background: #e5e7eb; color: #4b5563; }
.badge-sent { background: #dbeafe; color: #1d4ed8; }
.badge-accepted { background: #d1fae5; color: #065f46; }
.badge-rejected { background: #fee2e2; color: #991b1b; }
.badge-converted { background: var(--primary-bg); color: var(--primary-dark); }

[data-theme="dark"] .badge-draft { background: #374151; color: #9ca3af; }
[data-theme="dark"] .badge-sent { background: #1e3a5f; color: #60a5fa; }
[data-theme="dark"] .badge-accepted { background: #064e3b; color: #34d399; }
[data-theme="dark"] .badge-rejected { background: #7f1d1d; color: #f87171; }

/* ─── Plan Cards ─── */
.plans-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.plan-card {
    background: var(--secondary);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 28px 24px;
    text-align: center;
    transition: var(--transition);
    position: relative;
}

[data-theme="dark"] .plan-card {
    background: var(--bg-alt);
}

.plan-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

.plan-card.popular {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-bg);
}

.plan-card .plan-badge {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary);
    color: #fff;
    padding: 2px 16px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
}

.plan-card .plan-name {
    font-size: 1.2rem;
    font-weight: 700;
    margin-top: 8px;
}

.plan-card .plan-price {
    font-size: 2.2rem;
    font-weight: 800;
    margin: 8px 0;
    color: var(--primary);
}

.plan-card .plan-price span {
    font-size: 0.9rem;
    font-weight: 400;
    color: var(--text-muted);
}

.plan-card .plan-features {
    list-style: none;
    text-align: left;
    margin: 16px 0 20px;
    padding: 0;
}

.plan-card .plan-features li {
    padding: 6px 0;
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
}

.plan-card .plan-features li i {
    color: var(--primary);
    width: 18px;
    text-align: center;
}

.plan-card .plan-features li .fa-xmark {
    color: var(--danger);
}

.plan-card.current-plan {
    border-color: var(--primary);
    background: var(--primary-bg);
}

/* ─── Modal ─── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.modal-overlay.show {
    display: flex;
}

.modal {
    background: var(--secondary);
    border-radius: var(--radius);
    padding: 32px;
    max-width: 560px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalIn 0.25s ease;
}

[data-theme="dark"] .modal {
    background: var(--bg-alt);
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95) translateY(20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h3 {
    font-size: 1.2rem;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    color: var(--text-muted);
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--text);
    transform: rotate(90deg);
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    justify-content: flex-end;
}

/* ─── Widget Embed Code ─── */
.embed-code {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px;
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
    color: var(--text);
    position: relative;
}

.embed-code .copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 4px 12px;
    font-size: 0.7rem;
    cursor: pointer;
    font-weight: 600;
}

.embed-code .copy-btn:hover {
    background: var(--primary-dark);
}

/* ─── Empty State ─── */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 3rem;
    color: var(--border);
    margin-bottom: 16px;
}

.empty-state h4 {
    font-size: 1.1rem;
    color: var(--text);
    margin-bottom: 6px;
}

/* ─── Toast ─── */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: var(--secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 20px;
    box-shadow: var(--shadow-hover);
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 280px;
    max-width: 420px;
    animation: toastIn 0.3s ease;
}

[data-theme="dark"] .toast {
    background: var(--bg-alt);
}

.toast-success { border-left: 4px solid var(--success); }
.toast-error { border-left: 4px solid var(--danger); }
.toast-warning { border-left: 4px solid var(--warning); }

.toast i:first-child {
    font-size: 1.2rem;
}
.toast-success i:first-child { color: var(--success); }
.toast-error i:first-child { color: var(--danger); }
.toast-warning i:first-child { color: var(--warning); }

.toast .toast-close {
    margin-left: auto;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
}

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

/* ─── Responsive ─── */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
        padding: 16px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .plans-grid {
        grid-template-columns: 1fr;
    }
    
    .top-bar {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .hamburger {
        display: flex !important;
    }
}

.hamburger {
    display: none;
    background: none;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    color: var(--text);
    padding: 4px;
}

/* ─── Login Page ─── */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    padding: 20px;
}

.login-box {
    background: var(--secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px 32px;
    max-width: 420px;
    width: 100%;
    box-shadow: var(--shadow);
}

[data-theme="dark"] .login-box {
    background: var(--bg-alt);
}

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

.login-box .logo h1 {
    font-size: 1.8rem;
    font-weight: 800;
}

.login-box .logo h1 span {
    color: var(--primary);
}

.login-box .logo p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.login-box .form-group {
    margin-bottom: 16px;
}

.login-box .form-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

.login-box .switch-auth {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 16px;
}

.login-box .switch-auth a {
    color: var(--primary);
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}

.login-box .switch-auth a:hover {
    text-decoration: underline;
}

/* ─── Utilities ─── */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.w-full { width: 100%; }
.hidden { display: none !important; }



/* ─── Industry Badges ─── */
.industry-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.industry-badge-3d_printing { background: #dbeafe; color: #1d4ed8; }
.industry-badge-2d_printing { background: #d1fae5; color: #065f46; }
.industry-badge-tailor { background: #fce4ec; color: #b71c1c; }
.industry-badge-furniture { background: #fff3e0; color: #bf360c; }
.industry-badge-building { background: #f3e5f5; color: #4a148c; }
.industry-badge-branding { background: #e0f7fa; color: #00695c; }
.industry-badge-events { background: #fef3c7; color: #92400e; }
.industry-badge-smarthome { background: #e8eaf6; color: #1a237e; }
.industry-badge-electrical { background: #fce4ec; color: #880e4f; }

[data-theme="dark"] .industry-badge-3d_printing { background: #1a237e; color: #64b5f6; }
[data-theme="dark"] .industry-badge-2d_printing { background: #1b3a2b; color: #4caf50; }
[data-theme="dark"] .industry-badge-tailor { background: #4a1a2e; color: #ef5350; }
[data-theme="dark"] .industry-badge-furniture { background: #3e1f00; color: #ff8a65; }
[data-theme="dark"] .industry-badge-building { background: #2a1a4a; color: #ce93d8; }
[data-theme="dark"] .industry-badge-branding { background: #00363a; color: #4dd0e1; }
[data-theme="dark"] .industry-badge-events { background: #3e2a00; color: #ffb74d; }
[data-theme="dark"] .industry-badge-smarthome { background: #1a1a3a; color: #7986cb; }
[data-theme="dark"] .industry-badge-electrical { background: #3a1a2a; color: #ef5350; }



/* ─── Standalone Quote Pages ─── */
.standalone-pages-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
    margin-bottom: 16px;
}

.standalone-page-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    transition: var(--transition);
}

.standalone-page-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

.spc-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.spc-icon {
    width: 40px;
    height: 40px;
    background: var(--primary-bg);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-size: 1.2rem;
    flex-shrink: 0;
}

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

.spc-info h4 {
    font-size: 0.95rem;
    font-weight: 700;
    margin: 0;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.spc-url {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 2px 0 0;
    word-break: break-all;
}

.spc-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding: 12px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    margin-bottom: 12px;
}

.spc-stat {
    text-align: center;
}

.spc-stat-value {
    display: block;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
}

.spc-stat-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.spc-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.spc-actions .btn {
    flex: 1;
    min-width: 60px;
    justify-content: center;
    padding: 6px 10px;
    font-size: 0.75rem;
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

[data-theme="dark"] .badge-success {
    background: #064e3b;
    color: #34d399;
}

[data-theme="dark"] .badge-danger {
    background: #7f1d1d;
    color: #f87171;
}

/* ─── Mobile Responsive ─── */
@media (max-width: 768px) {
    .standalone-pages-grid {
        grid-template-columns: 1fr;
    }
    
    .spc-header {
        flex-wrap: wrap;
    }
    
    .spc-stats {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .spc-actions {
        flex-direction: column;
    }
    
    .spc-actions .btn {
        flex: none;
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .standalone-page-card {
        padding: 16px;
    }
    
    .spc-stats {
        grid-template-columns: 1fr 1fr 1fr;
        gap: 4px;
    }
    
    .spc-stat-value {
        font-size: 0.95rem;
    }
}

/* ════════════════════════════════════════════
   MOBILE/DESKTOP RESPONSIVE ADDITIONS
   Append this block to the end of dashboard.css
   ════════════════════════════════════════════ */

/* ─── Sidebar backdrop (mobile drawer overlay) ─── */
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 99; /* just below .sidebar's z-index:100 */
    opacity: 0;
    transition: opacity 0.25s ease;
}

.sidebar-backdrop.show {
    display: block;
    opacity: 1;
}

/* Prevent body scroll behind the drawer while it's open */
body.sidebar-locked {
    overflow: hidden;
}

/* ─── Sidebar close button (mobile only) ─── */
.sidebar-close {
    display: none;
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 8px;
    margin-left: auto;
}

.sidebar-close:hover {
    color: var(--text);
}

.sidebar-brand {
    /* allow the close button to sit flush right on mobile */
    position: relative;
}

/* ─── Top bar: title group + hamburger ─── */
.top-bar-title {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.top-bar-title h2 {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ─── Two-column quick-action grid (Overview page) ─── */
.two-col-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* ─── Standalone slug input row (was a hardcoded inline flex) ─── */
.url-input-row {
    display: flex;
    gap: 8px;
    margin-top: 6px;
    flex-wrap: wrap;
}

.url-input-row .url-prefix {
    padding: 8px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.85rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow-x: auto;
    max-width: 100%;
}

.url-input-row input {
    flex: 1;
    min-width: 160px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    color: var(--text);
}

/* ─── Tablet / mobile breakpoint (matches existing 768px sidebar breakpoint) ─── */
@media (max-width: 768px) {
    .sidebar-close {
        display: inline-flex;
        align-items: center;
    }

    .two-col-grid {
        grid-template-columns: 1fr;
    }

    .top-bar {
        align-items: flex-start;
    }

    .modal {
        padding: 20px;
        width: 94%;
    }

    .modal-actions {
        flex-wrap: wrap;
    }

    .modal-actions .btn {
        flex: 1;
        min-width: 120px;
        justify-content: center;
    }
}

/* ─── Narrow phones: drop stat cards to a single column ─── */
@media (max-width: 420px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .stat-card .stat-icon {
        float: none;
        margin-bottom: 4px;
    }

    .card,
    .modal {
        padding: 16px;
    }

    .plan-card {
        padding: 20px 16px;
    }
}

/* ─── Larger touch targets on touch devices ─── */
@media (pointer: coarse) {
    .btn {
        min-height: 44px;
    }

    .sidebar-nav .nav-item {
        min-height: 44px;
    }

    /* Size these up without touching their display value —
       .hamburger in particular must stay display:none above 768px */
    .theme-toggle,
    .sidebar-close,
    .modal-close {
        min-width: 44px;
        min-height: 44px;
    }

    .hamburger {
        min-width: 44px;
        min-height: 44px;
    }
}

/* ─── Cap content width on very large / ultra-wide desktop monitors ─── */
.page-content {
    max-width: 1400px;
}

/* ─── Fluid type scale: shrink smoothly instead of jumping at breakpoints ─── */
.top-bar h2 {
    font-size: clamp(1.15rem, 1rem + 1vw, 1.4rem);
}

.stat-card .stat-value {
    font-size: clamp(1.4rem, 1.1rem + 1.5vw, 2rem);
}

.plan-card .plan-price {
    font-size: clamp(1.7rem, 1.4rem + 1.5vw, 2.2rem);
}

/* ─── Safety net: if a table renders without a .table-wrap wrapper,
   force horizontal scroll instead of letting it blow out the layout ─── */
#allQuotes table,
#recentQuotes table,
#customerList table,
#standalonePagesList table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
}

#allQuotes table thead,
#allQuotes table tbody,
#allQuotes table tr,
#recentQuotes table thead,
#recentQuotes table tbody,
#recentQuotes table tr,
#customerList table thead,
#customerList table tbody,
#customerList table tr,
#standalonePagesList table thead,
#standalonePagesList table tbody,
#standalonePagesList table tr {
    display: revert;
}

/* On phones, prefer a stacked "card" reading order over side-scrolling
   if the JS output uses simple divs/rows rather than <table> */
@media (max-width: 640px) {
    #allQuotes .table-wrap,
    #recentQuotes .table-wrap,
    #customerList .table-wrap {
        margin: 0 -8px;
        padding: 0 8px;
    }
}

/* ─── Dynamically-added pickup/delivery region rows (industry settings & profile) ─── */
#pickupLocationsContainer .form-row,
#deliveryRegionsContainer .form-row {
    align-items: flex-end;
}

@media (max-width: 480px) {
    #pickupLocationsContainer .form-row,
    #deliveryRegionsContainer .form-row {
        grid-template-columns: 1fr;
    }
}

/* ─── Respect safe-area insets on notched phones ─── */
.sidebar {
    padding-top: max(24px, env(safe-area-inset-top));
}

.main-content {
    padding-left: max(32px, env(safe-area-inset-left));
    padding-right: max(32px, env(safe-area-inset-right));
}

@media (max-width: 768px) {
    .main-content {
        padding-left: max(16px, env(safe-area-inset-left));
        padding-right: max(16px, env(safe-area-inset-right));
    }
}



/* ─── Mobile Responsive Fixes ─── */
@media (max-width: 768px) {
    /* Quotes table */
    .table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .table-wrap table {
        min-width: 600px;
        font-size: 0.8rem;
    }
    
    .table-wrap table th,
    .table-wrap table td {
        padding: 8px 10px;
        white-space: nowrap;
    }
    
    .table-wrap table .actions {
        display: flex;
        gap: 4px;
        flex-wrap: nowrap;
    }
    
    .table-wrap table .actions button {
        padding: 4px 6px;
        font-size: 0.7rem;
    }
    
    /* Stats grid on mobile */
    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    
    .stat-card {
        padding: 14px 16px;
    }
    
    .stat-card .stat-value {
        font-size: 1.4rem;
    }
    
    /* Quick actions on mobile */
    .quick-actions-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .table-wrap table {
        min-width: 500px;
        font-size: 0.7rem;
    }
    
    .table-wrap table th,
    .table-wrap table td {
        padding: 6px 8px;
    }
}




/* ─── Fix: Green cards in dark mode ─── */
[data-theme="dark"] .ce-price-box {
    background: #1a2e1a !important;
    border: 1px solid #2d4a2d !important;
}

[data-theme="dark"] .ce-price-box .lbl {
    color: #7ddf7d !important;
}

[data-theme="dark"] .ce-price-box .ce-unit-row,
[data-theme="dark"] .ce-price-box .ce-choice-row {
    color: #d4d4d4 !important;
}

[data-theme="dark"] .ce-price-box input.ce-choice-label {
    background: #1a1a1a !important;
    color: #f5f5f5 !important;
    border-color: #2d2d2d !important;
}

[data-theme="dark"] .ce-price-box .ce-price-input {
    background: #1a1a1a !important;
    border-color: #2d2d2d !important;
}

[data-theme="dark"] .ce-price-box .ce-price-input input {
    color: #f5f5f5 !important;
}

[data-theme="dark"] .ce-price-box .ce-add-choice {
    color: #7ddf7d !important;
    border-color: #2d4a2d !important;
}

[data-theme="dark"] .ce-price-box .ce-add-choice:hover {
    background: #1a2e1a !important;
    border-color: #7ddf7d !important;
}


@media (max-width: 768px) {
    /* ─── Fix: Show header actions on mobile ─── */
    .top-bar-actions {
        display: flex !important;
        align-items: center;
        gap: 8px;
    }

    .top-bar-actions .theme-toggle {
        display: flex !important;
        background: none;
        border: 1px solid var(--border);
        border-radius: var(--radius-sm);
        padding: 6px 10px;
        cursor: pointer;
        color: var(--text-muted);
        font-size: 1rem;
        align-items: center;
        justify-content: center;
    }

    .top-bar-actions .hamburger {
        display: flex !important;
        background: none;
        border: 1px solid var(--border);
        border-radius: var(--radius-sm);
        padding: 6px 10px;
        cursor: pointer;
        color: var(--text);
        font-size: 1.2rem;
        align-items: center;
        justify-content: center;
    }

    /* ─── Fix: Remove the old hidden rule ─── */
    .header-actions .theme-toggle {
        display: flex !important;
    }
}


.leads-controls{display:flex;gap:8px;}
.leads-search,.leads-filter{padding:9px 12px;border:1px solid var(--border);border-radius:var(--radius-sm);background:var(--bg);color:var(--text);font-size:0.85rem;}

@media (max-width:600px){
  .page-header{flex-direction:column;align-items:stretch;gap:12px;}
  .leads-controls{flex-direction:column;}
  .leads-search,.leads-filter{width:100%;}
}
