/* APS Cizelgeleme Panosu - stil dosyasi (hafif, bagimliliksiz) */

:root {
    --bg: #0f172a;
    --bg-soft: #1e293b;
    --card: #ffffff;
    --ink: #1e293b;
    --ink-soft: #64748b;
    --line: #e2e8f0;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --accent: #0ea5e9;
    --late: #dc2626;
    --ok: #16a34a;
    --shadow: 0 1px 3px rgba(0, 0, 0, .1), 0 1px 2px rgba(0, 0, 0, .06);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
    background: #f1f5f9;
    color: var(--ink);
    line-height: 1.5;
}

/* Baslik */
.app-header {
    background: linear-gradient(135deg, var(--bg), var(--bg-soft));
    color: #fff;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 14px; }
.logo {
    font-weight: 800;
    font-size: 20px;
    background: var(--primary);
    padding: 8px 12px;
    border-radius: 10px;
    letter-spacing: 1px;
}
.app-header h1 { font-size: 18px; margin: 0; }
.subtitle { margin: 0; font-size: 13px; color: #94a3b8; }
.swagger-link { color: #bae6fd; text-decoration: none; font-size: 14px; }
.swagger-link:hover { text-decoration: underline; }

/* Yerlesim */
.container { max-width: 1200px; margin: 22px auto; padding: 0 18px; display: flex; flex-direction: column; gap: 18px; }

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 18px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.card-head-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.card h2 { font-size: 16px; margin: 0 0 12px; }
.card-head h2 { margin: 0; }

/* Kontroller */
.control-grid { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 14px; }
.field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--ink-soft); }
.field input, .field select {
    font-size: 14px; padding: 8px 10px; border: 1px solid var(--line);
    border-radius: 8px; color: var(--ink); background: #fff; min-width: 220px;
}
.button-row { display: flex; flex-wrap: wrap; gap: 10px; }
.button-row.data-tools { margin-top: 10px; padding-top: 12px; border-top: 1px dashed var(--line); }
.split-option { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 13px; color: var(--ink-soft); cursor: pointer; }
.split-option input { width: 17px; height: 17px; cursor: pointer; }
.split-option.sub-option { margin-top: 4px; margin-left: 26px; cursor: default; }
.split-option.sub-option input[type="number"] { width: 90px; height: auto; padding: 4px 6px; cursor: text; }
.split-option .hint-inline { font-size: 12px; color: var(--ink-soft); opacity: .8; }
.btn {
    font-size: 14px; font-weight: 600; padding: 9px 16px; border-radius: 8px;
    border: 1px solid var(--line); background: #fff; color: var(--ink); cursor: pointer;
    transition: all .15s ease;
}
.btn:hover { background: #f8fafc; border-color: #cbd5e1; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.status { margin-top: 12px; font-size: 13px; min-height: 18px; }
.status.error { color: var(--late); }
.status.ok { color: var(--ok); }

/* Ozet kartlari */
.summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat {
    background: var(--card); border: 1px solid var(--line); border-radius: 12px;
    padding: 14px 16px; box-shadow: var(--shadow);
}
.stat .label { font-size: 12px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .4px; }
.stat .value { font-size: 22px; font-weight: 700; margin-top: 4px; }
.stat.late .value { color: var(--late); }

/* Gantt */
.gantt-wrap { position: relative; overflow-x: auto; overflow-y: auto; max-height: 72vh; }
#gantt { display: block; }

/* Donmus bolmeler (sabit ust baslik + sol makine sutunu) */
.gantt-frozen-host { position: relative; }
.gantt-frozen {
    position: absolute; top: 0; left: 0;
    pointer-events: none;              /* fare olaylari alttaki canvas'a gecsin (ipucu calissin) */
    display: block;
}
/* ONEMLI: display tanimlamak [hidden] ozniteligini ezer -> acikca geri getir. */
.gantt-frozen[hidden] { display: none; }
#ganttFrozenLeft { z-index: 2; }
#ganttFrozenTop { z-index: 3; }        /* ust katman kose kutusunu da kapatir */
/* KAYDIGI BELLI OLSUN: icerik altina kayinca donmus kenara golge duser */
#ganttFrozenLeft.scrolled { box-shadow: 6px 0 8px -4px rgba(15, 23, 42, .28); }
#ganttFrozenTop.scrolled { box-shadow: 0 6px 8px -4px rgba(15, 23, 42, .28); }

/* Is Emri gorunumunde satir basina "İş emrini kapat" dugmesi: donmus sol panelin USTUNDE (tiklanabilir). */
.gantt-row-actions { position: absolute; top: 0; left: 0; z-index: 4; pointer-events: none; }
.gantt-row-actions[hidden] { display: none; }
.gantt-row-close-btn {
    position: absolute; pointer-events: auto;
    display: flex; align-items: center; justify-content: center;
    border: 1px solid #16a34a; border-radius: 6px; background: #f0fdf4; color: #166534;
    font-size: 13px; line-height: 1; cursor: pointer; padding: 0;
}
.gantt-row-close-btn:hover { background: #dcfce7; }
.gantt-row-pause-btn {
    position: absolute; pointer-events: auto;
    display: flex; align-items: center; justify-content: center;
    border: 1px solid #b45309; border-radius: 6px; background: #fffbeb; color: #92400e;
    font-size: 13px; line-height: 1; cursor: pointer; padding: 0;
}
.gantt-row-pause-btn:hover { background: #fef3c7; }
.empty-hint { color: var(--ink-soft); font-size: 14px; text-align: center; padding: 20px 0; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--ink-soft); }
.legend .item { display: flex; align-items: center; gap: 6px; }
.legend .swatch { width: 14px; height: 14px; border-radius: 3px; }

.tooltip {
    position: fixed; pointer-events: none; z-index: 1000;
    background: #0f172a; color: #fff; font-size: 12px; padding: 8px 10px;
    border-radius: 8px; box-shadow: 0 6px 18px rgba(0, 0, 0, .3); max-width: 280px;
}
.tooltip b { color: #93c5fd; }

/* Cizelge uzun bir donemе yayildiginda gosterilen bilgi seridi */
.gantt-notice {
    margin: 0 0 8px; padding: 8px 12px; border-radius: 8px;
    background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af;
    font-size: 13px; display: flex; align-items: center; gap: 8px;
}
.gantt-notice.compressed { background: #fff7ed; border-color: #fed7aa; color: #9a3412; }
.gantt-notice::before { content: "ℹ️"; }

/* Yurutme durumu rozetleri (kayitli plan tablosu) */
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge-planned { background: #eef2f7; color: #475569; }
.badge-inprogress { background: #fef3c7; color: #92400e; }
.badge-completed { background: #dcfce7; color: #166534; }
.help-cue { cursor: pointer; color: #2563eb; font-size: 12px; user-select: none; }

/* ---- Uretim yasam dongusu kontrolleri ---- */
.prod-banner { padding: 10px 14px; border-radius: 10px; font-weight: 700; font-size: 15px; margin-bottom: 10px; border: 1px solid transparent; }
.prod-banner.draft { background: #f1f5f9; color: #475569; border-color: #e2e8f0; }
.prod-banner.running { background: #dcfce7; color: #166534; border-color: #86efac; }
.prod-banner.stopped { background: #fee2e2; color: #991b1b; border-color: #fca5a5; }
.prod-approval { padding: 8px 12px; border-radius: 8px; margin-bottom: 10px; background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412; font-weight: 600; }

.event-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 10px; padding: 10px 12px; background: #f8fafc; border: 1px dashed #cbd5e1; border-radius: 10px; }
.event-actions .ev-title { font-weight: 600; color: #334155; font-size: 13px; }
.inline-field { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.inline-field select { padding: 4px 6px; }
.repair-area { font-size: 13px; color: #475569; }

.advanced { margin-top: 10px; border: 1px solid #e2e8f0; border-radius: 10px; padding: 4px 12px; background: #fbfcfe; }
.advanced > summary { cursor: pointer; padding: 8px 0; font-weight: 600; color: #334155; font-size: 13px; }
.advanced .adv-sep { border: none; border-top: 1px dashed #e2e8f0; margin: 10px 0; }

/* ---- Uretim gunlugu ---- */
.event-log .log-list { list-style: none; margin: 0; padding: 0; }
.event-log .log-list li { padding: 6px 4px; border-bottom: 1px solid #f1f5f9; font-size: 13px; display: flex; align-items: baseline; gap: 8px; }
.event-log .log-time { color: #94a3b8; font-variant-numeric: tabular-nums; white-space: nowrap; }
.event-log .log-ico { width: 18px; text-align: center; }

/* Tablo */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { background: #f8fafc; color: var(--ink-soft); font-weight: 600; position: sticky; top: 0; }
/* Tıklayınca sıralanan tablo başlıkları (Raporlar → İş Emri Bazlı Üretim) */
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--primary); }
th.sortable:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
th.sortable .sort-ind { font-size: 10px; opacity: .35; }
th.sortable.sorted { color: var(--primary); }
th.sortable.sorted .sort-ind { opacity: 1; }
tr:hover td { background: #f8fafc; }
.badge { padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge.late { background: #fee2e2; color: var(--late); }
.badge.ok { background: #dcfce7; color: var(--ok); }
.badge.warn { background: #fef3c7; color: #b45309; }

.app-footer { text-align: center; color: var(--ink-soft); font-size: 12px; padding: 24px; }

/* Sekmeler — sayfa kaydirilinca USTTE SABIT kalir (sticky); kaydirinca golge ile belli olur. */
.tabs {
    display: flex;
    flex-direction: row;
    gap: 6px;
    margin-top: 0;
    margin-bottom: 0;
    padding: 12px 18px 0;              /* .container'in 0 18px'ini ezer; ustte nefes payi (sabitken icerik gizlensin) */
    border-bottom: 2px solid var(--line);
    flex-wrap: wrap;
    position: sticky;
    top: 0;
    z-index: 20;                       /* kartlarin ustunde, modal(100)/tooltip(1000) altinda */
    background: #f1f5f9;               /* sayfa zemini: altina kayan icerigi ortsun */
    transition: box-shadow .18s ease;
}
.tabs.scrolled { box-shadow: 0 6px 14px -6px rgba(15, 23, 42, .28); }   /* sayfa kaydi gostergesi */
.tab {
    background: transparent; border: none; cursor: pointer;
    font-size: 14px; font-weight: 600; color: var(--ink-soft);
    padding: 10px 16px; border-radius: 8px 8px 0 0;
    border-bottom: 2px solid transparent; margin-bottom: -2px;
}
.tab:hover { color: var(--ink); background: #fff; }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); background: #fff; }
.tabpanel { display: flex; flex-direction: column; gap: 18px; }
/* ONEMLI: .tabpanel'in display'i, tarayicinin [hidden]{display:none} kuralini ezer.
   Bu yuzden gizli paneli acikca display:none yapmaliyiz (yoksa tum sekmeler ust uste gorunur). */
.tabpanel[hidden] { display: none; }

/* Veri giris formlari */
.entry-form { display: flex; flex-direction: column; gap: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.form-actions { display: flex; align-items: center; gap: 14px; }
.form-status { font-size: 13px; }
.form-status.ok { color: var(--ok); }
.form-status.error { color: var(--late); }

/* Onay kutusu (checkbox) alanlari - genis input stilini ezme */
.field.check { flex-direction: row; align-items: center; gap: 8px; }
.field input[type="checkbox"] { width: 18px; height: 18px; min-width: auto; flex: none; cursor: pointer; }

/* Vardiya onay kutusu grubu (makine formu) */
.field.wide { grid-column: 1 / -1; }
.check-group { display: flex; flex-wrap: wrap; gap: 8px 18px; padding: 6px 0; }
.check-group .chk { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink); cursor: pointer; }
.check-group .chk input { width: 16px; height: 16px; cursor: pointer; }
.check-group .muted { color: var(--ink-soft); font-size: 13px; }

/* Toplu vardiya atama (Makineler ekrani): secim sutunu + toplu cubuk */
.sel-col { width: 34px; text-align: center; }
.sel-col input[type="checkbox"] { width: 17px; height: 17px; cursor: pointer; vertical-align: middle; }
.bulk-bar { border: 1px solid var(--accent); background: #f0f9ff; border-radius: 10px; padding: 10px 12px; margin: 0 0 10px; display: flex; flex-direction: column; gap: 8px; }
.bulk-head { display: flex; align-items: center; gap: 12px; }
.bulk-head strong { color: var(--ink); }
.bulk-controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.bulk-shifts-row { display: flex; align-items: flex-start; gap: 10px; flex-wrap: wrap; }
.bulk-label { font-size: 13px; font-weight: 600; color: var(--ink-soft); padding-top: 6px; }
.field.inline { flex-direction: row; align-items: center; gap: 8px; }
.field.inline > span { cursor: default; }
.field.inline > span::after { content: none; }
.field.inline select { width: auto; }

/* ===== Fabrika Simülasyonu (üstten izleme) ===== */
.sim-toolbar { display:flex; justify-content:space-between; align-items:center; gap:12px; flex-wrap:wrap; }
.sim-controls { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.sim-speed { display:flex; align-items:center; gap:6px; font-size:13px; color:var(--ink-soft); }
.sim-speed select { width:auto; }
.sim-clock { text-align:right; font-family:ui-monospace,Consolas,monospace; }
.sim-clock #simClock { font-size:18px; font-weight:700; color:var(--ink); }
.sim-clock small { display:block; font-size:11px; color:#dc2626; }
.sim-slider { width:100%; margin:12px 0 8px; accent-color:var(--accent); }
.sim-slider:disabled { opacity:.5; }
.sim-legend { display:flex; align-items:center; gap:16px; flex-wrap:wrap; font-size:13px; color:var(--ink-soft); }
.sim-legend b { color:var(--ink); }
.sdot { display:inline-block; width:11px; height:11px; border-radius:3px; vertical-align:middle; margin-right:3px; }
.sdot.work { background:#16a34a; } .sdot.idle { background:#cbd5e1; } .sdot.broken { background:#dc2626; }
.sim-hint { margin-left:auto; font-size:12px; color:var(--ink-soft); }

.sim-floor-card { overflow:auto; }
.sim-floor { min-height:180px; }
.sim-flow { display:flex; align-items:stretch; gap:6px; padding:8px 2px; min-width:min-content; }
.sim-col { background:var(--surface-2,#f1f5f9); border:1px solid var(--line); border-radius:12px; padding:10px; display:flex; flex-direction:column; }
.sim-col-head { font-weight:700; color:var(--ink); text-align:center; margin-bottom:8px; font-size:13px; white-space:nowrap; }
.sim-col-head small { display:block; font-weight:400; color:var(--ink-soft); font-size:11px; }
.sim-col-body { display:flex; flex-direction:column; gap:8px; }
.sim-arrow { align-self:center; color:var(--ink-soft); font-size:20px; flex:none; }

.mc { --mc:#94a3b8; background:#fff; border:2px solid var(--line); border-radius:10px; padding:8px 10px; width:150px; transition:border-color .25s,box-shadow .25s,background .25s,opacity .25s; }
.mc-code { font-weight:700; font-size:13px; color:var(--ink); }
.mc-job { font-size:12px; color:var(--ink-soft); min-height:32px; margin-top:2px; line-height:1.3; }
.mc-job b { color:var(--ink); }
.mc-job small { display:block; font-size:10px; color:var(--ink-soft); }
.mc-prog { height:5px; background:var(--line); border-radius:3px; overflow:hidden; margin-top:5px; }
.mc-prog i { display:block; height:100%; width:0; background:var(--mc); transition:width .2s linear; }
.mc.work { border-color:var(--mc); box-shadow:0 0 14px -3px var(--mc); animation:mcPulse 2.2s ease-in-out infinite; }
.mc.idle { opacity:.66; }
.mc.broken { border-color:#dc2626; background:#fef2f2; }
.mc.broken .mc-code, .mc.broken .mc-job { color:#dc2626; }
@keyframes mcPulse { 0%,100%{ box-shadow:0 0 9px -4px var(--mc); } 50%{ box-shadow:0 0 17px -2px var(--mc); } }
@media (prefers-reduced-motion:reduce){ .mc.work{ animation:none; } }

/* ===== Vardiya: molalar + yarim gun ===== */
.break-rows { display:flex; flex-direction:column; gap:6px; padding:4px 0; }
.break-row { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.break-row .brk-label { width:130px; }
.break-row input[type=time] { width:120px; }
.break-row .brk-dash { color:var(--ink-soft); }
.break-row .brk-del { line-height:1; padding:2px 9px; }
.halfday-row { display:flex; align-items:center; gap:18px; flex-wrap:wrap; padding:4px 0; }
.day-checks { display:flex; gap:10px; flex-wrap:wrap; }
.day-checks .chk { display:flex; align-items:center; gap:4px; font-size:13px; color:var(--ink); cursor:pointer; }
.day-checks .chk input { width:16px; height:16px; cursor:pointer; }
.hd-end { display:flex; align-items:center; gap:6px; font-size:13px; color:var(--ink-soft); }
.hd-end input { width:120px; }

/* Is emri formu: izin verilen makineler (is merkezine gore gruplu + durum rozetli) */
.mach-group { padding: 6px 0; display: flex; flex-direction: column; gap: 8px; }
.mach-group .muted { color: var(--ink-soft); font-size: 13px; }
.mach-wc { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.mach-wc-name { font-size: 12px; font-weight: 600; color: var(--ink-soft); min-width: 84px; }
.mach-chk { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; padding: 3px 8px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.mach-chk:hover { border-color: var(--primary); }
.mach-chk input { width: 15px; height: 15px; cursor: pointer; }
.mach-chk.broken { opacity: .6; }
.mach-badge { font-size: 11px; padding: 1px 7px; border-radius: 999px; font-weight: 600; white-space: nowrap; }
.mach-badge.idle { background: #dcfce7; color: #166534; }        /* bosta */
.mach-badge.busy { background: #fef3c7; color: #92400e; }        /* calisiyor */
.mach-badge.broken { background: #fee2e2; color: #b91c1c; }      /* arizali */

/* Buton varyantlari */
.btn.danger { background: #fff; border-color: #fecaca; color: var(--late); }
.btn.danger:hover { background: #fee2e2; border-color: var(--late); }
.btn.success { background: #16a34a; border-color: #16a34a; color: #fff; }
.btn.success:hover { background: #15803d; border-color: #15803d; }
.btn.sm { padding: 4px 10px; font-size: 12px; }

/* Baslik aksiyonlari + Rehber butonu */
.header-actions { display: flex; align-items: center; gap: 14px; }
.guide-btn {
    background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .25);
    color: #fff; font-size: 13px; font-weight: 600; padding: 7px 12px; border-radius: 8px; cursor: pointer;
}
.guide-btn:hover { background: rgba(255, 255, 255, .22); }

/* Ipucu + alt baslik */
.hint { color: var(--ink-soft); font-size: 13px; margin: -4px 0 12px; }
.sub { font-size: 14px; margin: 6px 0; color: var(--ink); }

/* Operasyon tablosu (rota formu) */
.op-table input, .op-table select { padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; font-size: 13px; }
.op-table td { padding: 6px 8px; }
.op-table .op-name { width: 100%; min-width: 120px; }

/* Modal (Demo Rehberi) */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal[hidden] { display: none; }  /* tabpanel ile ayni: display ezimini engelle */
.modal-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, .55); }
.modal-box {
    position: relative; background: #fff; border-radius: 14px; box-shadow: 0 20px 50px rgba(0, 0, 0, .3);
    max-width: 720px; width: 100%; max-height: 85vh; display: flex; flex-direction: column; overflow: hidden;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 17px; }
.modal-close { background: none; border: none; font-size: 26px; line-height: 1; cursor: pointer; color: var(--ink-soft); }
.modal-close:hover { color: var(--ink); }
.modal-body { padding: 18px 22px; overflow-y: auto; font-size: 14px; }
.guide-steps { padding-left: 22px; display: flex; flex-direction: column; gap: 12px; margin: 0; }
.guide-steps li { line-height: 1.5; }
.guide-steps .ex { color: var(--ink-soft); font-size: 13px; }
.guide-tip { margin-top: 16px; background: #f0f9ff; border: 1px solid #bae6fd; border-radius: 10px; padding: 12px 16px; }
.guide-tip ul { margin: 8px 0 0; padding-left: 18px; }
.guide-tip li { margin: 4px 0; }

/* Duzenleme/iptal + satir aksiyon butonlari */
.btn.cancel-edit { background: #fff; border-color: var(--line); color: var(--ink-soft); }
.row-actions { display: flex; gap: 6px; }

/* Alan yardimi: tiklanabilir etiketler (uzerine gelince yardim imleci + ⓘ ipucu) */
label.field > span { cursor: help; }
label.field > span::after { content: " ⓘ"; color: #94a3b8; font-size: 11px; }
.op-table th[data-help] { cursor: help; }
.op-table th[data-help]::after { content: " ⓘ"; color: #94a3b8; font-size: 10px; }

/* Kucuk modal (alan yardimi) */
.modal-box.modal-sm { max-width: 440px; }
#helpBody { margin: 0; line-height: 1.55; }

/* Genis modal (arsiv uretim detayi: Gantt sigsin) */
.modal-box.modal-wide { max-width: min(1200px, 96vw); }

/* Iptal edilmis is emri satiri (cizelgelenmez -> belirgin) */
tr.row-cancelled > td { background: #fef2f2; opacity: .85; }

/* Uretimi fiilen bitmis is emri satiri (Is Emri Tamamlanma Ozeti) -> hafif yesil vurgu */
tr.row-completed > td { background: #f0fdf4; }

/* Elle duraklatilmis is emri satiri (Is Emirleri) -> hafif amber vurgu */
tr.row-paused > td { background: #fffbeb; }

/* Gantt ustu "Bos gunleri gizle" toggle */
.toggle-chk { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--ink-soft); cursor: pointer; user-select: none; }
.toggle-chk input { width: 15px; height: 15px; cursor: pointer; }

/* TAM EKRAN GANTT: kalabalik planlari buyuk ve net gostermek icin */
.gantt-fs { position: fixed; inset: 0; z-index: 150; background: #fff; display: flex; flex-direction: column; }
.gantt-fs[hidden] { display: none; }
.gantt-fs-bar {
    display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
    padding: 8px 14px; border-bottom: 1px solid var(--line); background: #f8fafc;
}
.gantt-fs-bar > b { font-size: 15px; color: var(--ink); }
.gantt-fs-spacer { flex: 1; }
.gantt-fs-host { flex: 1; min-height: 0; overflow: hidden; padding: 8px 12px; }
/* Tam ekranda Gantt kaydirma alani tum yuksekligi kullansin */
.gantt-fs-host .gantt-wrap { max-height: none; height: 100%; }
.gantt-fs-host .gantt-frozen-host { height: 100%; }

/* Gantt gorunum gecisi (Makine / Is Emri) — segmentli buton */
.gantt-view-toggle { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--ink-soft); }
.gantt-view-toggle .vbtn { border: 1px solid var(--line); background: #fff; color: var(--ink-soft); padding: 4px 10px; font-size: 12px; font-weight: 600; cursor: pointer; }
.gantt-view-toggle .vbtn:first-of-type { border-radius: 8px 0 0 8px; }
.gantt-view-toggle .vbtn:last-of-type { border-radius: 0 8px 8px 0; border-left: 0; }
.gantt-view-toggle .vbtn:hover { background: #f1f5f9; }
.gantt-view-toggle .vbtn.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* Operasyon detayi: her yeni is emri grubunun ilk satirina belirgin ust cizgi */
tr.wo-group-start > td { border-top: 2px solid var(--line); }
tr.wo-group-start > td:first-child { font-weight: 700; }

/* Ayarlar: snapshot kaydetme satiri */
.snap-save { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.snap-save input { flex: 1; min-width: 220px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; font-size: 14px; }
.snap-save input:focus { outline: none; border-color: var(--primary); }

/* Ayarlar sekmesi: veri yonetimi satirlari */
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-top: 1px solid var(--line); }
.setting-row > div { flex: 1; }
.setting-row b { font-size: 14px; }
.setting-row .ex { margin: 3px 0 0; color: var(--ink-soft); font-size: 13px; }
.setting-row.danger-zone b { color: var(--late); }
.hint-inline { color: var(--ink-soft); font-size: 12px; align-self: center; }

/* Rapor: is emri bitim yuzdesi ilerleme cubugu */
.pctbar { display: inline-block; width: 70px; height: 8px; background: #e2e8f0; border-radius: 999px; overflow: hidden; vertical-align: middle; margin-right: 6px; }
.pctbar > span { display: block; height: 100%; border-radius: 999px; }

/* Modal ustu sekmeler (Rehber / Neler Eklendi) */
.modal-tabs { display: flex; gap: 6px; }
.modal-tab { background: none; border: none; padding: 6px 12px; font-size: 15px; font-weight: 600; color: var(--ink-soft); cursor: pointer; border-radius: 8px 8px 0 0; border-bottom: 2px solid transparent; }
.modal-tab:hover { color: var(--ink); background: #f1f5f9; }
.modal-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.gtab-panel[hidden] { display: none; }

/* "Neler Eklendi" listesi */
.upd { display: flex; flex-direction: column; gap: 12px; }
.upd-item { border-left: 3px solid var(--primary); padding: 4px 0 4px 12px; }
.upd-item > b { font-size: 14px; }
.upd-item p { margin: 4px 0 0; line-height: 1.5; color: var(--ink); font-size: 13px; }
.upd-item .ub { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 999px; font-weight: 600; margin: 0 2px; }
.upd-item .ub.idle { background: #dcfce7; color: #166534; }
.upd-item .ub.busy { background: #fef3c7; color: #92400e; }
.upd-item .ub.broken { background: #fee2e2; color: #b91c1c; }

/* Kapasite analizi oneri bandi */
.reco-banner { background: #fef3c7; border: 1px solid #fcd34d; color: #92400e; border-radius: 10px; padding: 12px 16px; font-weight: 600; margin-bottom: 14px; line-height: 1.5; }
.reco-banner.ok { background: #dcfce7; border-color: #86efac; color: #166534; }
#analysisBody h3.sub { margin: 16px 0 8px; }

/* ============ YAPAY ZEKA DANISMANI ============ */
.ai-badge { font-size: 12px; padding: 3px 10px; border-radius: 999px; background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0; white-space: nowrap; }
.ai-badge.ok { background: #dcfce7; border-color: #86efac; color: #166534; }
.ai-badge.err { background: #fee2e2; border-color: #fca5a5; color: #991b1b; }

.ai-quick { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }

.ai-chat { border: 1px solid var(--border, #e2e8f0); border-radius: 10px; background: #fbfcfe; padding: 14px; min-height: 220px; max-height: 55vh; overflow-y: auto; }
.ai-chat:empty::after { content: "Bir soru sorun ya da yukarıdaki hazır sorulardan birine tıklayın."; color: #94a3b8; font-size: 13px; }

.ai-msg { margin-bottom: 14px; line-height: 1.55; }
.ai-msg .who { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: #64748b; margin-bottom: 4px; }
.ai-msg.user .bubble { background: #eef2ff; border: 1px solid #c7d2fe; border-radius: 10px; padding: 9px 12px; display: inline-block; max-width: 90%; }
.ai-msg.bot .bubble { background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; padding: 11px 14px; }
.ai-msg.bot .bubble p { margin: 0 0 8px; }
.ai-msg.bot .bubble p:last-child { margin-bottom: 0; }
.ai-msg.bot .bubble ul { margin: 6px 0 8px; padding-left: 20px; }
.ai-msg.bot .bubble code { background: #f1f5f9; padding: 1px 5px; border-radius: 4px; font-size: 12.5px; }

/* Modelin hangi araclari cagirdigi — seffaflik icin acilir kapanir */
.ai-tools { margin-top: 8px; font-size: 12px; }
.ai-tools summary { cursor: pointer; color: #64748b; user-select: none; }
.ai-tools summary:hover { color: #334155; }
.ai-tools pre { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 6px; padding: 8px 10px; margin: 6px 0 0; white-space: pre-wrap; word-break: break-word; font-size: 11.5px; color: #475569; max-height: 220px; overflow-y: auto; }
.ai-meta { font-size: 11.5px; color: #94a3b8; margin-top: 6px; }
.ai-warn { background: #fef3c7; border: 1px solid #fcd34d; color: #92400e; border-radius: 8px; padding: 8px 11px; font-size: 12.5px; margin-top: 8px; }

/* Bekleme gostergesi — yerel model yavas oldugu icin gecen sure de yazilir */
.ai-thinking { display: flex; align-items: center; gap: 9px; color: #64748b; font-size: 13px; }
.ai-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary, #4f46e5); animation: aiPulse 1.1s ease-in-out infinite; }
@keyframes aiPulse { 0%,100% { opacity: .25; transform: scale(.8); } 50% { opacity: 1; transform: scale(1.15); } }

.ai-compose { display: flex; gap: 8px; margin-top: 12px; align-items: flex-start; }
.ai-compose textarea { flex: 1; resize: vertical; min-height: 44px; font: inherit; padding: 10px 12px; border: 1px solid var(--border, #e2e8f0); border-radius: 8px; }
.ai-compose textarea:focus { outline: none; border-color: var(--primary, #4f46e5); }

@media (max-width: 720px) {
  .ai-compose { flex-wrap: wrap; }
  .ai-compose textarea { flex-basis: 100%; }
}

/* ---- Ayarlar: yapay zeka saglayici secimi ---- */
.ai-prov { display: grid; gap: 10px; margin-bottom: 14px; }
.ai-prov-opt { display: flex; gap: 11px; align-items: flex-start; border: 1px solid var(--border, #e2e8f0); border-radius: 10px; padding: 12px 14px; cursor: pointer; background: #fff; transition: border-color .15s, background .15s; }
.ai-prov-opt:hover { border-color: #cbd5e1; background: #fafbfc; }
.ai-prov-opt:has(input:checked) { border-color: var(--primary, #4f46e5); background: #f5f3ff; }
.ai-prov-opt input { margin-top: 3px; flex: none; }
.ai-prov-opt p { margin: 4px 0 0; }
.ai-tag { font-size: 11px; padding: 2px 8px; border-radius: 999px; margin-left: 6px; white-space: nowrap; }
.ai-tag.ok { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.ai-tag.warn { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }
.ai-cfg-box { border-left: 3px solid var(--primary, #4f46e5); padding-left: 14px; margin: 0 0 12px; }

/* ---- Sekme acilir menusu (Operasyon) ------------------------------------
   .tabs sticky ve z-index:20; acilir liste onun USTUNDE cizilmeli (z-index:30).
   Menu, sekme cubugunun bir parcasi gibi gorunsun diye .tab stilini kullanir. */
.tab-menu { position: relative; display: inline-flex; }
.tab-menu-btn { display: inline-flex; align-items: center; gap: 6px; }
.tab-menu-btn .caret { font-size: 10px; opacity: .7; transition: transform .15s ease; }
.tab-menu.open .tab-menu-btn .caret { transform: rotate(180deg); }
/* Icindeki sekmelerden biri secili ise baslik da secili gorunur (kullanici nerede oldugunu bilsin) */
.tab-menu-btn.active { color: var(--primary); border-bottom-color: var(--primary); background: #fff; }

.tab-menu-list {
    position: absolute; top: calc(100% + 2px); left: 0; z-index: 30;
    min-width: 268px; padding: 6px;
    background: #fff; border: 1px solid var(--line, #e2e8f0); border-radius: 10px;
    box-shadow: 0 12px 28px -8px rgba(15, 23, 42, .3);
    display: flex; flex-direction: column; gap: 2px;
}
.tab-menu-list[hidden] { display: none; }

.tab-menu-item {
    display: flex; align-items: flex-start; gap: 10px; width: 100%;
    background: transparent; border: none; cursor: pointer; text-align: left;
    padding: 8px 10px; border-radius: 8px; font: inherit; color: var(--ink, #0f172a);
}
.tab-menu-item:hover { background: #f1f5f9; }
.tab-menu-item.active { background: #eef2ff; }
.tab-menu-item.active .step { background: var(--primary, #4f46e5); color: #fff; border-color: var(--primary, #4f46e5); }
/* Kurulum sirasini gosteren numara rozeti */
.tab-menu-item .step {
    flex: none; width: 21px; height: 21px; margin-top: 1px;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--line, #e2e8f0); border-radius: 50%;
    font-size: 11px; font-weight: 700; color: var(--ink-soft, #64748b); background: #f8fafc;
}
.tab-menu-item .txt { display: flex; flex-direction: column; line-height: 1.3; }
.tab-menu-item .txt b { font-size: 14px; font-weight: 600; }
.tab-menu-item .txt small { font-size: 11.5px; color: var(--ink-soft, #64748b); margin-top: 1px; }

@media (max-width: 640px) {
    .tab-menu-list { min-width: 220px; }
    .tab-menu-item .txt small { display: none; }   /* dar ekranda aciklamayi gizle */
}

/* ---- "Planı yenile" sebep modali ---- */
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px 16px; border-top: 1px solid var(--line, #e2e8f0); }
.replan-reasons { display: flex; flex-direction: column; gap: 6px; }
.replan-reasons label { display: flex; gap: 9px; align-items: flex-start; padding: 9px 11px; border: 1px solid var(--line, #e2e8f0); border-radius: 8px; cursor: pointer; }
.replan-reasons label:hover { background: #f8fafc; }
.replan-reasons label:has(input:checked) { border-color: var(--primary, #4f46e5); background: #f5f3ff; }
.replan-reasons input { margin-top: 3px; flex: none; }
.replan-reasons span { display: flex; flex-direction: column; line-height: 1.35; }
.replan-reasons span b { font-size: 13.5px; font-weight: 600; }
.replan-reasons span small { font-size: 11.5px; color: var(--ink-soft, #64748b); }

/* ================= KIMLIK DOGRULAMA / KULLANICILAR ================= */
/* Giris ekrani — her seyin ustunde tam ekran */
.login-screen { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #1e293b, #0f172a); padding: 20px; }
.login-box { background: #fff; border-radius: 16px; padding: 30px 32px; width: 100%; max-width: 380px;
    box-shadow: 0 24px 60px -12px rgba(0,0,0,.45); display: flex; flex-direction: column; gap: 14px; }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.login-brand .logo { background: var(--primary, #4f46e5); color: #fff; font-weight: 800; padding: 8px 12px; border-radius: 10px; }
.login-brand h1 { font-size: 16px; margin: 0; }
.login-brand .subtitle { margin: 0; font-size: 12px; color: #64748b; }
.login-field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.login-field span { font-weight: 600; color: #334155; }
.login-field input { padding: 9px 11px; border: 1px solid #cbd5e1; border-radius: 8px; font: inherit; }
.login-field input:focus { outline: none; border-color: var(--primary, #4f46e5); }
.login-error { color: #b91c1c; font-size: 13px; min-height: 18px; font-weight: 600; }
.login-hint { font-size: 11.5px; color: #94a3b8; margin: 0; text-align: center; }

/* Header kullanici cipi */
.user-box { position: relative; }
.user-chip { display: inline-flex; align-items: center; gap: 7px; background: rgba(255,255,255,.1);
    border: 1px solid rgba(255,255,255,.18); color: #fff; padding: 5px 10px 5px 6px; border-radius: 999px;
    cursor: pointer; font: inherit; font-size: 13px; }
.user-chip:hover { background: rgba(255,255,255,.18); }
.user-chip .caret { font-size: 10px; opacity: .8; }
.user-initial { width: 24px; height: 24px; border-radius: 50%; background: var(--primary, #4f46e5); color: #fff;
    display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; }
.user-menu { position: absolute; top: calc(100% + 6px); right: 0; z-index: 40; min-width: 210px; background: #fff;
    border: 1px solid #e2e8f0; border-radius: 10px; box-shadow: 0 12px 28px -8px rgba(15,23,42,.3); padding: 6px; }
.user-menu[hidden] { display: none; }
.user-menu-head { padding: 8px 10px 10px; border-bottom: 1px solid #f1f5f9; margin-bottom: 4px; }
.user-menu-head b { display: block; font-size: 14px; color: #0f172a; }
.user-menu-head small { color: #64748b; font-size: 12px; }
.user-menu-item { display: block; width: 100%; text-align: left; background: transparent; border: none; cursor: pointer;
    padding: 8px 10px; border-radius: 7px; font: inherit; font-size: 13.5px; color: #334155; }
.user-menu-item:hover { background: #f1f5f9; }

/* Kullanicilar tablosu */
.role-badge { font-size: 11px; padding: 2px 9px; border-radius: 999px; font-weight: 600; }
.role-badge.admin { background: #ede9fe; color: #6d28d9; border: 1px solid #ddd6fe; }
.role-badge.user  { background: #e0f2fe; color: #075985; border: 1px solid #bae6fd; }
.role-badge.off   { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }

/* Kullanici formu + izin secimi */
.user-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; margin-bottom: 14px; }
.user-flags { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px 20px; }
.perm-head { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 8px; }
.perm-tools { display: flex; gap: 6px; }
.perm-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.perm-group { border: 1px solid #e2e8f0; border-radius: 10px; padding: 10px 12px; }
.perm-group > b { font-size: 13px; display: flex; align-items: center; gap: 6px; }
.perm-group .perm-screen { font-size: 11px; color: #64748b; }
.perm-item { display: flex; align-items: flex-start; gap: 7px; padding: 4px 0; font-size: 12.5px; cursor: pointer; }
.perm-item input { margin-top: 2px; }
.perm-item.is-screen { border-bottom: 1px dashed #e2e8f0; padding-bottom: 6px; margin-bottom: 2px; font-weight: 600; }
@media (max-width: 640px) { .user-form-grid { grid-template-columns: 1fr; } }

body.locked { overflow: hidden; }

.login-screen[hidden] { display: none !important; }

/* GELISMIS ALANLAR (Ayarlar -> "Gelişmiş rota/iş emri alanlarını göster" kapalıyken gizlenir):
   Rotalar'daki "Makine (sabit)" sütunu ve Is Emirleri'ndeki "Başlangıç operasyonu" alanı.
   Veri/davranışı ETKİLEMEZ — yalnızca bu iki girdiyi ekrandan kaldırır. */
body.hide-advanced-fields .adv-field { display: none !important; }
