/* ========================================
   EGEXO Business Manager — Design System
   Premium Dark Theme
   ======================================== */

/* === CSS Variables === */
:root {
    /* Core palette */
    --bg-dark: #0d1117;
    --bg-surface: #161b22;
    --bg-card: #1c2333;
    --bg-hover: #242d3d;
    --bg-input: #0d1117;
    --border-color: #2a3441;
    --border-light: #1e2732;

    /* Accent — teal/turquoise */
    --accent: #00bfa6;
    --accent-light: #33d4bf;
    --accent-dim: rgba(0, 191, 166, 0.12);
    --accent-glow: rgba(0, 191, 166, 0.25);

    /* Secondary accents */
    --blue: #3b82f6;
    --blue-dim: rgba(59, 130, 246, 0.12);
    --orange: #f59e0b;
    --orange-dim: rgba(245, 158, 11, 0.12);
    --red: #ef4444;
    --red-dim: rgba(239, 68, 68, 0.12);
    --green: #22c55e;
    --green-dim: rgba(34, 197, 94, 0.12);
    --purple: #a855f7;
    --purple-dim: rgba(168, 85, 247, 0.12);

    /* Text */
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #545d68;

    /* Gradients */
    --gradient-accent: linear-gradient(135deg, #00bfa6, #3b82f6);
    --gradient-warm: linear-gradient(135deg, #f59e0b, #ef4444);
    --gradient-card: linear-gradient(135deg, rgba(0, 191, 166, 0.05), rgba(59, 130, 246, 0.05));

    /* Layout */
    --sidebar-width: 260px;
    --sidebar-collapsed: 72px;
    --topbar-height: 64px;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-xs: 6px;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px var(--accent-glow);

    /* Transitions */
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --transition: all 0.25s var(--ease);
}

/* === Reset & Base === */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

a {
    color: var(--accent);
    text-decoration: none;
}

input,
select,
textarea,
button {
    font-family: inherit;
    font-size: inherit;
}

/* === Scrollbar === */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}


/* ========================================
   SIDEBAR
   ======================================== */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: width 0.3s var(--ease), transform 0.3s var(--ease);
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed);
}

.sidebar.collapsed .logo-text,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .user-details,
.sidebar.collapsed .nav-divider::before {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    overflow: hidden;
}

.logo-icon {
    width: 40px;
    height: 40px;
    min-width: 40px;
    background: var(--gradient-accent);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.1rem;
    color: var(--bg-dark);
    letter-spacing: 1px;
}

.logo-text {
    display: flex;
    flex-direction: column;
    transition: var(--transition);
    white-space: nowrap;
}

.logo-name {
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: 2px;
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-sub {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-xs);
    transition: var(--transition);
}

.sidebar-toggle:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.sidebar.collapsed .sidebar-toggle i {
    transform: rotate(180deg);
}

/* Nav Items */
.sidebar-nav {
    flex: 1;
    padding: 0.75rem 0.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 1rem;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    transition: var(--transition);
    cursor: pointer;
    white-space: nowrap;
    text-decoration: none;
    position: relative;
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--accent-dim);
    color: var(--accent);
    font-weight: 500;
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: var(--accent);
    border-radius: 0 3px 3px 0;
}

.nav-item i {
    width: 20px;
    text-align: center;
    font-size: 1rem;
    min-width: 20px;
}

.nav-divider {
    height: 1px;
    background: var(--border-color);
    margin: 0.5rem 1rem;
    position: relative;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    overflow: hidden;
}

.user-avatar {
    width: 36px;
    height: 36px;
    min-width: 36px;
    background: var(--bg-hover);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.user-details {
    display: flex;
    flex-direction: column;
    transition: var(--transition);
    white-space: nowrap;
}

.user-name {
    font-size: 0.8rem;
    font-weight: 600;
}

.user-role {
    font-size: 0.7rem;
    color: var(--text-muted);
}


/* ========================================
   MAIN CONTENT
   ======================================== */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left 0.3s var(--ease);
}

.sidebar.collapsed~.main-content {
    margin-left: var(--sidebar-collapsed);
}

.top-bar {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-surface);
    position: sticky;
    top: 0;
    z-index: 50;
    gap: 1rem;
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.5rem;
}

.page-title {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.3px;
    flex: 1;
}

.content-area {
    padding: 1.5rem;
    max-width: 1400px;
}


/* ========================================
   BUTTONS
   ======================================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    white-space: nowrap;
}

.btn-sm {
    padding: 0.45rem 1rem;
    font-size: 0.8rem;
}

.btn-xs {
    padding: 0.3rem 0.7rem;
    font-size: 0.75rem;
}

.btn-primary {
    background: var(--gradient-accent);
    color: var(--bg-dark);
}

.btn-primary:hover {
    box-shadow: var(--shadow-glow);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-hover);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    border-color: var(--text-muted);
}

.btn-danger {
    background: var(--red-dim);
    color: var(--red);
}

.btn-danger:hover {
    background: var(--red);
    color: white;
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    padding: 0.4rem 0.6rem;
}

.btn-ghost:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.btn-icon {
    width: 34px;
    height: 34px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-xs);
}

/* Button group */
.btn-group {
    display: flex;
    gap: 0.5rem;
}


/* ========================================
   CARDS
   ======================================== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1.5rem;
    transition: var(--transition);
}

.card:hover {
    border-color: var(--border-light);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.card-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
}


/* ========================================
   STAT CARDS (Dashboard)
   ======================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1.25rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-card.accent::after {
    background: var(--gradient-accent);
}

.stat-card.blue::after {
    background: var(--blue);
}

.stat-card.orange::after {
    background: var(--orange);
}

.stat-card.green::after {
    background: var(--green);
}

.stat-card.purple::after {
    background: var(--purple);
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    min-width: 44px;
}

.stat-icon.accent {
    background: var(--accent-dim);
    color: var(--accent);
}

.stat-icon.blue {
    background: var(--blue-dim);
    color: var(--blue);
}

.stat-icon.orange {
    background: var(--orange-dim);
    color: var(--orange);
}

.stat-icon.green {
    background: var(--green-dim);
    color: var(--green);
}

.stat-icon.purple {
    background: var(--purple-dim);
    color: var(--purple);
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.2rem;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    line-height: 1.2;
}

.stat-change {
    font-size: 0.7rem;
    margin-top: 0.2rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.stat-change.up {
    color: var(--green);
}

.stat-change.down {
    color: var(--red);
}


/* ========================================
   FORMS
   ======================================== */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.6rem 0.85rem;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xs);
    color: var(--text-primary);
    font-size: 0.85rem;
    transition: var(--transition);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

.form-input::placeholder {
    color: var(--text-muted);
}

.form-select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%238b949e' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
}

.form-textarea {
    resize: vertical;
    min-height: 80px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.form-row-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.form-row-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.form-section-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent);
    margin: 1.25rem 0 0.75rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--border-color);
}

.form-hint {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}


/* ========================================
   TABLES
   ======================================== */
.table-wrapper {
    overflow-x: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--bg-card);
}

.table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    gap: 1rem;
    flex-wrap: wrap;
}

.table-search {
    position: relative;
    flex: 1;
    max-width: 320px;
}

.table-search i {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.8rem;
}

.table-search input {
    width: 100%;
    padding: 0.5rem 0.75rem 0.5rem 2.25rem;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xs);
    color: var(--text-primary);
    font-size: 0.82rem;
}

.table-search input:focus {
    outline: none;
    border-color: var(--accent);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    padding: 0.7rem 1.25rem;
    text-align: left;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.data-table td {
    padding: 0.75rem 1.25rem;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tbody tr {
    transition: background 0.15s ease;
}

.data-table tbody tr:hover {
    background: var(--bg-hover);
}

.table-actions {
    display: flex;
    gap: 0.25rem;
}

.table-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.table-empty i {
    font-size: 2rem;
    margin-bottom: 0.75rem;
    display: block;
    opacity: 0.5;
}


/* ========================================
   BADGES / STATUS
   ======================================== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.65rem;
    border-radius: 100px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.badge.draft {
    background: var(--bg-hover);
    color: var(--text-muted);
}

.badge.sent {
    background: var(--blue-dim);
    color: var(--blue);
}

.badge.accepted,
.badge.paid,
.badge.completed,
.badge.delivered {
    background: var(--green-dim);
    color: var(--green);
}

.badge.rejected,
.badge.overdue {
    background: var(--red-dim);
    color: var(--red);
}

.badge.converted {
    background: var(--purple-dim);
    color: var(--purple);
}

.badge.processing,
.badge.shipped {
    background: var(--orange-dim);
    color: var(--orange);
}

.badge.partially_paid {
    background: var(--orange-dim);
    color: var(--orange);
}


/* ========================================
   MODAL
   ======================================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: fadeIn 0.2s ease;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    width: 100%;
    max-width: 700px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.25s var(--ease);
    box-shadow: var(--shadow-lg);
}

.modal.modal-lg {
    max-width: 900px;
}

.modal.modal-xl {
    max-width: 1100px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-title {
    font-size: 1rem;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    padding: 0.4rem;
    border-radius: var(--radius-xs);
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}


/* ========================================
   TOAST NOTIFICATIONS
   ======================================== */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.85rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 280px;
    max-width: 400px;
    animation: slideIn 0.3s var(--ease);
    box-shadow: var(--shadow-lg);
}

.toast.success {
    border-left: 3px solid var(--green);
}

.toast.error {
    border-left: 3px solid var(--red);
}

.toast.info {
    border-left: 3px solid var(--blue);
}

.toast-msg {
    font-size: 0.82rem;
    flex: 1;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(100px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}


/* ========================================
   PAGE-SPECIFIC: Quote/Invoice Builder
   ======================================== */
.doc-builder {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 1.5rem;
}

.doc-main {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.doc-sidebar-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.line-items-table {
    width: 100%;
    border-collapse: collapse;
}

.line-items-table th {
    padding: 0.5rem 0.65rem;
    text-align: left;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
}

.line-items-table td {
    padding: 0.4rem 0.5rem;
    vertical-align: middle;
}

.line-items-table input,
.line-items-table select {
    width: 100%;
    padding: 0.4rem 0.5rem;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xs);
    color: var(--text-primary);
    font-size: 0.82rem;
}

.line-items-table input:focus,
.line-items-table select:focus {
    outline: none;
    border-color: var(--accent);
}

.line-total {
    font-weight: 600;
    white-space: nowrap;
    text-align: right;
    padding-right: 0.5rem;
}

.remove-line-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.3rem;
    transition: var(--transition);
}

.remove-line-btn:hover {
    color: var(--red);
}

.add-line-btn {
    padding: 0.5rem 1rem;
    background: transparent;
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-xs);
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
    width: 100%;
    margin-top: 0.5rem;
    font-size: 0.82rem;
}

.add-line-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-dim);
}

/* Summary / Totals area */
.doc-totals {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding: 1rem;
    background: var(--bg-dark);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
}

.total-row.grand {
    font-size: 1.1rem;
    font-weight: 700;
    padding-top: 0.5rem;
    margin-top: 0.3rem;
    border-top: 1px solid var(--border-color);
    color: var(--accent);
}

.total-label {
    color: var(--text-secondary);
}


/* ========================================
   EMPTY STATE
   ======================================== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
}

.empty-state i {
    font-size: 3rem;
    color: var(--text-muted);
    opacity: 0.4;
    margin-bottom: 1rem;
}

.empty-state h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.empty-state p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    max-width: 400px;
}


/* ========================================
   UTILITY CLASSES
   ======================================== */
.flex {
    display: flex;
}

.flex-center {
    display: flex;
    align-items: center;
}

.flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.gap-1 {
    gap: 0.5rem;
}

.gap-2 {
    gap: 1rem;
}

.mt-1 {
    margin-top: 0.5rem;
}

.mt-2 {
    margin-top: 1rem;
}

.mb-1 {
    margin-bottom: 0.5rem;
}

.mb-2 {
    margin-bottom: 1rem;
}

.text-muted {
    color: var(--text-muted);
}

.text-small {
    font-size: 0.8rem;
}

.font-mono {
    font-family: 'Courier New', monospace;
}

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* File upload area */
.file-upload-area {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-sm);
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: var(--bg-input);
}

.file-upload-area:hover {
    border-color: var(--accent);
    background: var(--accent-dim);
}

.file-upload-area i {
    font-size: 1.5rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    display: block;
}

.file-upload-area p {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.uploaded-preview {
    max-width: 200px;
    max-height: 100px;
    border-radius: var(--radius-xs);
    margin-top: 0.5rem;
    border: 1px solid var(--border-color);
}

/* Page header with actions */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
}

/* Filter tabs */
.filter-tabs {
    display: flex;
    gap: 0.25rem;
    background: var(--bg-dark);
    padding: 0.25rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.filter-tab {
    padding: 0.4rem 0.85rem;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 500;
    border-radius: var(--radius-xs);
    cursor: pointer;
    transition: var(--transition);
}

.filter-tab:hover {
    color: var(--text-primary);
}

.filter-tab.active {
    background: var(--accent-dim);
    color: var(--accent);
}


/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 1024px) {
    .doc-builder {
        grid-template-columns: 1fr;
    }

    .form-row-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-width);
    }

    .sidebar.mobile-open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0 !important;
    }

    .mobile-menu-btn {
        display: block;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .form-row,
    .form-row-3,
    .form-row-4 {
        grid-template-columns: 1fr;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .content-area {
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}


/* ========================================
   PRINT STYLES (for PDF)
   ======================================== */
@media print {
    body {
        background: white;
        color: #111;
    }

    .sidebar,
    .top-bar,
    .modal-overlay,
    .toast-container {
        display: none !important;
    }

    .main-content {
        margin-left: 0 !important;
    }
}