:root {
    --brand: #4F5CF0;
    --brand-soft: rgba(79, 92, 240, .12);
    --radius: 12px;
    --card-border: rgba(100, 116, 139, .18);
}

html, body {
    font-family: 'Inter', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

.mud-typography, .mud-button-root, .mud-input, .mud-table-root { font-family: inherit !important; }

h1:focus { outline: none; }
::selection { background: var(--brand-soft); }

/* ---------- App bar ---------- */
.app-bar { border-bottom: 1px solid var(--card-border); backdrop-filter: blur(8px); }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; margin-left: 4px; }
.brand-mark {
    width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
    background: linear-gradient(135deg, #8793FF, #3B45D6); color: #fff;
    box-shadow: 0 6px 14px rgba(59, 69, 214, .35);
}
.brand-name { font-weight: 800; letter-spacing: -.02em; font-size: 1.15rem; }

.search-pill {
    display: inline-flex; align-items: center; gap: 10px; min-width: 340px; padding: 8px 14px;
    border-radius: 999px; border: 1px solid var(--card-border); background: rgba(100, 116, 139, .08);
    color: var(--mud-palette-text-secondary); cursor: pointer; font: inherit; font-size: .875rem;
    transition: border-color .15s, background .15s;
}
.search-pill:hover { border-color: var(--brand); background: var(--brand-soft); }
.search-pill span { flex: 1; text-align: left; }
.search-pill kbd {
    font: inherit; font-size: .7rem; padding: 2px 7px; border-radius: 6px;
    border: 1px solid var(--card-border); background: var(--mud-palette-surface);
}

.user-chip { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; padding: 4px 6px 4px 4px; border-radius: 999px; }
.user-chip:hover { background: rgba(100, 116, 139, .1); }
.user-chip-text { line-height: 1.15; text-align: left; }
.user-name { font-size: .85rem; font-weight: 600; }
.user-role { font-size: .72rem; color: var(--mud-palette-text-secondary); }
.menu-heading { padding: 8px 16px; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--mud-palette-text-secondary); }

/* ---------- Drawer ---------- */
.app-drawer { border-right: none !important; }
.app-drawer .mud-nav-link { color: var(--mud-palette-drawer-text); border-radius: 10px; margin: 2px 12px; padding: 9px 12px; font-weight: 500; }
.app-drawer .mud-nav-link .mud-icon-root { color: var(--mud-palette-drawer-icon); }
.app-drawer .mud-nav-link:hover { background: rgba(255, 255, 255, .06); }
.app-drawer .mud-nav-link.active {
    background: linear-gradient(90deg, rgba(79, 92, 240, .28), rgba(79, 92, 240, .08));
    color: #fff; box-shadow: inset 3px 0 0 var(--brand);
}
.app-drawer .mud-nav-link.active .mud-icon-root { color: var(--brand); }
.nav-section { padding: 18px 24px 6px; font-size: .68rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: #64748B; }
.drawer-footer { margin-top: auto; padding: 16px 24px; font-size: .72rem; color: #64748B; }

.main-content { background: var(--mud-palette-background); min-height: 100vh; }

/* ---------- Page header ---------- */
.page-header { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.page-header-main { display: flex; align-items: center; gap: 14px; }
.page-icon { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.page-title { font-weight: 800 !important; letter-spacing: -.02em; line-height: 1.15; }
.page-subtitle { color: var(--mud-palette-text-secondary); }
.page-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* ---------- Surfaces ---------- */
.surface-card { border: 1px solid var(--card-border); border-radius: var(--radius); overflow: hidden; }
.panel { border: 1px solid var(--card-border); border-radius: var(--radius); padding: 20px; background: var(--mud-palette-surface); height: 100%; }
.panel-title { font-weight: 700; font-size: 1rem; margin-bottom: 4px; }
.panel-sub { color: var(--mud-palette-text-secondary); font-size: .8rem; margin-bottom: 12px; }

.grid-toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--card-border); }
.search-box { max-width: 320px; min-width: 200px; flex: 1; }
.filter-select { max-width: 190px; min-width: 150px; }
.data-grid .mud-table-head .mud-table-cell { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; color: var(--mud-palette-text-secondary); background: rgba(100, 116, 139, .05); }
.data-grid .mud-table-row:hover { background: var(--mud-palette-table-hover); }
.actions-cell { width: 56px; text-align: right; }
.num { font-variant-numeric: tabular-nums; font-weight: 500; }
.person-cell { display: flex; align-items: center; gap: 12px; }
.person-avatar { background: var(--brand-soft) !important; color: var(--brand) !important; font-weight: 700; }
.cell-primary { font-weight: 600; font-size: .9rem; }
.cell-secondary { font-size: .76rem; color: var(--mud-palette-text-secondary); }
.percent-cell { display: flex; align-items: center; gap: 10px; min-width: 120px; }
.percent-cell .mud-progress-linear { flex: 1; }
.percent-cell span { font-size: .78rem; width: 42px; text-align: right; }
.status-chip { font-weight: 600 !important; }
.empty-state { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 48px 16px; color: var(--mud-palette-text-secondary); }
.form-section { display: block; margin-top: 8px; color: var(--brand); font-weight: 700 !important; }
.datetime-field { display: flex; gap: 8px; }
.datetime-field .time-part { max-width: 130px; }

/* ---------- KPI cards ---------- */
.stat-link { text-decoration: none; color: inherit; display: block; height: 100%; }
.stat-card {
    --accent: var(--brand);
    display: flex; gap: 14px; align-items: center; padding: 18px; height: 100%;
    background: var(--mud-palette-surface); border: 1px solid var(--card-border); border-radius: var(--radius);
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s;
}
a.stat-link:hover .stat-card { transform: translateY(-2px); border-color: var(--accent); box-shadow: 0 10px 24px rgba(15, 23, 42, .08); }
.stat-icon { width: 48px; height: 48px; flex: none; border-radius: 14px; display: grid; place-items: center; color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.stat-label { font-size: .74rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--mud-palette-text-secondary); }
.stat-value { font-size: 1.55rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat-hint { font-size: .76rem; color: var(--mud-palette-text-secondary); }

.hero-card {
    border-radius: 16px; padding: 24px 28px; color: #fff; margin-bottom: 20px;
    background: radial-gradient(900px 300px at 100% 0%, rgba(79, 92, 240, .55), transparent 60%), linear-gradient(135deg, #0F172A, #1E293B);
}
.hero-card h2 { margin: 0 0 4px; font-weight: 800; letter-spacing: -.02em; }
.hero-card p { margin: 0; opacity: .75; }
.attention-item { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--card-border); text-decoration: none; color: inherit; }
.attention-item:last-child { border-bottom: none; }
.attention-item:hover { color: var(--brand); }
.attention-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); flex: none; }
.project-row { padding: 12px 0; border-bottom: 1px solid var(--card-border); }
.project-row:last-child { border-bottom: none; }

/* ---------- Kanban ---------- */
.kanban { gap: 16px; align-items: flex-start; overflow-x: auto; padding-bottom: 8px; }
.kanban-col { flex: 1 1 260px; min-width: 260px; background: rgba(100, 116, 139, .08); border-radius: var(--radius); padding: 12px; }
.kanban-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; font-weight: 700; font-size: .85rem; }
.kanban-zone { min-height: 120px; display: flex; flex-direction: column; gap: 10px; }
.kanban-card {
    background: var(--mud-palette-surface); border: 1px solid var(--card-border); border-left: 4px solid #94A3B8;
    border-radius: 10px; padding: 12px; cursor: grab; box-shadow: 0 1px 2px rgba(15, 23, 42, .05);
}
.kanban-card:hover { box-shadow: 0 8px 18px rgba(15, 23, 42, .1); }
.kanban-card.prio-Critical { border-left-color: #DC2626; }
.kanban-card.prio-High { border-left-color: #F59E0B; }
.kanban-card.prio-Medium { border-left-color: #0EA5E9; }
.kanban-card.prio-Low { border-left-color: #16A34A; }
.kanban-title { font-weight: 600; font-size: .9rem; margin-bottom: 6px; }
.kanban-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: .74rem; color: var(--mud-palette-text-secondary); }
.overdue { color: #DC2626; font-weight: 600; }

/* ---------- Auth screens ---------- */
.auth-shell { min-height: 100vh; background: var(--mud-palette-background); }
.login-grid { display: grid; grid-template-columns: 1.1fr 1fr; min-height: 100vh; }
.login-hero {
    position: relative; color: #fff; padding: 56px 64px; display: flex; flex-direction: column; justify-content: space-between;
    background:
        radial-gradient(700px 420px at 90% 8%, rgba(79, 92, 240, .55), transparent 60%),
        radial-gradient(600px 400px at 0% 100%, rgba(14, 165, 233, .25), transparent 60%),
        linear-gradient(160deg, #0B1220, #111C33);
}
.login-hero::after {
    content: ''; position: absolute; inset: 0; opacity: .07; pointer-events: none;
    background-image: linear-gradient(#fff 1px, transparent 1px), linear-gradient(90deg, #fff 1px, transparent 1px);
    background-size: 44px 44px;
}
.login-hero > * { position: relative; z-index: 1; }
.login-hero h1 { font-size: 2.7rem; line-height: 1.1; font-weight: 800; letter-spacing: -.03em; margin: 0 0 16px; }
.login-hero h1 span { color: #8793FF; }
.login-hero p.lead { font-size: 1.05rem; opacity: .75; max-width: 520px; }
.feature { display: flex; gap: 14px; align-items: flex-start; margin-top: 18px; }
.feature .mud-icon-root { color: #8793FF; margin-top: 2px; }
.feature strong { display: block; font-weight: 600; }
.feature span { opacity: .65; font-size: .88rem; }
.login-panel { display: flex; align-items: center; justify-content: center; padding: 32px; }
.login-card { width: 100%; max-width: 420px; }
.login-card h2 { font-weight: 800; letter-spacing: -.02em; margin: 0 0 6px; }

.center-screen { min-height: 60vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 32px; }

@media (max-width: 960px) {
    .login-grid { grid-template-columns: 1fr; }
    .login-hero { display: none; }
    .search-pill { min-width: 0; }
}

/* ---------- Payslip print ---------- */
.payslip { padding: 8px; }
.payslip-head { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 2px solid var(--brand); padding-bottom: 12px; margin-bottom: 16px; }
.payslip table { width: 100%; border-collapse: collapse; }
.payslip td { padding: 7px 0; border-bottom: 1px dashed var(--card-border); }
.payslip td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.payslip .net td { font-weight: 800; font-size: 1.1rem; border-bottom: none; padding-top: 14px; }

@media print {
    body * { visibility: hidden; }
    .print-area, .print-area * { visibility: visible; }
    .print-area { position: absolute; left: 0; top: 0; width: 100%; color: #000; }
    .no-print { display: none !important; }
}

.toolbar-date { width: 170px; }
.palette-list { max-height: 360px; overflow-y: auto; }
.period-select { min-width: 140px; max-width: 160px; }

/* ---------- BuildX brand ---------- */
.brand-img { height: 38px; width: auto; display: block; }
.brand-name { font-weight: 800; letter-spacing: -.02em; font-size: 1.2rem; }
.brand-x { background: linear-gradient(135deg, #0EA5E9, #4F5CF0 55%, #7C3AED); -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-fill-color: transparent; }
.drawer-footer img { height: 46px; width: auto; display: block; opacity: .92; margin-bottom: 6px; }
.login-brand { display: flex; align-items: center; gap: 14px; font-size: 1.6rem; }
.login-brand img { height: 64px; width: auto; }
.login-brand .brand-name { font-size: 1.9rem; }
.login-credit { display: flex; align-items: center; gap: 14px; opacity: .75; font-size: .8rem; }
.login-credit img { height: 44px; width: auto; }

.company-found { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: .85rem; }
