/* ═══════════════════════════════════════════════════════════
   SmartConnect — Amazon Seller Central Theme
   ═══════════════════════════════════════════════════════════ */

:root {
    --navy: #232f3e;
    --navy-light: #37475a;
    --navy-dark: #131a22;
    --teal: #008296;
    --teal-hover: #006d7e;
    --orange: #ff9900;
    --orange-hover: #e88b00;
    --orange-light: #fff3e0;
    --bg: #f5f5f5;
    --white: #ffffff;
    --border: #d5d9d9;
    --border-light: #e7e7e7;
    --text: #0f1111;
    --text-dim: #565959;
    --text-link: #007185;
    --success: #067d62;
    --success-bg: #e6f7f2;
    --warning: #b06000;
    --warning-bg: #fff8e1;
    --danger: #cc0c39;
    --danger-bg: #fff0f0;
    --info: #1a73e8;
    --info-bg: #e8f0fe;
    --radius: 8px;
    --radius-sm: 4px;
    --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
    --shadow-md: 0 2px 8px rgba(0,0,0,.1);
    --font: 'Amazon Ember', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

body {
    font-family: var(--font); font-size: 14px; color: var(--text);
    background: var(--bg); line-height: 1.5; -webkit-font-smoothing: antialiased;
}

a { color: var(--text-link); text-decoration: none; }
a:hover { color: var(--teal); text-decoration: underline; }

/* ─── TOP HEADER BAR ────────────────────────────────────── */
.top-header {
    background: var(--navy); color: #fff; height: 60px;
    display: flex; align-items: center; padding: 0 20px;
    position: sticky; top: 0; z-index: 100;
    box-shadow: 0 2px 4px rgba(0,0,0,.2);
}
.top-header-brand {
    display: flex; align-items: center; gap: 8px; margin-right: 30px;
    cursor: pointer; white-space: nowrap;
}
.top-header-brand h1 {
    font-size: 22px; font-weight: 800; color: #fff; letter-spacing: -0.3px; line-height: 1;
}
.top-header-brand h1 span { color: var(--orange); }
.top-header-brand h1 .brand-smart { font-size: 13px; font-weight: 500; color: rgba(255,255,255,.6); letter-spacing: 0; }
.top-header-brand small { font-size: 10px; color: #999; display: block; margin-top: 1px; letter-spacing: .5px; }

.top-header-user {
    margin-left: auto; display: flex; align-items: center; gap: 16px;
}
.top-header-user .user-info {
    text-align: right; line-height: 1.3; cursor: default;
}
.top-header-user .user-name {
    font-size: 13px; font-weight: 600; color: #fff;
}
.top-header-user .user-role {
    font-size: 11px; color: #999;
}
.btn-notif-header {
    background: none; border: none; cursor: pointer; position: relative;
    color: #ccc; padding: 6px; border-radius: 4px; transition: .15s;
}
.btn-notif-header:hover { color: #fff; background: rgba(255,255,255,.1); }
.btn-notif-header .notif-badge {
    position: absolute; top: 0; right: -2px; background: var(--danger);
    color: #fff; font-size: 10px; font-weight: 700; padding: 1px 5px;
    border-radius: 10px; min-width: 16px; text-align: center; line-height: 1.4;
}
.btn-logout-header {
    background: none; border: 1px solid #555; color: #ccc;
    padding: 5px 14px; border-radius: var(--radius-sm); font-size: 12px;
    cursor: pointer; transition: .15s; font-weight: 500;
}
.btn-logout-header:hover { border-color: #999; color: #fff; background: rgba(255,255,255,.05); }

/* ─── SUB-NAV (Secondary Navigation) ────────────────────── */
.sub-nav {
    background: var(--navy-light); display: flex; align-items: center;
    padding: 0 20px; height: 42px; overflow-x: auto; scrollbar-width: none; -ms-overflow-style: none;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.sub-nav::-webkit-scrollbar { display: none; }
.sub-nav button {
    background: none; border: none; color: #ddd; font-size: 13px;
    padding: 8px 14px; cursor: pointer; white-space: nowrap;
    border-bottom: 2px solid transparent; transition: .15s;
    font-weight: 500; border-radius: 0;
}
.sub-nav button:hover { color: #fff; background: rgba(255,255,255,.05); }
.sub-nav button.active {
    color: #fff; border-bottom: 2px solid var(--orange);
    font-weight: 600;
}

/* ─── PAGE LAYOUT ───────────────────────────────────────── */
#app { display: flex; flex-direction: column; min-height: 100vh; }
.page-wrap {
    max-width: 1440px; margin: 0 auto; padding: 14px 16px; flex: 1; width: 100%; box-sizing: border-box;
}
.page-content { }

.page-title-bar {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 12px;
}
.page-title-bar h2 {
    font-size: 22px; font-weight: 400; color: var(--text);
}

/* ─── CARDS ─────────────────────────────────────────────── */
.card {
    background: var(--white); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow);
}
.card-header {
    padding: 12px 16px; border-bottom: 1px solid var(--border-light);
    display: flex; align-items: center; justify-content: space-between;
    background: #fafafa;
}
.card-title { font-size: 16px; font-weight: 700; color: var(--text); }
.card-subtitle { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.card-body { padding: 14px 16px; }

/* ─── STAT CARDS (Global Snapshot style) ────────────────── */
.stats-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px; margin-bottom: 14px;
}
.stat-card {
    background: var(--white); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 12px 16px;
    cursor: pointer; transition: .15s; box-shadow: var(--shadow);
}
.stat-card:hover { box-shadow: var(--shadow-md); border-color: #aaa; }
.stat-card-value {
    font-size: 24px; font-weight: 700; color: var(--text); line-height: 1;
}
.stat-card-label {
    font-size: 12px; color: var(--text-dim); margin-top: 4px;
    font-weight: 500; text-transform: uppercase; letter-spacing: 0.3px;
}
.stat-card-stripe {
    width: 4px; height: 100%; position: absolute; left: 0; top: 0;
    border-radius: var(--radius) 0 0 var(--radius);
}

/* ─── TABLES ────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; table-layout: auto; }
thead th {
    background: #f8f8f8; padding: 10px 14px; text-align: left;
    font-size: 12px; font-weight: 600; color: var(--text-dim);
    text-transform: uppercase; letter-spacing: 0.3px;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}
tbody td {
    padding: 12px 14px; border-bottom: 1px solid var(--border-light);
    font-size: 13px; color: var(--text); vertical-align: middle;
}
tbody tr:hover { background: #f0f8ff; }
tbody tr:last-child td { border-bottom: none; }
.table-empty {
    padding: 40px; text-align: center; color: var(--text-dim); font-style: italic;
}

/* ─── TABS ──────────────────────────────────────────────── */
.tab-bar {
    display: flex; gap: 0; border-bottom: 2px solid var(--border);
    margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; -ms-overflow-style: none;
}
.tab-bar::-webkit-scrollbar { display: none; }
.tab-bar button {
    background: none; border: none; border-bottom: 2px solid transparent;
    margin-bottom: -2px; padding: 10px 18px; font-size: 13px; font-weight: 500;
    color: var(--text-dim); cursor: pointer; transition: .15s; white-space: nowrap;
}
.tab-bar button:hover { color: var(--teal); }
.tab-bar button.active {
    color: var(--teal); border-bottom-color: var(--teal); font-weight: 600;
}
.tab-bar .tab-count {
    background: #e8e8e8; color: var(--text-dim); font-size: 11px;
    padding: 1px 7px; border-radius: 10px; margin-left: 6px; font-weight: 600;
}
.tab-bar button.active .tab-count {
    background: var(--teal); color: #fff;
}

/* ─── BADGES ────────────────────────────────────────────── */
.badge {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 11px; font-weight: 600; padding: 3px 10px;
    border-radius: 12px; white-space: nowrap;
    line-height: 1.4;
}
.badge-dot {
    width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0;
}

/* ─── BUTTONS ───────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 13px; font-weight: 500; padding: 8px 16px;
    border-radius: var(--radius-sm); cursor: pointer;
    border: 1px solid transparent; transition: .15s;
    text-decoration: none; white-space: nowrap;
    font-family: inherit; line-height: 1.3;
}
.btn-primary {
    background: var(--orange); color: var(--navy-dark); border-color: #c77600;
    font-weight: 600;
    background: linear-gradient(180deg, #ffb84d 0%, var(--orange) 100%);
}
.btn-primary:hover {
    background: linear-gradient(180deg, var(--orange) 0%, #e88b00 100%);
}
.btn-success {
    background: linear-gradient(180deg, #7bc67b 0%, var(--success) 100%);
    color: #fff; border-color: #056650;
}
.btn-success:hover { background: var(--success); }
.btn-danger {
    background: #fff; color: var(--danger); border-color: var(--danger);
}
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-warning {
    background: #fff; color: var(--warning); border-color: var(--warning);
}
.btn-warning:hover { background: var(--warning); color: #fff; }
.btn-outline {
    background: #fff; color: var(--text); border-color: var(--border);
}
.btn-outline:hover { background: #f7f7f7; border-color: #aaa; }
.btn-ghost {
    background: none; border: 1px solid var(--border); color: var(--text-link);
}
.btn-ghost:hover { background: #f0f8ff; border-color: var(--text-link); }
.btn-sm { font-size: 12px; padding: 4px 10px; }
.btn-lg { font-size: 14px; padding: 10px 24px; }
.btn-block { width: 100%; justify-content: center; }

/* ─── FORMS ─────────────────────────────────────────────── */
.form-stack { display: flex; flex-direction: column; gap: 14px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-label {
    font-size: 12px; font-weight: 700; color: var(--text);
}
.form-label .required { color: var(--danger); }
.form-control {
    padding: 8px 10px; background: var(--white); border: 1px solid var(--border);
    border-radius: var(--radius-sm); color: var(--text); font-size: 13px;
    outline: none; width: 100%; transition: .15s; font-family: inherit;
}
.form-control:focus {
    border-color: var(--teal); box-shadow: 0 0 0 3px rgba(0,130,150,.15);
}
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 70px; }

/* ─── MODALS ────────────────────────────────────────────── */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,.5);
    z-index: 500; display: flex; align-items: center; justify-content: center;
    animation: fadeIn .15s;
}
.modal-box {
    background: var(--white); border-radius: var(--radius);
    box-shadow: 0 4px 24px rgba(0,0,0,.2); max-height: 90vh; overflow-y: auto;
    animation: slideUp .2s;
}
.modal-header {
    padding: 16px 20px; border-bottom: 1px solid var(--border);
    display: flex; justify-content: space-between; align-items: center;
    background: #fafafa; border-radius: var(--radius) var(--radius) 0 0;
}
.modal-title { font-size: 17px; font-weight: 700; color: var(--text); }
.modal-close {
    background: none; border: none; font-size: 22px; cursor: pointer;
    color: var(--text-dim); width: 32px; height: 32px; display: flex;
    align-items: center; justify-content: center; border-radius: 50%;
}
.modal-close:hover { background: #eee; color: var(--text); }
.modal-body { padding: 20px; }

/* ─── LOGIN PAGE ────────────────────────────────────────── */
.login-wrap {
    min-height: 100vh; width: 100%; display: flex; align-items: center;
    justify-content: center; background: var(--bg);
    background: linear-gradient(180deg, var(--navy) 0%, var(--navy) 35%, var(--bg) 35%);
}
.login-box {
    width: 420px; max-width: 95%; background: var(--white);
    border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow-md); overflow: hidden;
}
.login-header {
    text-align: center; padding: 28px 30px 20px;
}
.login-header h1 { font-size: 28px; font-weight: 800; color: var(--text); }
.login-header h1 span { color: var(--orange); }
.login-header h1 .brand-smart { font-size: 16px; font-weight: 500; color: var(--text-dim); }
.login-header p { font-size: 13px; color: var(--text-dim); margin-top: 4px; }
.login-body { padding: 0 30px 28px; }
.login-tabs {
    display: flex; border-bottom: 2px solid var(--border); margin-bottom: 20px;
}
.login-tabs button {
    flex: 1; background: none; border: none; border-bottom: 2px solid transparent;
    margin-bottom: -2px; padding: 10px; font-size: 14px; font-weight: 500;
    color: var(--text-dim); cursor: pointer; transition: .15s;
}
.login-tabs button.active {
    color: var(--teal); border-bottom-color: var(--teal); font-weight: 600;
}
.login-demo {
    margin-top: 16px; text-align: center; font-size: 11px;
    color: var(--text-dim); line-height: 1.6;
}
.login-demo b { color: var(--text-link); }

/* ─── RFQ CARDS (Marketplace) ───────────────────────────── */
.rfq-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 10px;
}
.rfq-card {
    background: var(--white); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow);
    transition: .15s;
}
.rfq-card:hover { box-shadow: var(--shadow-md); border-color: #aaa; }
.rfq-card-header {
    padding: 10px 14px; display: flex; justify-content: space-between;
    align-items: center; border-bottom: 1px solid var(--border-light);
}
.rfq-card-grid {
    padding: 10px 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 3px 10px;
}
.rfq-card-label { font-size: 11px; color: var(--text-dim); font-weight: 600; text-transform: uppercase; }
.rfq-card-actions {
    padding: 8px 14px; border-top: 1px solid var(--border-light);
    display: flex; gap: 6px;
}

/* ─── COUNTDOWN BAR ─────────────────────────────────────── */
.countdown-bar {
    margin: 0; padding: 8px 0; max-width: 180px;
}
.countdown-track {
    height: 6px; background: #e8e8e8; border-radius: 3px; overflow: hidden;
}
.countdown-fill {
    height: 100%; border-radius: 3px;
    transition: width 1s linear;
}
.countdown-text {
    font-size: 11px; margin-top: 4px;
    display: flex; justify-content: space-between; font-weight: 700;
}
.countdown-urgent .countdown-fill { background: #cc0c39; }
.countdown-urgent .countdown-text { color: #cc0c39; }
.countdown-warning .countdown-fill { background: #e67e00; }
.countdown-warning .countdown-text { color: #e67e00; }
.countdown-normal .countdown-fill { background: var(--teal); }
.countdown-normal .countdown-text { color: var(--teal); }

/* ─── ORDER PROGRESS ────────────────────────────────────── */
.order-progress {
    display: flex; align-items: center; gap: 0; padding: 14px 0;
}
.progress-step {
    display: flex; flex-direction: column; align-items: center; flex: 1; position: relative;
}
.progress-dot {
    width: 24px; height: 24px; border-radius: 50%;
    background: #e8e8e8; border: 2px solid #d5d5d5;
    display: flex; align-items: center; justify-content: center;
    font-size: 10px; font-weight: 700; color: #999; z-index: 1;
}
.progress-step.done .progress-dot {
    background: var(--success); border-color: var(--success); color: #fff;
}
.progress-step.active .progress-dot {
    background: var(--teal); border-color: var(--teal); color: #fff;
    animation: pulse 2s infinite;
}
.progress-label {
    font-size: 10px; color: var(--text-dim); margin-top: 4px;
    text-transform: uppercase; font-weight: 600;
}
.progress-step.done .progress-label { color: var(--success); }
.progress-step.active .progress-label { color: var(--teal); }
.progress-line {
    flex: 1; height: 2px; background: #e0e0e0; margin-top: -12px;
}
.progress-line.done { background: var(--success); }

/* ─── TOAST NOTIFICATIONS ───────────────────────────────── */
.toast-container {
    position: fixed; top: 68px; right: 20px; z-index: 600;
    display: flex; flex-direction: column; gap: 8px;
}
.toast {
    padding: 12px 18px; border-radius: var(--radius-sm);
    font-size: 13px; font-weight: 500; box-shadow: var(--shadow-md);
    animation: slideRight .2s; display: flex; align-items: center; gap: 8px;
    border-left: 4px solid;
}
.toast-success { background: var(--success-bg); color: var(--success); border-color: var(--success); }
.toast-error   { background: var(--danger-bg);  color: var(--danger);  border-color: var(--danger); }
.toast-warning { background: var(--warning-bg); color: var(--warning); border-color: var(--warning); }
.toast-info    { background: var(--info-bg);    color: var(--info);    border-color: var(--info); }
.toast-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.toast-success .toast-dot { background: var(--success); }
.toast-error   .toast-dot { background: var(--danger); }
.toast-warning .toast-dot { background: var(--warning); }

/* ─── UTILITY ───────────────────────────────────────────── */
.fw500 { font-weight: 500; }
.fw600 { font-weight: 600; }
.fw700 { font-weight: 700; }
.mono { font-family: 'SF Mono', Consolas, monospace; }
.text-accent { color: var(--teal); }
.text-dim { color: var(--text-dim); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-link { color: var(--text-link); }

.loading-center {
    display: flex; justify-content: center; align-items: center;
    min-height: 200px;
}
.spinner {
    width: 32px; height: 32px; border: 3px solid var(--border);
    border-top-color: var(--teal); border-radius: 50%;
    animation: spin .7s linear infinite;
}

/* ─── GRID HELPER ───────────────────────────────────────── */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

/* ─── ANIMATIONS ────────────────────────────────────────── */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideRight { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: translateX(0); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(0,130,150,.3); } 50% { box-shadow: 0 0 0 6px rgba(0,130,150,0); } }
.fade-in { animation: fadeIn .25s; }

/* ─── RESPONSIVE ────────────────────────────────────────── */

/* ── Tablet: 768px ─────────────────────────────────────── */
@media (max-width: 768px) {

    /* Header */
    .top-header { padding: 0 12px; height: 54px; }
    .top-header-brand { margin-right: 0; }
    .top-header-brand h1 { font-size: 18px; }
    .top-header-user { gap: 8px; }
    .top-header-user .user-info { display: none; }
    .btn-logout-header { padding: 4px 10px; font-size: 11px; }

    /* Sub-nav */
    .sub-nav { padding: 0 6px; height: 38px; }
    .sub-nav button { padding: 6px 10px; font-size: 12px; }

    /* Page layout */
    .page-wrap { padding: 10px; }

    /* Cards and accordions */
    .card-header {
        flex-direction: column;
        gap: 8px;
        align-items: flex-start !important;
        padding: 12px 14px;
    }
    .card-header > div:last-child,
    .card-header > div[onclick="event.stopPropagation()"],
    .card-header > div[style*="display:flex;gap:6px"] {
        width: 100%;
        flex-wrap: wrap !important;
        gap: 5px !important;
    }
    .card-header .btn,
    .card-header button {
        font-size: 11px !important;
        padding: 4px 8px !important;
        white-space: nowrap;
    }
    .card-body { padding: 12px; }

    /* Tab bars */
    .tab-bar button { padding: 8px 10px; font-size: 12px; }
    .tab-bar { overflow-x: auto; }

    /* Status filter pill rows */
    .status-filter-row { flex-wrap: wrap; gap: 4px; }

    /* Tables - horizontal scroll */
    .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    table { font-size: 12px; min-width: 500px; }
    thead th { padding: 8px 8px; font-size: 11px; }
    tbody td { padding: 8px 8px; }

    /* Order progress bar — scale down */
    .order-progress { transform: scale(0.75); transform-origin: left center; }

    /* Buttons */
    .btn { font-size: 11px; padding: 5px 10px; }
    .btn-sm { font-size: 10px; padding: 4px 8px; }

    /* Grids */
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
    .rfq-grid { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .two-col { grid-template-columns: 1fr; }

    /* Modals */
    .modal-box { width: 95vw !important; max-height: 88vh; margin: 6% auto; }
    .modal-body { padding: 14px; }
    .modal-header { padding: 12px 14px; }

    /* Notification popups */
    #notif-popup-container { right: 8px; left: 8px; max-width: none; width: auto; }

    /* Delivery/order info bar */
    .info-bar-row { flex-wrap: wrap !important; gap: 6px 16px !important; }

    /* Search inputs in card headers */
    .card-header input[type="text"] { width: 100% !important; }

    /* Pagination */
    .pagination { flex-direction: column; gap: 8px; align-items: center; }

    /* Section tab bars inside pages (Enquiries / Orders / Responses) */
    .section-tab-bar { overflow-x: auto; scrollbar-width: none; }
    .section-tab-bar::-webkit-scrollbar { display: none; }
    .section-tab-bar button { padding: 8px 14px !important; font-size: 12px !important; }

    /* History accordion */
    .hist-acc-header { flex-wrap: wrap; gap: 6px; }

    /* Stat numbers on dashboard performance grid */
    .perf-grid { grid-template-columns: 1fr 1fr !important; }
}

/* ── Mobile: 480px ─────────────────────────────────────── */
@media (max-width: 480px) {

    /* Header */
    .top-header { padding: 0 8px; height: 50px; }
    .top-header-brand h1 { font-size: 16px; }
    .top-header-user { gap: 6px; }
    .btn-logout-header { display: none; } /* Hide text sign-out; keep icon */

    /* Page layout */
    .page-wrap { padding: 6px; }

    /* Cards */
    .card-header { padding: 10px 12px; }

    /* Tables */
    table { font-size: 11px; }
    thead th { padding: 6px 6px; font-size: 10px; }
    tbody td { padding: 6px 6px; }

    /* Order progress bar — hide labels */
    .order-progress { transform: scale(0.65); transform-origin: left center; }
    .progress-label { display: none; }

    /* RFQ grid */
    .rfq-grid { gap: 6px; }
    .rfq-card { font-size: 12px; }

    /* Stats: single column on very small screens */
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 6px; }
    .stat-card { padding: 12px 14px; }
    .stat-card-value { font-size: 22px; }

    /* Modals */
    .modal-box { width: 98vw !important; margin: 2% auto; max-height: 92vh; }
    .modal-body { padding: 10px; }
    .form-stack { gap: 10px; }

    /* Buttons in actions column — stack if needed */
    .btn-sm { font-size: 10px; padding: 3px 6px; }

    /* Toast container */
    .toast-container { right: 8px; left: 8px; top: 58px; }
    .toast { font-size: 12px; padding: 10px 12px; }

    /* VAT badge in table */
    .vat-badge { font-size: 10px !important; padding: 1px 5px !important; }

    /* Login box */
    .login-box { width: 98%; }
    .login-header { padding: 20px 18px 14px; }
    .login-body { padding: 0 18px 20px; }

    /* Section tabs */
    .section-tab-bar button { padding: 6px 10px !important; font-size: 11px !important; }

    /* Card subtitle wrapping */
    .card-subtitle { font-size: 11px; }
}

/* ── Small mobile: 360px ───────────────────────────────── */
@media (max-width: 360px) {
    .top-header-brand h1 { font-size: 14px; }
    .page-wrap { padding: 4px; }
    .card-header { padding: 8px 10px; }
    .stats-grid { grid-template-columns: 1fr; }
    .btn-logout-header { display: none; }
}

/* ── Touch device improvements ─────────────────────────── */
@media (hover: none) and (pointer: coarse) {
    /* Bigger tap targets */
    .btn { min-height: 36px; }
    .btn-sm { min-height: 30px; }
    .sub-nav button { min-height: 38px; }
    .tab-bar button { min-height: 38px; }
    .form-control { font-size: 16px; } /* Prevent iOS zoom on focus */
    select.form-control { font-size: 16px; }
    .modal-close { width: 40px; height: 40px; }
    /* Remove hover effects that don't make sense on touch */
    tbody tr:hover { background: transparent; }
}


/* ─── SCROLLBAR ─────────────────────────────────────────── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #c5c5c5; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #aaa; }

/* ─── PAGINATION ────────────────────────────────────────── */
.pagination {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 20px; border-top: 1px solid var(--border-light);
    font-size: 13px; color: var(--text-dim);
}
.pagination-btns {
    display: flex; gap: 4px;
}
.pagination-btns button {
    padding: 5px 12px; border: 1px solid var(--border); background: #fff;
    border-radius: var(--radius-sm); cursor: pointer; font-size: 12px;
    color: var(--text); transition: .15s; font-weight: 500;
}
.pagination-btns button:hover { border-color: var(--teal); color: var(--teal); }
.pagination-btns button.active {
    background: var(--teal); color: #fff; border-color: var(--teal);
}
.pagination-btns button:disabled { opacity: .4; cursor: default; }

/* ─── FOOTER ───────────────────────────────────────────── */
.app-footer {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 24px; font-size: 11px; color: #999;
    border-top: 1px solid #eee; background: #fafafa; flex-wrap: wrap; gap: 8px;
}
.app-footer a { color: var(--teal); text-decoration: none; font-weight: 600; }
.app-footer a:hover { text-decoration: underline; }

/* ─── MOBILE UTILITY HELPERS ────────────────────────────── */
/* Applied via JS inline style overrides for flex rows */
.flex-wrap-row {
    display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
}
/* Safe select/input sizing on all screen sizes */
select.form-control, input.form-control {
    min-width: 0; max-width: 100%;
}
/* Ensure all table wrappers scroll on mobile */
.table-wrap {
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    width: 100%; display: block;
}
/* Prevent card header action buttons from overflowing on mobile */
.card-header-actions {
    display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
}
/* Section header bars with search */
.page-toolbar {
    display: flex; align-items: center; gap: 8px;
    flex-wrap: wrap; padding: 10px 16px;
    border-bottom: 1px solid var(--border-light);
    background: #fafafa;
}
/* RFQ card actions always wrap */
.rfq-card-actions { flex-wrap: wrap; }
/* DC filter bar selects — prevent overflow */
.dc-filter-bar select { min-width: 100px; }
/* History and notification cards */
.hist-group-header {
    display: flex; align-items: center; gap: 10px;
    flex: 1; min-width: 0;
}
/* Prevent long order numbers / delivery IDs from breaking layout */
.mono { word-break: break-all; }
/* Notification page items */
.notif-item { min-width: 0; overflow: hidden; }
/* Progress bar container */
.progress-wrap { overflow: hidden; min-width: 80px; }

/* ─── CHAT WIDGET RESPONSIVE ────────────────────────────── */
@media (max-width: 480px) {
    #chat-fab-wrap { bottom: 12px; right: 12px; }
    #chat-box {
        width: calc(100vw - 24px) !important;
        max-height: calc(100vh - 120px) !important;
        border-radius: 14px !important;
    }
    #notif-panel {
        left: 8px !important;
        right: 8px !important;
        width: auto !important;
    }
}

/* ─── PACKING PAGE RESPONSIVE ───────────────────────────── */
@media (max-width: 640px) {
    /* Sidebar stacks above products */
    #pk-layout { flex-direction: column !important; }
    #pk-sidebar { width: 100% !important; position: static !important; }
    /* Product grid: 2 columns on small screens */
    .pk-grid { grid-template-columns: repeat(2, 1fr) !important; }
}

/* ─── DEAL CENTER RESPONSIVE ────────────────────────────── */
@media (max-width: 480px) {
    .dc-grid { grid-template-columns: repeat(2, 1fr) !important; }
}

/* ─── NOTIFICATION PANEL ────────────────────────────────── */
@media (max-width: 480px) {
    #notif-panel {
        top: 58px !important;
        left: 8px !important;
        right: 8px !important;
        width: auto !important;
        max-height: calc(100vh - 70px) !important;
    }
}

/* ─── SETTINGS PAGE ─────────────────────────────────────── */
@media (max-width: 640px) {
    .settings-two-col {
        grid-template-columns: 1fr !important;
    }
}

/* ─── ACCORDION CARD HEADERS (orders/sales) ─────────────── */
@media (max-width: 600px) {
    /* Order group header: title + badge + buttons all wrap */
    .card-header > div:first-child { min-width: 0; flex: 1; }
    .card-header .card-title { font-size: 13px !important; }
    .card-header .card-subtitle { font-size: 11px !important; }
    /* Action buttons row in card header: full width, wrap */
    .card-header > div:last-child:not(:first-child) {
        width: 100%;
        justify-content: flex-start;
    }
    /* Progress bar: even more compact */
    .order-progress { transform: scale(0.65); transform-origin: left center; }
    /* Hide order number column label on tiny screens */
    .orders-table th:first-child { display: none; }
}

/* ─── DROPDOWN / SELECT STYLING ─────────────────────────── */
select.form-control {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23888'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 28px !important;
}
/* Prevent mobile iOS from adding extra styling to selects */
@supports (-webkit-touch-callout: none) {
    select.form-control { font-size: 16px; }
}
