/* VoucherDesk — CRM Styles */
:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #e0e7ff;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --text: #1e293b;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --bg: #f1f5f9;
    --card-bg: #fff;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --sidebar-bg: #1e293b;
    --sidebar-text: #cbd5e1;
    --sidebar-active: #6366f1;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,.1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 240px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    transition: transform .3s;
}
.sidebar-brand a {
    display: flex; align-items: center; gap: .6rem;
    padding: 1.2rem 1rem;
    text-decoration: none; color: #fff;
    font-size: 1.1rem; font-weight: 800;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.brand-icon { font-size: 1.3rem; }
.sidebar-menu {
    list-style: none; padding: .5rem 0; flex: 1; overflow-y: auto;
}
.sidebar-menu li a {
    display: flex; align-items: center; gap: .5rem;
    padding: .6rem 1rem; margin: 2px .5rem;
    color: var(--sidebar-text); text-decoration: none;
    border-radius: var(--radius-sm); font-size: .88rem;
    transition: background .15s;
}
.sidebar-menu li a:hover { background: rgba(255,255,255,.08); }
.sidebar-menu li.active a {
    background: var(--sidebar-active); color: #fff; font-weight: 600;
}
.sidebar-footer {
    padding: 1rem; border-top: 1px solid rgba(255,255,255,.08);
    display: flex; align-items: center; justify-content: space-between;
}
.sidebar-user { display: flex; flex-direction: column; }
.user-name { font-size: .82rem; font-weight: 600; color: #fff; }
.user-role { font-size: .72rem; color: var(--text-muted); text-transform: uppercase; }
.logout-link { font-size: .78rem; color: var(--text-muted); text-decoration: none; }
.logout-link:hover { color: var(--danger); }

/* Main Content */
.main-content {
    margin-left: 240px; flex: 1; min-height: 100vh;
    display: flex; flex-direction: column;
}
.topbar {
    background: var(--card-bg); padding: .8rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 1rem;
    position: sticky; top: 0; z-index: 50;
}
.sidebar-toggle { display: none; background: none; border: none; font-size: 1.3rem; cursor: pointer; }
.page-title { font-size: 1.1rem; font-weight: 700; }
.content-body { padding: 1.5rem; flex: 1; }
.main-footer {
    padding: .8rem 1.5rem; border-top: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    font-size: .75rem; color: var(--text-muted);
}
.main-footer a { color: var(--primary); text-decoration: none; font-weight: 600; }
.main-footer a:hover { text-decoration: underline; }

/* Cards */
.card {
    background: var(--card-bg); border-radius: var(--radius);
    box-shadow: var(--shadow); overflow: hidden;
}
.card-header {
    padding: .8rem 1rem; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    font-weight: 700; font-size: .92rem;
}
.card-body { padding: 1rem; }

/* Stats Grid */
.stats-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem; margin-bottom: 1.5rem;
}
.stat-card {
    background: var(--card-bg); border-radius: var(--radius);
    padding: 1.2rem; box-shadow: var(--shadow);
    display: flex; align-items: center; gap: 1rem;
}
.stat-icon {
    width: 48px; height: 48px; border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem;
}
.stat-info { flex: 1; }
.stat-value { font-size: 1.5rem; font-weight: 800; line-height: 1.2; }
.stat-label { font-size: .78rem; color: var(--text-muted); font-weight: 500; }

/* Pipeline Board */
.pipeline-board {
    display: flex; gap: 1rem; overflow-x: auto; padding-bottom: 1rem;
    min-height: 400px;
}
.pipeline-column {
    min-width: 260px; width: 260px; flex-shrink: 0;
    background: var(--border-light); border-radius: var(--radius);
    display: flex; flex-direction: column;
}
.pipeline-header {
    padding: .8rem; font-weight: 700; font-size: .85rem;
    display: flex; align-items: center; justify-content: space-between;
    border-bottom: 2px solid;
}
.pipeline-count {
    background: rgba(0,0,0,.08); padding: 2px 8px;
    border-radius: 10px; font-size: .75rem;
}
.pipeline-cards {
    padding: .5rem; flex: 1; overflow-y: auto; max-height: 70vh;
    display: flex; flex-direction: column; gap: .5rem;
}
.pipeline-card {
    background: var(--card-bg); border-radius: var(--radius-sm);
    padding: .8rem; box-shadow: var(--shadow); cursor: pointer;
    border-left: 3px solid transparent;
    transition: box-shadow .15s, transform .15s;
}
.pipeline-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.pipeline-card-name { font-weight: 600; font-size: .88rem; margin-bottom: .3rem; }
.pipeline-card-info { font-size: .75rem; color: var(--text-muted); }
.pipeline-card-info span { display: inline-flex; align-items: center; gap: .2rem; }

/* Table */
.data-table {
    width: 100%; border-collapse: collapse;
}
.data-table th, .data-table td {
    padding: .6rem .8rem; text-align: left; border-bottom: 1px solid var(--border);
    font-size: .85rem;
}
.data-table th {
    font-weight: 600; color: var(--text-secondary);
    background: var(--border-light); position: sticky; top: 0;
}
.data-table tr:hover td { background: #f8fafc; }
.data-table td a { color: var(--primary); text-decoration: none; font-weight: 600; }

/* Badges */
.badge {
    display: inline-flex; align-items: center; gap: .3rem;
    padding: 2px 10px; border-radius: 10px;
    font-size: .72rem; font-weight: 600;
}
.badge-primary { background: var(--primary-light); color: var(--primary-dark); }
.badge-success { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-info { background: #dbeafe; color: #1e40af; }
.badge-muted { background: var(--border-light); color: var(--text-muted); }

/* Buttons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
    padding: .5rem 1rem; border-radius: var(--radius-sm);
    font-size: .85rem; font-weight: 600; border: none;
    cursor: pointer; text-decoration: none;
    transition: background .15s, transform .1s;
    font-family: inherit;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-secondary { background: var(--border); color: var(--text-secondary); }
.btn-sm { padding: .35rem .7rem; font-size: .8rem; }
.btn-xs { padding: .2rem .5rem; font-size: .72rem; }
.btn-outline { background: none; border: 1px solid var(--border); color: var(--text-secondary); }
.btn-outline:hover { background: var(--border-light); }

/* Forms */
.form-group { margin-bottom: 1rem; }
.form-label { display: block; font-size: .82rem; font-weight: 600; margin-bottom: .3rem; color: var(--text-secondary); }
.form-control {
    width: 100%; padding: .5rem .7rem; border: 1px solid var(--border);
    border-radius: var(--radius-sm); font-size: .88rem;
    font-family: inherit; transition: border-color .15s;
    background: var(--card-bg); color: var(--text);
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .7rem center; padding-right: 2rem; }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-row { display: flex; gap: 1rem; }
.form-row > * { flex: 1; }
.form-hint { font-size: .75rem; color: var(--text-muted); margin-top: .2rem; }

/* Alerts */
.alert {
    padding: .7rem 1rem; border-radius: var(--radius-sm);
    margin-bottom: 1rem; font-size: .88rem; font-weight: 500;
    animation: slideDown .3s;
}
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-danger { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-info { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }
.alert-warning { background: #fefce8; color: #854d0e; border: 1px solid #fde68a; }
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

/* Stage progress bar */
.stage-progress {
    display: flex; gap: 2px; margin-bottom: 1rem;
}
.stage-step {
    flex: 1; padding: .5rem .3rem; text-align: center;
    font-size: .72rem; font-weight: 600; color: var(--text-muted);
    background: var(--border-light); position: relative;
    transition: background .2s;
}
.stage-step:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.stage-step:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.stage-step.completed { background: var(--success); color: #fff; }
.stage-step.current { background: var(--primary); color: #fff; }

/* Timeline */
.timeline { position: relative; padding-left: 1.5rem; }
.timeline::before {
    content: ''; position: absolute; left: .5rem; top: 0; bottom: 0;
    width: 2px; background: var(--border);
}
.timeline-item {
    position: relative; padding-bottom: 1.2rem;
}
.timeline-dot {
    position: absolute; left: -1.2rem; top: .2rem;
    width: 12px; height: 12px; border-radius: 50%;
    background: var(--primary); border: 2px solid var(--card-bg);
}
.timeline-dot.stage-change { background: var(--success); }
.timeline-dot.email { background: var(--info); }
.timeline-dot.note { background: var(--warning); }
.timeline-time { font-size: .72rem; color: var(--text-muted); }
.timeline-action { font-size: .85rem; font-weight: 500; }
.timeline-detail { font-size: .78rem; color: var(--text-secondary); margin-top: .2rem; }

/* Hours progress */
.hours-bar {
    height: 8px; background: var(--border-light); border-radius: 4px;
    overflow: hidden; width: 100%;
}
.hours-bar-fill {
    height: 100%; border-radius: 4px;
    background: linear-gradient(90deg, var(--primary), var(--success));
    transition: width .3s;
}

/* Tabs */
.tabs {
    display: flex; gap: 0; border-bottom: 2px solid var(--border);
    margin-bottom: 1rem;
}
.tab {
    padding: .6rem 1rem; font-size: .85rem; font-weight: 600;
    color: var(--text-muted); border: none; background: none;
    cursor: pointer; border-bottom: 2px solid transparent;
    margin-bottom: -2px; font-family: inherit;
    transition: color .15s;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* Modal */
.modal-overlay {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5);
    z-index: 200; align-items: center; justify-content: center;
}
.modal-overlay.show { display: flex; }
.modal {
    background: var(--card-bg); border-radius: var(--radius);
    width: 90%; max-width: 600px; max-height: 90vh;
    overflow-y: auto; box-shadow: var(--shadow-md);
}
.modal-header {
    padding: 1rem 1.2rem; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    font-weight: 700;
}
.modal-close {
    background: none; border: none; font-size: 1.3rem;
    cursor: pointer; color: var(--text-muted);
}
.modal-body { padding: 1.2rem; }
.modal-footer {
    padding: .8rem 1.2rem; border-top: 1px solid var(--border);
    display: flex; justify-content: flex-end; gap: .5rem;
}

/* Login page */
.login-page {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh; background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
}
.login-card {
    background: #fff; border-radius: var(--radius); padding: 2rem;
    width: 380px; box-shadow: var(--shadow-md);
}
.login-brand {
    text-align: center; margin-bottom: 1.5rem;
}
.login-brand h1 { font-size: 1.3rem; font-weight: 800; }
.login-brand p { font-size: .85rem; color: var(--text-muted); }

/* Responsive */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    body.sidebar-open .sidebar { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .sidebar-toggle { display: block; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .pipeline-board { flex-direction: column; }
    .pipeline-column { width: 100%; min-width: 100%; }
    .form-row { flex-direction: column; gap: .5rem; }
}

/* Utility */
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-primary { color: var(--primary); }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.gap-1 { gap: .5rem; }
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-center { display: flex; align-items: center; }
.flex-wrap { flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* Revenue card */
.revenue-card {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: #fff; border-radius: var(--radius); padding: 1.5rem;
    box-shadow: var(--shadow-md);
}
.revenue-value { font-size: 2rem; font-weight: 800; }
.revenue-label { font-size: .85rem; opacity: .8; }

/* Empty state */
.empty-state {
    text-align: center; padding: 3rem; color: var(--text-muted);
}
.empty-state-icon { font-size: 2.5rem; margin-bottom: .5rem; }

/* Search */
.search-box {
    position: relative;
}
.search-box input {
    padding-left: 2.2rem;
}
.search-box::before {
    content: '🔍'; position: absolute; left: .7rem; top: 50%;
    transform: translateY(-50%); font-size: .85rem;
}

/* Checkbox/Radio custom */
.form-check {
    display: flex; align-items: center; gap: .4rem;
    font-size: .85rem; cursor: pointer;
}
