/* ==========================================================
   Nöbet Planlayıcı — tasarım sistemi
   ========================================================== */
:root {
    --bg: #f4f6f9;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --line: #e3e8ef;
    --line-strong: #cbd5e1;
    --ink: #0f172a;
    --ink-2: #334155;
    --muted: #64748b;
    --faint: #94a3b8;

    --primary: #1d4ed8;
    --primary-hover: #1e40af;
    --primary-soft: #eff4ff;
    --brand: #dc2626;

    --role-sorumlu: #4f46e5;
    --role-saglik: #0d9488;
    --role-surucu: #d97706;

    --leave: #2563eb;
    --leave-soft: #dbeafe;
    --unwanted: #e11d48;
    --unwanted-soft: #ffe4e6;
    --training: #7c3aed;
    --training-soft: #ede9fe;
    --external: #0d9488;
    --wanted: #16a34a;
    --wanted-soft: #dcfce7;
    --external-soft: #ccfbf1;

    --error: #dc2626;
    --error-soft: #fef2f2;
    --warn: #d97706;
    --warn-soft: #fffbeb;
    --ok: #16a34a;
    --ok-soft: #f0fdf4;

    --weekend: #f1f5f9;
    --holiday: #fff1f2;

    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 1px 3px rgba(15, 23, 42, .04);
    --shadow-lg: 0 20px 45px -12px rgba(15, 23, 42, .35);
    --topbar-h: 64px;
    --tabs-h: 48px;
    --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
    font: 14px/1.45 var(--font);
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
h2, h3 { margin: 0; }
[hidden] { display: none !important; }

.ico {
    width: 16px; height: 16px; flex: none;
    fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.ico.rot90 { transform: rotate(90deg); }

.muted { color: var(--muted); margin: 2px 0 0; }
.small { font-size: 12.5px; }

/* ---------- Butonlar ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    height: 36px; padding: 0 14px;
    border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
    background: var(--surface); color: var(--ink-2);
    font-weight: 600; font-size: 13.5px; cursor: pointer; white-space: nowrap;
    transition: background .15s, border-color .15s, box-shadow .15s, transform .05s;
}
.btn:hover { background: var(--surface-2); border-color: var(--faint); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn:focus-visible, .icon-btn:focus-visible, .chip:focus-visible, .seg:focus-visible, .tab:focus-visible {
    outline: 2px solid var(--primary); outline-offset: 2px;
}
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 1px 2px rgba(29, 78, 216, .3); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-danger { background: var(--error); border-color: var(--error); color: #fff; }
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: rgba(15, 23, 42, .05); border-color: transparent; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.danger-text { color: var(--error) !important; }

.icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border-radius: var(--radius-sm);
    border: 1px solid transparent; background: transparent; color: var(--ink-2); cursor: pointer;
}
.icon-btn:hover:not(:disabled) { background: rgba(15, 23, 42, .06); }
.icon-btn:disabled { opacity: .35; cursor: default; }
.icon-btn .ico { width: 18px; height: 18px; }
.icon-btn.sm { width: 30px; height: 30px; }
.icon-btn.sm .ico { width: 15px; height: 15px; }

.link-btn { background: none; border: 0; padding: 4px 0; color: var(--primary); font-weight: 600; font-size: 12.5px; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }

.x-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 20px; height: 20px; border-radius: 6px; border: 0; background: transparent; color: var(--faint); cursor: pointer;
}
.x-btn:hover { background: var(--error-soft); color: var(--error); }
.x-btn .ico { width: 13px; height: 13px; }

/* ---------- Üst çubuk ---------- */
.topbar {
    position: sticky; top: 0; z-index: 50;
    height: var(--topbar-h);
    display: flex; align-items: center; gap: 16px;
    padding: 0 20px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; flex: 1; }
/* Uygulama simgesiyle aynı (çizelge önünde ambulans) */
.brand-mark { width: 38px; height: 38px; flex: none; display: block; filter: drop-shadow(0 2px 4px rgba(220, 38, 38, .3)); }
.brand-title { font-weight: 700; font-size: 15.5px; letter-spacing: -.01em; }
.brand-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 320px; }

.month-nav { display: flex; align-items: center; gap: 4px; }
.month-picker { display: flex; gap: 0; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); }
.month-picker select {
    border: 0; background: transparent; height: 34px; padding: 0 8px 0 12px;
    font-weight: 700; font-size: 15px; cursor: pointer; outline: none;
}
.month-picker select + select { border-left: 1px solid var(--line); padding-left: 10px; }
.month-picker select:focus-visible { background: var(--primary-soft); }

.top-actions { display: flex; align-items: center; gap: 6px; flex: 1; justify-content: flex-end; }
.divider { width: 1px; height: 24px; background: var(--line); margin: 0 4px; }

.menu { position: relative; }
.menu-list {
    position: absolute; right: 0; top: calc(100% + 6px); min-width: 250px;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow-lg); padding: 6px;
    opacity: 0; transform: translateY(-4px); pointer-events: none; transition: .12s;
}
.menu.open .menu-list { opacity: 1; transform: none; pointer-events: auto; }
.menu-list button {
    display: flex; align-items: center; gap: 10px; width: 100%;
    padding: 9px 10px; border: 0; background: none; border-radius: 7px; text-align: left; cursor: pointer; font-size: 13.5px;
}
.menu-list button:hover { background: var(--surface-2); }
.menu-list button.danger { color: var(--error); }
.menu-list hr { border: 0; border-top: 1px solid var(--line); margin: 5px 2px; }

/* ---------- Sekmeler ---------- */
.tabs {
    position: sticky; top: var(--topbar-h); z-index: 40;
    height: var(--tabs-h);
    display: flex; align-items: stretch; gap: 4px;
    padding: 0 20px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}
.tab {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 0 12px; border: 0; background: none; cursor: pointer;
    color: var(--muted); font-weight: 600; font-size: 13.5px;
    border-bottom: 2px solid transparent; margin-bottom: -1px;
}
@media (hover: hover) { .tab:hover { color: var(--ink); } }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-badge:empty { display: none; }
.tab-badge {
    min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
    display: inline-grid; place-items: center;
    background: var(--weekend); color: var(--ink-2); font-size: 11.5px; font-weight: 700;
}
.tab-badge.badge-error { background: var(--error); color: #fff; }
.tabs-spacer { flex: 1; }
.save-state {
    align-self: center; display: inline-flex; align-items: center; gap: 6px;
    font-size: 12.5px; color: var(--ok); opacity: 0; transition: opacity .3s;
}
.save-state.show { opacity: 1; }
.save-state.error { color: var(--error); }
.file-state {
    align-self: center; display: inline-flex; align-items: center; gap: 6px; margin-left: 10px;
    height: 28px; padding: 0 10px; border-radius: 999px; border: 1px solid transparent;
    font-size: 12.5px; font-weight: 600; background: transparent; cursor: pointer; white-space: nowrap;
}
.file-state .ico { width: 14px; height: 14px; }
.file-state.ok { color: var(--muted); font-weight: 500; cursor: default; }
.file-state.warn { color: var(--warn); background: var(--warn-soft); border-color: #fcd9a5; }
.file-state.error { color: var(--error); background: var(--error-soft); border-color: #fecaca; }
.file-state.warn:hover, .file-state.error:hover { filter: brightness(.97); }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 12px; }

main { padding: 20px; max-width: 1680px; margin: 0 auto; }

/* ---------- Kart ---------- */
.card {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 16px;
}
.card.subtle { background: var(--surface-2); box-shadow: none; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.card-head h2 { font-size: 17px; letter-spacing: -.01em; }
.card-title {
    display: flex; align-items: center; gap: 8px;
    font-weight: 700; font-size: 13.5px; margin-bottom: 10px;
}
.card-title .pill-group, .card-title .link-btn { margin-left: auto; }

.pill-group { display: inline-flex; gap: 5px; }
.pill { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 11px; font-size: 11.5px; font-weight: 700; background: var(--weekend); color: var(--ink-2); }
.pill-error { background: var(--error-soft); color: var(--error); }
.pill-warn { background: var(--warn-soft); color: #b45309; }

.mini-tag { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 6px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.tag-leave { background: var(--leave-soft); color: var(--leave); }
.tag-unwanted { background: var(--unwanted-soft); color: var(--unwanted); }
.tag-training { background: var(--training-soft); color: var(--training); }
.tag-isci { background: #ffedd5; color: #9a3412; }
.tag-memur { background: #e0f2fe; color: #075985; }
.tag-12 { background: #e0e7ff; color: #3730a3; }
.t-pos { color: #15803d; }
.t-neg { color: #b91c1c; }

.callout {
    display: flex; align-items: center; gap: 14px;
    padding: 14px 16px; border-radius: var(--radius-sm); margin-bottom: 14px;
}
.callout > .ico { width: 22px; height: 22px; }
.callout p { margin: 2px 0 0; color: var(--ink-2); }
.callout > div { flex: 1; }
.callout-info { background: var(--primary-soft); border: 1px solid #c7d7fe; color: var(--primary); }
.callout-info b { color: var(--ink); }
.callout-error { background: var(--error-soft); border: 1px solid #fecaca; color: var(--error); margin: 12px 0 0; }

.empty-note { padding: 14px; text-align: center; color: var(--muted); font-size: 13px; background: var(--surface-2); border-radius: var(--radius-sm); }

/* Görev renk noktaları */
.role-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: none; }
.role-sorumlu { --role: var(--role-sorumlu); }
.role-saglik { --role: var(--role-saglik); }
.role-surucu { --role: var(--role-surucu); }
.role-dot { background: var(--role); }
.role-dots { display: inline-flex; gap: 3px; }

/* ==========================================================
   Çizelge görünümü
   ========================================================== */
.roster-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; align-items: start; }
.side { display: flex; flex-direction: column; gap: 16px; position: sticky; top: calc(var(--topbar-h) + var(--tabs-h) + 20px); }

.fill-meter { min-width: 190px; }
.fill-meter-num { font-size: 12.5px; color: var(--muted); margin-bottom: 5px; text-align: right; }
.fill-meter-num b { color: var(--ink); font-size: 15px; }
.meter { height: 6px; border-radius: 3px; background: var(--weekend); overflow: hidden; }
.meter span { display: block; height: 100%; background: linear-gradient(90deg, #3b82f6, var(--primary)); border-radius: 3px; transition: width .3s; }

.roster-card { padding: 16px 16px 6px; }
.table-wrap { margin: 0 -16px; }
table.roster { width: 100%; border-collapse: separate; border-spacing: 0; }
table.roster thead th {
    position: sticky; top: calc(var(--topbar-h) + var(--tabs-h)); z-index: 5;
    background: var(--surface-2); color: var(--muted);
    font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
    text-align: left; padding: 9px 10px;
    border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
table.roster thead th .role-dot { margin-right: 7px; vertical-align: 1px; }
table.roster th.c-date { width: 190px; padding-left: 16px; }
table.roster td { border-bottom: 1px solid var(--line); padding: 3px 6px; vertical-align: middle; }
table.roster td.c-date { padding: 5px 10px 5px 16px; border-left: 3px solid transparent; }
table.roster tr:last-child td { border-bottom: 0; }

tr.r-weekend td { background: var(--weekend); }
tr.r-holiday td { background: var(--holiday); }
tr.r-half td { background: #fffbeb; }
tr.r-today td.c-date { border-left-color: var(--primary); }
tr.flash td { animation: flash 1.4s ease-out; }
@keyframes flash { 0%, 30% { background: #fef9c3; } 100% { } }

.c-date { white-space: nowrap; }
.c-date .date { display: inline-flex; align-items: baseline; gap: 8px; min-width: 104px; }
.date-num { font-weight: 800; font-size: 16px; width: 22px; text-align: right; font-variant-numeric: tabular-nums; }
.date-name { color: var(--ink-2); font-size: 13px; }
.date-short { display: none; }
.date-name em { font-style: normal; font-size: 10.5px; font-weight: 700; color: var(--primary); background: var(--primary-soft); padding: 1px 5px; border-radius: 4px; margin-left: 3px; }
tr.r-weekend .date-name, tr.r-holiday .date-name { font-weight: 700; }
tr.r-holiday .date-num, tr.r-holiday .date-name { color: #be123c; }

.daytype {
    border: 0; background: none; padding: 1px 6px; border-radius: 5px; margin-left: 2px;
    font-size: 11px; font-weight: 600; cursor: pointer; max-width: 120px;
    overflow: hidden; text-overflow: ellipsis; vertical-align: 1px;
}
.daytype.t-work { color: var(--faint); opacity: 0; }
tr:hover .daytype.t-work, .daytype.t-work:focus-visible { opacity: 1; }
.daytype.t-work:hover { background: var(--holiday); color: #be123c; }
.daytype.t-weekend { color: var(--muted); }
.daytype.t-weekend:hover { background: var(--holiday); color: #be123c; }
.daytype.t-holiday { background: #fecdd3; color: #9f1239; }
.daytype.t-holiday:hover { text-decoration: line-through; }
.daytype.t-half { background: #fde68a; color: #92400e; max-width: 190px; }
.daytype.t-half:hover { text-decoration: line-through; }
th.m-day.half { background: #fef3c7; }
.stat-extra { display: block; font-size: 10.5px; font-weight: 600; color: #b45309; line-height: 1.2; white-space: nowrap; }
.holiday-list li.half .hl-name { color: #92400e; }
.half-tag { font-size: 10.5px; font-weight: 700; background: #fde68a; color: #92400e; padding: 1px 5px; border-radius: 4px; }

.c-cell .cell { position: relative; display: flex; align-items: center; }
select.assign {
    width: 100%; height: 34px; padding: 0 30px 0 10px;
    border: 1px solid transparent; border-radius: 7px;
    background: transparent; cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--ink);
    appearance: none; -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 9px center; background-size: 14px;
    text-overflow: ellipsis;
}
select.assign:hover { background-color: rgba(255, 255, 255, .85); border-color: var(--line-strong); }
select.assign:focus { outline: none; border-color: var(--primary); background-color: #fff; box-shadow: 0 0 0 3px rgba(29, 78, 216, .15); }
select.assign option { font-weight: 500; color: var(--ink); }
select.assign optgroup { font-style: normal; color: var(--muted); }
.cell.is-empty select.assign { color: var(--faint); font-weight: 500; }
.cell.is-external select.assign { border: 1px dashed var(--external); background-color: var(--external-soft); font-style: italic; }
.cell.is-empty { background: repeating-linear-gradient(-45deg, transparent 0 6px, rgba(148, 163, 184, .08) 6px 12px); border-radius: 7px; }

.cell.sev-error select.assign { border-color: #fca5a5; background-color: var(--error-soft); color: #991b1b; }
.cell.sev-warn select.assign { border-color: #fcd34d; background-color: var(--warn-soft); }
.flag { position: absolute; right: 28px; display: inline-flex; pointer-events: auto; cursor: help; }
.flag .ico { width: 15px; height: 15px; }
.flag-error { color: var(--error); }
.flag-warn { color: var(--warn); }
.flag-info { color: var(--faint); }

table.roster.has-hl .cell:not(.hl) select.assign { opacity: .45; }
.cell.hl select.assign { background-color: #fef3c7; border-color: #f59e0b; opacity: 1; box-shadow: 0 0 0 2px rgba(245, 158, 11, .2); }

/* 12 saatlik vardiya: gündüz / gece olarak bölünmüş hücre */
.c-cell.is-split { padding-top: 3px; padding-bottom: 3px; }
.cell.half { gap: 5px; padding-left: 2px; }
.cell.half + .cell.half { margin-top: 2px; }
.cell.half select.assign { height: 27px; font-size: 12.5px; padding-left: 6px; }
.part-tag {
    display: inline-grid; place-items: center; flex: none; width: 18px; height: 18px;
    border-radius: 5px; font-size: 10.5px; font-weight: 800; line-height: 1;
}
.part-g { background: #fef3c7; color: #b45309; }
.part-a, .part-b, .part-c, .part-ab, .part-bc { width: auto; padding: 0 4px; background: #dcfce7; color: #166534; }
.part-ab, .part-bc { background: #bbf7d0; }
.c-cell.is-eight .cell.half select.assign { height: 24px; font-size: 12px; }
.tag-8 { background: #dcfce7; color: #166534; }
.shift-mark.half-a, .shift-mark.half-b, .shift-mark.half-c, .shift-mark.half-ab, .shift-mark.half-bc { border-radius: 2px; }
.part-n { background: #e0e7ff; color: #3730a3; }
.shift-legend { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.shift-legend .ico { width: 14px; height: 14px; }

/* Yan panel */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stat { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 10px; }
.stat span { display: block; font-size: 11px; color: var(--muted); }
.stat b { font-size: 18px; font-variant-numeric: tabular-nums; }
.stat-wide {
    margin-top: 8px; padding: 10px 12px; border-radius: var(--radius-sm);
    background: linear-gradient(135deg, #1e3a8a, var(--primary)); color: #fff;
    display: grid; grid-template-columns: 1fr auto; align-items: center; row-gap: 2px;
}
.stat-wide span { font-size: 12px; opacity: .9; }
.stat-wide b { font-size: 20px; grid-row: span 2; }
.stat-wide small { font-size: 11px; opacity: .75; }
.stat-wide.alt { background: linear-gradient(135deg, #7c2d12, #c2410c); }

.all-good { display: flex; gap: 10px; align-items: center; padding: 12px; border-radius: var(--radius-sm); background: var(--ok-soft); color: var(--ok); }
.all-good .ico { width: 22px; height: 22px; }
.all-good b { display: block; color: #166534; }
.all-good span { font-size: 12.5px; color: #15803d; }

.issue-list { display: flex; flex-direction: column; gap: 4px; max-height: 300px; overflow: hidden; position: relative; }
.issue-list.expanded { max-height: 420px; overflow-y: auto; }
.issue {
    display: flex; gap: 9px; align-items: flex-start; text-align: left;
    padding: 7px 9px; border-radius: 7px; border: 1px solid transparent; cursor: pointer; width: 100%;
}
.issue .ico { margin-top: 2px; }
.issue.lvl-error { background: var(--error-soft); color: var(--error); }
.issue.lvl-warn { background: var(--warn-soft); color: var(--warn); }
.issue:hover { border-color: currentColor; }
.issue-main { display: flex; flex-direction: column; min-width: 0; }
.issue-where { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; opacity: .85; }
.issue-msg { font-size: 12.5px; color: var(--ink-2); }

table.hours { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.hours th { text-align: left; font-size: 11px; color: var(--muted); font-weight: 700; padding: 6px 4px; border-bottom: 1px solid var(--line); }
table.hours th:not(:first-child), table.hours td.num { text-align: right; }
table.hours td { padding: 5px 4px; border-bottom: 1px solid var(--line); vertical-align: middle; font-variant-numeric: tabular-nums; }
table.hours tr:last-child td { border-bottom: 0; }
table.hours td small { color: var(--faint); font-size: 11px; }
table.hours tr.is-hl td { background: #fffbeb; }
.person-btn { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; border: 0; background: none; padding: 0; cursor: pointer; text-align: left; max-width: 100%; }
/* Etiketler ismin altında ayrı satırda: dar panelde isim kesilmesin, etiket sayılara taşmasın */
.person-tags { display: flex; flex-wrap: wrap; gap: 3px; flex-basis: 100%; }
.person-tags:empty, .person-tags:not(:has(*)) { display: none; }
.person-tags .mini-tag { height: 17px; padding: 0 5px; font-size: 10.5px; }
.person-btn:hover .person-name { color: var(--primary); text-decoration: underline; }
.person-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar { height: 3px; background: var(--weekend); border-radius: 2px; margin-top: 4px; max-width: 160px; }
.bar span { display: block; height: 100%; background: #93c5fd; border-radius: 2px; }
.fm { display: inline-block; min-width: 38px; text-align: center; padding: 1px 6px; border-radius: 5px; font-weight: 700; background: var(--weekend); color: var(--muted); }
.fm-pos { background: #dcfce7; color: #15803d; }
.fm-neg { background: #fee2e2; color: #b91c1c; }
.foot-note { margin: 10px 0 0; font-size: 11.5px; color: var(--muted); }

/* ==========================================================
   İzin & Tercihler (matris)
   ========================================================== */
.head-stats { display: flex; gap: 6px; }
.brushbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.segmented { display: inline-flex; padding: 3px; background: var(--weekend); border-radius: 10px; gap: 2px; }
.seg {
    display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 13px;
    border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-weight: 600; font-size: 13px; cursor: pointer;
}
.seg:hover { color: var(--ink); }
.seg.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.seg-leave.active .ico { color: var(--leave); }
.seg-unwanted.active .ico { color: var(--unwanted); }
.seg-training.active .ico { color: var(--training); }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); flex: 1; flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.lg { width: 14px; height: 14px; border-radius: 4px; border: 1px solid var(--line-strong); position: relative; }
.lg-shift::after { content: ""; position: absolute; inset: 3px; border-radius: 50%; background: var(--ink-2); }
.lg-conflict { border: 2px solid var(--error); background: var(--unwanted-soft); }
.lg-off { background: var(--weekend); }
.lg-pretrain { background: repeating-linear-gradient(-45deg, var(--training-soft) 0 3px, #fff 3px 6px); border-color: #c4b5fd; }

.matrix-wrap {
    overflow: auto; margin: 0 -16px -16px; border-top: 1px solid var(--line);
    /* Tablo kendi içinde iki yönde kayar: tarih satırı üstte, isim sütunu solda sabit kalır */
    max-height: calc(100vh - var(--topbar-h) - var(--tabs-h) - 16px); overscroll-behavior: contain;
}
table.matrix { border-collapse: separate; border-spacing: 0; font-size: 12px; min-width: 100%; }
table.matrix th, table.matrix td { border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); }
table.matrix thead th { background: var(--surface-2); position: sticky; top: 0; z-index: 2; }
th.m-name {
    position: sticky; left: 0; z-index: 3; background: var(--surface);
    min-width: 210px; max-width: 230px; text-align: left; padding: 6px 12px; font-weight: 600;
}
table.matrix thead th.m-name { z-index: 4; background: var(--surface-2); font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.m-person { display: flex; align-items: center; gap: 7px; }
.m-person .person-name { flex: 1; }
.m-sub { font-size: 11px; color: var(--muted); font-weight: 500; min-height: 14px; }
th.m-day { width: 30px; min-width: 30px; padding: 5px 0; text-align: center; font-weight: 500; }
th.m-day b { display: block; font-size: 12.5px; color: var(--ink); }
th.m-day span { font-size: 10px; color: var(--muted); }
th.m-day.off { background: #e9eef5; }
th.m-day.off span { color: #be123c; }

td.pc {
    height: 40px; text-align: center; cursor: crosshair; user-select: none; touch-action: none; position: relative;
    transition: background .08s;
}
td.pc.off { background: var(--weekend); }
td.pc:hover { box-shadow: inset 0 0 0 2px var(--primary); }
td.pc.st-leave { background: var(--leave); }
td.pc.st-unwanted { background: var(--unwanted); }
td.pc.st-unwanted::before {
    content: ""; position: absolute; inset: 0;
    background: repeating-linear-gradient(-45deg, transparent 0 4px, rgba(255, 255, 255, .22) 4px 8px);
}
.shift-mark { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--role); box-shadow: 0 0 0 2px #fff; position: relative; }
td.pc.st-training { background: var(--training); }
/* 12 saatlik vardiya: üst yarı dolu = gündüz, alt yarı dolu = gece */
.shift-mark.half-g { background: linear-gradient(var(--role) 50%, #fff 50%); }
.shift-mark.half-n { background: linear-gradient(#fff 50%, var(--role) 50%); }
td.pc.pre-training { background: repeating-linear-gradient(-45deg, var(--training-soft) 0 4px, transparent 4px 8px); }
td.pc.conflict { box-shadow: inset 0 0 0 3px #7f1d1d; }
td.pc.conflict .shift-mark { background: #fff; box-shadow: 0 0 0 2px #7f1d1d; }

td.m-meta, th.m-meta { padding: 4px 8px; min-width: 76px; text-align: center; background: var(--surface); }
thead th.m-meta { font-size: 11px; color: var(--muted); font-weight: 700; background: var(--surface-2); }
td.m-meta.wide, th.m-meta.wide { min-width: 200px; }
.target-input {
    width: 64px; height: 30px; text-align: center; border: 1px solid var(--line-strong); border-radius: 6px; font-weight: 700; color: var(--primary);
}
.target-input::placeholder { color: var(--faint); font-weight: 500; font-size: 12px; }
.norm-hint { font-size: 10.5px; color: var(--muted); margin-top: 3px; white-space: nowrap; cursor: help; }
.last-select { width: 100%; height: 30px; border: 1px solid var(--line-strong); border-radius: 6px; padding: 0 6px; font-size: 12px; background: #fff; }
.target-input:focus, .last-select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(29, 78, 216, .15); }

/* ==========================================================
   Personel
   ========================================================== */
.staff-layout { display: flex; flex-direction: column; gap: 16px; max-width: 980px; }
.add-form {
    display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
    padding: 12px; background: var(--surface-2); border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); margin-bottom: 14px;
}
.add-form input[type="text"] { flex: 1; min-width: 220px; height: 36px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: #fff; }
.add-form input:focus, .name-input:focus, .field input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(29, 78, 216, .15); }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
    display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px;
    border-radius: 15px; border: 1px solid var(--line-strong); background: #fff; color: var(--muted);
    font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.chip .role-dot { background: var(--line-strong); }
.chip:hover { border-color: var(--role); }
.chip.on { border-color: var(--role); color: var(--ink); background: color-mix(in srgb, var(--role) 10%, #fff); }
.chip.on .role-dot { background: var(--role); }
.chip-sm { height: 26px; padding: 0 9px; font-size: 12px; }

.role-coverage { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.coverage { display: flex; align-items: center; gap: 7px; padding: 7px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); font-size: 12.5px; }
.coverage b { margin-left: 4px; }
.coverage em { display: inline-flex; align-items: center; gap: 4px; font-style: normal; color: var(--error); font-weight: 600; margin-left: 6px; }
.coverage.low { border-color: #fecaca; background: var(--error-soft); }

.staff-list { display: flex; flex-direction: column; }
.staff-row { display: flex; align-items: center; gap: 14px; padding: 10px 4px; border-top: 1px solid var(--line); }
.staff-row:first-child { border-top: 0; }
.staff-row.inactive { opacity: .8; }
.avatar {
    width: 38px; height: 38px; border-radius: 50%; flex: none; display: grid; place-items: center;
    background: linear-gradient(135deg, #e0e7ff, #dbeafe); color: #3730a3; font-weight: 700; font-size: 13px;
}
.staff-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.name-input { border: 1px solid transparent; border-radius: 6px; height: 30px; padding: 0 8px; margin-left: -8px; font-weight: 700; font-size: 14.5px; background: transparent; max-width: 360px; }
.name-input:hover { border-color: var(--line-strong); background: #fff; }
.staff-name-static { font-weight: 700; }
.staff-month { text-align: center; min-width: 74px; }
.staff-month b { display: block; font-size: 18px; }
.staff-month span { font-size: 11px; color: var(--muted); }
.staff-actions { display: flex; gap: 4px; align-items: center; }
.avoid-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px; }
.avoid-label { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-weight: 600; }
.avoid-label .ico { width: 13px; height: 13px; color: var(--unwanted); }
.avoid-chip {
    display: inline-flex; align-items: center; gap: 2px; height: 24px; padding: 0 2px 0 9px;
    border-radius: 12px; background: var(--unwanted-soft); color: #9f1239; font-weight: 600;
}
.avoid-chip.inactive { opacity: .6; }
.avoid-chip .x-btn { color: #be123c; }
.avoid-add {
    height: 24px; padding: 0 6px; border: 1px dashed var(--line-strong); border-radius: 12px;
    background: transparent; color: var(--muted); font-size: 12px; cursor: pointer; max-width: 180px;
}
.avoid-add:hover, .avoid-add:focus { border-color: var(--primary); color: var(--primary); outline: none; }
.pair-label .ico { color: var(--ok); }
.pair-chip { background: var(--ok-soft); color: #166534; box-shadow: inset 0 0 0 1px #bbf7d0; }
.pair-chip .x-btn { color: #15803d; }
.pair-warn { display: inline-flex; align-items: center; gap: 4px; color: var(--warn); font-weight: 600; }
.pair-warn .ico { width: 13px; height: 13px; }
.bulk-actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 0; border-top: 1px solid var(--line); }
.bulk-actions:nth-of-type(2) { border-top: 0; padding-top: 0; }
.bulk-actions p { margin: 2px 0 0; }
.bulk-actions .btn { flex: none; }
.emp-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.add-emp { flex-basis: 100%; }
.emp-hint { font-size: 11.5px; color: var(--muted); }
.segmented.seg-sm { padding: 2px; border-radius: 8px; }
.seg-sm .seg { height: 26px; padding: 0 10px; font-size: 12px; gap: 5px; border-radius: 6px; }
.seg-sm .seg .ico { width: 13px; height: 13px; }
.cov-12 { font-size: 11px; font-weight: 700; color: #3730a3; background: #e0e7ff; padding: 1px 6px; border-radius: 5px; margin-left: 4px; }

/* ==========================================================
   Yıllık fazla mesai: kişi listesi, dokununca ay ay ayrıntı
   ========================================================== */
.yr-wrap { max-width: 760px; margin: 0 auto; }
.year-controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.yr-list { display: flex; flex-direction: column; }
.yr + .yr { border-top: 1px solid var(--line); }
.yr-sum {
    display: flex; align-items: center; gap: 11px; width: 100%; min-height: 60px; padding: 8px 2px;
    border: 0; background: none; text-align: left; cursor: pointer;
}
.yr-sum:hover { background: var(--surface-2); }
.yr-sum > .ico { width: 16px; height: 16px; flex: none; color: var(--faint); transition: transform .15s; }
.yr.open .yr-sum > .ico { transform: rotate(90deg); }
.yr-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.yr-main b { font-size: 14.5px; font-weight: 600; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.yr-main small { font-size: 12px; color: var(--muted); }
.yr.inactive .yr-main b { color: var(--muted); }
.yv { display: inline-block; padding: 3px 8px; border-radius: 6px; font-weight: 700; font-size: 13px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.yv.pos { background: #dcfce7; color: #15803d; }
.yv.neg { background: #fee2e2; color: #b91c1c; }
.yv.zero { background: var(--weekend); color: var(--muted); }
.yr-detail { display: none; padding: 0 2px 12px; }
.yr.open .yr-detail { display: block; }
.yr-table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.yr-table th { text-align: left; font-size: 11.5px; font-weight: 600; color: var(--muted); padding: 5px 6px; }
.yr-table td { padding: 5px 6px; border-top: 1px solid var(--line); }
.yr-table th:not(:first-child), .yr-table td:not(:first-child) { text-align: right; }
.yr-table td small { color: var(--faint); }
.yr-table .link-btn { font-size: 13px; padding: 2px 0; }
.yr-table tfoot th, .yr-table tfoot td { border-top: 1px solid var(--line-strong); font-size: 13px; font-weight: 700; color: var(--ink); }

/* ==========================================================
   Ayarlar
   ========================================================== */
.settings-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; align-items: start; }
.side-stack { display: flex; flex-direction: column; gap: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.span-2 { grid-column: span 2; }
.field > span { font-weight: 600; font-size: 13px; }
.field > span small { font-weight: 400; color: var(--muted); }
.field input { height: 36px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: #fff; }
.field input[type="number"] { max-width: 140px; font-weight: 700; }
.field > small { color: var(--muted); font-size: 12px; }
.settings-section { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 12px; }
.section-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.section-head h3 { display: flex; align-items: center; gap: 8px; font-size: 14.5px; }
.field.is-disabled { opacity: .5; }
.chip:disabled { cursor: not-allowed; }
.switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; flex: none; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-track { width: 40px; height: 22px; border-radius: 11px; background: var(--line-strong); position: relative; transition: background .15s; }
.switch-thumb { position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: transform .15s; }
.switch input:checked + .switch-track { background: var(--primary); }
.switch input:checked + .switch-track .switch-thumb { transform: translateX(18px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--primary); outline-offset: 2px; }
.switch-label { font-weight: 600; font-size: 13px; min-width: 42px; }
.btn-col { display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
.btn-col .btn { justify-content: flex-start; }
.holiday-list { list-style: none; margin: 0; padding: 0; max-height: 360px; overflow-y: auto; }
.holiday-list li { display: flex; align-items: center; gap: 10px; padding: 6px 2px; border-top: 1px solid var(--line); font-size: 13px; }
.holiday-list li:first-child { border-top: 0; }
.holiday-list li.removed { color: var(--muted); }
.hl-date { width: 56px; font-weight: 700; font-variant-numeric: tabular-nums; }
.hl-name { flex: 1; }
.hl-src { font-size: 11px; color: var(--faint); }

/* ==========================================================
   Bildirim ve diyaloglar
   ========================================================== */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 2000; display: flex; flex-direction: column; gap: 10px; align-items: flex-end; }
.toast {
    display: flex; align-items: flex-start; gap: 10px; max-width: 460px;
    padding: 12px 12px 12px 14px; border-radius: var(--radius);
    background: #0f172a; color: #e2e8f0; box-shadow: var(--shadow-lg); font-size: 13.5px;
    opacity: 0; transform: translateY(8px); transition: .2s;
}
.toast.show { opacity: 1; transform: none; }
.toast > .ico { width: 18px; height: 18px; margin-top: 1px; }
.toast-success > .ico { color: #4ade80; }
.toast-error > .ico { color: #f87171; }
.toast-warn > .ico { color: #fbbf24; }
.toast-info > .ico { color: #93c5fd; }
.toast-msg { flex: 1; }
.toast-msg b { color: #fff; }
.toast-action { border: 0; background: rgba(255, 255, 255, .12); color: #fff; font-weight: 700; border-radius: 6px; padding: 4px 10px; cursor: pointer; white-space: nowrap; }
.toast-action:hover { background: rgba(255, 255, 255, .2); }
.toast-close { border: 0; background: none; color: #94a3b8; cursor: pointer; padding: 2px; display: inline-flex; }

.dialog-backdrop {
    position: fixed; inset: 0; z-index: 1500; display: grid; place-items: center; padding: 20px;
    background: rgba(15, 23, 42, .45); backdrop-filter: blur(2px);
    opacity: 0; transition: opacity .15s;
}
.dialog-backdrop.show { opacity: 1; }
.dialog {
    width: 100%; max-width: 480px; background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg);
    padding: 20px; transform: scale(.97); transition: transform .15s;
}
.dialog-backdrop.show .dialog { transform: none; }
.dialog-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.dialog-head h3 { font-size: 16.5px; }
.dialog-icon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); flex: none; }
.dialog-icon .ico { width: 20px; height: 20px; }
.dialog-danger .dialog-icon { background: var(--error-soft); color: var(--error); }
.dialog-body { color: var(--ink-2); font-size: 13.5px; }
.dialog-body p { margin: 0 0 8px; }
.choice-notes { margin: 8px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.progress { height: 8px; border-radius: 4px; background: var(--weekend); overflow: hidden; margin-top: 10px; }
.progress-bar { width: 0; height: 100%; background: linear-gradient(90deg, #3b82f6, var(--primary)); transition: width .2s; }
.progress-text { color: var(--muted); }
.spin .ico { animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(.8); opacity: .6; } }

/* ==========================================================
   Duyarlı düzen
   ========================================================== */
@media (max-width: 1180px) {
    .roster-layout, .settings-layout { grid-template-columns: minmax(0, 1fr); }
    .side { position: static; }
    .brand-sub { display: none; }
}
@media (max-width: 860px) {
    :root { --topbar-h: auto; }
    .topbar { flex-wrap: wrap; height: auto; padding: 10px 14px; position: static; gap: 10px; }
    .brand { flex: 1 1 100%; }
    .top-actions { flex: 1 1 auto; }
    .tabs { position: static; overflow-x: auto; padding: 0 10px; scrollbar-width: none; }
    .tab { white-space: nowrap; }
    .save-state { display: none; }
    main { padding: 12px; }
    .table-wrap { overflow-x: auto; }
    table.roster { min-width: 680px; }
    table.roster thead th { top: 0; }
    .form-grid { grid-template-columns: 1fr; }
    .field.span-2 { grid-column: auto; }
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .staff-month { display: none; }
    .matrix-wrap { max-height: calc(100dvh - 24px); }
}

/* ==========================================================
   Yazdırma — A4 yatay, tek sayfa
   ========================================================== */
.print-area { display: none; }
@media print {
    @page { size: A4 landscape; margin: 6mm; }
    body { background: #fff; }
    .app, .toasts, #dialogRoot { display: none !important; }
    .print-area { display: block; font-family: "Segoe UI", Arial, sans-serif; color: #000; }
    * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .p-head { text-align: center; border-bottom: 1.5px solid #0f172a; padding-bottom: 3px; margin-bottom: 5px; }
    .p-head h1 { font-size: 11pt; margin: 0; }
    .p-head p { font-size: 7.5pt; margin: 2px 0 0; color: #334155; }
    .p-body { display: grid; grid-template-columns: 1fr 72mm; gap: 5mm; align-items: start; }
    .print-area table { width: 100%; border-collapse: collapse; }
    .print-area th { background: #e2e8f0; font-size: 7pt; padding: 2px 3px; border: .5pt solid #64748b; text-align: left; }
    .print-area td { font-size: 7pt; padding: 1.2px 3px; border: .5pt solid #94a3b8; height: 12.5px; }
    .print-area td.c { text-align: center; }
    .print-area td.st { font-size: 6.2pt; }
    .print-area tr.we td { background: #f1f5f9; font-weight: 600; }
    .print-area tr.ho td { background: #fee2e2; font-weight: 600; }
    .print-area tr.hf td { background: #fef3c7; }
    .print-area td.pos { background: #dcfce7; font-weight: 700; }
    .print-area td.neg { background: #fee2e2; font-weight: 700; }
    .p-half { display: block; line-height: 1.15; }
    .p-half b { font-size: 5.8pt; color: #475569; margin-right: 2px; }
    .p-note { font-size: 6.2pt; color: #475569; margin: 3px 0 0; }
    .p-sign { display: grid; grid-template-columns: 1fr 1fr; gap: 6mm; margin-top: 10mm; }
    .p-sign div { border-top: .5pt solid #475569; padding-top: 2px; font-size: 7pt; text-align: center; }
}

/* İzin sarı, rapor kırmızı, istenmeyen gün gri */
td.pc.st-leave { background: #facc15; }
td.pc.st-report { background: #ef4444; }
td.pc.st-unwanted { background: #cbd5e1; }
.tag-leave { background: #fef9c3; color: #854d0e; }
.tag-report { background: #fee2e2; color: #b91c1c; }
.seg-leave.active .ico { color: #ca8a04; }
.seg-report.active .ico { color: #dc2626; }
.section-head.sub-toggle { margin-top: 6px; padding: 12px; background: var(--surface-2); border-radius: var(--radius-sm); }
.stat-wide.alt b { grid-row: auto; }
.stat-wide.alt small { grid-column: 1 / -1; }
.head-side { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.meslek-select {
    height: 26px; padding: 0 6px; border: 1px solid var(--line-strong); border-radius: 8px;
    background: var(--surface); color: inherit; font-size: 12px; cursor: pointer;
}
.meslek-select:focus { border-color: var(--primary); outline: none; }
.meslek-select.unset { color: var(--muted); border-style: dashed; }
.tag-meslek { background: var(--line); color: inherit; }
.tag-external { background: var(--external-soft); color: var(--external); }
.seg-external.active .ico { color: var(--external); }
td.pc.st-external { background: var(--external); }
td.pc.pre-external { background: repeating-linear-gradient(-45deg, var(--external-soft) 0 4px, transparent 4px 8px); }
.lg-preext { background: repeating-linear-gradient(-45deg, var(--external-soft) 0 3px, #fff 3px 6px); border-color: #5eead4; }
.tag-wanted { background: var(--wanted-soft); color: #166534; }
.seg-wanted.active .ico { color: var(--wanted); }
td.pc.st-wanted { background: var(--wanted-soft); box-shadow: inset 0 0 0 2px var(--wanted); }

/* Renkli çizelge: kişi rengi (uyarı / hata çerçevesi korunur) */
.cell.colored select.assign { background-color: var(--pc); border-color: var(--pcl); }
.cell.colored.sev-error select.assign { border-color: var(--error); box-shadow: inset 0 0 0 1px var(--error); color: var(--ink); }
.cell.colored.sev-warn select.assign { border-color: var(--warn); box-shadow: inset 0 0 0 1px var(--warn); }
.cell.colored select.assign:hover { filter: brightness(.97); }
.cell.colored.hl select.assign { background-color: var(--pc); box-shadow: 0 0 0 3px #f59e0b; }
.person-swatch { flex: none; width: 12px; height: 12px; border-radius: 4px; border: 1px solid; }
.toggle-btn { gap: 8px; }
.toggle-btn .switch {
    position: relative; width: 28px; height: 16px; border-radius: 8px; background: var(--line-strong); transition: background .15s;
}
.toggle-btn .switch::after {
    content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%; background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .2); transition: transform .15s;
}
.toggle-btn.on .switch { background: var(--primary); }
.toggle-btn.on .switch::after { transform: translateX(12px); }

/* 12 saatlik gündüz / gece: iki isim yan yana */
.split-row { display: flex; gap: 4px; }
.split-row .cell.half { flex: 1 1 0; min-width: 0; padding-left: 0; gap: 3px; }
.split-row .cell.half + .cell.half { margin-top: 0; }
.split-row .cell.half select.assign { height: 30px; padding-right: 20px; background-position: right 5px center; background-size: 12px; }
.split-row .flag { right: 18px; }

/* ---------- Google Drive eşitleme kutusu ---------- */
.sync-box { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px; margin-bottom: 12px; background: var(--surface-2); }
.sync-box > b { display: flex; align-items: center; gap: 6px; font-size: 13.5px; }
.sync-box > b .ico { width: 16px; height: 16px; }
.sync-box p { margin: 6px 0 10px; }
.sync-box .btn-row { margin: 0; }

/* ---------- Alttan açılan sayfa ---------- */
.sheet-backdrop { place-items: end center; padding: 0; }
.sheet {
    width: 100%; max-width: 560px; max-height: 86vh; max-height: 86dvh; display: flex; flex-direction: column;
    background: var(--surface); border-radius: 22px 22px 0 0; box-shadow: var(--shadow-lg);
    padding-bottom: env(safe-area-inset-bottom);
    transform: translateY(100%); transition: transform .24s cubic-bezier(.2, .8, .2, 1);
}
.dialog-backdrop.show .sheet { transform: none; }
.sheet-top { flex: none; touch-action: none; cursor: grab; border-bottom: 1px solid var(--line); }
.sheet-grab { width: 36px; height: 4px; margin: 10px auto 10px; border-radius: 2px; background: var(--line-strong); }
.sheet-head { padding: 0 18px 12px; }
.sheet-head h3 { font-size: 17px; letter-spacing: -.01em; }
.sheet-head p { margin: 1px 0 0; color: var(--muted); font-size: 13px; }
.sheet-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 10px 10px 14px; }

.pick-group + .pick-group { margin-top: 8px; }
.pick-label, .pick-group > summary { font-size: 12px; font-weight: 700; color: var(--muted); }
.pick-label { padding: 6px 8px 4px; }
.pick-group > summary {
    display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 8px;
    cursor: pointer; list-style: none; border-radius: 10px;
}
.pick-group > summary::-webkit-details-marker { display: none; }
.pick-group > summary .ico { margin-left: auto; width: 15px; height: 15px; transition: transform .15s; }
.pick-group[open] > summary .ico { transform: rotate(90deg); }
.pick-count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; display: inline-grid; place-items: center; background: var(--weekend); color: var(--ink-2); font-size: 11.5px; }
.pick-row {
    display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 7px 8px;
    border: 0; border-radius: 12px; background: none; text-align: left; cursor: pointer;
}
.pick-row:active { background: var(--primary-soft); }
.pick-row.is-on { background: var(--primary-soft); }
.pick-row.is-on > .ico { width: 20px; height: 20px; margin-left: auto; color: var(--primary); }
.pick-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.pick-main b { font-size: 15px; font-weight: 600; }
.pick-main small { font-size: 12.5px; line-height: 1.3; color: var(--muted); }
.pick-row.tone-warn small { color: #b45309; }
.pick-row.tone-error small { color: var(--error); }
.pick-row.tone-error b { color: var(--ink-2); }
.avatar.sm { width: 38px; height: 38px; font-size: 12.5px; }
.avatar.special { background: var(--weekend); color: var(--muted); }
.avatar.special .ico { width: 17px; height: 17px; }
.pick-current {
    display: flex; align-items: center; gap: 12px; padding: 10px; margin-bottom: 8px;
    border-radius: 14px; background: var(--primary-soft);
}
.pick-current .pick-main small { font-size: 11.5px; }
.pick-current .avatar.sm { background: var(--primary); color: #fff; }
.pick-issue { display: flex; gap: 9px; padding: 10px 12px; margin-bottom: 8px; border-radius: 12px; font-size: 13px; line-height: 1.35; }
.pick-issue .ico { margin-top: 1px; }
.pick-issue.error { background: var(--error-soft); color: #991b1b; }
.pick-issue.warn { background: var(--warn-soft); color: #92400e; }
.person-sheet { display: grid; gap: 16px; padding: 6px 8px; }
.person-sheet .field:has(> input[type="number"]) { display: flex; align-items: stretch; }
.person-sheet .field .target-input { width: 100%; height: 44px; text-align: left; padding: 0 12px; border-radius: 10px; }
.person-sheet .norm-hint { margin-top: 5px; font-size: 12px; white-space: normal; }
.person-sheet .last-select { height: 44px; border-radius: 10px; }
.legend-sheet { flex-direction: column; gap: 12px; padding: 6px 8px; font-size: 14px; color: var(--ink-2); }

/* ==========================================================
   Telefon (≤ 640 px): tek satır üst çubuk, alt sekme çubuğu, yüzen Akıllı Dağıt, alttan açılan sayfalar
   ========================================================== */
.tab-short, .phone-only, .pane-tabs, .cell-name, .staff-summary, .add-toggle, .hl-chip, .legend-btn { display: none; }
.menu-list button.phone-only { display: none; }
@media (pointer: coarse) {
    td.pc { touch-action: manipulation; }   /* dokun = işaretle, kaydır = tabloyu kaydır */
}
@media (max-width: 640px) {
    :root { --bottom-nav: 64px; --topbar-h: calc(56px + env(safe-area-inset-top)); }
    html { -webkit-tap-highlight-color: transparent; }
    body { padding-bottom: calc(var(--bottom-nav) + env(safe-area-inset-bottom)); overscroll-behavior-y: none; }
    button, summary, .cell { touch-action: manipulation; }
    .phone-only { display: inline-flex; }
    .desktop-only { display: none; }
    .menu-list button.phone-only { display: flex; }
    .btn:active, .icon-btn:active:not(:disabled) { transform: scale(.96); }

    /* Üst çubuk: ☰ ‹ Ay Yıl › geri al, yinele, ⋮ */
    .topbar {
        position: sticky; top: 0; z-index: 65; flex-wrap: nowrap; gap: 0; height: var(--topbar-h);
        padding: env(safe-area-inset-top) 4px 0;
    }
    .icon-btn { width: 40px; height: 40px; border-radius: 50%; }
    .icon-btn .ico { width: 20px; height: 20px; }
    .menu-btn { margin: 0; }
    .brand { display: none; }
    body[data-tab="overtime"] .brand { display: flex; flex: 1 1 auto; margin-left: 4px; }
    body[data-tab="overtime"] .brand-mark { width: 30px; height: 30px; }
    .brand-title { font-size: 16px; }
    .month-nav { flex: 1 1 auto; min-width: 0; justify-content: center; gap: 0; }
    .month-nav .icon-btn { width: 32px; }
    .month-nav .btn { display: none; }
    .month-picker { flex: 0 1 auto; gap: 5px; border: 0; border-radius: 0; background: none; overflow: visible; }
    .month-picker select {
        appearance: none; -webkit-appearance: none; flex: none; height: 40px; padding: 0;
        font-size: 17px; font-weight: 700; letter-spacing: -.01em; text-align: center; field-sizing: content;
    }
    .month-picker select + select { border-left: 0; padding-left: 0; font-weight: 500; color: var(--muted); }
    .top-actions { flex: none; gap: 0; }
    .top-actions .divider { display: none; }
    .top-actions .menu > .btn {
        width: 40px; height: 40px; min-height: 0; padding: 0; border: 0; border-radius: 50%; background: none;
    }
    .top-actions .menu > .btn .btn-label { display: none; }
    .top-actions .menu > .btn .ico { width: 20px; height: 20px; }

    /* ⋮ menüsü: alttan açılan sayfa */
    .menu { z-index: 2; }
    .menu.open::before { content: ""; position: fixed; inset: 0; background: rgba(15, 23, 42, .45); }
    .menu-list {
        position: fixed; left: 0; right: 0; top: auto; bottom: 0; min-width: 0; padding: 12px 10px calc(14px + env(safe-area-inset-bottom));
        border: 0; border-radius: 22px 22px 0 0; opacity: 1; transform: translateY(105%);
        transition: transform .22s cubic-bezier(.2, .8, .2, 1);
    }
    .menu.open .menu-list { transform: none; }
    .menu-list button { min-height: 50px; padding: 0 12px; gap: 14px; font-size: 15px; border-radius: 12px; }
    .menu-list button .ico { width: 20px; height: 20px; }

    /* Akıllı Dağıt: alt çubuğun üstünde yüzen düğme, aşağı kaydırınca küçülür */
    #solveBtn {
        position: fixed; right: 14px; bottom: calc(var(--bottom-nav) + env(safe-area-inset-bottom) + 14px); z-index: 1;
        min-height: 0; height: 52px; padding: 0 20px; border-radius: 26px; font-size: 15px;
        box-shadow: 0 10px 22px -6px rgba(29, 78, 216, .6), 0 2px 6px rgba(15, 23, 42, .15);
    }
    #solveBtn .ico { width: 20px; height: 20px; }
    .fab-mini #solveBtn { width: 52px; padding: 0; }
    .fab-mini #solveBtn .btn-label { display: none; }
    body:not([data-tab="roster"]) #solveBtn, body:has(.pane-issues, .pane-hours) #solveBtn { display: none; }
    body[data-tab="roster"] main { padding-bottom: 84px; }   /* son satırlar düğmenin altında kalmasın */
    /* Bildirimler düğmenin üstünde dursun: dağıtım uyarıları 12 sn açık kalır, altında düğmeye dokunulamıyordu */
    body[data-tab="roster"]:not(:has(.pane-issues, .pane-hours, .dialog-backdrop)) .toasts { bottom: calc(var(--bottom-nav) + env(safe-area-inset-bottom) + 76px); }

    /* Alt sekme çubuğu: seçili sekmenin simgesi hap içinde */
    .tabs {
        position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 60;
        height: calc(var(--bottom-nav) + env(safe-area-inset-bottom));
        padding: 0 0 env(safe-area-inset-bottom); gap: 0; overflow: visible;
        border-bottom: 0; border-top: 1px solid var(--line);
    }
    .tab {
        flex: 1 1 0; min-width: 0; flex-direction: column; justify-content: center; gap: 2px;
        padding: 0; margin: 0; font-size: 11.5px; font-weight: 500; position: relative; border: 0;
    }
    .tab > [data-icon] {
        display: grid; place-items: center; width: 54px; height: 30px; border-radius: 15px;
        transition: background .18s;
    }
    .tab .ico { width: 21px; height: 21px; }
    .tab.active { font-weight: 700; }
    .tab.active > [data-icon] { background: var(--primary-soft); }
    .tab-label { display: none; }
    .tab-short { display: inline; }
    .tab-badge { position: absolute; top: 4px; left: calc(50% + 8px); min-width: 17px; height: 17px; padding: 0 4px; font-size: 10.5px; background: var(--ink-2); color: #fff; box-shadow: 0 0 0 2px var(--surface); }
    #staffBadge { display: none; }
    .tabs-spacer, .save-state { display: none; }
    /* Kayıt / Drive uyarıları alt çubuğun üstünde yüzen bir rozet olarak (her şey yolundaysa gizli) */
    .file-state { position: fixed; left: 50%; transform: translateX(-50%); margin: 0; z-index: 61; box-shadow: var(--shadow-lg); background: var(--surface); }
    #fileState { bottom: calc(var(--bottom-nav) + env(safe-area-inset-bottom) + 8px); }
    #driveState { bottom: calc(var(--bottom-nav) + env(safe-area-inset-bottom) + 44px); }
    .file-state.ok { display: none; }

    main { padding: 10px; }
    .card { padding: 14px; border-radius: 16px; box-shadow: none; }
    .card-head h2 { font-size: 18px; }
    .toasts { left: 10px; right: 10px; bottom: calc(var(--bottom-nav) + env(safe-area-inset-bottom) + 10px); align-items: stretch; }
    .toasts { pointer-events: none; }   /* kutu dokunuşu yutmasın, yalnızca bildirimin kendisi */
    .toast { max-width: none; pointer-events: auto; }
    /* Pencere açıkken bildirim üstte: alttaki düğmeleri kapatmasın */
    body:has(.dialog-backdrop) .toasts { top: calc(var(--topbar-h) + 8px); bottom: auto; }

    /* Diyaloglar da alttan açılır (bulanıklık zayıf telefonlarda kasar) */
    .dialog-backdrop { backdrop-filter: none; }
    .dialog-backdrop:not(.sheet-backdrop) { place-items: end stretch; padding: 0; }
    .dialog {
        max-width: none; max-height: 86vh; max-height: 86dvh; overflow: auto;
        border-radius: 22px 22px 0 0; padding: 20px 18px calc(16px + env(safe-area-inset-bottom));
        transform: translateY(40px);
    }
    .dialog-actions { flex-direction: column-reverse; }
    .dialog-actions .btn { width: 100%; height: 46px; }

    /* Dokunmaya uygun yükseklik; 16 px altı yazı iOS'ta yakınlaştırma yapar */
    select, input[type="text"], input[type="number"] { font-size: 16px; }
    .btn { min-height: 40px; }
    .btn-sm { min-height: 36px; }
    .chip, .chip-sm { height: 36px; padding: 0 13px; font-size: 13px; }

    /* Açıklama paragrafları telefonda yer kaplamasın */
    #view-staff .card-head { display: none; }

    /* ---------- Çizelge ---------- */
    .roster-layout { gap: 10px; }
    .pane-tabs { display: flex; gap: 2px; padding: 3px; border-radius: 12px; background: #e6ebf2; }
    .pane-tab {
        flex: 1 1 0; display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px;
        border: 0; border-radius: 9px; background: none; color: var(--muted); font-weight: 600; font-size: 13.5px; cursor: pointer;
    }
    .pane-tab.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
    .pane-count { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; display: inline-grid; place-items: center; font-size: 11px; font-weight: 700; color: #fff; }
    .pane-count.is-error { background: var(--error); }
    .pane-count.is-warn { background: var(--warn); }
    .pane-table .side, .pane-issues .roster-card, .pane-hours .roster-card,
    .pane-issues .side-summary, .pane-issues .side-hours, .pane-hours .side-issues { display: none; }
    .side { gap: 10px; }
    .issue-list { max-height: none; overflow: visible; gap: 6px; }
    .issue { padding: 11px 12px; border-radius: 12px; }
    .issue-msg { font-size: 13.5px; }
    .side .card { overflow-x: auto; }
    .bar { display: none; }
    .person-btn { min-height: 34px; }
    table.hours td { padding: 8px 3px; }

    .roster-card { margin: 0 -10px; padding: 10px 0 0; border-radius: 0; border-width: 1px 0; }
    .roster-card .card-head { flex-direction: column; align-items: stretch; gap: 8px; padding: 0 12px; margin-bottom: 10px; }
    .roster-card .card-head > div:first-child { display: none; }
    .head-side { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px 14px; }
    .head-side > [data-action="clear-month"] { display: none; }
    .fill-meter { min-width: 0; }
    .fill-meter-num { text-align: left; font-size: 12px; margin-bottom: 4px; }
    .fill-meter-num b { font-size: 13px; }
    .toggle-btn { border: 0; background: none; padding: 0; min-height: 32px; font-size: 12.5px; }
    .hl-chip {
        grid-column: 1 / -1; grid-row: 2; justify-self: start; display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px;
        border: 0; border-radius: 15px; background: #fef3c7; color: #92400e; font-size: 12.5px; font-weight: 700; cursor: pointer;
    }
    .hl-chip .ico { width: 14px; height: 14px; }
    .roster-card .callout { margin: 0 10px 10px; padding: 12px; }
    .roster-card .callout > .btn { display: none; }   /* yüzen Akıllı Dağıt düğmesi var */

    /* Gün başına tek satır: dar tarih sütunu + 3 görev sütunu. Hücrede select yerine iki satıra sığan ad, dokununca seçim sayfası */
    .table-wrap { overflow: visible; margin: 0; }
    table.roster { min-width: 0; table-layout: fixed; }
    table.roster thead th {
        position: sticky; top: var(--topbar-h); z-index: 5; padding: 6px 2px; font-size: 10px; letter-spacing: 0;
        line-height: 1.15; white-space: normal; text-align: center; text-transform: none; font-weight: 600;
    }
    table.roster thead th .role-dot { display: block; margin: 0 auto 2px; }
    table.roster th.c-date { width: 42px; padding: 6px 0; }
    table.roster tbody tr { scroll-margin-top: calc(var(--topbar-h) + 40px); }
    table.roster td { padding: 2px; }
    table.roster td.c-date { padding: 2px 0; border-left-width: 0; text-align: center; white-space: normal; cursor: pointer; }
    .c-date .date { display: flex; flex-direction: column; align-items: center; gap: 1px; min-width: 0; }
    .date-num { width: 26px; height: 22px; display: grid; place-items: center; font-size: 14px; line-height: 1; border-radius: 11px; }
    .date-name, .daytype { display: none; }
    .date-short { display: block; font-size: 10px; color: var(--muted); line-height: 1.1; }
    tr.r-weekend .date-short, tr.r-holiday .date-short { font-weight: 700; color: var(--ink-2); }
    tr.r-holiday .date-short { color: #be123c; }
    tr.r-today .date-num { background: var(--primary); color: #fff; }
    tr.r-today .date-short { color: var(--primary); font-weight: 700; }
    table.roster td.c-cell + td.c-cell { border-left: 1px solid var(--line); }

    select.assign, .cell.half select.assign, .split-row .cell.half select.assign, .c-cell.is-eight .cell.half select.assign {
        position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; pointer-events: none; padding: 0;
    }
    .c-cell .cell {
        min-height: 42px; justify-content: center; border-radius: 8px; border: 1px solid transparent; cursor: pointer; padding: 2px 3px;
        transition: background .12s;
    }
    .cell-name {
        display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; min-width: 0;
        font-size: 12px; font-weight: 600; line-height: 1.22; text-align: center; color: var(--ink);
    }
    .cell-name .ico { display: block; width: 15px; height: 15px; }
    .c-cell .cell:active { background: var(--primary-soft); }
    .cell.is-empty { background: none; border: 1px dashed var(--line-strong); }
    .cell.is-empty .cell-name { color: var(--faint); }
    .cell.is-external { border: 1px dashed var(--external); background: var(--external-soft); }
    .cell.is-external .cell-name { font-style: italic; }
    .cell.sev-error { border-color: #fca5a5; background: var(--error-soft); }
    .cell.sev-error .cell-name { color: #991b1b; }
    .cell.sev-warn { border-color: #fcd34d; background: var(--warn-soft); }
    .cell.colored { background: var(--pc); border-color: var(--pcl); }
    .cell.colored.sev-error { border-color: var(--error); box-shadow: inset 0 0 0 1px var(--error); }
    .cell.colored.sev-warn { border-color: var(--warn); box-shadow: inset 0 0 0 1px var(--warn); }
    /* Masaüstü vurgu kuralları select'i görünür yapmasın: yazı iki kez görünür */
    table.roster.has-hl .cell:not(.hl) select.assign, .cell.hl select.assign, .cell.colored.hl select.assign { opacity: 0; }
    table.roster.has-hl .cell:not(.hl) { opacity: .35; }
    .cell.hl, .cell.colored.hl { background: #fef3c7; border-color: #f59e0b; box-shadow: 0 0 0 1px #f59e0b; opacity: 1; }
    .flag { right: 1px; top: 1px; pointer-events: none; }
    .flag .ico { width: 11px; height: 11px; }

    /* Bölünmüş hücreler: dilimler alt alta, etiket + tek satır ad */
    .c-cell.is-split { padding-top: 1px; padding-bottom: 1px; }
    .split-row { flex-direction: column; gap: 2px; }
    .c-cell .cell.half, .split-row .cell.half { min-height: 25px; gap: 3px; padding: 0 2px; justify-content: flex-start; }
    .cell.half + .cell.half, .split-row .cell.half + .cell.half { margin-top: 2px; }
    .cell.half .cell-name { -webkit-line-clamp: 1; flex: 1; font-size: 11.5px; text-align: left; word-break: break-all; }
    .cell.half.is-empty .cell-name { display: grid; place-items: center; }
    .part-tag { width: 15px; height: 16px; font-size: 9.5px; border-radius: 4px; }
    .part-a, .part-b, .part-c, .part-ab, .part-bc { width: auto; padding: 0 2px; font-size: 8.5px; }
    .split-row .flag { right: 1px; }

    /* ---------- Yıllık ---------- */
    .year-controls { width: 100%; }
    .year-controls .segmented { flex: 1; }
    .year-controls .seg { flex: 1; justify-content: center; }
    .year-controls .btn { flex: none; }

    /* ---------- Personel: kapalı satırlar, dokununca açılan düzenleme ---------- */
    .staff-layout { gap: 10px; }
    .add-toggle { display: inline-flex; width: 100%; height: 46px; margin-bottom: 12px; border-style: dashed; color: var(--primary); border-color: #b9c9f5; background: var(--primary-soft); }
    .add-form { display: none; gap: 10px; }
    .add-form.open { display: flex; }
    .add-form input[type="text"] { flex-basis: 100%; height: 44px; }
    .add-form .btn-primary { order: 5; width: 100%; height: 46px; }
    .role-coverage { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-bottom: 8px; }
    .coverage { flex-wrap: wrap; align-items: center; gap: 3px 5px; padding: 8px 9px; font-size: 11.5px; line-height: 1.2; border-radius: 12px; }
    .coverage > span { flex: 1 1 60%; min-width: 0; }
    .coverage b { order: 3; flex-basis: 100%; margin: 0; font-size: 14px; }
    .coverage .cov-12 { order: 4; margin: 0; padding: 1px 4px; font-size: 10px; }
    .coverage em { order: 5; margin: 0; font-size: 10.5px; }
    .coverage em .ico { width: 11px; height: 11px; }

    .staff-row { flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 12px 2px; }
    .staff-row.has-summary { padding: 0; gap: 0; }
    .staff-row.has-summary > .avatar, .staff-row.has-summary > .staff-main, .staff-row.has-summary > .staff-actions { display: none; }
    .staff-row.has-summary.open > .staff-main { display: flex; order: 3; flex: 1 1 100%; padding: 2px 2px 8px; gap: 10px; }
    .staff-row.has-summary.open > .staff-actions { display: flex; order: 4; flex: 1 1 100%; justify-content: flex-end; gap: 4px; padding-bottom: 12px; }
    .staff-summary {
        display: flex; align-items: center; gap: 11px; width: 100%; min-height: 62px; padding: 8px 2px;
        border: 0; background: none; text-align: left; cursor: pointer;
    }
    .staff-summary:active { background: var(--surface-2); }
    .staff-summary > .ico { width: 16px; height: 16px; color: var(--faint); transition: transform .15s; flex: none; }
    .staff-row.open .staff-summary > .ico { transform: rotate(90deg); }
    .staff-sum-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
    .staff-sum-main b { font-size: 14.5px; font-weight: 600; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
    .staff-sum-main small { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
    .staff-sum-count { flex: none; text-align: center; min-width: 40px; }
    .staff-sum-count b { display: block; font-size: 16px; line-height: 1.1; font-variant-numeric: tabular-nums; }
    .staff-sum-count small { font-size: 10.5px; color: var(--muted); }
    .staff-row .name-input { margin-left: 0; max-width: none; width: 100%; height: 44px; border-color: var(--line-strong); background: #fff; padding: 0 12px; border-radius: 10px; }
    .staff-row .icon-btn.sm { width: 40px; height: 40px; }
    .staff-row .icon-btn.sm .ico { width: 18px; height: 18px; }
    .emp-row { flex-wrap: wrap; gap: 8px; }
    .meslek-select { height: 38px; flex: 1 1 auto; }
    .seg-sm .seg { height: 34px; padding: 0 14px; font-size: 13px; }
    .avoid-add { height: 34px; max-width: none; }
    .avoid-chip { height: 30px; }
    .avoid-chip .x-btn { width: 26px; height: 26px; }
    .bulk-actions { flex-direction: column; align-items: stretch; }

    /* ---------- İzinler: tablo ekranın kalanını doldurur, sayfa kaymaz ---------- */
    #view-planning > .card { margin: -10px; padding: 8px 0 0; border: 0; border-radius: 0; }
    #view-planning .card-head { display: none; }
    .brushbar { display: flex; flex-wrap: nowrap; gap: 2px; margin-bottom: 8px; padding-right: 4px; }
    .brushbar .legend { display: none; }
    .brushbar .legend-btn { display: inline-flex; flex: none; color: var(--muted); }
    .brushbar .clear-prefs { flex: none; width: 40px; height: 40px; padding: 0; color: var(--muted); }
    .brushbar .clear-prefs .btn-label { display: none; }
    .brushbar .clear-prefs .ico { width: 18px; height: 18px; }
    .brushbar .segmented { flex: 1; min-width: 0; padding: 0 10px; gap: 6px; background: none; border-radius: 0; overflow-x: auto; scrollbar-width: none; position: relative; }
    .segmented::-webkit-scrollbar { display: none; }
    .brushbar .seg { flex: none; height: 38px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 19px; background: var(--surface); color: var(--ink-2); box-shadow: none; }
    .brushbar .seg.active .ico { color: inherit; }
    .brushbar .seg-leave.active { background: #facc15; border-color: #facc15; color: #422006; }
    .brushbar .seg-report.active { background: #ef4444; border-color: #ef4444; color: #fff; }
    .brushbar .seg-unwanted.active { background: #cbd5e1; border-color: #cbd5e1; color: var(--ink); }
    .brushbar .seg-wanted.active { background: var(--wanted-soft); border: 2px solid var(--wanted); color: #166534; }
    .brushbar .seg-training.active { background: var(--training); border-color: var(--training); color: #fff; }
    .brushbar .seg-external.active { background: var(--external); border-color: var(--external); color: #fff; }
    .brushbar .seg-erase.active { background: var(--ink-2); border-color: var(--ink-2); color: #fff; }
    .matrix-wrap {
        margin: 0; max-height: calc(100vh - var(--topbar-h) - var(--bottom-nav) - 56px - env(safe-area-inset-bottom));
        max-height: calc(100dvh - var(--topbar-h) - var(--bottom-nav) - 56px - env(safe-area-inset-bottom));
    }
    th.m-name { min-width: 104px; width: 104px; max-width: 104px; padding: 5px 7px; cursor: pointer; }
    table.matrix thead th.m-name { cursor: default; font-size: 10.5px; }
    th.m-name .mini-tag, th.m-name .role-dots, th.m-name .x-btn { display: none; }
    th.m-name .person-name { white-space: normal; font-size: 12px; line-height: 1.2; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
    .m-sub { min-height: 0; font-size: 10px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--primary); }
    th.m-day { min-width: 38px; width: 38px; }
    td.pc { height: 48px; }
    td.m-meta, th.m-meta { display: none; }
    .head-stats { flex-wrap: wrap; }

    /* ---------- Ayarlar: etiket solda, sayı sağda ---------- */
    .settings-layout { gap: 10px; }
    .side-stack { gap: 10px; }
    .form-grid { gap: 18px; }
    .field:has(> input[type="number"]) { display: grid; grid-template-columns: minmax(0, 1fr) 76px; align-items: center; gap: 4px 12px; }
    .field:has(> input[type="number"]) > small { grid-column: 1 / -1; }
    .field > span { line-height: 1.3; }
    .field input { height: 42px; border-radius: 10px; }
    .field input[type="number"] { max-width: none; width: 100%; text-align: center; }
    .ot-form .field:has(> input[type="number"]) { display: flex; align-items: stretch; }
    .section-head { flex-direction: row; }
    .section-head h3 { font-size: 15px; }
    .switch-label { display: none; }
    .switch-track { width: 46px; height: 28px; border-radius: 14px; }
    .switch-thumb { width: 22px; height: 22px; }
    .switch input:checked + .switch-track .switch-thumb { transform: translateX(18px); }
    .settings-section .form-grid { margin-top: 2px; }
    .btn-col .btn { height: 46px; }
    .holiday-list { max-height: none; }
}
@media (max-width: 359px) {
    #redoBtn { display: none; }
    .month-picker select { font-size: 15.5px; }
    .month-nav .icon-btn { width: 28px; }
}

/* ==========================================================
   Sol menü (sekmeler + ek araçlar)
   ========================================================== */
.menu-btn { flex: none; margin-right: -6px; }
.drawer-backdrop {
    position: fixed; inset: 0; z-index: 90; background: rgba(15, 23, 42, .35);
    opacity: 0; pointer-events: none; transition: opacity .18s;
}
.drawer {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 91; width: min(300px, 84vw);
    display: flex; flex-direction: column; gap: 2px; padding: 12px 10px calc(16px + env(safe-area-inset-bottom));
    padding-top: calc(12px + env(safe-area-inset-top));
    background: var(--surface); overflow-y: auto;
    transform: translateX(-102%); transition: transform .2s ease;
}
/* Gölge yalnızca açıkken: kapalıyken ekranın sol kenarına vuruyordu */
.drawer-open .drawer { transform: none; box-shadow: var(--shadow-lg); }
.drawer-open .drawer-backdrop { opacity: 1; pointer-events: auto; }
.drawer-head { display: flex; align-items: center; gap: 10px; padding: 4px 4px 12px 6px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.drawer-head .brand-mark { width: 32px; height: 32px; }
.drawer-head .brand-title { flex: 1; }
.drawer-group { padding: 14px 10px 6px; font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--faint); }
.drawer-item {
    display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px;
    border: 0; border-radius: 9px; background: none; text-align: left; cursor: pointer;
    font-size: 14.5px; font-weight: 600; color: var(--ink-2);
}
.drawer-item .ico { width: 19px; height: 19px; color: var(--muted); }
.drawer-item:hover { background: var(--surface-2); }
.drawer-item.active { background: var(--primary-soft); color: var(--primary); }
.drawer-item.active .ico { color: var(--primary); }
/* Araç ekranlarında ay seçimi ve Akıllı Dağıt gerekmez */
body[data-tab="overtime"] .month-nav, body[data-tab="overtime"] #solveBtn { display: none; }

/* ==========================================================
   Fazla mesai ücreti hesaplama
   ========================================================== */
.ot-wrap { max-width: 760px; margin: 0 auto; display: grid; gap: 16px; }
.ot-form { display: grid; gap: 18px; margin-bottom: 18px; }
.ot-form .field input[type="number"] { height: 42px; font-size: 18px; max-width: 180px; }
.ot-result { display: grid; gap: 12px; }
.ot-rate {
    display: grid; gap: 2px; padding: 14px 16px; border-radius: var(--radius);
    background: var(--primary-soft); border: 1px solid color-mix(in srgb, var(--primary) 20%, transparent);
}
.ot-rate > span { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.ot-rate > b { font-size: 26px; letter-spacing: -.01em; color: var(--primary); }
.ot-rate small { font-size: 12.5px; color: var(--ink-2); }
.ot-rate small.muted { color: var(--muted); }
.ot-total { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.ot-total > div { display: flex; justify-content: space-between; gap: 12px; padding: 11px 16px; }
.ot-total > div + div { border-top: 1px solid var(--line); }
.ot-total span { color: var(--ink-2); }
.ot-total b { white-space: nowrap; }
.ot-total .ot-net { background: var(--ok-soft); }
.ot-total .ot-net b { font-size: 22px; color: var(--ok); }
.ot-warn { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--warn-soft); color: #92400e; font-size: 13px; margin: 0 0 12px; }
.ot-warn .ico { width: 16px; height: 16px; flex: none; margin-top: 1px; color: var(--warn); }
.ot-result .ot-warn { margin: 0; }
.ot-empty { padding: 4px 2px; }
.ot-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.ot-table th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 6px 10px; }
.ot-table td { padding: 8px 10px; border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.ot-table td:not(:first-child), .ot-table th:not(:first-child) { text-align: right; }
.ot-table tr.on td { font-weight: 700; color: var(--ink); background: var(--surface); }
.ot-notes { margin: 12px 0 0; padding-left: 18px; display: grid; gap: 4px; }
@media (max-width: 640px) {
    .menu-btn { margin-right: -4px; }
    .ot-form .segmented { display: flex; }
    .ot-form .seg { flex: 1; justify-content: center; padding: 0 8px; }
    .ot-form .field input[type="number"] { max-width: none; }
}
.ot-gross { margin: -4px 2px 0; }
.ot-total .ot-net span { font-weight: 600; color: var(--ink); }
.seg:disabled { opacity: .4; cursor: not-allowed; }
@media (max-width: 640px) {
    .ot-titles .segmented { display: grid; grid-template-columns: 1fr 1fr; }
}
.ot-table td:not(:first-child), .ot-table th:not(:first-child) { white-space: nowrap; }
@media (max-width: 640px) {
    .ot-table { font-size: 12.5px; }
    .ot-table td, .ot-table th { padding: 7px 5px; }
}
