/* ── CSS Variables ───────────────────────────────────────────────────────── */
:root {
    --bg: #090b14;
    /* Deep premium navy */
    --surface: rgba(20, 24, 39, 0.7);
    /* Translucent surface for glassmorphism */
    --surface2: rgba(30, 36, 56, 0.6);
    --border: rgba(60, 68, 92, 0.5);
    --primary: #0ea5e9;
    /* Vibrant cerulean/cyan for water/tech feel */
    --primary-hover: #0284c7;
    --primary-glow: rgba(14, 165, 233, 0.35);
    --text: #f8fafc;
    --text-muted: #94a3b8;
    --radius: 16px;
    /* Softer radius */
    --radius-sm: 10px;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    --glass-blur: blur(16px);
    --panel-width: 520px;
    --sidebar-width: 240px;
}

/* ── Light Theme ─────────────────────────────────────────────────────────── */
[data-theme="light"] {
    --bg: #f8fafc;
    /* Crisp light gray-blue */
    --surface: rgba(255, 255, 255, 0.85);
    --surface2: rgba(241, 245, 249, 0.8);
    --border: rgba(203, 213, 225, 0.6);
    --primary: #0284c7;
    --primary-hover: #0369a1;
    --primary-glow: rgba(2, 132, 199, 0.2);
    --text: #0f172a;
    --text-muted: #64748b;
    --shadow: 0 8px 32px rgba(15, 23, 42, 0.08);
}

[data-theme="light"] .login-container {
    background: radial-gradient(circle at 50% 0%, #e0f2fe 0%, #f8fafc 70%);
}

[data-theme="light"] .login-card {
    box-shadow: var(--shadow), 0 0 60px var(--primary-glow);
}

[data-theme="light"] .kanban-card:hover {
    box-shadow: 0 10px 25px rgba(15, 23, 42, .06);
}

[data-theme="light"] .panel-overlay {
    background: rgba(15, 23, 42, .15);
}

[data-theme="light"] .modal {
    background: rgba(15, 23, 42, .2);
}

/* ── Theme Toggle (Premium iOS-like) ─────────────────────────────────────── */
.theme-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    cursor: pointer;
    user-select: none;
    transition: background .2s;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.02);
}

.theme-toggle-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    flex: 1;
}

.toggle-track {
    width: 44px;
    height: 24px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    border-radius: 24px;
    position: relative;
    transition: all .3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.toggle-track.active {
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2), 0 0 12px var(--primary-glow);
}

.toggle-thumb {
    width: 18px;
    height: 18px;
    background: #fff;
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 2px;
    transition: all .3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.toggle-track.active .toggle-thumb {
    transform: translateX(20px);
}


* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    font-size: 14px;
}

a {
    text-decoration: none;
    color: inherit;
}

/* ── Login ───────────────────────────────────────────────────────────────── */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 50% 0%, #0c1a35 0%, #090b14 70%);
    /* Deep aquatic gradient */
    transition: opacity 0.3s;
    position: relative;
    overflow: hidden;
}

/* Subtle background glowing orb */
.login-container::before {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    background: var(--primary);
    border-radius: 50%;
    filter: blur(150px);
    opacity: 0.15;
    z-index: 0;
    animation: pulseGlow 8s infinite alternate ease-in-out;
}

@keyframes pulseGlow {
    0% {
        transform: scale(0.8) translate(-10%, -10%);
    }

    100% {
        transform: scale(1.1) translate(10%, 10%);
    }
}

.login-card {
    background: var(--surface);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 48px 40px;
    width: 380px;
    box-shadow: var(--shadow), 0 0 80px rgba(0, 0, 0, 0.4), inset 0 1px 1px rgba(255, 255, 255, 0.05);
    z-index: 1;
    position: relative;
    transform: translateY(0);
    animation: cardFloatUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes cardFloatUp {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-header p {
    color: var(--text-muted);
    font-size: 13px;
    margin-top: 8px;
}

.logo-large {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    justify-content: center;
    margin-bottom: 8px;
}

.logo-large svg {
    margin-bottom: 4px;
    filter: drop-shadow(0 4px 12px var(--primary-glow));
}

@keyframes spin {
    100% {
        transform: rotate(360deg);
    }
}

.logo-large:hover .gear-icon,
.sidebar .logo:hover .gear-icon {
    animation: spin 5s linear infinite;
}

.logo-text-wrapper {
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.logo-tsk {
    font-family: 'Outfit', sans-serif;
    font-size: 32px;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -0.5px;
}

.logo-group {
    font-family: 'Outfit', sans-serif;
    font-size: 32px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.5px;
}

.login-footer {
    text-align: center;
    color: var(--text-muted);
    font-size: 11px;
    margin-top: 24px;
}

.form-group {
    margin-bottom: 4px;
    /* Highly compact */
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group label {
    display: block;
    margin-bottom: 2px;
    /* Highly compact */
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
}

.form-group input,
.form-control {
    width: 100%;
    padding: 6px 10px;
    /* Reduced from 8px 12px for compactness */
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 13px;
    font-family: inherit;
    outline: none;
    transition: border-color .2s;
}

.form-group input:focus,
.form-control:focus {
    border-color: var(--primary);
}

.select-with-add {
    display: flex;
    gap: 6px;
    align-items: center;
}

.select-with-add> :first-child,
.select-with-add .ts-wrapper {
    flex: 1;
    min-width: 0;
}

.btn-add-quick {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 35px;
    height: 35px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    flex-shrink: 0;
    transition: all .2s;
}

.btn-add-quick:hover {
    color: var(--primary);
    border-color: var(--primary);
    background: var(--surface);
}

.req {
    color: #f87171;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: all .2s;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #0284c7);
    color: #fff;
    box-shadow: 0 4px 12px var(--primary-glow);
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-hover), #0369a1);
    box-shadow: 0 6px 16px var(--primary-glow);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--surface2);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    border-color: var(--primary);
}

.btn-full {
    width: 100%;
    justify-content: center;
    padding: 12px;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px;
    border-radius: 6px;
    transition: color .2s, background .2s;
}

.btn-icon:hover {
    color: var(--text);
    background: var(--border);
}

/* ── App Layout ──────────────────────────────────────────────────────────── */
.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-width);
    background: var(--surface);
    backdrop-filter: var(--glass-blur);
    /* Glass on sidebar */
    -webkit-backdrop-filter: var(--glass-blur);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 24px 0;
    flex-shrink: 0;
    z-index: 10;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 20px 24px;
    border-bottom: 1px solid var(--border);
}

.sidebar .logo svg {
    filter: drop-shadow(0 2px 6px var(--primary-glow));
}

.logo-tag {
    font-size: 10px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), #0284c7);
    color: #fff;
    padding: 3px 8px;
    border-radius: 6px;
    margin-left: auto;
    /* Push to right */
    letter-spacing: .5px;
    box-shadow: 0 2px 8px var(--primary-glow);
}

.logo .logo-tsk {
    font-size: 20px;
}

.logo .logo-group {
    font-size: 20px;
}

.nav-menu {
    flex: 1;
    padding: 16px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    transition: all .2s;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    color: var(--text);
    background: var(--surface2);
}

.nav-item.active {
    color: var(--primary);
    background: rgba(99, 102, 241, .1);
    border-left-color: var(--primary);
}

.nav-item i {
    width: 16px;
    height: 16px;
}

.nav-section {
    padding: 16px 20px 6px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--text-muted);
}

.user-block {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 20px;
    border-top: 1px solid var(--border);
}

.avatar {
    width: 34px;
    height: 34px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    color: #fff;
    flex-shrink: 0;
}

.user-avatar-mini {
    width: 22px;
    height: 22px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    color: #fff;
}

.user-info {
    flex: 1;
}

.username {
    display: block;
    font-size: 13px;
    font-weight: 600;
}

.role {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
}

.logout-icon {
    width: 16px;
    height: 16px;
    cursor: pointer;
    color: var(--text-muted);
    transition: color .2s;
}

.logout-icon:hover {
    color: #f87171;
}

/* ── Main Content ────────────────────────────────────────────────────────── */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ── Top Bar ─────────────────────────────────────────────────────────────── */
.top-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 32px;
    /* Wider padding */
    background: var(--surface);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    z-index: 5;
    position: relative;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 14px;
    flex: 1;
    max-width: 360px;
}

.search-box i {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.search-box input {
    background: none;
    border: none;
    outline: none;
    color: var(--text);
    font-size: 13px;
    width: 100%;
}

.top-actions {
    margin-left: auto;
    display: flex;
    gap: 8px;
}

/* ── Content Header ──────────────────────────────────────────────────────── */
.content-header {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 32px 32px 24px;
    /* More breathing room */
    flex-shrink: 0;
    flex-wrap: wrap;
}

.header-text h1 {
    font-size: 20px;
    font-weight: 700;
}

.header-text p {
    color: var(--text-muted);
    font-size: 12px;
    margin-top: 2px;
}

.stats-cards {
    display: flex;
    gap: 12px;
    margin-left: auto;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 18px;
    text-align: center;
}

.stat-active {
    border-color: rgba(99, 102, 241, .4);
}

.stat-done {
    border-color: rgba(16, 185, 129, .4);
}

.stat-value {
    display: block;
    font-size: 22px;
    font-weight: 700;
    line-height: 1;
}

.stat-label {
    display: block;
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ── Funnel / Kanban ─────────────────────────────────────────────────────── */
.document-section {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.funnel-scroll-wrapper {
    flex: 1;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 24px 24px;
}

.kanban-container {
    display: flex;
    gap: 14px;
    height: 100%;
    min-height: 500px;
    padding-top: 4px;
}

.kanban-column {
    min-width: 200px;
    max-width: 220px;
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: border-color .2s;
}

.kanban-column.drag-over {
    border-color: var(--primary);
    background: rgba(99, 102, 241, .06);
}

.column-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px 10px;
    flex-shrink: 0;
    border-radius: var(--radius) var(--radius) 0 0;
}

.col-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}

.count {
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 20px;
    flex-shrink: 0;
}

.column-content {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* ── Kanban Card ─────────────────────────────────────────────────────────── */
.kanban-card {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px;
    cursor: pointer;
    transition: all .2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.kanban-card:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 12px 24px rgba(0, 0, 0, .25);
    border-color: rgba(255, 255, 255, 0.1);
}

.kanban-card.dragging {
    opacity: .4;
}

.card-date {
    font-size: 10px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.card-title {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.35;
    margin-bottom: 6px;
}

.card-client {
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 4px;
}

.card-amount {
    font-size: 12px;
    font-weight: 600;
    color: #34d399;
    margin-bottom: 8px;
}

.card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
}


/* ── List View ───────────────────────────────────────────────────────────── */
.table-container {
    flex: 1;
    overflow: auto;
    padding: 0 24px 24px;
}

.doc-table {
    width: 100%;
    border-collapse: collapse;
}

.doc-table th,
.doc-table td {
    text-align: left;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

.doc-table th {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .5px;
    background: var(--surface);
}

.doc-table tr:hover td {
    background: var(--surface2);
}

.empty-row {
    text-align: center;
    color: var(--text-muted);
    padding: 40px;
}

/* ── Status Badge ────────────────────────────────────────────────────────── */
.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

/* ── Modal ───────────────────────────────────────────────────────────────── */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--surface);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 24px;
    /* Reduced from 32px to make modal more compact */
    width: 100%;
    min-width: 360px;
    max-width: 500px;
    box-shadow: var(--shadow), 0 0 60px rgba(0, 0, 0, 0.5), inset 0 1px 1px rgba(255, 255, 255, 0.05);
    animation: modalPopIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes modalPopIn {
    0% {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }

    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-sm {
    max-width: 380px;
    min-width: 320px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    /* Reduced from 20px */
}

.modal-header h2 {
    font-size: 17px;
    font-weight: 700;
}

.close-modal {
    cursor: pointer;
    color: var(--text-muted);
    width: 18px;
    height: 18px;
}

.close-modal:hover {
    color: var(--text);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 16px;
    /* Reduced from 20px */
}

/* ── Order Panel (side drawer) ───────────────────────────────────────────── */
.order-panel {
    position: fixed;
    inset: 0;
    z-index: 900;
    pointer-events: none;
}

.order-panel.open {
    pointer-events: all;
}

.panel-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .5);
    backdrop-filter: blur(3px);
    opacity: 0;
    transition: opacity .3s;
}

.order-panel.open .panel-overlay {
    opacity: 1;
}

.panel-body {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: var(--panel-width);
    background: var(--surface);
    backdrop-filter: var(--glass-blur);
    /* Glass on slider panel */
    -webkit-backdrop-filter: var(--glass-blur);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateX(100%);
    transition: transform .4s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.5);
}

.order-panel.open .panel-body {
    transform: translateX(0);
}

/* ── Layout Utilities ────────────────────────────────────────────────────── */
.modal-two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    /* Highly compact */
}

.kanban-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--border);
}

.panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.panel-title-wrap {
    flex: 1;
    min-width: 0;
}

.panel-title-wrap h2 {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.3;
}

.panel-title-wrap .status-badge {
    margin-top: 6px;
}

/* Progress Bar */
.progress-bar-wrap {
    padding: 16px 24px 14px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    position: relative;
}

.progress-line {
    height: 3px;
    background: var(--surface2);
    border-radius: 2px;
    margin: 0 10px;
    position: relative;
    top: -10px;
    z-index: 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #6366f1, #10b981);
    border-radius: 2px;
    transition: width .5s ease;
}

.progress-steps {
    display: flex;
    justify-content: space-between;
    position: relative;
    z-index: 1;
}

.progress-dot {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--surface2);
    border: 2px solid var(--border);
    transition: all .3s;
    cursor: default;
    flex-shrink: 0;
}

.progress-dot.done {
    background: var(--dot-color, #6366f1);
    border-color: var(--dot-color, #6366f1);
}

.progress-dot.active {
    background: var(--dot-color, #6366f1);
    border-color: var(--dot-color, #6366f1);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, .2);
}

/* Panel Sections */
.panel-body>.panel-section:first-of-type {
    padding-top: 20px;
}

.panel-section {
    padding: 0 24px 16px;
    border-bottom: 1px solid var(--border);
    overflow-y: auto;
    max-height: 260px;
}

.panel-section:last-child {
    border-bottom: none;
    flex: 1;
}

.section-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.section-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.section-row .section-label {
    margin-bottom: 0;
}

.status-select {
    margin-bottom: 10px;
    background: var(--surface2);
}

.file-upload-label {
    cursor: pointer;
}

/* Files List */
.files-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.file-link {
    flex: 1;
    font-size: 12px;
    color: #60a5fa;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
}

.file-link:hover {
    text-decoration: underline;
}

.empty-hint {
    color: var(--text-muted);
    font-size: 12px;
    font-style: italic;
}

/* Comments */
.comment-input-wrap {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.comment-textarea {
    flex: 1;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    color: var(--text);
    font-family: inherit;
    font-size: 13px;
    resize: none;
    min-height: 60px;
    outline: none;
    transition: border-color .2s;
}

.comment-textarea:focus {
    border-color: var(--primary);
}

.comments-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.comment-item {
    display: flex;
    gap: 10px;
    animation: fadeIn .3s ease;
}

.comment-system .comment-avatar {
    background: var(--surface2);
    color: var(--text-muted);
    font-size: 12px;
}

.comment-avatar {
    width: 28px;
    height: 28px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.comment-body {
    flex: 1;
    background: var(--surface2);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    border: 1px solid var(--border);
}

.comment-system .comment-body {
    background: rgba(255, 255, 255, .03);
    border-style: dashed;
}

.comment-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    flex-wrap: wrap;
}

.comment-author {
    font-size: 12px;
    font-weight: 600;
}

.comment-time {
    font-size: 11px;
    color: var(--text-muted);
}

.comment-status-tag {
    font-size: 10px;
    font-weight: 600;
    padding: 1px 7px;
    border-radius: 10px;
}

.comment-text {
    font-size: 13px;
    line-height: 1.5;
    white-space: pre-wrap;
}

/* ── Modal Sizes & Layout ──────────────────────────────────── */
.modal-md {
    max-width: 460px;
}

.modal-lg {
    max-width: 720px;
}

/* ── New Order Modal: Two-Column Layout ────────────────────── */
.order-modal-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    min-height: 340px;
}

.order-modal-left {
    padding-right: 20px;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.order-modal-right {
    padding-left: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.order-modal-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.order-modal-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.order-modal-row-3 .form-group:nth-child(3) {
    grid-column: 1 / -1;
}

/* Products header */
.order-products-header {
    display: flex;
    align-items: center;
    gap: 8px;
}

.order-products-badge {
    background: var(--primary);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* Add product bar */
.order-add-product-bar {
    display: flex;
    gap: 6px;
}

.order-add-product-row {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.order-add-product-btn {
    white-space: nowrap;
    height: 36px;
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

/* Product list */
.order-products-list {
    flex: 1;
    overflow-y: auto;
    max-height: 200px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 2px 0;
}

.order-products-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 32px 16px;
    color: var(--text-muted);
    font-size: 12px;
    font-style: italic;
    flex: 1;
}

.order-product-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 12px;
    animation: fadeIn 0.2s ease;
}

.order-product-item:hover {
    border-color: rgba(255, 255, 255, 0.15);
}

.order-product-info {
    flex: 1;
    min-width: 0;
}

.order-product-name {
    font-weight: 600;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.order-product-details {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.order-product-sum {
    font-weight: 700;
    font-size: 12px;
    color: #34d399;
    white-space: nowrap;
}

.order-products-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    margin-top: auto;
}

.order-products-total-value {
    color: #34d399;
    font-weight: 700;
}

@media (max-width: 768px) {
    .order-modal-body {
        grid-template-columns: 1fr;
    }

    .order-modal-left {
        padding-right: 0;
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding-bottom: 16px;
    }

    .order-modal-right {
        padding-left: 0;
        padding-top: 16px;
    }

    .modal-lg {
        max-width: 460px;
    }
}

.modal-two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 14px;
}

/* ── Client Card in Panel ───────────────────────────────────── */
.client-card {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cc-company {
    font-size: 14px;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.cc-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    border-top: 1px solid var(--border);
    padding-top: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.cc-info {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ── Items Table ────────────────────────────────────────────── */
.items-table-wrap {
    overflow-x: auto;
    margin-top: 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.items-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.items-table th,
.items-table td {
    padding: 8px 10px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.items-table th {
    background: var(--surface2);
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 10px;
    letter-spacing: .5px;
}

.items-table tr:last-child td {
    border-bottom: none;
}

.items-total-label {
    text-align: right;
    font-weight: 600;
    background: var(--surface2);
}

.items-total-value {
    font-weight: 700;
    color: #34d399;
    background: var(--surface2);
}

/* ── Panel Enhancements ─────────────────────────────────────── */
.panel-scroll {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 40px;
}

.panel-meta-row {
    display: flex;
    gap: 20px;
    padding-top: 16px !important;
    padding-bottom: 16px !important;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
}

.status-change-row {
    display: flex;
    gap: 8px;
}

.status-change-row select {
    flex: 1;
    margin-bottom: 0;
}

.panel-section-last {
    border-bottom: none;
}

/* ── Content Header Adjustments ─────────────────────────────── */
#pageSubtitle {
    margin-bottom: 0;
}

/* ── Misc ─────────────────────────────────────────────────── */
.btn-danger {
    background: #ef4444;
    color: #fff;
}

.btn-danger:hover {
    background: #dc2626;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── Scrollbar ───────────────────────────────────────────────────────────── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #3d4260;
}

/* ── Order List View Styles ──────────────────────────────────────────────── */
.order-list-row:hover td {
    background: var(--surface2);
}

.ol-title {
    font-weight: 600;
    margin-bottom: 2px;
}

.ol-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.ol-link:hover {
    text-decoration: underline;
}

.ol-sub {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.ol-muted {
    color: var(--text-muted);
    font-size: 13px;
}

.ol-progress-bar {
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 4px;
}

.ol-progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width .3s;
}

.ol-status-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .3px;
}

.ol-assigned {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ol-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}

/* ── Tom Select Styling (Premium Glass) ─────────────────────────────────── */
.ts-wrapper {
    margin-bottom: 0;
}

.ts-control {
    background: var(--surface2) !important;
    border: 1px solid var(--border) !important;
    color: var(--text) !important;
    border-radius: var(--radius-sm) !important;
    padding: 6px 10px !important;
    /* Reduced from 10px 14px */
    font-size: 13px !important;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1) !important;
    transition: all 0.2s ease !important;
    cursor: pointer;
}

.ts-control:hover {
    border-color: rgba(255, 255, 255, 0.15) !important;
}

.ts-wrapper.focus .ts-control {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px var(--primary-glow) !important;
    background: var(--surface) !important;
}

.ts-control input {
    color: var(--text) !important;
    font-family: inherit !important;
    font-size: 13px !important;
    display: none !important;
    /* hide inline input since we use dropdown_input */
}

.ts-dropdown .dropdown-input-wrap {
    padding: 10px;
    background: transparent;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.ts-dropdown .dropdown-input {
    width: 100%;
    background: var(--surface2) !important;
    border: 1px solid var(--border) !important;
    color: var(--text) !important;
    border-radius: var(--radius-sm) !important;
    padding: 8px 12px !important;
    font-size: 14px !important;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05) !important;
    transition: all 0.2s ease !important;
}

.ts-dropdown .dropdown-input:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 2px var(--primary-glow) !important;
    outline: none !important;
}

.ts-dropdown .dropdown-input::placeholder {
    color: var(--text-muted) !important;
    opacity: 0.7;
}

.ts-dropdown {
    background: var(--surface) !important;
    border: 1px solid var(--border) !important;
    color: var(--text) !important;
    border-radius: var(--radius-sm) !important;
    backdrop-filter: blur(24px) !important;
    -webkit-backdrop-filter: blur(24px) !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6), inset 0 1px 1px rgba(255, 255, 255, 0.05) !important;
    margin-top: 6px !important;
    overflow: hidden !important;
    animation: dropdownPop 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes dropdownPop {
    0% {
        opacity: 0;
        transform: translateY(-4px) scale(0.98);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.ts-dropdown .option {
    color: var(--text);
    padding: 10px 14px !important;
    font-size: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.15s ease;
    cursor: pointer;
}

.ts-dropdown .option:last-child {
    border-bottom: none;
}

.ts-dropdown .option:hover,
.ts-dropdown .active {
    background: rgba(14, 165, 233, 0.1) !important;
    color: var(--primary) !important;
    /* Adaptable text for primary color */
    padding-left: 18px !important;
    /* Slight indent on hover */
}

.ts-wrapper.single .ts-control::after {
    border-color: var(--text-muted) transparent transparent transparent !important;
    right: 14px !important;
}

.ts-wrapper.single.focus .ts-control::after {
    border-color: transparent transparent var(--primary) transparent !important;
}

/* Rich items in TomSelect */
.dropdown-item-rich {
    display: flex;
    align-items: center;
}

/* ── Mobile Menu Button (hidden on desktop) ───────────────────────────── */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text);
    cursor: pointer;
    padding: 4px;
    flex-shrink: 0;
}

/* ── Sidebar Backdrop (hidden on desktop) ──────────────────────────────── */
.sidebar-backdrop {
    display: none;
}

/* ── Mobile Responsiveness ────────────────────────────────────────────── */
@media (max-width: 768px) {

    /* ── App Container ── */
    .app-container {
        flex-direction: column;
    }

    /* ── Login Screen ── */
    .login-container {
        padding: 16px;
    }

    .login-card {
        padding: 28px 20px;
        margin: 0;
        width: 100%;
        max-width: 100%;
    }

    /* ── Mobile Menu Button ── */
    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* ── Sidebar Overlay ── */
    .sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        bottom: 0;
        width: 260px;
        z-index: 1001;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: none;
    }

    .sidebar.open {
        left: 0;
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.5);
    }

    /* ── Backdrop ── */
    .sidebar-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1000;
        backdrop-filter: blur(2px);
        -webkit-backdrop-filter: blur(2px);
    }

    .sidebar-backdrop.active {
        display: block;
    }

    /* ── Main Content ── */
    .main-content {
        margin-left: 0;
        width: 100%;
    }

    /* ── Top Bar ── */
    .top-bar {
        padding: 10px 16px;
        gap: 8px;
    }

    .search-box {
        max-width: none;
        padding: 6px 10px;
    }

    .search-box input {
        font-size: 14px;
    }

    .top-actions .btn {
        padding: 6px 12px;
        font-size: 12px;
        white-space: nowrap;
    }

    /* ── Content Header ── */
    .content-header {
        padding: 16px;
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    #pageTitle {
        font-size: 20px;
    }

    #pageSubtitle {
        font-size: 12px;
    }

    /* ── Stats Cards ── */
    .stats-cards {
        display: flex;
        gap: 8px;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 4px;
    }

    .stat-card {
        min-width: 100px;
        padding: 10px 12px;
    }

    .stat-value {
        font-size: 22px;
    }

    /* ── Document Section (content padding) ── */
    .document-section {
        padding: 16px;
    }

    /* ── Kanban Toggle Bar ── */
    .filter-bar {
        padding: 0;
        margin-bottom: 12px !important;
    }

    /* ── Kanban Container ── */
    .kanban-container {
        flex-direction: column;
        height: auto;
        overflow: visible;
        gap: 12px;
    }

    .kanban-col {
        min-width: 100%;
        max-height: none;
        height: auto;
    }

    .kanban-cards {
        max-height: none;
    }

    /* ── Tables ── */
    .table-container {
        border-radius: 0;
        border-left: none;
        border-right: none;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .doc-table {
        min-width: 600px;
    }

    /* ── Right Detail Panel ── */
    .panel-overlay {
        position: fixed;
        inset: 0;
        z-index: 999;
        width: 100%;
        max-width: 100%;
    }

    .panel-overlay .panel-header {
        padding: 12px 16px;
    }

    .panel-section {
        padding: 0 16px 14px;
    }

    /* ── Modals ── */
    .modal-content {
        width: 95%;
        margin: 10px auto;
        max-height: 90vh;
        overflow-y: auto;
    }

    .modal-md,
    .modal-lg {
        max-width: 95%;
    }

    .modal-two-col {
        grid-template-columns: 1fr;
    }

    .order-modal-body {
        grid-template-columns: 1fr;
    }

    .order-modal-left {
        padding-right: 0;
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding-bottom: 14px;
    }

    .order-modal-right {
        padding-left: 0;
        padding-top: 14px;
    }

    /* ── Funnel Scroll Wrapper ── */
    .funnel-scroll-wrapper {
        overflow: visible;
    }

    /* ── User Block in Sidebar ── */
    .user-block {
        padding: 12px 16px;
    }
}

/* ── Extra Small Screens (< 420px) ────────────────────────────────────── */
@media (max-width: 420px) {
    .top-bar {
        padding: 8px 12px;
        gap: 6px;
    }

    .top-actions .btn {
        padding: 5px 8px;
        font-size: 11px;
    }

    .top-actions .btn i {
        display: none;
    }

    .stat-card {
        min-width: 85px;
        padding: 8px 10px;
    }

    .stat-value {
        font-size: 18px;
    }
}