@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ============================================================
   CSS Custom Properties
   ============================================================ */
:root {
    --bg:         #0d0d14;
    --bg2:        #13131e;
    --bg3:        #1a1a28;
    --bg4:        #22223a;
    --bg5:        #2a2a42;
    --accent:     #f97316;
    --accent2:    #fb923c;
    --accent-dim: rgba(249,115,22,0.12);
    --accent-glow:rgba(249,115,22,0.25);
    --text:       #f0f0fa;
    --text2:      #9090b0;
    --text3:      #585878;
    --border:     #252538;
    --border2:    #30304c;
    --success:    #22c55e;
    --danger:     #ef4444;
    --warning:    #eab308;
    --info:       #60a5fa;
    --radius:     14px;
    --radius-sm:  8px;
    --radius-lg:  22px;
    --shadow:     0 8px 40px rgba(0,0,0,0.5);
    --shadow-sm:  0 2px 16px rgba(0,0,0,0.3);
    --sidebar-w:  260px;
    --navbar-h:   68px;
    --transition: all 0.2s cubic-bezier(.4,0,.2,1);
}

/* ============================================================
   Reset & Base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

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

img { max-width: 100%; }

/* ============================================================
   Scrollbar
   ============================================================ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--bg5); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ============================================================
   Typography
   ============================================================ */
h1,h2,h3,h4,h5,h6 { font-weight: 700; line-height: 1.2; }
h1 { font-size: clamp(1.8rem, 3vw, 2.5rem); }
h2 { font-size: clamp(1.4rem, 2.5vw, 2rem); }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.1rem; }

/* ============================================================
   Auth Layout (login / register)
   ============================================================ */
.auth-bg {
    min-height: 100vh;
    background: var(--bg);
    background-image:
        radial-gradient(ellipse 80% 60% at 20% 10%, rgba(249,115,22,0.08) 0%, transparent 70%),
        radial-gradient(ellipse 60% 80% at 80% 90%, rgba(96,165,250,0.04) 0%, transparent 60%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.auth-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 440px;
    box-shadow: var(--shadow);
}

.auth-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 2rem;
}

.auth-logo img {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    object-fit: cover;
}

.auth-logo-text {
    font-size: 1.4rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent), #fbbf24);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-title { font-size: 1.6rem; font-weight: 700; margin-bottom: 0.3rem; }
.auth-sub   { color: var(--text2); font-size: 0.9rem; margin-bottom: 2rem; }

.auth-footer { text-align: center; margin-top: 1.5rem; color: var(--text2); font-size: 0.9rem; }

/* ============================================================
   App Layout (sidebar + content)
   ============================================================ */
.app-layout { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
    width: var(--sidebar-w);
    background: var(--bg2);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    z-index: 100;
    transition: var(--transition);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 1.5rem 1.25rem;
    border-bottom: 1px solid var(--border);
}

.sidebar-brand img {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    object-fit: cover;
}

.sidebar-brand-text {
    font-size: 1.1rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent), #fbbf24);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0.75rem;
    overflow-y: auto;
}

.nav-label {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text3);
    padding: 0 0.5rem;
    margin: 1rem 0 0.4rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.7rem 0.9rem;
    border-radius: var(--radius-sm);
    color: var(--text2);
    font-weight: 500;
    font-size: 0.9rem;
    transition: var(--transition);
    margin-bottom: 2px;
}

.nav-item:hover {
    background: var(--bg4);
    color: var(--text);
}

.nav-item.active {
    background: var(--accent-dim);
    color: var(--accent);
    font-weight: 600;
}

.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }

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

.user-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.7rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.user-card:hover { background: var(--bg4); }

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #fbbf24);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    color: #fff;
    flex-shrink: 0;
}

.user-info { flex: 1; min-width: 0; }
.user-name  { font-size: 0.875rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-email { font-size: 0.75rem; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Main Content */
.main-content {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Top Bar */
.topbar {
    height: var(--navbar-h);
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-left h2 { font-size: 1.15rem; font-weight: 700; }
.topbar-left p  { font-size: 0.8rem; color: var(--text2); }

.topbar-right { display: flex; align-items: center; gap: 1rem; }

.page-content { padding: 2rem; flex: 1; }

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

.stat-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0; right: 0;
    width: 80px; height: 80px;
    border-radius: 0 0 0 80px;
    opacity: 0.1;
}

.stat-card.orange::before { background: var(--accent); }
.stat-card.blue::before   { background: var(--info); }
.stat-card.green::before  { background: var(--success); }
.stat-card.purple::before { background: #a78bfa; }

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

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.stat-icon.orange { background: rgba(249,115,22,0.15); color: var(--accent); }
.stat-icon.blue   { background: rgba(96,165,250,0.15); color: var(--info); }
.stat-icon.green  { background: rgba(34,197,94,0.15);  color: var(--success); }
.stat-icon.purple { background: rgba(167,139,250,0.15);color: #a78bfa; }

.stat-value { font-size: 2rem; font-weight: 800; line-height: 1; margin-bottom: 0.25rem; }
.stat-label { font-size: 0.82rem; color: var(--text2); font-weight: 500; }

/* ============================================================
   Cards & Sections
   ============================================================ */
.card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.card-title { font-size: 1rem; font-weight: 700; }
.card-body  { padding: 1.5rem; }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    white-space: nowrap;
    text-decoration: none;
    line-height: 1;
}

.btn svg { width: 16px; height: 16px; }

.btn-primary {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 4px 14px rgba(249,115,22,0.35);
}
.btn-primary:hover { background: var(--accent2); color: #fff; transform: translateY(-1px); box-shadow: 0 6px 20px rgba(249,115,22,0.45); }

.btn-secondary {
    background: var(--bg4);
    color: var(--text);
    border: 1px solid var(--border2);
}
.btn-secondary:hover { background: var(--bg5); color: var(--text); }

.btn-outline {
    background: transparent;
    color: var(--accent);
    border: 1px solid var(--accent);
}
.btn-outline:hover { background: var(--accent-dim); color: var(--accent); }

.btn-danger {
    background: rgba(239,68,68,0.12);
    color: var(--danger);
    border: 1px solid rgba(239,68,68,0.2);
}
.btn-danger:hover { background: rgba(239,68,68,0.2); color: var(--danger); }

.btn-success {
    background: rgba(34,197,94,0.12);
    color: var(--success);
    border: 1px solid rgba(34,197,94,0.2);
}
.btn-success:hover { background: rgba(34,197,94,0.2); color: var(--success); }

.btn-sm { padding: 0.4rem 0.875rem; font-size: 0.8rem; }
.btn-lg { padding: 0.85rem 1.75rem; font-size: 1rem; }
.btn-icon { padding: 0.5rem; border-radius: var(--radius-sm); }

.btn:disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }

/* ============================================================
   Forms
   ============================================================ */
.form-group { margin-bottom: 1.25rem; }

.form-label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text2);
    margin-bottom: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.form-control {
    width: 100%;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    padding: 0.7rem 0.9rem;
    font-family: inherit;
    font-size: 0.9rem;
    transition: var(--transition);
    outline: none;
}

.form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

.form-control::placeholder { color: var(--text3); }

textarea.form-control { resize: vertical; min-height: 100px; }

select.form-control { cursor: pointer; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }

.input-group { position: relative; display: flex; align-items: center; }
.input-group .form-control { padding-left: 2.5rem; }
.input-icon {
    position: absolute;
    left: 0.75rem;
    color: var(--text3);
    pointer-events: none;
}
.input-icon svg { width: 16px; height: 16px; }

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

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

thead { background: var(--bg3); }

th {
    text-align: left;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text2);
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
}

td {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
    vertical-align: middle;
}

tbody tr { transition: var(--transition); }
tbody tr:hover { background: var(--bg3); }
tbody tr:last-child td { border-bottom: none; }

/* Items table inside quotation form */
.items-table { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.items-table th { background: var(--bg3); }
.items-table .form-control {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0.5rem 0.4rem;
}
.items-table .form-control:focus {
    background: var(--accent-dim);
    box-shadow: none;
    border-radius: var(--radius-sm);
}
.items-table td { padding: 0.4rem 0.5rem; }

/* ============================================================
   Badges / Status
   ============================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0.25rem 0.65rem;
    border-radius: 99px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: capitalize;
}

.badge-draft   { background: rgba(88,88,120,0.25); color: var(--text2); border: 1px solid var(--border2); }
.badge-shared  { background: rgba(34,197,94,0.12); color: var(--success); border: 1px solid rgba(34,197,94,0.2); }
.badge-sent    { background: rgba(96,165,250,0.12); color: var(--info); border: 1px solid rgba(96,165,250,0.2); }

/* ============================================================
   Action Buttons Group
   ============================================================ */
.action-btns { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }

/* ============================================================
   Alert / Toast
   ============================================================ */
.alert {
    padding: 0.875rem 1.25rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.25rem;
    font-size: 0.875rem;
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
}
.alert-success { background: rgba(34,197,94,0.1);  border: 1px solid rgba(34,197,94,0.3);  color: var(--success); }
.alert-danger  { background: rgba(239,68,68,0.1);  border: 1px solid rgba(239,68,68,0.3);  color: var(--danger); }
.alert-info    { background: rgba(96,165,250,0.1); border: 1px solid rgba(96,165,250,0.3); color: var(--info); }

/* Toast Notifications */
#toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.toast {
    background: var(--bg3);
    border: 1px solid var(--border2);
    border-radius: var(--radius-sm);
    padding: 0.875rem 1.25rem;
    min-width: 280px;
    max-width: 380px;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: var(--shadow);
    animation: slideIn 0.3s ease;
    cursor: pointer;
}

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

@keyframes slideIn {
    from { transform: translateX(110%); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}

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

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

.modal {
    background: var(--bg2);
    border: 1px solid var(--border2);
    border-radius: var(--radius-lg);
    padding: 2rem;
    width: 100%;
    max-width: 500px;
    box-shadow: var(--shadow);
    animation: modalIn 0.25s ease;
}

@keyframes modalIn {
    from { transform: scale(0.92); opacity: 0; }
    to   { transform: scale(1);    opacity: 1; }
}

.modal-title { font-size: 1.2rem; font-weight: 700; margin-bottom: 0.5rem; }
.modal-desc  { color: var(--text2); font-size: 0.875rem; margin-bottom: 1.5rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: 0.75rem; margin-top: 1.5rem; }

/* ============================================================
   Share Modal specific
   ============================================================ */
.share-link-box {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg3);
    border: 1px solid var(--border2);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.75rem;
    margin-top: 0.75rem;
}

.share-link-box input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text);
    font-size: 0.8rem;
    outline: none;
    font-family: monospace;
}

/* ============================================================
   Comments Section
   ============================================================ */
.comment-list { display: flex; flex-direction: column; gap: 1rem; }

.comment-item {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1rem 1.25rem;
    transition: var(--transition);
}
.comment-item:hover { border-color: var(--border2); }

.comment-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.6rem;
}

.comment-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #fbbf24);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.75rem;
    color: #fff;
    flex-shrink: 0;
}

.comment-name { font-size: 0.85rem; font-weight: 600; }
.comment-time { font-size: 0.75rem; color: var(--text2); }
.comment-text { font-size: 0.875rem; color: var(--text2); line-height: 1.6; }

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text2);
}

.empty-state svg { width: 48px; height: 48px; opacity: 0.3; margin-bottom: 1rem; }
.empty-state h4  { font-size: 1rem; color: var(--text2); font-weight: 600; }
.empty-state p   { font-size: 0.85rem; color: var(--text3); margin-top: 0.3rem; }

/* ============================================================
   Action Bar (View Quotation)
   ============================================================ */
.action-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
}

.action-bar-left  { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.action-bar-right { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }

/* ============================================================
   Quotation Document (the printable white paper)
   ============================================================ */
.quotation-wrapper {
    background: #fff;
    color: #111;
    border-radius: var(--radius);
    box-shadow: 0 8px 60px rgba(0,0,0,0.5);
    overflow: hidden;
    max-width: 860px;
    margin: 0 auto;
    font-family: 'Times New Roman', Times, serif;
}

/* Top header strip */
.qd-top {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: stretch;
    background: #1a1a24;
}

.qd-company-top {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: #1a1a24;
}

.qd-logo {
    width: 70px;
    height: 70px;
    object-fit: contain;
    border-radius: 8px;
}

.qd-company-top-info {
    color: #fff;
    font-family: 'Inter', sans-serif;
}

.qd-company-top-info h3 {
    font-size: 1rem;
    font-weight: 800;
    color: #f97316;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.qd-company-top-info p { font-size: 0.75rem; opacity: 0.8; line-height: 1.6; }

.qd-title-banner {
    background: #f97316;
    color: #fff;
    font-family: 'Inter', sans-serif;
    font-size: 1.5rem;
    font-weight: 900;
    letter-spacing: 0.1em;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 2.5rem;
    text-transform: uppercase;
}

/* Body */
.qd-body {
    display: grid;
    grid-template-columns: 200px 1fr;
    min-height: 600px;
}

/* Left sidebar */
.qd-sidebar {
    background: #1a1a24;
    color: #fff;
    padding: 1.5rem 1rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.72rem;
}

.qd-sidebar-section { margin-bottom: 1.5rem; }

.qd-sidebar-section h4 {
    color: #f97316;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid rgba(249,115,22,0.3);
    padding-bottom: 0.3rem;
}

.qd-sidebar-section p { line-height: 1.7; opacity: 0.85; }
.qd-sidebar-section ul { list-style: none; padding: 0; }
.qd-sidebar-section ul li { padding: 0.15rem 0; opacity: 0.85; }
.qd-sidebar-section ul li::before { content: '•  '; color: #f97316; }

/* Right content */
.qd-content { background: #fff; padding: 1.5rem 1.5rem; }

.qd-customer-date {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #f97316;
}

.qd-customer-label {
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #f97316;
    font-family: 'Inter', sans-serif;
    border-bottom: 2px solid #f97316;
    padding-bottom: 0.15rem;
    margin-bottom: 0.4rem;
}

.qd-customer-name { font-size: 0.95rem; font-weight: 700; }
.qd-customer-addr { font-size: 0.8rem; color: #444; }

.qd-date-label { font-size: 0.75rem; color: #555; text-align: right; }
.qd-date-value { font-size: 0.9rem; font-weight: 600; text-align: right; border-bottom: 1px solid #999; padding-bottom: 2px; min-width: 120px; display: block; }

/* Items table */
.qd-items-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 0;
    font-size: 0.8rem;
}

.qd-items-table thead th {
    background: #1a1a24;
    color: #fff;
    font-family: 'Inter', sans-serif;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.5rem 0.6rem;
    text-align: center;
    border: 1px solid #333;
}

.qd-items-table thead th:nth-child(2) { text-align: left; }

.qd-items-table tbody td {
    border: 1px solid #ddd;
    padding: 0.45rem 0.6rem;
    text-align: center;
    vertical-align: top;
    color: #222;
}

.qd-items-table tbody td:nth-child(2) { text-align: left; }
.qd-items-table tbody tr { background: #fff; }
.qd-items-table tbody tr:nth-child(even) { background: #fafafa; }

/* Totals */
.qd-totals-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
    margin-top: 0;
}

.qd-totals-table td {
    border: 1px solid #ddd;
    padding: 0.45rem 0.6rem;
    color: #222;
}

.qd-totals-table .total-label { text-align: right; font-weight: 600; }
.qd-totals-table .total-value { text-align: right; font-weight: 700; }
.qd-totals-table .subtotal-row { background: #1a1a24; color: #fff; }
.qd-totals-table .subtotal-row td { color: #fff; font-weight: 800; }

/* Notes */
.qd-notes {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid #ddd;
}

.qd-notes h4 {
    font-size: 0.8rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-family: 'Inter', sans-serif;
    margin-bottom: 0.5rem;
    color: #111;
}

.qd-notes p { font-size: 0.8rem; color: #333; line-height: 1.7; margin-bottom: 0.25rem; }

/* Payment */
.qd-payment {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid #ddd;
    font-size: 0.78rem;
    color: #333;
    line-height: 1.7;
}

/* ============================================================
   Profile Page
   ============================================================ */
.profile-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

/* ============================================================
   Empty state / Placeholder
   ============================================================ */
.no-results {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text2);
}
.no-results svg  { width: 64px; height: 64px; opacity: 0.15; margin-bottom: 1rem; }
.no-results h3   { font-size: 1.1rem; margin-bottom: 0.5rem; color: var(--text2); }
.no-results p    { font-size: 0.875rem; color: var(--text3); }

/* ============================================================
   Utility classes
   ============================================================ */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.text-muted { color: var(--text2); }
.text-sm { font-size: 0.85rem; }
.text-right { text-align: right; }
.font-bold { font-weight: 700; }
.w-full { width: 100%; }
.d-none { display: none !important; }

/* ============================================================
   Hamburger Button
   ============================================================ */
.hamburger-btn {
    display: none;
    background: var(--bg4);
    border: 1px solid var(--border2);
    border-radius: var(--radius-sm);
    color: var(--text);
    padding: 0.45rem;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: var(--transition);
    margin-right: 0.75rem;
}
.hamburger-btn:hover { background: var(--bg5); }

/* Mobile sidebar overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(2px);
    z-index: 99;
}
.sidebar-overlay.active { display: block; }

/* ============================================================
   Loader
   ============================================================ */
.spinner {
    display: inline-block;
    width: 18px; height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   @media print — only the quotation document shows
   ============================================================ */
@media print {
    body { background: #fff !important; }
    .sidebar, .topbar, .action-bar, .comments-section, .no-print { display: none !important; }
    .main-content { margin-left: 0 !important; }
    .page-content { padding: 0 !important; }
    .quotation-wrapper { box-shadow: none; border-radius: 0; max-width: 100%; }
    .qd-body { page-break-inside: avoid; }
}

/* ============================================================
   Responsive — Tablet (≤ 900px)
   ============================================================ */
@media (max-width: 900px) {
    .stats-grid { grid-template-columns: 1fr 1fr; }

    /* Card header wraps search/filter form */
    .card-header {
        flex-wrap: wrap;
        gap: 0.75rem;
    }
    .card-header form {
        width: 100%;
        flex-wrap: wrap;
    }
    .card-header form .form-control {
        flex: 1;
        min-width: 120px;
    }
}

/* ============================================================
   Responsive — Mobile (≤ 768px)
   ============================================================ */
@media (max-width: 768px) {
    :root { --sidebar-w: 0px; }

    /* Sidebar slides in/out */
    .sidebar {
        transform: translateX(-100%);
        z-index: 100;
        width: 260px;
        box-shadow: var(--shadow);
    }
    .sidebar.open { transform: translateX(0); }

    /* Show hamburger button */
    .hamburger-btn { display: inline-flex; }

    /* Topbar adjusts */
    .topbar { padding: 0 1rem; gap: 0.5rem; }
    .topbar-left { display: flex; align-items: center; flex: 1; min-width: 0; }
    .topbar-left h2 { font-size: 1rem; }
    .topbar-left p  { font-size: 0.75rem; }
    .topbar-right .btn span { display: none; } /* hide text in topbar btns */

    /* Page content */
    .page-content { padding: 0.875rem; }

    /* Forms */
    .form-row, .form-row-3 { grid-template-columns: 1fr; }

    /* Auth card */
    .auth-bg  { padding: 1rem; }
    .auth-card { padding: 1.75rem 1.25rem; }

    /* Stats */
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 0.75rem; }
    .stat-value { font-size: 1.5rem; }

    /* Cards header stacks */
    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    .card-header form {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    .card-header form .form-control { flex: 1; min-width: 100px; }

    /* Profile grid */
    .profile-grid { grid-template-columns: 1fr; }
    [style*="grid-template-columns:1fr 1fr"] { grid-template-columns: 1fr !important; }

    /* Action bar */
    .action-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
    .action-bar-left, .action-bar-right {
        flex-wrap: wrap;
        justify-content: center;
    }

    /* Tables — horizontal scroll */
    .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    table { min-width: 560px; }

    /* Quotation document */
    .qd-body { grid-template-columns: 1fr; }
    .qd-sidebar { display: none; }
    .qd-top { grid-template-columns: 1fr; }
    .qd-title-banner { padding: 0.75rem 1rem; font-size: 1.1rem; }

    /* Modal */
    .modal { padding: 1.5rem 1.25rem; }
    .modal-actions { flex-direction: column-reverse; }
    .modal-actions .btn { width: 100%; justify-content: center; }

    /* Toast container */
    #toast-container {
        left: 1rem;
        right: 1rem;
        bottom: 1rem;
    }
    .toast { min-width: unset; max-width: 100%; }
}

/* ============================================================
   Responsive — Very small (≤ 480px)
   ============================================================ */
@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .stat-card  { padding: 1.1rem; }
    .auth-card  { padding: 1.5rem 1rem; }
    .btn-lg     { padding: 0.75rem 1.25rem; font-size: 0.95rem; }
    .action-btns { gap: 0.25rem; }
    .action-btns .btn span { display: none; }
}

