/* ==========================================================
   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
   ========================================================== */
.year-controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.year-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 14px; }
.year-stats .stat b { display: block; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.year-stats .stat small { font-size: 12px; font-weight: 600; color: var(--muted); }
.year-stats .stat small.t-pos { color: #15803d; }
.year-stats .stat b.stat-top { white-space: normal; }
.stat-top .top-name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat-top small { display: block; margin-top: 1px; }
.y-kadro-short { display: none; }
table.yearly thead th.y-cur, table.yearly thead th.y-cur .link-btn { color: var(--primary); }
.year-wrap { overflow-x: auto; margin: 0 -16px; border-top: 1px solid var(--line); }
table.yearly { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12.5px; font-variant-numeric: tabular-nums; }
table.yearly th, table.yearly td { border-bottom: 1px solid var(--line); padding: 6px; text-align: center; white-space: nowrap; }
table.yearly thead th { background: var(--surface-2); font-size: 11px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
table.yearly thead .link-btn { font-size: 11px; text-transform: uppercase; color: inherit; padding: 0; }
table.yearly thead .link-btn:hover { color: var(--primary); }
table.yearly th.unplanned .link-btn { color: var(--faint); }
table.yearly th.y-name { text-align: left; position: sticky; left: 0; z-index: 1; background: var(--surface); padding-left: 16px; min-width: 210px; }
table.yearly thead th.y-name, table.yearly tfoot th.y-name { background: var(--surface-2); }
.y-name .person-name { display: block; font-weight: 600; }
.y-tags { display: flex; gap: 4px; margin-top: 2px; }
table.yearly td.y-m { min-width: 58px; }
table.yearly td.unplanned { color: var(--faint); }
.yv { display: inline-block; min-width: 44px; padding: 2px 5px; border-radius: 5px; font-weight: 700; cursor: default; }
.yv.pos { background: #dcfce7; color: #15803d; }
.yv.neg { background: #fee2e2; color: #b91c1c; }
.yv.zero { background: var(--weekend); color: var(--muted); }
table.yearly td.y-num small { color: var(--faint); }
table.yearly td.y-total .yv { min-width: 62px; font-size: 13px; }
table.yearly td.y-bar { min-width: 130px; padding-right: 16px; }
.dbar { position: relative; height: 8px; background: var(--weekend); border-radius: 4px; }
.dbar::before { content: ""; position: absolute; left: 50%; top: -3px; bottom: -3px; width: 1px; background: var(--line-strong); }
.dbar span { position: absolute; top: 0; bottom: 0; border-radius: 4px; }
.dbar span.pos { left: 50%; background: #4ade80; }
.dbar span.neg { right: 50%; background: #f87171; }
table.yearly tfoot th, table.yearly tfoot td { background: var(--surface-2); font-weight: 700; border-bottom: 0; }
table.yearly tr.inactive .person-name { color: var(--muted); }

/* ==========================================================
   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); }
    .year-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ==========================================================
   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; }

/* ==========================================================
   Telefon (≤ 640 px): kısa üst çubuk, alt sekme çubuğu, gün kartları
   ========================================================== */
.tab-short { 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: 58px; }
    body { padding-bottom: calc(var(--bottom-nav) + env(safe-area-inset-bottom)); }

    /* Üst çubuk: marka + işlemler, altında ay seçimi */
    .topbar {
        position: sticky; top: 0; z-index: 50; flex-wrap: wrap; gap: 8px;
        padding: calc(8px + env(safe-area-inset-top)) 12px 8px;
        box-shadow: 0 1px 0 var(--line);
    }
    .brand { flex: 1 1 auto; gap: 8px; }
    .brand-mark { width: 36px; height: 36px; }
    .brand-title { font-size: 16px; }
    .top-actions { flex: 0 0 auto; gap: 4px; }
    .top-actions .divider { display: none; }
    .top-actions [data-action="toggle-menu"] .btn-label { display: none; }
    .top-actions [data-action="toggle-menu"] { padding: 0 10px; }
    .top-actions #solveBtn { padding: 0 12px; }
    .month-nav { order: 3; flex: 1 1 100%; gap: 6px; }
    .month-picker { flex: 1; display: flex; gap: 6px; }
    .month-picker select { flex: 1; min-width: 0; height: 38px; font-size: 15px; }
    .menu-list { right: 0; min-width: 240px; }

    /* Alt sekme çubuğu (uygulama gibi) */
    .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);
        box-shadow: 0 -4px 14px rgba(15, 23, 42, .07);
    }
    .tab {
        flex: 1 1 0; min-width: 0; flex-direction: column; justify-content: center; gap: 3px;
        padding: 4px 0 2px; margin: 0; font-size: 11px; position: relative;
        border-bottom: 0; border-top: 2px solid transparent;
    }
    .tab.active { border-top-color: var(--primary); background: var(--primary-soft); }
    .tab .ico { width: 21px; height: 21px; }
    .tab-label { display: none; }
    .tab-short { display: inline; }
    .tab-badge { position: absolute; top: 4px; left: calc(50% + 7px); margin: 0; }
    .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: 14px; }
    .toasts { left: 10px; right: 10px; bottom: calc(var(--bottom-nav) + env(safe-area-inset-bottom) + 10px); align-items: stretch; }
    .dialog { width: calc(100vw - 20px); max-width: none; max-height: calc(100vh - 40px); overflow: auto; }

    /* 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; }

    /* Nöbet çizelgesi: ekrana sığan sıkı tablo — her gün tek satır, dar tarih sütunu + 3 görev sütunu */
    .roster-card { padding: 12px 8px 4px; }
    .roster-card .card-head { flex-direction: column; align-items: stretch; gap: 8px; padding: 0 4px; }
    .roster-card .card-head h2 { font-size: 16px; }
    .roster-card .card-head > div:first-child > p { display: none; }
    .head-side { flex-wrap: wrap; gap: 8px; justify-content: space-between; }
    .fill-meter { flex: 1 1 100%; }
    .roster-card .callout { margin: 0 4px 10px; flex-wrap: wrap; align-items: flex-start; gap: 10px; padding: 12px; }
    .roster-card .callout > div { flex: 1 1 calc(100% - 40px); }
    .roster-card .callout > .btn { flex: 1 1 100%; justify-content: center; }

    /* Yıllık: dar isim sütunu, kadro etiketi ismin yanında tek harf */
    table.yearly th.y-name { min-width: 0; width: 132px; max-width: 150px; padding-left: 10px; white-space: normal; }
    .y-name .person-name { font-size: 12.5px; line-height: 1.25; }
    .y-kadro-short { display: inline-flex; height: 16px; margin-left: 5px; padding: 0 4px; border-radius: 4px; font-size: 10px; vertical-align: 1px; }
    .y-tags .y-kadro { display: none; }
    .y-tags:not(:has(.mini-tag:not(.y-kadro))) { display: none; }
    .table-wrap { overflow: visible; margin: 0 -8px; }
    table.roster { min-width: 0; table-layout: fixed; }
    table.roster thead th {
        position: static; padding: 6px 3px; font-size: 10px; letter-spacing: 0;
        line-height: 1.2; white-space: normal; text-align: center;
    }
    table.roster thead th .role-dot { display: none; }
    table.roster th.c-date { width: 38px; padding: 6px 0; }
    table.roster td { padding: 2px 1px; }
    table.roster td.c-date { padding: 2px 0; border-left-width: 3px; text-align: center; white-space: normal; }
    .c-date .date { display: flex; flex-direction: column; align-items: center; gap: 0; min-width: 0; }
    .date-num { width: auto; font-size: 14px; line-height: 1.1; text-align: center; }
    .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-short { color: var(--primary); font-weight: 700; }
    table.roster td.c-cell + td.c-cell { border-left: 1px solid var(--line); }

    /* Hücreler: oksuz, küçük yazı; isim sığmazsa kesilir (tam adı açılır listede) */
    select.assign {
        height: 30px; padding: 0 3px; font-size: 12px; font-weight: 600;
        background-image: none; text-align: center; text-align-last: center; border-radius: 5px;
    }
    .cell.is-empty select.assign { font-size: 11px; }
    .cell.is-empty { border-radius: 5px; }
    .flag { right: 1px; top: 1px; }
    .flag .ico { width: 11px; height: 11px; }
    .c-cell.is-split { padding-top: 1px; padding-bottom: 1px; }
    .split-row { flex-direction: column; gap: 1px; }
    .cell.half, .split-row .cell.half { gap: 1px; padding-left: 0; }
    .cell.half + .cell.half { margin-top: 1px; }
    .cell.half select.assign, .split-row .cell.half select.assign,
    .c-cell.is-eight .cell.half select.assign {
        height: 24px; font-size: 11px; padding: 0 2px; background-image: none; text-align: left; text-align-last: left;
    }
    .part-tag { width: 13px; height: 16px; font-size: 9px; border-radius: 3px; }
    .part-a, .part-b, .part-c, .part-ab, .part-bc { width: auto; padding: 0 2px; font-size: 8.5px; }
    .split-row .flag { right: 1px; }

    .side .card { overflow-x: auto; }
    .head-stats { flex-wrap: wrap; }

    /* Personel: baş harfler ve düğmeler üstte, bilgiler tam genişlikte altta */
    .staff-row { flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 12px 2px; }
    .staff-row .staff-actions { margin-left: auto; }
    .staff-row .staff-main { order: 3; flex: 1 1 100%; }
    .staff-row .name-input { margin-left: 0; max-width: none; width: 100%; }
    .emp-row { flex-wrap: wrap; gap: 6px; }

    /* İzin & Tercihler: fırçalar yana kayar, tablo yalnızca kendi kutusunda kayar */
    .brushbar { gap: 10px; }
    .segmented { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
    .segmented::-webkit-scrollbar { display: none; }
    .seg { flex: none; }
    .matrix-wrap { margin: 0 -14px -14px; max-height: calc(100dvh - 240px - env(safe-area-inset-bottom)); }
    th.m-name { min-width: 128px; max-width: 150px; padding: 6px 8px; }
    th.m-name .mini-tag, th.m-name .role-dots { display: none; }
    th.m-day { min-width: 34px; }
    td.pc { height: 44px; }
    td.m-meta.wide, th.m-meta.wide { min-width: 150px; }
}

/* ==========================================================
   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); box-shadow: var(--shadow-lg); overflow-y: auto;
    transform: translateX(-102%); transition: transform .2s ease;
}
.drawer-open .drawer { transform: none; }
.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 .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; }
}
