:root {
    --ink: #17172c;
    --muted: #6f7184;
    --line: #e7e7ef;
    --paper: #ffffff;
    --canvas: #f5f5f9;
    --night: #121326;
    --night-soft: #1d1e37;
    --violet: #6657e8;
    --violet-dark: #5142d2;
    --violet-soft: #efedff;
    --green: #16866f;
    --green-soft: #e9f8f3;
    --amber: #ae6a00;
    --amber-soft: #fff5de;
    --red: #bd3b54;
    --red-soft: #fff0f3;
    --shadow: 0 20px 55px rgba(23, 23, 44, .09);
    --radius: 22px;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--ink);
    background: var(--canvas);
    font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-width: 320px; scroll-behavior: smooth; }
body { margin: 0; background: var(--canvas); color: var(--ink); }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; }
input, select, textarea {
    width: 100%; border: 1px solid #dadae6; border-radius: 12px; background: #fff;
    color: var(--ink); padding: 11px 12px; outline: none; transition: .18s ease;
}
input:focus, select:focus, textarea:focus { border-color: var(--violet); box-shadow: 0 0 0 4px rgba(102, 87, 232, .12); }
textarea { resize: vertical; min-height: 84px; }
label { display: grid; gap: 7px; color: #57596d; font-size: .82rem; font-weight: 750; }
.check { display: flex !important; align-items: flex-start; gap: 9px; font-weight: 650; line-height: 1.45; }
.check input { width: 18px; height: 18px; flex: 0 0 auto; margin: 1px 0 0; accent-color: var(--violet); }
.button {
    display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: 10px 15px;
    border: 1px solid transparent; border-radius: 12px; font-weight: 800; transition: .18s ease; white-space: nowrap;
}
.button.primary { color: #fff; background: var(--violet); box-shadow: 0 9px 24px rgba(102, 87, 232, .2); }
.button.primary:hover { background: var(--violet-dark); transform: translateY(-1px); }
.button.quiet { background: #fff; color: var(--ink); border-color: var(--line); }
.button.quiet:hover { border-color: #cac7ee; background: #fbfaff; }
.eyebrow { margin: 0 0 7px; color: var(--violet); font-size: .72rem; font-weight: 900; letter-spacing: .11em; text-transform: uppercase; }
.alert { margin: 0 0 18px; padding: 13px 15px; border-radius: 14px; font-size: .9rem; font-weight: 700; }
.alert.success { background: var(--green-soft); color: #0b6653; border: 1px solid #cceee4; }
.alert.error { background: var(--red-soft); color: #9f2940; border: 1px solid #f6d0d9; }
.empty { padding: 28px 16px; color: var(--muted); text-align: center; background: #fafafd; border: 1px dashed #dcdce8; border-radius: 15px; }

/* Login */
.login-body { min-height: 100vh; background: var(--night); }
.login-shell {
    min-height: 100vh; display: grid; grid-template-columns: minmax(360px, 600px) minmax(360px, 520px);
    justify-content: center; align-items: center; gap: clamp(40px, 8vw, 120px); padding: 48px;
    background: radial-gradient(circle at 72% 20%, rgba(102, 87, 232, .25), transparent 28%),
                radial-gradient(circle at 20% 90%, rgba(53, 170, 148, .13), transparent 30%), var(--night);
}
.login-card { background: var(--paper); border-radius: 30px; padding: clamp(28px, 5vw, 54px); box-shadow: 0 30px 90px rgba(0, 0, 0, .27); }
.brand { display: flex; align-items: center; gap: 12px; }
.brand > span {
    display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px;
    color: #fff; font-size: 1.3rem; font-weight: 950; background: linear-gradient(145deg, #7669f1, #5748d7);
    box-shadow: 0 8px 20px rgba(102, 87, 232, .26);
}
.brand div { display: grid; gap: 2px; }
.brand strong { font-size: .95rem; }
.brand small { color: var(--muted); font-size: .72rem; }
.login-card > .eyebrow { margin-top: 52px; }
.login-card h1 { margin: 0; max-width: 520px; font-size: clamp(2rem, 4vw, 3.35rem); line-height: 1.03; letter-spacing: -.045em; }
.login-lead { max-width: 500px; margin: 22px 0; color: var(--muted); font-size: 1rem; line-height: 1.7; }
.login-form { display: grid; gap: 14px; margin-top: 24px; }
.login-form .button { margin-top: 4px; min-height: 50px; }
.login-link { display: block; margin-top: 20px; color: var(--muted); font-size: .84rem; font-weight: 700; text-align: center; }
.login-link:hover { color: var(--violet); }
.login-preview { color: #fff; padding: 32px; }
.preview-kpi { padding: 32px; border: 1px solid rgba(255,255,255,.13); border-radius: 26px; background: rgba(255,255,255,.07); backdrop-filter: blur(18px); }
.preview-kpi small, .preview-kpi span { display: block; color: #b9bbd2; }
.preview-kpi strong { display: block; margin: 9px 0; font-size: 4.6rem; line-height: 1; letter-spacing: -.08em; }
.preview-row { display: grid; grid-template-columns: 12px 1fr auto; gap: 13px; align-items: center; padding: 21px 8px; border-bottom: 1px solid rgba(255,255,255,.1); }
.preview-row i { width: 10px; height: 10px; border-radius: 50%; background: #5bd9b2; box-shadow: 0 0 0 5px rgba(91,217,178,.11); }
.preview-row b { font-size: .92rem; }
.preview-row span { color: #b9bbd2; font-size: .78rem; }

/* Main application */
.app-body { min-height: 100vh; }
.sudo-banner { display: flex; gap: 14px; align-items: center; justify-content: center; padding: 9px 18px; background: #fff1c7; color: #6b4800; font-size: .78rem; }
.sudo-banner span { opacity: .8; }
.sudo-banner a { margin-left: 10px; font-weight: 900; text-decoration: underline; }
.app-shell { min-height: 100vh; }
.topbar {
    position: sticky; z-index: 30; top: 0; display: flex; align-items: center; justify-content: space-between;
    min-height: 74px; padding: 13px 26px; color: #fff; background: rgba(18,19,38,.96); backdrop-filter: blur(18px);
}
.app-brand > span { width: 40px; height: 40px; }
.app-brand strong { color: #fff; }
.app-brand small { color: #aeb0c8; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.top-actions a { padding: 9px 12px; border-radius: 10px; color: #dfe0ed; font-size: .78rem; font-weight: 800; }
.top-actions a:hover { color: #fff; background: rgba(255,255,255,.08); }
.top-actions .icon-link { display: grid; place-items: center; width: 38px; height: 38px; padding: 0; border: 1px solid rgba(255,255,255,.13); }
.workspace { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: calc(100vh - 74px); }
.sidebar {
    position: sticky; top: 74px; align-self: start; height: calc(100vh - 74px); padding: 26px 17px;
    color: #d5d6e5; background: var(--night); border-top: 1px solid rgba(255,255,255,.05); overflow: auto;
}
.side-kicker { padding: 0 12px 14px; color: #777b9c; font-size: .65rem; font-weight: 900; letter-spacing: .14em; text-transform: uppercase; }
.sidebar > a { display: grid; grid-template-columns: 25px 1fr auto; gap: 10px; align-items: center; margin: 3px 0; padding: 12px; border-radius: 12px; font-size: .83rem; font-weight: 760; }
.sidebar > a i { color: #8e91ad; font-style: normal; text-align: center; }
.sidebar > a b { display: grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 99px; background: #e6667e; color: #fff; font-size: .67rem; }
.sidebar > a:hover { color: #fff; background: rgba(255,255,255,.055); }
.sidebar > a.active { color: #fff; background: linear-gradient(105deg, rgba(102,87,232,.35), rgba(102,87,232,.13)); }
.sidebar > a.active i { color: #c3bcff; }
.side-note { margin-top: 28px; padding: 15px; border-radius: 15px; background: rgba(255,255,255,.05); }
.side-note small, .side-note span { display: block; color: #8d90ac; font-size: .69rem; line-height: 1.45; }
.side-note strong { display: block; margin: 7px 0; color: #f2f2f8; font-size: .79rem; }
.mobile-tabs { display: none; }
.content { min-width: 0; padding: 30px clamp(20px, 3vw, 48px) 64px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; margin-bottom: 23px; }
.page-head h1 { margin: 0; font-size: clamp(1.8rem, 3vw, 2.55rem); letter-spacing: -.04em; line-height: 1.05; }
.page-head p:not(.eyebrow) { max-width: 700px; margin: 9px 0 0; color: var(--muted); line-height: 1.55; font-size: .9rem; }
.head-total { min-width: 190px; padding: 14px 17px; border-radius: 15px; color: #fff; background: var(--night); }
.head-total small { display: block; color: #afb1c9; }
.head-total strong { display: block; margin-top: 4px; font-size: 1.3rem; }

.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { min-width: 0; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); box-shadow: 0 8px 25px rgba(23,23,44,.035); text-align: left; }
.kpi small, .kpi span { display: block; color: var(--muted); }
.kpi small { font-size: .72rem; font-weight: 800; }
.kpi strong { display: block; margin: 9px 0 6px; font-size: clamp(1.55rem, 3vw, 2.4rem); line-height: 1; letter-spacing: -.045em; overflow-wrap: anywhere; }
.kpi span { font-size: .75rem; }
.kpi.hero-kpi { color: #fff; background: linear-gradient(140deg, #5950d8, #7769ef); border-color: transparent; }
.kpi.hero-kpi small, .kpi.hero-kpi span { color: #e1ddff; }
.kpi.attention { background: var(--amber-soft); border-color: #f1dca7; }
.dashboard-grid, .report-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, .85fr); gap: 18px; margin-bottom: 18px; }
.panel-card { min-width: 0; padding: 21px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); box-shadow: 0 8px 25px rgba(23,23,44,.035); }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 17px; }
.card-head h2 { margin: 0; font-size: 1.08rem; letter-spacing: -.02em; }
.card-head > a, .card-head > span { color: var(--violet); font-size: .76rem; font-weight: 850; }
.staff-list { display: grid; gap: 7px; }
.staff-row { display: grid; grid-template-columns: 38px minmax(100px, 1fr) auto auto; align-items: center; gap: 11px; padding: 11px; border-radius: 15px; background: #f8f8fb; }
.staff-row > div:nth-of-type(1) { min-width: 0; }
.staff-row > div > strong, .staff-row > div > small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.staff-row > div > strong { font-size: .84rem; }
.staff-row > div > small { margin-top: 3px; color: var(--muted); font-size: .68rem; }
.staff-row > b { padding: 6px 9px; border-radius: 99px; color: var(--green); background: var(--green-soft); font-size: .67rem; }
.staff-row.status-islemde > b, .staff-row.status-gorevde > b { color: var(--violet-dark); background: var(--violet-soft); }
.staff-row.status-mesai_disi > b { color: #76788b; background: #ededf2; }
.avatar { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 13px; color: var(--violet-dark); background: var(--violet-soft); font-weight: 900; }
.avatar.large { width: 48px; height: 48px; border-radius: 15px; font-size: 1.12rem; }
.row-actions { display: flex; gap: 5px; }
.row-actions button, .row-actions a, .person-actions button, .person-actions a, .record-link {
    padding: 7px 8px; border: 1px solid var(--line); border-radius: 9px; color: #57596d; background: #fff; font-size: .67rem; font-weight: 800;
}
.row-actions button:hover, .row-actions a:hover, .person-actions button:hover, .person-actions a:hover { color: var(--violet-dark); border-color: #cfcaf4; }
.attention-list { display: grid; gap: 8px; }
.attention-list a { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; padding: 13px 14px; border-radius: 13px; background: #f8f8fb; }
.attention-list span { font-size: .78rem; font-weight: 750; }
.attention-list b { color: var(--violet-dark); font-size: .78rem; }
.approval-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.approval-card { padding: 16px; border-radius: 16px; background: var(--amber-soft); border: 1px solid #f0dca7; }
.approval-card small { color: #8a6427; font-size: .7rem; }
.approval-card h3 { margin: 8px 0 5px; font-size: .95rem; }
.approval-card p { margin: 0 0 12px; color: #6f572f; font-size: .8rem; line-height: 1.5; }
.approval-form { display: grid; grid-template-columns: 1fr auto auto; gap: 7px; }
.approval-form button { border: 0; border-radius: 9px; padding: 8px 10px; font-weight: 800; }
.approval-form button[value="onaylandi"] { background: var(--green); color: #fff; }
.approval-form button[value="reddedildi"] { background: #fff; color: var(--red); border: 1px solid #efcbd3; }

/* Work records and tables */
.filter-bar, .month-form { display: flex; align-items: flex-end; gap: 9px; margin-bottom: 16px; }
.filter-bar label { width: min(210px, 50vw); }
.month-form input { min-width: 160px; }
.month-form button { border: 0; border-radius: 10px; padding: 10px 13px; color: #fff; background: var(--night); font-weight: 800; }
.timeline { display: grid; gap: 12px; }
.timeline-card { display: grid; grid-template-columns: 72px minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 16px 17px; border: 1px solid var(--line); border-radius: 17px; background: #fff; }
.timeline-card > time { align-self: start; padding-top: 3px; color: var(--violet-dark); font-size: 1rem; font-weight: 900; }
.timeline-main { min-width: 0; }
.record-head { display: flex; gap: 7px; align-items: center; }
.record-head .source, .record-head .status { padding: 5px 7px; border-radius: 99px; color: var(--muted); background: #f0f0f6; font-size: .62rem; font-weight: 900; }
.record-head .source { color: var(--violet-dark); background: var(--violet-soft); }
.timeline-main h3 { margin: 8px 0 4px; font-size: .95rem; }
.timeline-main p { margin: 0; color: var(--muted); font-size: .75rem; }
.timeline-actions { display: flex; align-items: center; gap: 7px; }
.record-editor { position: relative; }
.record-editor > summary { padding: 9px 10px; border: 1px solid var(--line); border-radius: 9px; color: var(--violet-dark); background: #fff; font-size: .7rem; font-weight: 850; list-style: none; cursor: pointer; }
.record-editor > summary::-webkit-details-marker { display: none; }
.record-editor > form { position: absolute; z-index: 12; top: 40px; right: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 9px; width: min(440px, calc(100vw - 60px)); padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: #fff; box-shadow: var(--shadow); }
.record-editor > form label:nth-of-type(1), .record-editor > form label:nth-of-type(6), .record-editor > form .check, .record-editor > form button { grid-column: 1 / -1; }
.timeline-day { display: grid; grid-template-columns: 95px minmax(0, 1fr); gap: 14px; align-items: start; }
.timeline-day > time { position: sticky; top: 92px; padding: 12px 0; color: var(--muted); font-size: .76rem; font-weight: 850; }
.timeline-items { display: grid; gap: 8px; }
.record-card { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 15px 17px; border: 1px solid var(--line); border-radius: 16px; background: #fff; }
.record-main { min-width: 0; flex: 1; }
.record-meta { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: .66rem; font-weight: 850; }
.record-meta .source, .record-meta .status { padding: 5px 7px; border-radius: 99px; background: #f0f0f6; }
.record-main h3 { margin: 8px 0 4px; font-size: .93rem; }
.record-main p { margin: 0; color: var(--muted); font-size: .76rem; }
.money-line { display: flex; gap: 12px; margin-top: 8px; font-size: .75rem; }
.money-line span { color: var(--green); }
.inline-actions { display: flex; gap: 6px; align-items: center; }
.inline-actions select { min-width: 130px; padding: 8px 9px; font-size: .72rem; }
.inline-actions button { border: 0; border-radius: 9px; padding: 9px 10px; color: #fff; background: var(--night); font-size: .7rem; font-weight: 850; }
.responsive-table { min-width: 0; overflow: visible; }
.table-head, .table-row { display: grid; grid-template-columns: .85fr 1.55fr 1fr .8fr 1fr .9fr .8fr; gap: 12px; align-items: center; }
.table-head { padding: 10px 14px; color: var(--muted); font-size: .66rem; font-weight: 900; letter-spacing: .04em; text-transform: uppercase; }
.table-row { position: relative; margin-bottom: 7px; padding: 14px; border: 1px solid var(--line); border-radius: 15px; background: #fff; font-size: .76rem; }
.table-row span { min-width: 0; overflow-wrap: anywhere; }
.table-row span > b, .table-row span > small { display: block; }
.table-row span > small { margin-top: 3px; color: var(--muted); font-size: .64rem; }
.table-row em { padding: 6px 8px; border-radius: 99px; color: var(--violet-dark); background: var(--violet-soft); font-size: .65rem; font-style: normal; font-weight: 850; }
.responsive-table.compact .table-head, .responsive-table.compact .table-row { grid-template-columns: 1.3fr .65fr 1fr .85fr .85fr 1fr; }
.edit-pop { position: relative; }
.edit-pop summary { color: var(--violet-dark); font-weight: 850; cursor: pointer; list-style: none; }
.edit-pop summary::-webkit-details-marker { display: none; }
.edit-pop form { position: absolute; z-index: 8; right: 0; top: 28px; display: grid; gap: 9px; width: 270px; padding: 15px; border: 1px solid var(--line); border-radius: 15px; background: #fff; box-shadow: var(--shadow); }

/* Personnel, commission and reports */
.personnel-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.person-card { min-width: 0; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.person-head { display: flex; align-items: center; gap: 12px; }
.person-head h2 { margin: 0; font-size: 1rem; }
.person-head p { margin: 4px 0 0; color: var(--muted); font-size: .74rem; }
.mini-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(78px, 1fr)); gap: 7px; margin: 16px 0; }
.mini-kpis span { min-width: 0; padding: 10px 7px; border-radius: 12px; color: var(--muted); background: #f8f8fb; font-size: .62rem; text-align: center; }
.mini-kpis b { display: block; margin-bottom: 3px; color: var(--ink); font-size: .77rem; overflow-wrap: anywhere; }
.person-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.person-actions > * { text-align: center; }
.person-card details { margin-top: 13px; padding-top: 12px; border-top: 1px solid var(--line); }
.person-card summary { color: var(--violet-dark); font-size: .75rem; font-weight: 850; cursor: pointer; }
.person-card details form, .person-card details > label { margin-top: 11px; }
.private-note { margin-top: 9px; padding: 10px 12px; border-radius: 11px; background: #fff8e9; }
.private-note small { color: #9a762f; font-size: .64rem; }
.private-note p { margin: 4px 0 0; font-size: .73rem; line-height: 1.45; }
.commission-list { display: grid; gap: 11px; }
.commission-card { display: grid; grid-template-columns: minmax(170px, .9fr) minmax(310px, 1.25fr) minmax(310px, 1fr); gap: 18px; align-items: center; padding: 17px; border: 1px solid var(--line); border-radius: 17px; background: #fff; }
.commission-card h3 { margin: 5px 0; font-size: .9rem; }
.commission-card p, .commission-card small { margin: 0; color: var(--muted); font-size: .7rem; }
.commission-values { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.commission-values span { padding: 10px; border-radius: 11px; background: #f7f7fb; }
.commission-values b { display: block; margin-top: 4px; font-size: .84rem; }
.commission-form { display: grid; grid-template-columns: .7fr 1fr; gap: 7px; align-items: end; }
.commission-form .check, .commission-form button { grid-column: span 2; }
.report-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.bar-list { display: grid; gap: 13px; }
.bar-list > div { display: grid; grid-template-columns: 100px 1fr 30px; gap: 10px; align-items: center; font-size: .72rem; }
.bar-list i { position: relative; height: 9px; border-radius: 99px; background: #eeeeF5; overflow: hidden; }
.bar-list i::after { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--w); border-radius: inherit; background: linear-gradient(90deg, var(--violet), #9a8fff); }
.bar-list b { text-align: right; }
.funnel-list { display: grid; gap: 6px; }
.funnel-list div { display: flex; justify-content: space-between; gap: 18px; padding: 11px 13px; border-radius: 11px; background: #f8f8fb; font-size: .76rem; }
.assistant-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.assistant-card { display: flex; min-height: 150px; flex-direction: column; align-items: flex-start; padding: 18px; border: 1px solid var(--line); border-radius: 18px; background: #fff; }
.assistant-card.urgent { border-color: #f0d79c; background: var(--amber-soft); }
.assistant-card span { color: var(--muted); font-size: .7rem; font-weight: 850; }
.assistant-card strong { margin: 12px 0; font-size: 1rem; line-height: 1.35; }
.assistant-card a, .assistant-card button { margin-top: auto; padding: 0; border: 0; color: var(--violet-dark); background: none; font-size: .74rem; font-weight: 850; }
.reminder-list { display: grid; gap: 8px; }
.reminder-list article { display: grid; grid-template-columns: 130px 1fr auto; gap: 16px; align-items: start; padding: 13px; border-radius: 13px; background: #f8f8fb; }
.reminder-list time, .reminder-list em { color: var(--muted); font-size: .69rem; font-style: normal; }
.reminder-list strong { font-size: .84rem; }
.reminder-list p { margin: 4px 0 0; color: var(--muted); font-size: .73rem; }

/* Modal */
.modal[hidden] { display: none; }
.modal { position: fixed; z-index: 100; inset: 0; display: grid; place-items: center; padding: 20px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(12,13,28,.72); backdrop-filter: blur(5px); }
.modal-card { position: relative; width: min(760px, 100%); max-height: calc(100vh - 40px); overflow: auto; border-radius: 24px; background: #fff; box-shadow: 0 30px 90px rgba(0,0,0,.3); }
.modal-card header { position: sticky; z-index: 2; top: 0; display: flex; justify-content: space-between; align-items: flex-start; padding: 20px 22px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.97); }
.modal-card h2 { margin: 0; font-size: 1.25rem; }
.modal-card header > button { display: grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 10px; color: var(--muted); background: #f1f1f6; font-size: 1.3rem; }
.task-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; padding: 22px; }
.task-form .wide, .task-form footer { grid-column: 1 / -1; }
.task-form footer { position: sticky; bottom: -22px; display: flex; justify-content: flex-end; gap: 8px; margin: 3px -22px -22px; padding: 15px 22px; border-top: 1px solid var(--line); background: rgba(255,255,255,.97); }
body.modal-open { overflow: hidden; }

/* Personnel portal */
.employee-body { min-height: 100vh; background: #f3f3f8; }
.employee-shell { width: min(760px, 100%); min-height: 100vh; margin: 0 auto; padding: 0 18px 50px; }
.employee-top { display: flex; justify-content: space-between; align-items: center; margin: 0 -18px 20px; padding: 16px 18px; color: #fff; background: var(--night); }
.employee-top .brand strong { color: #fff; }
.employee-top .brand small { color: #b5b7cb; }
.employee-top > a { padding: 8px 10px; border: 1px solid rgba(255,255,255,.13); border-radius: 9px; color: #d9dbea; font-size: .72rem; font-weight: 800; }
.employee-hero { padding: 6px 0 19px; }
.employee-hero h1 { margin: 0; font-size: 1.8rem; letter-spacing: -.04em; }
.employee-hero p { margin: 7px 0 0; color: var(--muted); font-size: .86rem; line-height: 1.5; }
.employee-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin-bottom: 18px; }
.employee-summary article { padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: #fff; }
.employee-summary small { display: block; color: var(--muted); font-size: .65rem; }
.employee-summary strong { display: block; margin-top: 6px; font-size: 1.1rem; overflow-wrap: anywhere; }
.employee-tabs { display: flex; gap: 7px; margin-bottom: 14px; overflow-x: auto; scrollbar-width: none; }
.employee-tabs::-webkit-scrollbar { display: none; }
.employee-tabs a { flex: 0 0 auto; padding: 9px 12px; border: 1px solid var(--line); border-radius: 99px; color: var(--muted); background: #fff; font-size: .72rem; font-weight: 850; }
.employee-tabs a.active { color: #fff; background: var(--violet); border-color: var(--violet); }
.employee-list { display: grid; gap: 10px; }
.employee-task { padding: 16px; border: 1px solid var(--line); border-radius: 18px; background: #fff; }
.employee-task-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.employee-task-top time { color: var(--violet-dark); font-size: .76rem; font-weight: 900; }
.employee-task-top span { padding: 5px 8px; border-radius: 99px; color: var(--muted); background: #f0f0f5; font-size: .64rem; font-weight: 850; }
.employee-task h2 { margin: 12px 0 5px; font-size: 1rem; }
.employee-task p { margin: 0; color: var(--muted); font-size: .78rem; line-height: 1.55; }
.employee-task .task-detail { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: 11px; color: #585a6c; font-size: .7rem; }
.employee-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 14px; padding-top: 13px; border-top: 1px solid var(--line); }
.employee-actions button, .employee-actions summary { padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: #fff; font-size: .7rem; font-weight: 850; list-style: none; cursor: pointer; }
.employee-actions button.primary-action { color: #fff; background: var(--violet); border-color: var(--violet); }
.employee-actions details { flex: 1 1 100%; }
.employee-actions details form { display: grid; gap: 8px; margin-top: 9px; padding: 12px; border-radius: 12px; background: #f7f7fb; }
.approval-history { display: grid; gap: 9px; }
.approval-history article { padding: 14px; border: 1px solid var(--line); border-radius: 15px; background: #fff; }
.approval-history small { color: var(--muted); font-size: .67rem; }
.approval-history h3 { margin: 6px 0; font-size: .88rem; }
.approval-history p { margin: 0; color: var(--muted); font-size: .74rem; line-height: 1.5; }
.approval-history .decision { margin-top: 8px; color: var(--violet-dark); font-weight: 800; }
.notification-card { margin: 15px 0; padding: 15px; border-radius: 16px; color: #e8e8f3; background: var(--night-soft); }
.notification-card strong { display: block; font-size: .82rem; }
.notification-card p { margin: 6px 0; color: #b4b6ce; font-size: .72rem; line-height: 1.5; }
.notification-card code { display: block; padding: 8px; border-radius: 9px; color: #d9d4ff; background: rgba(255,255,255,.07); font-size: .68rem; overflow-wrap: anywhere; }

@media (max-width: 1120px) {
    .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .assistant-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .commission-card { grid-template-columns: minmax(150px, .75fr) 1.2fr; }
    .commission-form { grid-column: 1 / -1; }
    .table-head, .table-row { grid-template-columns: .8fr 1.35fr .9fr .75fr 1fr .8fr .8fr; gap: 8px; }
}

@media (max-width: 860px) {
    .login-shell { grid-template-columns: minmax(0, 560px); padding: 24px; }
    .login-preview { display: none; }
    .workspace { display: block; }
    .sidebar { display: none; }
    .mobile-tabs { position: sticky; z-index: 25; top: 66px; display: block; padding: 9px 14px; background: rgba(245,245,249,.94); backdrop-filter: blur(15px); border-bottom: 1px solid var(--line); }
    .mobile-tabs select { padding: 10px 12px; background: #fff; font-weight: 800; }
    .topbar { min-height: 66px; padding: 10px 14px; }
    .top-actions a:not(.icon-link) { display: none; }
    .content { padding: 24px 16px 54px; }
    .dashboard-grid, .report-grid { grid-template-columns: 1fr; }
    .personnel-grid { grid-template-columns: 1fr; }
    .approval-grid { grid-template-columns: 1fr; }
    .staff-row { grid-template-columns: 38px minmax(100px, 1fr) auto; }
    .staff-row .row-actions { grid-column: 1 / -1; padding-left: 49px; }
    .responsive-table:not(.compact) .table-head, .responsive-table.compact .table-head { display: none; }
    .responsive-table:not(.compact) .table-row, .responsive-table.compact .table-row {
        display: grid; grid-template-columns: 1fr 1fr; gap: 11px 18px; padding: 15px;
    }
    .table-row span::before { content: attr(data-label); display: block; margin-bottom: 4px; color: #9294a5; font-size: .58rem; font-weight: 900; letter-spacing: .05em; text-transform: uppercase; }
    .edit-pop form { right: auto; left: 0; width: min(280px, calc(100vw - 64px)); }
    .timeline-day { grid-template-columns: 1fr; gap: 4px; }
    .timeline-day > time { position: static; padding: 8px 4px 3px; }
    .record-card { align-items: flex-start; flex-direction: column; }
    .timeline-card { grid-template-columns: 58px minmax(0, 1fr); align-items: start; }
    .timeline-actions { grid-column: 1 / -1; padding-left: 74px; }
    .inline-actions { width: 100%; }
    .inline-actions select { flex: 1; }
}

@media (max-width: 580px) {
    .sudo-banner { align-items: flex-start; flex-wrap: wrap; justify-content: flex-start; }
    .sudo-banner span { width: 100%; order: 3; }
    .app-brand strong { max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .app-brand small { font-size: .63rem; }
    .page-head { align-items: stretch; flex-direction: column; gap: 14px; }
    .page-head .button, .page-head > button { width: 100%; }
    .kpi-grid, .report-kpis { grid-template-columns: 1fr 1fr; gap: 9px; }
    .kpi { padding: 15px; border-radius: 17px; }
    .kpi strong { font-size: 1.42rem; }
    .panel-card { padding: 16px; border-radius: 18px; }
    .card-head { gap: 10px; }
    .staff-row { grid-template-columns: 36px 1fr; }
    .staff-row > b { justify-self: start; margin-left: 47px; }
    .staff-row .row-actions { padding-left: 47px; flex-wrap: wrap; }
    .approval-form { grid-template-columns: 1fr 1fr; }
    .approval-form input { grid-column: 1 / -1; }
    .person-actions { grid-template-columns: 1fr; }
    .mini-kpis { grid-template-columns: 1fr 1fr; }
    .commission-card { grid-template-columns: 1fr; }
    .commission-values { grid-template-columns: 1fr 1fr 1fr; }
    .commission-form { grid-template-columns: 1fr; }
    .commission-form .check, .commission-form button { grid-column: auto; }
    .assistant-grid { grid-template-columns: 1fr; }
    .assistant-card { min-height: 125px; }
    .reminder-list article { grid-template-columns: 1fr; gap: 6px; }
    .task-form { grid-template-columns: 1fr; padding: 17px; }
    .timeline-card { grid-template-columns: 1fr; gap: 8px; }
    .timeline-card > time { padding: 0; }
    .timeline-actions { padding-left: 0; flex-wrap: wrap; }
    .record-editor { flex: 1; }
    .record-editor > summary { text-align: center; }
    .record-editor > form { position: fixed; z-index: 90; inset: auto 10px 10px; grid-template-columns: 1fr; width: auto; max-height: 82vh; overflow: auto; }
    .record-editor > form label:nth-of-type(1), .record-editor > form label:nth-of-type(6), .record-editor > form .check, .record-editor > form button { grid-column: auto; }
    .task-form .wide, .task-form footer { grid-column: auto; }
    .task-form footer { margin: 3px -17px -17px; padding: 13px 17px; }
    .task-form footer .button { flex: 1; }
    .modal { padding: 0; align-items: end; }
    .modal-card { width: 100%; max-height: 92vh; border-radius: 23px 23px 0 0; }
    .responsive-table:not(.compact) .table-row, .responsive-table.compact .table-row { grid-template-columns: 1fr; }
    .employee-shell { padding-left: 13px; padding-right: 13px; }
    .employee-top { margin-left: -13px; margin-right: -13px; padding-left: 13px; padding-right: 13px; }
    .employee-summary { grid-template-columns: 1fr 1fr; }
    .employee-summary article:last-child { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
