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

/* ============================================================
   HUMELY DESIGN SYSTEM
   ============================================================ */

/* ------------------------------------------------------------
   1. CSS VARIABLES
   ------------------------------------------------------------ */
:root {
    /* Brand */
    --primary:          #185FA5;
    --primary-light:    #E6F1FB;
    --primary-hover:    #0C447C;

    /* Semantic */
    --success:          #3B6D11;
    --success-light:    #EAF3DE;
    --warning:          #BA7517;
    --warning-light:    #FAEEDA;
    --danger:           #A32D2D;
    --danger-light:     #FCEBEB;

    /* Neutrals */
    --bg-app:           #F5F6F8;
    --bg-surface:       #FFFFFF;
    --bg-muted:         #F1F3F5;
    --text-primary:     #0F172A;
    --text-secondary:   #475569;
    --text-muted:       #94A3B8;
    --border:           rgba(15, 23, 42, 0.08);
    --border-strong:    rgba(15, 23, 42, 0.15);

    /* Layout */
    --sidebar-width:    224px;
    --topbar-height:    52px;

    /* Spacing */
    --space-1:  4px;
    --space-2:  8px;
    --space-3:  12px;
    --space-4:  16px;
    --space-5:  20px;
    --space-6:  24px;
    --space-8:  32px;

    /* Radius */
    --radius-sm:    6px;
    --radius-md:    10px;
    --radius-lg:    14px;
    --radius-xl:    20px;
    --radius-full:  9999px;

    /* Shadows */
    --shadow-sm:  0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-md:  0 4px 12px rgba(15, 23, 42, 0.08), 0 2px 4px rgba(15, 23, 42, 0.04);
    --shadow-lg:  0 12px 32px rgba(15, 23, 42, 0.1), 0 4px 8px rgba(15, 23, 42, 0.05);
    --shadow-xl:  0 24px 48px rgba(15, 23, 42, 0.12);

    /* Typography */
    --font-sans:    'Inter', system-ui, -apple-system, sans-serif;
    --font-display: 'Outfit', var(--font-sans);

    /* Transitions */
    --transition:       150ms ease;
    --transition-slow:  250ms ease;
}

/* ------------------------------------------------------------
   2. RESET & BASE
   ------------------------------------------------------------ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html { -webkit-text-size-adjust: 100%; }

body {
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-app);
    -webkit-font-smoothing: antialiased;
}

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

img, svg { display: block; max-width: 100%; }

button, input, select, textarea { font-family: inherit; font-size: inherit; }

/* ------------------------------------------------------------
   3. LAYOUT
   ------------------------------------------------------------ */
.app-shell {
    display: flex;
    min-height: 100vh;
    background: var(--bg-app);
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 200;
    padding: var(--space-5) var(--space-3);
}

.sidebar-logo {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    padding: var(--space-1) var(--space-2);
    margin-bottom: var(--space-6);
    letter-spacing: -0.02em;
}

.sidebar-logo .logo-accent { color: var(--primary); }

.sidebar-section {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 0 var(--space-2);
    margin: var(--space-4) 0 var(--space-2);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 8px 10px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 13.5px;
    font-weight: 400;
    text-decoration: none;
    transition: background var(--transition), color var(--transition);
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.nav-item i { font-size: 15px; width: 18px; text-align: center; flex-shrink: 0; }

.nav-item:hover { background: var(--bg-muted); color: var(--text-primary); text-decoration: none; }

.nav-item.active { background: var(--primary-light); color: var(--primary); font-weight: 500; }

.nav-badge {
    margin-left: auto;
    font-size: 11px;
    font-weight: 600;
    background: var(--primary);
    color: white;
    border-radius: var(--radius-full);
    padding: 1px 7px;
    line-height: 1.6;
}

.nav-item.nav-danger { color: var(--danger); }
.nav-item.nav-danger:hover { background: var(--danger-light); }

.sidebar-footer {
    border-top: 1px solid var(--border);
    padding-top: var(--space-3);
    margin-top: var(--space-3);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

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

/* Topbar */
.topbar {
    height: var(--topbar-height);
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: 0 var(--space-5);
    position: sticky;
    top: 0;
    z-index: 100;
}

/* Omnibar */
.omnibar-wrap { position: relative; flex: 1; max-width: 420px; }

.omnibar-input {
    width: 100%;
    height: 34px;
    padding: 0 var(--space-4) 0 36px;
    background: var(--bg-muted);
    border: 1px solid transparent;
    border-radius: var(--radius-full);
    font-size: 13px;
    color: var(--text-primary);
    transition: all var(--transition);
    outline: none;
}

.omnibar-input::placeholder { color: var(--text-muted); }

.omnibar-input:focus {
    background: var(--bg-surface);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.omnibar-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 13px;
    pointer-events: none;
}

.omnibar-results {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 999;
    display: none;
    max-height: 380px;
    overflow-y: auto;
}

.omnibar-results.open { display: block; }

.omnibar-category {
    padding: 8px 14px 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted);
    background: var(--bg-muted);
}

.omnibar-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    text-decoration: none;
    color: var(--text-primary);
    transition: background var(--transition);
    font-size: 13px;
}

.omnibar-item:hover { background: var(--bg-muted); text-decoration: none; }

.omnibar-item-icon {
    width: 30px;
    height: 30px;
    border-radius: var(--radius-sm);
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    flex-shrink: 0;
}

/* Topbar right */
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: var(--space-3); }

.icon-btn {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-full);
    background: none;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    cursor: pointer;
    position: relative;
    transition: background var(--transition);
    font-size: 14px;
}

.icon-btn:hover { background: var(--bg-muted); }

.notif-badge-dot {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 8px;
    height: 8px;
    background: var(--danger);
    border-radius: var(--radius-full);
    border: 2px solid var(--bg-surface);
    display: none;
}

.notif-badge-dot.visible { display: block; }

/* Notification dropdown */
.notif-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 320px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 999;
    display: none;
}

.notif-dropdown.open { display: block; }

.notif-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4);
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 13px;
}

.notif-item {
    padding: 10px var(--space-4);
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    transition: background var(--transition);
    cursor: pointer;
}

.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--bg-muted); }
.notif-item.unread { background: var(--primary-light); }

.notif-item-text { font-weight: 500; margin-bottom: 2px; }
.notif-item-time { font-size: 12px; color: var(--text-muted); }

/* User avatar */
.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 13px;
    flex-shrink: 0;
    cursor: pointer;
}

/* Page content */
.page-content {
    flex: 1;
    padding: var(--space-6);
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
}

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-4);
}

.page-title {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.page-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

/* ------------------------------------------------------------
   4. CARDS
   ------------------------------------------------------------ */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
}

.card-sm  { padding: var(--space-4); }
.card-lg  { padding: var(--space-6); }

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-4);
}

.card-title { font-size: 14px; font-weight: 600; color: var(--text-primary); }

.card-action {
    font-size: 13px;
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.card-action:hover { color: var(--primary-hover); text-decoration: none; }

/* Stat card */
.stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-4) var(--space-5);
}

.stat-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: var(--space-2);
}

.stat-label i { font-size: 13px; color: var(--text-muted); }

.stat-value {
    font-family: var(--font-display);
    font-size: 26px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    line-height: 1.1;
}

.stat-trend { font-size: 12px; margin-top: var(--space-1); color: var(--text-muted); }
.stat-trend.up   { color: var(--success); }
.stat-trend.down { color: var(--danger); }
.stat-trend.warn { color: var(--warning); }

/* ------------------------------------------------------------
   5. BUTTONS
   ------------------------------------------------------------ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: 7px 14px;
    border-radius: var(--radius-md);
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all var(--transition);
    text-decoration: none;
    line-height: 1.4;
    white-space: nowrap;
    font-family: inherit;
}

.btn:hover { text-decoration: none; }
.btn:active { transform: scale(0.98); }
.btn i { font-size: 14px; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-lg { padding: 10px 20px; font-size: 14.5px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; pointer-events: none; }

.btn-primary  { background: var(--primary); color: white; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: white; }

.btn-secondary { background: var(--bg-muted); color: var(--text-primary); border-color: var(--border); }
.btn-secondary:hover { background: #E4E7EB; color: var(--text-primary); }

.btn-outline { background: transparent; color: var(--primary); border-color: var(--primary); }
.btn-outline:hover { background: var(--primary-light); }

.btn-ghost { background: transparent; color: var(--text-secondary); border-color: transparent; }
.btn-ghost:hover { background: var(--bg-muted); color: var(--text-primary); }

.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #8b2020; border-color: #8b2020; color: #fff; }

.btn-success { background: var(--success-light); color: var(--success); border-color: transparent; }
.btn-success:hover { background: var(--success); color: white; }

/* ------------------------------------------------------------
   6. FORMS
   ------------------------------------------------------------ */
.form-group { display: flex; flex-direction: column; gap: var(--space-2); }

.form-label { font-size: 13px; font-weight: 500; color: var(--text-secondary); }
.form-label.required::after { content: ' *'; color: var(--danger); }

.input,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="tel"],
select,
textarea {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-muted);
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    font-size: 13.5px;
    color: var(--text-primary);
    transition: all var(--transition);
    outline: none;
    font-family: inherit;
    -webkit-appearance: none;
    appearance: none;
}

.input::placeholder, input::placeholder { color: var(--text-muted); }

.input:focus,
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
input[type="tel"]:focus,
select:focus,
textarea:focus {
    background: var(--bg-surface);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 32px;
}

textarea { resize: vertical; min-height: 90px; line-height: 1.6; }

.form-hint  { font-size: 12px; color: var(--text-muted); }
.form-error { font-size: 12px; color: var(--danger); }
.input-error, .input-error:focus { border-color: var(--danger) !important; box-shadow: 0 0 0 3px var(--danger-light) !important; }

.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--space-4); }

/* ------------------------------------------------------------
   7. BADGES
   ------------------------------------------------------------ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: var(--radius-full);
    font-size: 11.5px;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
}

.badge-primary  { background: var(--primary-light);  color: var(--primary); }
.badge-success  { background: var(--success-light);  color: var(--success); }
.badge-warning  { background: var(--warning-light);  color: var(--warning); }
.badge-danger   { background: var(--danger-light);   color: var(--danger); }
.badge-neutral  { background: var(--bg-muted);       color: var(--text-secondary); }
.badge-purple   { background: #F3EFFE;               color: #6D28D9; }

/* Contract */
.badge-cdi        { background: var(--success-light); color: var(--success); }
.badge-cdd        { background: var(--warning-light); color: var(--warning); }
.badge-alternance { background: var(--primary-light); color: var(--primary); }
.badge-stage      { background: var(--bg-muted);      color: var(--text-secondary); }
.badge-freelance  { background: #F3EFFE;              color: #6D28D9; }

/* Status */
.badge-active   { background: var(--success-light); color: var(--success); }
.badge-inactive { background: var(--bg-muted);      color: var(--text-secondary); }
.badge-pending  { background: var(--warning-light); color: var(--warning); }
.badge-approved { background: var(--success-light); color: var(--success); }
.badge-rejected { background: var(--danger-light);  color: var(--danger); }

/* ------------------------------------------------------------
   8. TABLES
   ------------------------------------------------------------ */
.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--border); }

table.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }

.table thead { background: var(--bg-muted); }

.table th {
    padding: 10px var(--space-4);
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
}

.table td {
    padding: 12px var(--space-4);
    border-top: 1px solid var(--border);
    color: var(--text-primary);
    vertical-align: middle;
}

.table tbody tr { transition: background var(--transition); }
.table tbody tr:hover { background: var(--bg-muted); }

.person-cell { display: flex; align-items: center; gap: 10px; }

.person-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 12px;
    flex-shrink: 0;
}

.person-name  { font-weight: 500; font-size: 13.5px; color: var(--text-primary); }
.person-sub   { font-size: 12px; color: var(--text-muted); }
.table-actions { display: flex; align-items: center; gap: var(--space-1); justify-content: flex-end; }

/* ------------------------------------------------------------
   9. MODALS
   ------------------------------------------------------------ */
dialog.modal {
    border: none;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    padding: 0;
    background: var(--bg-surface);
    width: 540px;
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - 64px);
    overflow: hidden;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
}

dialog.modal::backdrop {
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(4px);
}

dialog.modal-sm { width: 400px; }
dialog.modal-lg { width: 720px; }

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-5) var(--space-6);
    border-bottom: 1px solid var(--border);
}

.modal-title {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    width: 30px;
    height: 30px;
    border-radius: var(--radius-full);
    background: var(--bg-muted);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 14px;
    transition: all var(--transition);
}

.modal-close:hover { background: var(--border); color: var(--text-primary); }

.modal-body {
    padding: var(--space-6);
    overflow-y: auto;
    max-height: calc(100vh - 200px);
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid var(--border);
    background: var(--bg-muted);
}

/* ------------------------------------------------------------
   10. TABS
   ------------------------------------------------------------ */
.tabs {
    display: flex;
    gap: 2px;
    border-bottom: 1px solid var(--border);
    margin-bottom: var(--space-5);
}

.tab {
    padding: 8px 14px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    border: none;
    background: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: all var(--transition);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    white-space: nowrap;
    font-family: inherit;
}

.tab:hover { color: var(--text-primary); text-decoration: none; }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab i { font-size: 14px; }

/* ------------------------------------------------------------
   11. ALERTS
   ------------------------------------------------------------ */
.alert {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-4);
    border-radius: var(--radius-md);
    font-size: 13.5px;
    border: 1px solid transparent;
}

.alert i { font-size: 16px; flex-shrink: 0; margin-top: 1px; }

.alert-info    { background: var(--primary-light);  color: #0C447C;  border-color: #B5D4F4; }
.alert-success { background: var(--success-light);  color: #27500A;  border-color: #C0DD97; }
.alert-warning { background: var(--warning-light);  color: #633806;  border-color: #FAC775; }
.alert-danger  { background: var(--danger-light);   color: #791F1F;  border-color: #F7C1C1; }

/* ------------------------------------------------------------
   12. TOASTS
   ------------------------------------------------------------ */
#toast-container {
    position: fixed;
    top: var(--space-5);
    right: var(--space-5);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 10px var(--space-4);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    font-size: 13.5px;
    font-weight: 500;
    min-width: 260px;
    max-width: 380px;
    pointer-events: auto;
    animation: toast-in 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transition: opacity 0.3s, transform 0.3s;
}

.toast.hiding { opacity: 0; transform: translateX(20px); }
.toast i { font-size: 16px; flex-shrink: 0; }
.toast-success i { color: var(--success); }
.toast-error   i { color: var(--danger); }
.toast-warning i { color: var(--warning); }
.toast-info    i { color: var(--primary); }

@keyframes toast-in {
    from { opacity: 0; transform: translateX(20px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* ------------------------------------------------------------
   13. EMPTY STATES
   ------------------------------------------------------------ */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-8) var(--space-6);
    text-align: center;
    color: var(--text-muted);
    gap: var(--space-3);
}

.empty-state-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-xl);
    background: var(--bg-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: var(--text-muted);
}

.empty-state-title { font-size: 14px; font-weight: 600; color: var(--text-secondary); }
.empty-state-text  { font-size: 13px; max-width: 280px; }

/* ------------------------------------------------------------
   14. UTILITY & COMPONENTS
   ------------------------------------------------------------ */
.grid-2    { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-4); }
.grid-3    { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-4); }
.grid-4    { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-4); }
.grid-2-1  { display: grid; grid-template-columns: 2fr 1fr; gap: var(--space-4); }
.grid-3-1  { display: grid; grid-template-columns: 3fr 1fr; gap: var(--space-4); }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--space-4); }

.flex            { display: flex; }
.flex-col        { display: flex; flex-direction: column; }
.items-center    { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }

.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-5 { margin-top: var(--space-5); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-5 { margin-bottom: var(--space-5); }

.text-sm       { font-size: 12.5px; }
.text-muted    { color: var(--text-muted); }
.text-primary-color { color: var(--primary); }
.text-success  { color: var(--success); }
.text-warning  { color: var(--warning); }
.text-danger   { color: var(--danger); }
.font-medium   { font-weight: 500; }
.font-semibold { font-weight: 600; }
.text-center   { text-align: center; }
.text-right    { text-align: right; }

hr.divider { height: 1px; background: var(--border); border: none; margin: var(--space-4) 0; }

/* Quick action button */
.qa-btn {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 10px 12px;
    background: var(--bg-muted);
    border: none;
    border-radius: var(--radius-md);
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    font-weight: 400;
    transition: all var(--transition);
    text-decoration: none;
    font-family: inherit;
    width: 100%;
    text-align: left;
}

.qa-btn:hover { background: var(--primary-light); color: var(--primary); text-decoration: none; }
.qa-btn i { font-size: 15px; color: var(--primary); }

/* Alert row */
.alert-row {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--border);
}

.alert-row:last-child { border-bottom: none; padding-bottom: 0; }
.alert-dot { width: 8px; height: 8px; border-radius: var(--radius-full); flex-shrink: 0; margin-top: 5px; }
.alert-row-text { font-size: 13px; font-weight: 500; color: var(--text-primary); }
.alert-row-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* Activity */
.activity-item { display: flex; align-items: flex-start; gap: var(--space-3); padding: var(--space-2) 0; }

.activity-icon {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    background: var(--bg-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 13px;
    color: var(--text-secondary);
}

.activity-text { font-size: 13px; color: var(--text-primary); line-height: 1.5; }
.activity-time { font-size: 12px; color: var(--text-muted); }

/* Doc card */
.doc-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    transition: box-shadow var(--transition);
}

.doc-card:hover { box-shadow: var(--shadow-sm); }

.doc-icon { width: 40px; height: 40px; border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; font-size: 18px; }
.doc-icon-pdf   { background: var(--danger-light);  color: var(--danger); }
.doc-icon-word  { background: var(--primary-light); color: var(--primary); }
.doc-icon-image { background: var(--success-light); color: var(--success); }
.doc-icon-other { background: var(--bg-muted);      color: var(--text-secondary); }

/* Chat */
.chat-bubble {
    max-width: 75%;
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-lg);
    font-size: 13.5px;
    line-height: 1.6;
}

.chat-bubble-out { background: var(--primary); color: white; border-bottom-right-radius: var(--radius-sm); margin-left: auto; }
.chat-bubble-in  { background: var(--bg-muted); color: var(--text-primary); border-bottom-left-radius: var(--radius-sm); }

/* Pipeline */
.pipeline-col { background: var(--bg-muted); border-radius: var(--radius-lg); padding: var(--space-4); min-width: 220px; }

.pipeline-col-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: var(--space-3);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.pipeline-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-3);
    margin-bottom: var(--space-2);
    font-size: 13px;
    transition: box-shadow var(--transition);
}

.pipeline-card:last-child { margin-bottom: 0; }
.pipeline-card:hover { box-shadow: var(--shadow-sm); }

/* Scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* Animations */
@keyframes fade-in {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.animate-fade-in { animation: fade-in 0.25s ease; }

/* Responsive */
@media (max-width: 900px) {
    .grid-4, .grid-3   { grid-template-columns: repeat(2, 1fr); }
    .grid-2-1          { grid-template-columns: 1fr; }
    .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
}

/* ---- Confirm modal redesign ---- */
dialog.modal-confirm {
    width: 360px;
    max-width: calc(100vw - 32px);
    padding: 0;
    overflow: hidden;
    text-align: left;
}
dialog.modal-confirm[open] { display: flex; flex-direction: column; }

.confirm-body {
    padding: var(--space-6) var(--space-6) var(--space-5);
    display: flex;
    gap: var(--space-4);
    align-items: flex-start;
    position: relative;
}
.confirm-close {
    position: absolute;
    top: var(--space-4);
    right: var(--space-4);
    width: 28px;
    height: 28px;
    border-radius: var(--radius-full);
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 13px;
    transition: background var(--transition), color var(--transition);
}
.confirm-close:hover { background: var(--bg-muted); color: var(--text-primary); }
.confirm-icon-wrap {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    background: var(--danger-light);
    color: var(--danger);
}
.confirm-icon-wrap.warning { background: #fef3c7; color: #d97706; }
.confirm-icon-wrap.info    { background: var(--primary-light); color: var(--primary); }
.confirm-content { flex: 1; padding-right: var(--space-5); }
.confirm-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 4px;
    font-family: var(--font-display);
}
.confirm-text {
    font-size: 13.5px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0;
}
.confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-2);
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid var(--border);
    background: var(--bg-muted);
}
