:root {
  --bg: #f4f6f9; --panel: #ffffff; --ink: #18202c; --muted: #667085; --line: #e2e6ec;
  --brand: #1f3a5f; --accent: #1f5fbf; --danger: #c62828; --hotel: #c81e2d;
  --radius: 10px; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-size: 15px; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }

/* ---------- butonlar ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 8px;
  border: 1px solid var(--line); background: #fff; color: var(--ink); font: inherit; font-weight: 600;
  cursor: pointer; text-decoration: none; white-space: nowrap; line-height: 1.2;
}
.btn:hover { border-color: #c5ccd6; background: #fafbfc; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #1a51a3; }
.btn.danger { color: var(--danger); border-color: #f0c7c7; }
.btn.ghost { background: transparent; border-color: transparent; color: #dbe5f3; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.linkbtn { background: none; border: 0; color: #fff; text-decoration: underline; cursor: pointer; font: inherit; }
form.inline { display: inline; margin: 0; }

/* ---------- üst bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 1000; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; padding: 10px 16px; background: var(--brand); color: #fff;
}
.brand { font-weight: 800; font-size: 17px; letter-spacing: .2px; }
.brand span { font-weight: 400; opacity: .8; }
.top-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.top-actions .btn:not(.primary):not(.ghost) { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.25); color: #fff; }
.list-switch { display: flex; align-items: center; gap: 6px; font-size: 13px; opacity: .95; }
.list-switch select { padding: 6px 8px; border-radius: 8px; border: 0; font: inherit; }
.readonly-bar { background: #fff4d6; color: #6b4e00; padding: 8px 16px; font-size: 14px; border-bottom: 1px solid #f1dfa6; }

/* ---------- harita ---------- */
.map-wrap { position: relative; }
#map { height: 56vh; min-height: 340px; background: #dfe6ee; }
#map.picking { cursor: crosshair; }
.pick-hint {
  position: absolute; left: 50%; top: 12px; transform: translateX(-50%); z-index: 900;
  background: var(--brand); color: #fff; padding: 8px 14px; border-radius: 999px; box-shadow: var(--shadow); font-size: 14px;
}
.pin-wrap { background: none; border: 0; }
.pin {
  width: 30px; height: 30px; border-radius: 50%; background: var(--c); color: #fff; border: 3px solid #fff;
  display: grid; place-items: center; font-weight: 800; font-size: 12px; box-shadow: 0 1px 4px rgba(0,0,0,.45);
}
.pin.approx { border-style: dashed; }
.pin.cancel { opacity: .6; text-decoration: line-through; }
.pin.arch { opacity: .4; }
.hotel-pin {
  width: 40px; height: 30px; margin-top: 8px; border-radius: 7px; background: var(--hotel); color: #fff; border: 3px solid #fff;
  display: grid; place-items: center; font-weight: 800; font-size: 13px; box-shadow: 0 1px 5px rgba(0,0,0,.5); position: relative;
}
.hotel-pin small {
  position: absolute; top: -17px; left: 50%; transform: translateX(-50%); font-size: 9px; font-weight: 800;
  background: #fff; color: var(--hotel); border: 1.5px solid var(--hotel); border-radius: 4px; padding: 0 3px; line-height: 12px;
}
.loc-btn {
  width: 34px; height: 34px; border-radius: 4px; border: 2px solid rgba(0,0,0,.2); background: #fff; cursor: pointer;
  display: grid; place-items: center; background-clip: padding-box;
}
.loc-btn span { width: 14px; height: 14px; border-radius: 50%; border: 3px solid #555; position: relative; }
.loc-btn span::after { content: ''; position: absolute; inset: 2px; border-radius: 50%; background: #555; }
.loc-btn.on span { border-color: #1a73e8; } .loc-btn.on span::after { background: #1a73e8; }
.loc-btn.wait span { animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .3; } }

/* popup */
.pop { font-size: 13.5px; line-height: 1.4; min-width: 220px; }
.pop > div { margin-top: 4px; }
.pop-title { font-weight: 800; font-size: 15px; display: flex; gap: 8px; align-items: center; margin-top: 0 !important; }
.pop-title.hotel { color: var(--hotel); }
.pop-no { background: var(--c); color: #fff; border-radius: 999px; min-width: 24px; height: 24px; display: inline-grid; place-items: center; font-size: 12px; padding: 0 6px; }
.pop-sub { color: var(--muted); }
.pop-addr { font-size: 12.5px; }
.pop-notes { background: #f6f8fb; border-left: 3px solid var(--accent); padding: 4px 8px; white-space: pre-wrap; }
.sbtns { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px !important; }
.sbtn { border: 1.5px solid var(--c); color: var(--c); background: #fff; border-radius: 999px; padding: 3px 9px; font-size: 12px; font-weight: 700; cursor: pointer; }
.sbtn.on { background: var(--c); color: #fff; }
.nav-links { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 8px !important; font-size: 12.5px; }
.pop-actions { margin-top: 8px !important; }

/* ---------- filtreler ---------- */
.controls {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px 16px;
  background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 56px; z-index: 800;
}
.controls input[type=search], .controls select {
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; background: #fff;
}
.controls input[type=search] { flex: 1 1 240px; min-width: 180px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: #fff; border-radius: 999px;
  padding: 5px 11px; font: inherit; font-size: 13px; cursor: pointer;
}
.chip i { width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.chip b { color: var(--muted); font-weight: 600; }
.chip.on { background: var(--c); color: #fff; border-color: var(--c); }
.chip.on i { background: #fff; } .chip.on b { color: #fff; }
.chk { display: inline-flex; align-items: center; gap: 5px; font-size: 13.5px; color: var(--muted); cursor: pointer; }

/* ---------- liste ---------- */
.list-wrap { padding: 12px 16px 40px; }
.list-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.list-head h2 { margin: 4px 0 10px; font-size: 18px; }
.plist { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.plist th {
  text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted);
  padding: 10px 10px; border-bottom: 1px solid var(--line); background: #fafbfc; cursor: pointer; user-select: none; white-space: nowrap;
}
.plist th.sorted::after { content: ' ' attr(data-dir); }
.plist td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.plist tbody tr { cursor: pointer; }
.plist tbody tr:hover { background: #f7f9fc; }
.plist tr.st-gidildi { background: #f1faf3; }
.plist tr.st-iptal .nm { text-decoration: line-through; color: var(--muted); }
.plist tr.arch { opacity: .55; }
.c-no { width: 52px; } .c-prio { width: 56px; } .c-act { width: 1%; white-space: nowrap; text-align: right; }
.c-dist { display: none; white-space: nowrap; font-variant-numeric: tabular-nums; }
body.has-pos .c-dist { display: table-cell; }
.no { display: inline-grid; place-items: center; min-width: 28px; height: 28px; padding: 0 5px; border-radius: 999px; background: var(--c); color: #fff; font-weight: 800; font-size: 12.5px; }
.nm { font-weight: 650; }
.sub { color: var(--muted); font-size: 12.5px; }
.tag { display: inline-block; font-size: 11px; background: #e9eef6; color: #3d5a80; border-radius: 4px; padding: 0 4px; font-weight: 700; }
.prio { font-size: 12px; font-weight: 800; padding: 2px 7px; border-radius: 6px; background: #eef1f5; }
.prio.p-P1 { background: #fde8e8; color: #b42318; }
.st-sel, .stxt { font: inherit; font-size: 13px; font-weight: 700; color: var(--c); border: 1.5px solid var(--c); border-radius: 999px; padding: 4px 8px; background: #fff; }
.c-act .btn { margin-left: 4px; }
.c-act .btn.ghost { color: var(--muted); }
.empty { padding: 20px; text-align: center; }

/* ---------- diyaloglar ---------- */
.dlg { border: 0; border-radius: 14px; padding: 0; width: min(760px, 96vw); max-height: 92vh; box-shadow: 0 20px 50px rgba(0,0,0,.3); }
.dlg.small { width: min(420px, 94vw); }
.dlg::backdrop { background: rgba(15,23,42,.45); }
.dlg form { display: flex; flex-direction: column; max-height: 92vh; margin: 0; }
.dlg-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.dlg-head h3 { margin: 0; font-size: 17px; }
.x { border: 0; background: none; font-size: 26px; line-height: 1; cursor: pointer; color: var(--muted); }
.dlg-body { padding: 14px 18px; overflow: auto; }
.dlg-body > label { display: block; margin-bottom: 10px; }
.dlg-foot { display: flex; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); background: #fafbfc; }
.spacer { flex: 1; }
fieldset { border: 1px solid var(--line); border-radius: 10px; margin: 0 0 12px; padding: 10px 12px 12px; }
legend { font-weight: 700; font-size: 13px; color: var(--brand); padding: 0 6px; }
details { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; }
summary { cursor: pointer; font-weight: 700; font-size: 13px; color: var(--brand); }
details .grid { margin-top: 10px; }
.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.grid label, .dlg-body > label { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.grid label.chk { align-self: end; padding-bottom: 8px; }
.grid .w2 { grid-column: span 2; } .grid .w3 { grid-column: span 3; } .grid .w4 { grid-column: 1 / -1; }
.grid input:not([type=checkbox]), .grid select, .grid textarea, .dlg-body > label input {
  display: block; width: 100%; margin-top: 4px; padding: 8px 9px; border: 1px solid var(--line); border-radius: 8px;
  font: inherit; font-size: 14px; color: var(--ink); background: #fff;
}
.grid textarea { resize: vertical; }
.row-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.geo-results { font-size: 13px; }
.geo-results .ok { color: #1e8e3e; font-weight: 600; }
.geo-item { display: block; width: 100%; text-align: left; border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 7px 9px; margin-top: 5px; cursor: pointer; font: inherit; font-size: 12.5px; }
.geo-item:hover { border-color: var(--accent); }
.form-err { color: var(--danger); font-weight: 600; }

.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 3000;
  background: #1d2433; color: #fff; padding: 10px 16px; border-radius: 10px; box-shadow: 0 6px 20px rgba(0,0,0,.25); font-size: 14px; max-width: 92vw;
}

/* ---------- giriş ---------- */
.login-body { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(160deg, #1f3a5f, #0f1e33); padding: 16px; }
.login-card { width: min(360px, 100%); background: #fff; border-radius: 16px; padding: 28px 26px; box-shadow: 0 20px 50px rgba(0,0,0,.35); display: flex; flex-direction: column; gap: 12px; }
.login-card h1 { margin: 0; font-size: 22px; line-height: 1.25; }
.login-card p { margin: 0 0 4px; }
.login-card label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 600; color: var(--muted); }
.login-card input { padding: 10px 11px; border: 1px solid var(--line); border-radius: 8px; font: inherit; font-size: 15px; }
.login-card .btn { justify-content: center; padding: 11px; margin-top: 4px; }
.login-logo { width: 46px; height: 46px; border-radius: 12px; background: var(--hotel); color: #fff; display: grid; place-items: center; font-size: 24px; font-weight: 800; }
.login-err { background: #fde8e8; color: #b42318; border-radius: 8px; padding: 8px 10px; font-size: 13.5px; font-weight: 600; }

/* ---------- telefon ---------- */
@media (max-width: 760px) {
  .topbar { padding: 8px 10px; }
  .brand { font-size: 15px; }
  .top-actions { width: 100%; }
  .top-actions .btn { padding: 7px 10px; font-size: 13px; }
  #map { height: 48vh; }
  .controls { position: static; padding: 10px; }
  .list-wrap { padding: 10px 10px 40px; }
  .plist thead { display: none; }
  .plist, .plist tbody, .plist tr, .plist td { display: block; width: 100%; }
  .plist { background: none; box-shadow: none; }
  .plist tr {
    display: grid; grid-template-columns: 40px 1fr auto; grid-template-areas: "no name prio" "no city dist" "no st st" "no act act";
    gap: 4px 8px; background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 8px; padding: 10px;
  }
  .plist td { border: 0; padding: 0; }
  .plist td.c-no { grid-area: no; } .plist td.c-name { grid-area: name; } .plist td.c-city { grid-area: city; font-size: 13px; }
  .plist td.c-prio { grid-area: prio; } .plist td.c-dist { grid-area: dist; text-align: right; font-size: 13px; color: var(--muted); }
  body.has-pos .plist td.c-dist { display: block; }
  .plist td.c-st { grid-area: st; display: flex; gap: 8px; align-items: center; }
  .plist td.c-date { display: none; }
  .plist td.c-act { grid-area: act; text-align: left; }
  .plist td.c-act .btn { margin: 0 6px 0 0; }
  .grid { grid-template-columns: 1fr 1fr; }
  .grid .w3 { grid-column: 1 / -1; }
}

/* ---------- görünüm sekmeleri ---------- */
.tabs { display: flex; gap: 4px; padding: 8px 16px 0; background: var(--panel); border-bottom: 1px solid var(--line); }
.tabs button {
  border: 0; background: none; font: inherit; font-weight: 700; color: var(--muted); padding: 9px 16px;
  border-bottom: 3px solid transparent; cursor: pointer;
}
.tabs button.on { color: var(--brand); border-bottom-color: var(--accent); }

/* ---------- ekip ---------- */
.team-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 10px 16px; background: #f9fafc; border-bottom: 1px solid var(--line); }
.tb-title { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin-right: 4px; }
.tm { display: grid; grid-template-columns: auto 110px; grid-template-rows: auto auto; gap: 2px 10px; align-items: center;
  border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 6px 10px; cursor: pointer; font: inherit; text-align: left; }
.tm.on { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(31,95,191,.15); }
.tm b { font-size: 13.5px; }
.tm small { grid-column: 1 / -1; color: var(--muted); font-size: 11.5px; }
.tm .bar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: #eef1f5; }
.tm .bar i { display: block; height: 100%; }
.badges { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.tb { font-size: 11px; font-weight: 700; color: var(--c); border: 1px solid var(--c); border-radius: 999px; padding: 0 6px; line-height: 17px; background: #fff; white-space: nowrap; }
.tb.big { font-size: 13px; padding: 3px 10px; line-height: 1.3; }
.cnt { font: inherit; font-size: 12px; border: 1px solid var(--line); background: #f6f8fb; border-radius: 999px; padding: 0 7px; line-height: 17px; cursor: pointer; }
.pop-team { font-size: 12.5px; }

/* ---------- dosya & yorum ---------- */
.dlg .dlg-form { display: flex; flex-direction: column; max-height: 92vh; }
.det-team { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.det-sec { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; }
.det-sec h4 { margin: 0 0 8px; font-size: 14px; color: var(--brand); }
.det-upload { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.det-upload label.btn { cursor: pointer; }
.det-files { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.fcard { position: relative; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.fthumb { display: grid; place-items: center; height: 110px; background: #eef2f7; color: var(--brand); font-weight: 800; text-decoration: none; }
.fthumb img { width: 100%; height: 100%; object-fit: cover; }
.fmeta { padding: 6px 8px; font-size: 12px; }
.fmeta a { display: block; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fmeta small { color: var(--muted); }
.fcard .x.small { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; font-size: 18px; border-radius: 50%; background: rgba(255,255,255,.9); display: grid; place-items: center; }
.det-comments { max-height: 300px; overflow: auto; display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.cm { background: #f6f8fb; border-radius: 10px; padding: 7px 10px; max-width: 92%; }
.cm.mine { background: #e8f0fc; align-self: flex-end; }
.cm-h { font-size: 12px; display: flex; gap: 8px; align-items: baseline; }
.cm-h small { color: var(--muted); }
.cm-t { white-space: pre-wrap; font-size: 14px; margin-top: 2px; overflow-wrap: anywhere; }
.linkbtn.dark { color: var(--danger); font-size: 12px; margin-left: auto; }
.comment-form { display: flex; gap: 8px; align-items: flex-end; }
.comment-form textarea { flex: 1; padding: 8px 9px; border: 1px solid var(--line); border-radius: 8px; font: inherit; resize: vertical; }

/* ---------- gün planı ---------- */
.day-wrap, .cal-wrap { padding: 12px 16px 40px; }
.day-chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; }
.dchip { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-start; border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 6px 10px; font: inherit; cursor: pointer; }
.dchip b { font-size: 13px; } .dchip small { color: var(--muted); font-size: 11.5px; }
.dchip.on { background: var(--brand); border-color: var(--brand); color: #fff; } .dchip.on small { color: #cfdcec; }
.day-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; flex-wrap: wrap; margin: 12px 0 6px; }
.day-head h2 { margin: 0; font-size: 19px; }
.day-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.day-summary { font-size: 14px; margin: 6px 0 10px; }
.day-stops { list-style: none; margin: 0; padding: 0; max-width: 820px; }
.stop { display: flex; align-items: center; gap: 10px; background: var(--panel); border-radius: 10px; box-shadow: var(--shadow); padding: 9px 10px; cursor: pointer; }
.stop.hotel { background: #fff5f5; cursor: default; }
.stop.cancel { opacity: .55; } .stop.cancel b { text-decoration: line-through; }
.snum { flex: 0 0 auto; min-width: 30px; height: 30px; border-radius: 999px; background: var(--c, var(--hotel)); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 12.5px; padding: 0 6px; }
.stop.hotel .snum { border-radius: 7px; }
.sbody { flex: 1; min-width: 0; }
.sact { display: flex; gap: 4px; align-items: center; }
.ib { width: 30px; height: 30px; border: 1px solid var(--line); background: #fff; border-radius: 8px; cursor: pointer; font-size: 14px; }
.ib:disabled { opacity: .35; cursor: default; }
.leg { font-size: 12.5px; color: var(--muted); padding: 4px 0 4px 24px; min-height: 12px; border-left: 2px dashed #b8c4d4; margin-left: 24px; }
.empty-day { padding: 14px 4px; }
.day-add { display: flex; gap: 8px; margin-top: 14px; max-width: 820px; }
.day-add select { flex: 1; min-width: 0; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; font: inherit; }
.pin.day { font-size: 13px; }

/* ---------- takvim ---------- */
.cal-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.cal-head h2 { margin: 4px 0; font-size: 19px; }
.cal-tools { display: flex; gap: 8px; flex-wrap: wrap; }
.btn.ghost.dark { color: var(--muted); }
.cal-help { font-size: 13px; line-height: 1.5; max-width: 900px; }
.cal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.cday { text-align: left; font: inherit; border: 1px solid var(--line); background: var(--panel); border-radius: 10px; padding: 8px 10px; min-height: 120px; cursor: pointer; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 4px; }
.cday:hover { border-color: var(--accent); }
.cday.today { border: 2px solid var(--accent); }
.cd-h { display: flex; justify-content: space-between; gap: 6px; align-items: baseline; margin-bottom: 2px; }
.cd-city { font-size: 11px; font-weight: 700; color: var(--hotel); }
.ce { display: flex; gap: 6px; align-items: baseline; font-size: 12.5px; line-height: 1.3; }
.ce i { flex: 0 0 8px; height: 8px; border-radius: 50%; background: var(--c); transform: translateY(-1px); }
.ce span { font-weight: 700; font-variant-numeric: tabular-nums; }
.ce.cancel { text-decoration: line-through; opacity: .6; }
.small { font-size: 12px; }
.cal-other h3 { font-size: 15px; margin: 18px 0 6px; }
.cal-other .ce { margin: 3px 0; }

@media (max-width: 760px) {
  .tabs { padding: 4px 10px 0; } .tabs button { padding: 8px 10px; }
  .team-bar { padding: 8px 10px; overflow-x: auto; flex-wrap: nowrap; }
  .tm { grid-template-columns: auto 70px; flex: 0 0 auto; }
  .day-wrap, .cal-wrap { padding: 10px; }
  .sact .btn { display: none; }
  .cal-grid { grid-template-columns: 1fr 1fr; }
  .comment-form { flex-direction: column; align-items: stretch; }
}
