/* SHIVOMWEB CRM — Tailwind pre-compiled subset + custom */

:root {
    --c-primary: #2563EB;
    --c-secondary: #0F172A;
    --c-accent: #14B8A6;
    --c-bg: #F8FAFC;
    --c-card: #FFFFFF;
    --c-text: #0F172A;
    --c-muted: #64748B;
    --c-border: #E2E8F0;
}

[data-theme="dark"] {
    --c-bg: #0B1220;
    --c-card: #111827;
    --c-text: #E2E8F0;
    --c-muted: #94A3B8;
    --c-border: #1F2937;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--c-bg);
    color: var(--c-text);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--c-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; }

button { font-family: inherit; }

.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 240px;
    background: var(--c-secondary);
    color: #fff;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar .brand {
    padding: 18px 20px;
    font-weight: 700;
    font-size: 16px;
    border-bottom: 1px solid #1E293B;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar .brand .logo {
    width: 32px; height: 32px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--c-primary), var(--c-accent));
    display: flex; align-items: center; justify-content: center;
    color: white; font-weight: 800;
}

.sidebar nav { padding: 12px 8px; flex: 1; }
.sidebar nav a {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px;
    color: #CBD5E1;
    border-radius: 6px;
    margin-bottom: 2px;
    font-size: 13px;
}
.sidebar nav a:hover { background: #1E293B; color: #fff; text-decoration: none; }
.sidebar nav a.active { background: var(--c-primary); color: #fff; }
.sidebar nav a .icon { width: 18px; text-align: center; }

.sidebar .group-title {
    font-size: 11px; text-transform: uppercase; color: #64748B;
    padding: 12px 12px 4px; font-weight: 600; letter-spacing: 0.5px;
}

.main {
    flex: 1;
    display: flex; flex-direction: column;
    min-width: 0;
}

.topbar {
    background: var(--c-card);
    border-bottom: 1px solid var(--c-border);
    padding: 12px 24px;
    display: flex; align-items: center; gap: 16px;
    position: sticky; top: 0; z-index: 50;
}
.topbar .title { font-size: 16px; font-weight: 600; }
.topbar .right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.topbar .search {
    background: var(--c-bg); border: 1px solid var(--c-border);
    border-radius: 6px; padding: 6px 12px; font-size: 13px; width: 280px;
    color: var(--c-text);
}
.avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: linear-gradient(135deg, var(--c-primary), var(--c-accent));
    color: #fff; display: inline-flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: 13px;
}

.content { padding: 24px; }

.card {
    background: var(--c-card);
    border: 1px solid var(--c-border);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 18px;
    box-shadow: 0 1px 2px rgba(15,23,42,0.04);
}
.card h2, .card h3 { margin: 0 0 12px; }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-header h3 { margin: 0; }

.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 14px; border-radius: 6px;
    font-size: 13px; font-weight: 500;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--c-primary); color: #fff; }
.btn-primary:hover { background: #1D4ED8; color: #fff; }
.btn-secondary { background: var(--c-card); color: var(--c-text); border-color: var(--c-border); }
.btn-secondary:hover { background: var(--c-bg); }
.btn-danger { background: #DC2626; color: #fff; }
.btn-danger:hover { background: #B91C1C; }
.btn-success { background: #16A34A; color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 12px; }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 500; margin-bottom: 6px; font-size: 13px; }
.form-group .required::after { content: " *"; color: #DC2626; }
.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--c-border);
    border-radius: 6px;
    background: var(--c-card);
    color: var(--c-text);
    font-size: 13px;
    font-family: inherit;
}
.form-control:focus { outline: none; border-color: var(--c-primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
textarea.form-control { min-height: 80px; resize: vertical; }
select.form-control { cursor: pointer; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.error-msg { color: #DC2626; font-size: 12px; margin-top: 4px; }

.alert {
    padding: 12px 16px; border-radius: 6px; margin-bottom: 16px;
    font-size: 13px;
}
.alert-success { background: #DCFCE7; color: #166534; border: 1px solid #BBF7D0; }
.alert-error   { background: #FEE2E2; color: #991B1B; border: 1px solid #FECACA; }
.alert-warning { background: #FEF3C7; color: #92400E; border: 1px solid #FDE68A; }
.alert-info    { background: #DBEAFE; color: #1E40AF; border: 1px solid #BFDBFE; }

.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--c-border); }
.table th { font-weight: 600; color: var(--c-muted); background: var(--c-bg); font-size: 12px; text-transform: uppercase; letter-spacing: 0.3px; }
.table tr:hover td { background: var(--c-bg); }
.table .actions a, .table .actions button { margin-right: 4px; }

.badge { display: inline-block; padding: 3px 8px; border-radius: 4px; font-size: 11px; font-weight: 500; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-5 { grid-template-columns: repeat(5, 1fr); }


.stat-card {
    background: var(--c-card);
    border: 1px solid var(--c-border);
    border-radius: 10px;
    padding: 20px;
}
.stat-card .label { font-size: 12px; color: var(--c-muted); text-transform: uppercase; letter-spacing: 0.4px; }
.stat-card .value { font-size: 28px; font-weight: 700; margin-top: 6px; }
.stat-card .delta { font-size: 12px; color: var(--c-muted); margin-top: 4px; }
.stat-card .icon-wrap {
    width: 40px; height: 40px; border-radius: 8px;
    display: inline-flex; align-items: center; justify-content: center;
    background: rgba(37,99,235,0.1); color: var(--c-primary);
    float: right;
}
.stat-card.green .icon-wrap { background: rgba(22,163,74,0.1); color: #16A34A; }
.stat-card.red .icon-wrap { background: rgba(220,38,38,0.1); color: #DC2626; }
.stat-card.yellow .icon-wrap { background: rgba(234,179,8,0.1); color: #CA8A04; }

.empty-state {
    text-align: center; padding: 60px 20px; color: var(--c-muted);
}
.empty-state .icon { font-size: 48px; margin-bottom: 10px; opacity: 0.4; }

.modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(15,23,42,0.5);
    display: flex; align-items: center; justify-content: center;
    z-index: 100;
}
.modal {
    background: var(--c-card);
    border-radius: 10px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow: auto;
    padding: 24px;
}

.pagination { display: flex; gap: 4px; align-items: center; margin-top: 16px; }
.pagination a, .pagination span {
    padding: 6px 10px; border: 1px solid var(--c-border);
    border-radius: 4px; font-size: 12px; color: var(--c-text);
}
.pagination a:hover { background: var(--c-bg); text-decoration: none; }
.pagination .active { background: var(--c-primary); color: #fff; border-color: var(--c-primary); }
.pagination .disabled { opacity: 0.4; }

.kanban { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.kanban-col {
    background: var(--c-bg);
    border: 1px solid var(--c-border);
    border-radius: 8px;
    padding: 12px;
    min-height: 400px;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.kanban-col.drag-over {
    background: var(--c-border);
    border-color: var(--c-primary);
}
.kanban-col h4 {
    margin: 0 0 12px;
    font-size: 13px;
    text-transform: uppercase;
    color: var(--c-muted);
    display: flex; justify-content: space-between;
}
.kanban-card {
    background: var(--c-card);
    border: 1px solid var(--c-border);
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 8px;
    cursor: grab;
    font-size: 12px;
    transition: opacity 0.15s ease, transform 0.15s ease;
}
.kanban-card:active {
    cursor: grabbing;
}
.kanban-card.dragging {
    opacity: 0.4;
    border-style: dashed;
}
.kanban-card:hover { box-shadow: 0 2px 6px rgba(0,0,0,0.05); }

.login-page {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #1E3A8A 0%, #0F172A 100%);
    padding: 20px;
}
.login-card {
    background: #fff;
    border-radius: 14px;
    width: 100%; max-width: 420px;
    padding: 36px 32px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.login-card h1 { margin: 0 0 6px; font-size: 22px; }
.login-card .subtitle { color: var(--c-muted); margin-bottom: 24px; font-size: 13px; }
.login-card .brand-logo {
    width: 48px; height: 48px; border-radius: 12px;
    background: linear-gradient(135deg, var(--c-primary), var(--c-accent));
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 800; font-size: 18px;
    margin-bottom: 16px;
}

/* Mobile Sidebar Backdrop Overlay */
.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(2px);
    z-index: 999;
    display: none;
}
.sidebar-backdrop.active {
    display: block;
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -240px;
        top: 0;
        bottom: 0;
        z-index: 1000;
        width: 240px;
        height: 100vh;
        transition: left 0.3s cubic-bezier(0.16, 1, 0.3, 1);
        display: flex;
        box-shadow: 4px 0 15px rgba(0,0,0,0.15);
    }
    .sidebar.open {
        left: 0;
    }
    .topbar #mobile-menu {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        width: 38px;
        height: 38px;
        padding: 0;
        font-size: 18px;
    }
    .topbar {
        padding: 12px 16px;
    }
    .topbar .search {
        display: none; /* Hide wide desktop search on mobile */
    }
    .content {
        padding: 16px;
    }
    .form-row, .form-row-3, .grid-2, .grid-3, .grid-4, .grid-5 {
        grid-template-columns: 1fr;
    }
    .kanban {
        grid-template-columns: 1fr;
    }
    /* Auto horizontal scroll for tables and wide elements inside cards */
    .card {
        overflow-x: auto;
    }
    /* Adjust quick note drawer size on small screens */
    .notes-drawer {
        width: 100%;
        right: -100%;
    }
    .notes-drawer.open {
        right: 0;
    }
}

.flash {
    position: fixed; top: 20px; right: 20px;
    background: var(--c-card);
    border-left: 4px solid var(--c-primary);
    padding: 12px 18px;
    border-radius: 6px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    z-index: 200;
    max-width: 400px;
}
.flash.success { border-color: #16A34A; }
.flash.error   { border-color: #DC2626; }

/* ===== Professional Icon Action Buttons ===== */
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 6px;
    border: 1px solid transparent;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
    line-height: 1;
    background: transparent;
    color: inherit;
}
.btn-icon i { line-height: 1; pointer-events: none; }
.btn-icon:hover { transform: translateY(-1px); box-shadow: 0 2px 6px rgba(0,0,0,0.1); }
.btn-icon.btn-view    { color: #2563EB; background: #EFF6FF; border-color: #BFDBFE; }
.btn-icon.btn-view:hover    { background: #2563EB; color: #fff; border-color: #2563EB; }
.btn-icon.btn-edit    { color: #7C3AED; background: #F5F3FF; border-color: #DDD6FE; }
.btn-icon.btn-edit:hover    { background: #7C3AED; color: #fff; border-color: #7C3AED; }
.btn-icon.btn-pdf     { color: #DC2626; background: #FEF2F2; border-color: #FECACA; }
.btn-icon.btn-pdf:hover     { background: #DC2626; color: #fff; border-color: #DC2626; }
.btn-icon.btn-whatsapp { color: #16A34A; background: #F0FDF4; border-color: #BBF7D0; }
.btn-icon.btn-whatsapp:hover { background: #16A34A; color: #fff; border-color: #16A34A; }
.btn-icon.btn-email   { color: #2563EB; background: #EFF6FF; border-color: #BFDBFE; }
.btn-icon.btn-email:hover   { background: #2563EB; color: #fff; border-color: #2563EB; }
.btn-icon.btn-delete  { color: #DC2626; background: #FEF2F2; border-color: #FECACA; }
.btn-icon.btn-delete:hover  { background: #DC2626; color: #fff; border-color: #DC2626; }
.btn-icon.btn-convert { color: #F59E0B; background: #FFFBEB; border-color: #FDE68A; }
.btn-icon.btn-convert:hover { background: #F59E0B; color: #fff; border-color: #F59E0B; }
.btn-icon.btn-copy    { color: #64748B; background: #F1F5F9; border-color: #CBD5E1; }
.btn-icon.btn-copy:hover    { background: #64748B; color: #fff; border-color: #64748B; }
.btn-icon.btn-back    { color: #64748B; background: #F1F5F9; border-color: #CBD5E1; }
.btn-icon.btn-back:hover    { background: #64748B; color: #fff; border-color: #64748B; }
.btn-icon:disabled,
.btn-icon[disabled] {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}
.btn-icon.btn-sm { width: 28px; height: 28px; font-size: 12px; }
.btn-icon.btn-lg { width: 38px; height: 38px; font-size: 15px; }

/* Action group: row of icon buttons */
.action-group {
    display: inline-flex;
    gap: 4px;
    align-items: center;
    flex-wrap: nowrap;
}

/* Icon + text button (for primary actions on the show page) */
.btn-icon-text {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid transparent;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
    line-height: 1.4;
    background: transparent;
    color: inherit;
    white-space: nowrap;
}
.btn-icon-text i { line-height: 1; }
.btn-icon-text.btn-view      { color: #2563EB; background: #EFF6FF; border-color: #BFDBFE; }
.btn-icon-text.btn-view:hover{ background: #2563EB; color: #fff; }
.btn-icon-text.btn-edit      { color: #7C3AED; background: #F5F3FF; border-color: #DDD6FE; }
.btn-icon-text.btn-edit:hover{ background: #7C3AED; color: #fff; }
.btn-icon-text.btn-pdf       { color: #DC2626; background: #FEF2F2; border-color: #FECACA; }
.btn-icon-text.btn-pdf:hover { background: #DC2626; color: #fff; }
.btn-icon-text.btn-whatsapp  { color: #fff; background: #16A34A; border-color: #15803D; }
.btn-icon-text.btn-whatsapp:hover { background: #15803D; }
.btn-icon-text.btn-email     { color: #fff; background: #2563EB; border-color: #1E40AF; }
.btn-icon-text.btn-email:hover{ background: #1E40AF; }
.btn-icon-text.btn-delete    { color: #DC2626; background: #FEF2F2; border-color: #FECACA; }
.btn-icon-text.btn-delete:hover{ background: #DC2626; color: #fff; }
.btn-icon-text.btn-convert   { color: #fff; background: #F59E0B; border-color: #D97706; }
.btn-icon-text.btn-convert:hover{ background: #D97706; }
.btn-icon-text.btn-copy      { color: #475569; background: #F1F5F9; border-color: #CBD5E1; }
.btn-icon-text.btn-copy:hover{ background: #475569; color: #fff; }
.btn-icon-text.btn-back      { color: #475569; background: #F1F5F9; border-color: #CBD5E1; }
.btn-icon-text.btn-back:hover{ background: #475569; color: #fff; }
.btn-icon-text:disabled,
.btn-icon-text[disabled] {
    opacity: 0.4;
    cursor: not-allowed;
}
