/* =====================================================================
   Nazar IK / PDKS - arayuz stilleri
   ===================================================================== */

:root {
    --blue: #2563eb;
    --blue-dark: #1d4ed8;
    --blue-soft: #eff6ff;
    --green: #16a34a;
    --green-soft: #f0fdf4;
    --amber: #d97706;
    --amber-soft: #fffbeb;
    --red: #dc2626;
    --red-soft: #fef2f2;
    --purple: #7c3aed;

    --ink: #0f172a;
    --ink-2: #334155;
    --muted: #64748b;
    --muted-2: #94a3b8;
    --line: #e2e8f0;
    --line-soft: #f1f5f9;
    --bg: #f8fafc;
    --card: #ffffff;

    --radius: 10px;
    --radius-sm: 6px;
    --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .06);
    --shadow-lg: 0 10px 30px rgba(15, 23, 42, .12);
    --sidebar-w: 232px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.3; }
h1 { font-size: 22px; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }

/* ---------- Yerlesim ---------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    flex: 0 0 var(--sidebar-w);
    background: #0f172a;
    color: #cbd5e1;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-brand {
    padding: 18px 18px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.sidebar-brand strong { display: block; color: #fff; font-size: 15px; letter-spacing: .2px; }
.sidebar-brand span { font-size: 11px; color: #64748b; text-transform: uppercase; letter-spacing: .8px; }

.sidebar-nav { padding: 10px 8px 20px; flex: 1; }
.sidebar-group {
    padding: 14px 10px 6px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .9px;
    color: #475569;
    font-weight: 600;
}
.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    color: #cbd5e1;
    font-size: 13.5px;
    margin-bottom: 1px;
}
.sidebar-nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; text-decoration: none; }
.sidebar-nav a.active { background: var(--blue); color: #fff; font-weight: 500; }
.sidebar-nav a .ico { width: 16px; text-align: center; opacity: .85; font-size: 13px; }

.sidebar-foot {
    padding: 12px 16px;
    border-top: 1px solid rgba(255, 255, 255, .08);
    font-size: 12px;
    color: #64748b;
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    height: 56px;
    background: var(--card);
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 22px;
    position: sticky;
    top: 0;
    z-index: 30;
}
.topbar-title { font-size: 15px; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.topbar-user { font-size: 13px; color: var(--ink-2); }
.topbar-user b { display: block; font-weight: 600; }
.topbar-user small { color: var(--muted); font-size: 11.5px; }

.content { padding: 22px; flex: 1; }
.content-narrow { max-width: 940px; }

.page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}
.page-head .sub { color: var(--muted); font-size: 13px; margin-top: 3px; }

/* ---------- Kart ---------- */
.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 18px;
}
.card-head {
    padding: 14px 18px;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.card-head h2 { font-size: 15px; }
.card-head .sub { color: var(--muted); font-size: 12.5px; font-weight: 400; margin-top: 2px; }
.card-body { padding: 18px; }
.card-body.tight { padding: 0; }
.card-foot {
    padding: 12px 18px;
    border-top: 1px solid var(--line);
    background: var(--line-soft);
    border-radius: 0 0 var(--radius) var(--radius);
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: flex-end;
}

/* ---------- Izgara ---------- */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px)  { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* ---------- Istatistik kutusu ---------- */
.stat {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 15px 17px;
    box-shadow: var(--shadow);
}
.stat .label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; font-weight: 600; }
.stat .value { font-size: 26px; font-weight: 650; margin-top: 6px; letter-spacing: -.5px; }
.stat .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.stat.is-good .value { color: var(--green); }
.stat.is-warn .value { color: var(--amber); }
.stat.is-bad  .value { color: var(--red); }

/* ---------- Tablo ---------- */
.table-wrap { overflow-x: auto; }
table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}
table.data th {
    text-align: left;
    padding: 10px 14px;
    background: var(--line-soft);
    border-bottom: 1px solid var(--line);
    font-weight: 600;
    font-size: 12px;
    color: var(--ink-2);
    text-transform: uppercase;
    letter-spacing: .3px;
    white-space: nowrap;
}
table.data td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--line-soft);
    vertical-align: middle;
}
table.data tbody tr:hover { background: #fafbfc; }
table.data tbody tr:last-child td { border-bottom: none; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data td.mid, table.data th.mid { text-align: center; }
table.data .muted { color: var(--muted); }

.empty {
    padding: 44px 20px;
    text-align: center;
    color: var(--muted);
}
.empty .big { font-size: 30px; margin-bottom: 8px; opacity: .5; }

/* ---------- Rozet ---------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 600;
    line-height: 18px;
    white-space: nowrap;
}
.badge-blue   { background: var(--blue-soft); color: var(--blue-dark); }
.badge-green  { background: var(--green-soft); color: #15803d; }
.badge-amber  { background: var(--amber-soft); color: #b45309; }
.badge-red    { background: var(--red-soft); color: #b91c1c; }
.badge-gray   { background: var(--line-soft); color: var(--muted); }
.badge-purple { background: #f5f3ff; color: #6d28d9; }

/* ---------- Dugme ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    background: var(--card);
    color: var(--ink-2);
    font-size: 13.5px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: background .12s, border-color .12s;
    white-space: nowrap;
}
.btn:hover { background: var(--line-soft); text-decoration: none; }
.btn-primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-dark); border-color: var(--blue-dark); }
.btn-success { background: var(--green); border-color: var(--green); color: #fff; }
.btn-success:hover { background: #15803d; }
.btn-danger { background: var(--card); border-color: #fecaca; color: var(--red); }
.btn-danger:hover { background: var(--red-soft); }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-lg { padding: 12px 22px; font-size: 15px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-block { width: 100%; }

.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.btn-group .btn.active { background: var(--blue); border-color: var(--blue); color: #fff; z-index: 1; }

/* ---------- Form ---------- */
.field { margin-bottom: 15px; }
.field label {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--ink-2);
    margin-bottom: 5px;
}
.field .help { font-size: 12px; color: var(--muted); margin-top: 4px; line-height: 1.45; }
.field .err { font-size: 12px; color: var(--red); margin-top: 4px; }

input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=time], input[type=search], input[type=tel],
select, textarea {
    width: 100%;
    padding: 8px 11px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-family: inherit;
    color: var(--ink);
    background: #fff;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
input.is-error, select.is-error { border-color: #fca5a5; }
textarea { resize: vertical; min-height: 74px; }
input[type=color] { width: 44px; height: 34px; padding: 2px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; }

.check { display: flex; align-items: flex-start; gap: 9px; }
.check input[type=checkbox] { margin-top: 2px; width: 16px; height: 16px; accent-color: var(--blue); flex: 0 0 16px; }
.check label { margin: 0; font-weight: 500; font-size: 13.5px; }

.inline-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.inline-form .field { margin-bottom: 0; }

.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.form-row-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 14px; }
@media (max-width: 700px) { .form-row, .form-row-3 { grid-template-columns: 1fr; } }

/* ---------- Uyari kutusu ---------- */
.alert {
    padding: 11px 15px;
    border-radius: var(--radius-sm);
    margin-bottom: 14px;
    font-size: 13.5px;
    border: 1px solid transparent;
    display: flex;
    gap: 9px;
    align-items: flex-start;
}
.alert-success { background: var(--green-soft); border-color: #bbf7d0; color: #166534; }
.alert-error   { background: var(--red-soft); border-color: #fecaca; color: #991b1b; }
.alert-warning { background: var(--amber-soft); border-color: #fde68a; color: #92400e; }
.alert-info    { background: var(--blue-soft); border-color: #bfdbfe; color: #1e40af; }

/* ---------- Filtre cubugu ---------- */
.filters {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 13px 16px;
    margin-bottom: 16px;
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-wrap: wrap;
    box-shadow: var(--shadow);
}
.filters .field { margin: 0; min-width: 150px; }

/* ---------- Vardiya takvimi ---------- */
.planner-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
table.planner { border-collapse: collapse; width: 100%; min-width: 940px; }
table.planner th, table.planner td { border-bottom: 1px solid var(--line); }
table.planner thead th {
    background: var(--card);
    padding: 11px 12px;
    text-align: left;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--ink-2);
    position: sticky;
    top: 0;
    z-index: 5;
    border-bottom: 1px solid var(--line);
}
table.planner thead th .dnum { font-size: 15px; font-weight: 650; color: var(--ink); }
table.planner thead th .dname { color: var(--muted); font-weight: 500; margin-left: 3px; }
table.planner thead th.is-today .dnum,
table.planner thead th.is-today .dname { color: var(--blue); }

table.planner td.emp {
    padding: 8px 12px;
    width: 220px;
    min-width: 220px;
    background: var(--card);
    position: sticky;
    left: 0;
    z-index: 3;
    border-right: 1px solid var(--line);
}
table.planner thead th.emp { position: sticky; left: 0; z-index: 6; background: var(--card); border-right: 1px solid var(--line); }
.emp-name { font-weight: 600; font-size: 13.5px; }
.emp-meta { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.emp-meta .code { color: var(--muted-2); }

table.planner td.cell { padding: 5px; width: 130px; min-width: 130px; vertical-align: top; }
table.planner tbody tr:hover td.emp { background: #fafbfc; }

.shift-chip {
    display: block;
    border-radius: var(--radius-sm);
    padding: 6px 8px;
    color: #fff;
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    width: 100%;
    text-align: left;
    font-family: inherit;
    line-height: 1.35;
    transition: filter .12s;
}
.shift-chip:hover { filter: brightness(1.08); }
.shift-chip .code { display: inline-block; }
.shift-chip .hours { float: right; font-weight: 500; opacity: .92; }
.shift-chip.is-draft { background-image: repeating-linear-gradient(45deg, rgba(255,255,255,.16) 0 6px, transparent 6px 12px); }
.shift-chip.is-empty {
    background: transparent;
    border: 1px dashed var(--line);
    color: var(--muted-2);
    text-align: center;
    font-weight: 500;
}
.shift-chip.is-empty:hover { border-color: var(--blue); color: var(--blue); background: var(--blue-soft); }

/* Plan kutucugunun altinda gerceklesen giris/cikis.
   Renkler badge-* siniflarindan gelir; durum dili her ekranda ayni kalsin. */
.actual-line {
    display: flex;
    align-items: baseline;
    gap: 5px;
    margin-top: 3px;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-size: 10.5px;
    font-variant-numeric: tabular-nums;
    text-decoration: none;
    line-height: 1.5;
}
.actual-line:hover { filter: brightness(.95); text-decoration: none; }
.actual-line .t { opacity: .85; }
.actual-line b { margin-left: auto; font-weight: 700; }
.actual-line .ot { font-weight: 700; }

/* ---------- Yan panel (drawer) ---------- */
.drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .35);
    z-index: 90;
    opacity: 0;
    pointer-events: none;
    transition: opacity .18s;
}
.drawer-backdrop.open { opacity: 1; pointer-events: auto; }
.drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 420px;
    max-width: 92vw;
    height: 100vh;
    background: #fff;
    z-index: 100;
    box-shadow: var(--shadow-lg);
    transform: translateX(100%);
    transition: transform .2s ease;
    display: flex;
    flex-direction: column;
}
.drawer.open { transform: translateX(0); }
.drawer-head {
    padding: 18px 22px 14px;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}
.drawer-head h2 { font-size: 19px; }
.drawer-head .sub { font-size: 13px; color: var(--muted); margin-top: 4px; line-height: 1.5; }
.drawer-body { padding: 18px 22px; overflow-y: auto; flex: 1; }
.drawer-foot { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; gap: 8px; }
.drawer-close {
    background: none;
    border: none;
    font-size: 22px;
    line-height: 1;
    color: var(--muted);
    cursor: pointer;
    padding: 0 2px;
}
.drawer-close:hover { color: var(--ink); }

/* ---------- Zaman cizelgesi (gun detayi) ---------- */
.timeline { border-left: 2px solid var(--line); margin-left: 6px; padding-left: 16px; }
.timeline-item { position: relative; padding-bottom: 16px; }
.timeline-item::before {
    content: '';
    position: absolute;
    left: -22px;
    top: 4px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--blue);
    border: 2px solid #fff;
    box-shadow: 0 0 0 2px var(--blue-soft);
}
.timeline-item.t-out::before { background: var(--amber); box-shadow: 0 0 0 2px var(--amber-soft); }
.timeline-item.t-end::before { background: var(--muted); box-shadow: 0 0 0 2px var(--line-soft); }
.timeline-time { font-weight: 650; font-size: 14px; font-variant-numeric: tabular-nums; }
.timeline-label { font-size: 12.5px; color: var(--muted); }
.timeline-meta { font-size: 11.5px; color: var(--muted-2); margin-top: 2px; }

.segment {
    background: var(--line-soft);
    border-left: 3px solid var(--green);
    border-radius: var(--radius-sm);
    padding: 9px 12px;
    margin-bottom: 7px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}
.segment.is-break { border-left-color: var(--amber); }
.segment.is-meal { border-left-color: var(--purple); }
.segment .range { font-weight: 600; font-variant-numeric: tabular-nums; }
.segment .dur { font-size: 12.5px; color: var(--muted); }

/* ---------- Yardimci ---------- */
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; }
.flex { display: flex; gap: 10px; align-items: center; }
.flex-between { display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.gap-sm { gap: 6px; }
.hidden { display: none !important; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; flex-wrap: wrap; }
.tabs a {
    padding: 9px 15px;
    font-size: 13.5px;
    color: var(--muted);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    font-weight: 500;
}
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.active { color: var(--blue); border-bottom-color: var(--blue); font-weight: 600; }

.week-nav { display: flex; align-items: center; gap: 4px; }
.week-nav .label {
    padding: 0 12px;
    font-weight: 600;
    font-size: 13.5px;
    font-variant-numeric: tabular-nums;
    min-width: 176px;
    text-align: center;
}

/* Tarih etiketinin uzerine seffaf bir tarih secici bindirilir:
   gorunum aynen kalir, tiklayinca takvim acilir. */
.week-nav .label.is-pickable {
    position: relative;
    cursor: pointer;
    border-radius: 6px;
    padding-top: 5px;
    padding-bottom: 5px;
    border: 1px solid transparent;
}
.week-nav .label.is-pickable:hover {
    border-color: var(--line);
    background: var(--bg-soft, #f8fafc);
}
.week-nav .label.is-pickable input[type="date"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    border: 0;
    padding: 0;
    cursor: pointer;
}

/* ---------- Kimlik dogrulama sayfasi ---------- */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(160deg, #1e293b 0%, #0f172a 100%);
    padding: 20px;
}
.auth-box {
    width: 100%;
    max-width: 400px;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, .3);
    padding: 34px 32px;
}
.auth-box.wide { max-width: 640px; }
.auth-brand { text-align: center; margin-bottom: 24px; }
.auth-brand .logo {
    width: 52px;
    height: 52px;
    border-radius: 13px;
    background: var(--blue);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 12px;
}
.auth-brand h1 { font-size: 19px; }
.auth-brand p { color: var(--muted); font-size: 13px; margin: 5px 0 0; }

/* ---------- Kurulum adimlari ---------- */
.steps { display: flex; gap: 8px; margin-bottom: 24px; }
.step {
    flex: 1;
    padding: 8px 4px;
    text-align: center;
    font-size: 12px;
    color: var(--muted);
    border-top: 3px solid var(--line);
    font-weight: 600;
}
.step.active { color: var(--blue); border-top-color: var(--blue); }
.step.done { color: var(--green); border-top-color: var(--green); }

/* ---------- Yazdirma ---------- */
@media print {
    .sidebar, .topbar, .btn, .filters, .no-print { display: none !important; }
    .content { padding: 0; }
    .card { box-shadow: none; border: 1px solid #ddd; }
    body { background: #fff; }
}

/* ---------- Kucuk ekran ---------- */
@media (max-width: 820px) {
    .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .2s; z-index: 80; }
    .sidebar.open { transform: translateX(0); }
    .menu-toggle { display: inline-flex !important; }
    .content { padding: 16px 14px; }
}
.menu-toggle {
    display: none;
    background: none;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 6px 10px;
    cursor: pointer;
    font-size: 15px;
}
