:root {
  --bg: #f4f2ec;
  --paper: #ffffff;
  --ink: #1f2430;
  --muted: #6b7180;
  --line: #e3e0d7;
  --blue: #2f3fa8;
  --blue-soft: #e9ecfb;
  --danger: #b42318;
  --ok: #1a7f4b;
  --warn: #b45309;
  --c1: #7c3aed; /* özel */
  --c2: #2563eb; /* ortak */
  --c3: #0891b2; /* takvim */
  --c4: #16a34a; /* ziyaret */
  --c5: #ea580c; /* görev */
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 24, 40, .06), 0 2px 8px rgba(20, 24, 40, .05);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

/* ---------- üst bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 12px; padding: 12px 20px;
  background: var(--paper); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5;
}
.brand { font-family: Georgia, "Times New Roman", serif; font-size: 24px; font-weight: 700; letter-spacing: .5px; color: var(--blue); }
.brand span { color: var(--ink); }
.topbar .spacer { flex: 1; }
.who { color: var(--muted); font-size: 14px; }
.who b { color: var(--ink); font-weight: 600; }
.badge { display: inline-block; font-size: 11px; padding: 2px 7px; border-radius: 99px; background: var(--blue-soft); color: var(--blue); font-weight: 600; vertical-align: middle; }

.btn { border: 1px solid var(--line); background: var(--paper); padding: 7px 12px; border-radius: 8px; font-size: 14px; }
.btn:hover { background: #f8f7f3; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.primary:hover { background: #26348c; }
.btn.danger { color: var(--danger); }
.btn.small { padding: 4px 9px; font-size: 13px; }
.icon-btn { border: 0; background: transparent; width: 30px; height: 30px; border-radius: 8px; font-size: 20px; line-height: 1; color: var(--muted); }
.icon-btn:hover { background: rgba(0,0,0,.06); color: var(--ink); }

/* ---------- 5 sütunlu pano ---------- */
.board {
  display: grid; grid-template-columns: repeat(5, minmax(250px, 1fr)); gap: 14px;
  padding: 16px 20px 24px; height: calc(100vh - 59px); overflow-x: auto;
}
.col {
  background: var(--paper); border: 1px solid var(--line); border-radius: 14px; display: flex; flex-direction: column;
  min-height: 0; border-top: 4px solid var(--accent);
}
.col-head { display: flex; align-items: center; gap: 8px; padding: 12px 12px 10px 14px; border-bottom: 1px solid var(--line); }
.col-head h2 { margin: 0; font-size: 15px; font-weight: 700; flex: 1; }
.col-head small { display: block; font-size: 12px; font-weight: 400; color: var(--muted); margin-top: 2px; }
.count { font-size: 12px; color: var(--muted); background: #f3f2ee; border-radius: 99px; padding: 1px 8px; }
.col-head .add { background: var(--accent); color: #fff; width: 28px; height: 28px; border-radius: 8px; border: 0; font-size: 18px; line-height: 1; }
.col-body { overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.empty { color: var(--muted); font-size: 13px; text-align: center; padding: 24px 8px; }
.filter { display: flex; gap: 4px; padding: 8px 10px 0; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: 2px 10px; font-size: 12px; color: var(--muted); }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---------- kartlar ---------- */
.card {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; background: #fff; box-shadow: var(--shadow);
  cursor: pointer; text-align: left; width: 100%; display: block; transition: transform .08s ease;
}
.card:hover { transform: translateY(-1px); border-color: #cfccc2; }
.card h3 { margin: 0 0 4px; font-size: 14px; font-weight: 600; display: flex; gap: 6px; align-items: baseline; }
.card p { margin: 0; font-size: 13px; color: #3d4352; white-space: pre-wrap; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.meta { font-size: 12px; color: var(--muted); margin-top: 6px; display: flex; flex-wrap: wrap; gap: 4px 10px; }
.card.yellow { background: #fffbea; border-color: #f3e5a8; }
.card.blue { background: #eef4ff; border-color: #cddcfb; }
.card.green { background: #ecfbf1; border-color: #c4ecd2; }
.card.pink { background: #fdf0f5; border-color: #f6cfdf; }
.card.gray { background: #f6f6f4; }
.pin { font-size: 12px; }
.tag { font-size: 11px; padding: 1px 7px; border-radius: 99px; background: #f1f0ec; color: var(--muted); }
.tag.high { background: #fde8e6; color: var(--danger); }
.tag.low { background: #eef6f0; color: var(--ok); }
.tag.todo { background: #f1f0ec; }
.tag.doing { background: #fff3e0; color: var(--warn); }
.tag.done { background: #e7f6ed; color: var(--ok); }
.tag.late { background: var(--danger); color: #fff; }
.card.done h3 { text-decoration: line-through; color: var(--muted); }
.status-row { display: flex; gap: 4px; margin-top: 8px; }
.status-row button { flex: 1; border: 1px solid var(--line); background: #fff; border-radius: 6px; font-size: 11px; padding: 3px 0; color: var(--muted); }
.status-row button.on { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ---------- takvim ---------- */
.cal { padding: 10px 10px 4px; border-bottom: 1px solid var(--line); }
.cal-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.cal-nav b { font-size: 14px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.cal-grid .dow { font-size: 10px; color: var(--muted); padding: 2px 0; text-transform: uppercase; }
.cal-grid .day { border: 0; background: transparent; border-radius: 7px; font-size: 12px; padding: 5px 0 7px; position: relative; }
.cal-grid .day:hover { background: #f1f0ec; }
.cal-grid .day.other { color: #b9bcc4; }
.cal-grid .day.today { font-weight: 700; color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.cal-grid .day.sel { background: var(--accent); color: #fff; }
.cal-grid .day .dots { position: absolute; left: 0; right: 0; bottom: 2px; display: flex; justify-content: center; gap: 2px; }
.cal-grid .day .dots i { width: 4px; height: 4px; border-radius: 50%; background: var(--c3); }
.cal-grid .day .dots i.t { background: var(--c5); }
.cal-grid .day .dots i.v { background: var(--c4); }
.cal-grid .day.sel .dots i { background: #fff; }
.cal-label { font-size: 12px; color: var(--muted); font-weight: 600; margin: 4px 2px 0; display: flex; justify-content: space-between; }
.when { font-weight: 600; color: var(--accent); font-size: 12px; }

/* ---------- giriş ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth form { width: 100%; max-width: 380px; background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 28px; box-shadow: var(--shadow); }
.auth .brand { font-size: 32px; text-align: center; margin-bottom: 4px; }
.auth p.sub { text-align: center; color: var(--muted); margin: 0 0 20px; font-size: 14px; }

/* ---------- form & modal ---------- */
label.f { display: block; font-size: 13px; font-weight: 600; margin: 12px 0 4px; }
.f-input { width: 100%; border: 1px solid #d8d5cc; border-radius: 8px; padding: 9px 10px; background: #fff; font-size: 14px; }
.f-input:focus { outline: 2px solid var(--blue-soft); border-color: var(--blue); }
textarea.f-input { min-height: 110px; resize: vertical; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; margin-top: 12px; }
.err { color: var(--danger); font-size: 13px; margin-top: 10px; min-height: 18px; }
.people { display: flex; flex-wrap: wrap; gap: 6px; max-height: 130px; overflow-y: auto; padding: 2px; }
.people label { display: flex; align-items: center; gap: 5px; border: 1px solid var(--line); border-radius: 99px; padding: 4px 10px; font-size: 13px; cursor: pointer; }
.people label:has(input:checked) { background: var(--blue-soft); border-color: var(--blue); color: var(--blue); }
.people input { margin: 0; }
.colors { display: flex; gap: 8px; }
.colors label { width: 26px; height: 26px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; }
.colors input { display: none; }
.colors label:has(input:checked) { border-color: var(--ink); }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }

.overlay { position: fixed; inset: 0; background: rgba(20, 22, 30, .45); display: grid; place-items: center; z-index: 20; padding: 16px; }
.modal { background: var(--paper); border-radius: 16px; width: 100%; max-width: 520px; max-height: calc(100vh - 32px); overflow-y: auto; padding: 22px 24px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal.wide { max-width: 720px; }
.modal h2 { margin: 0 0 4px; font-size: 18px; }
.modal .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; align-items: center; }
.modal .actions .left { margin-right: auto; }
.readonly { background: #faf9f6; border: 1px solid var(--line); border-radius: 8px; padding: 10px; white-space: pre-wrap; font-size: 14px; overflow-wrap: anywhere; }
table.users { width: 100%; border-collapse: collapse; font-size: 14px; margin-top: 10px; }
table.users th, table.users td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); }
table.users th { font-size: 12px; color: var(--muted); font-weight: 600; }
.copy { display: flex; gap: 6px; }
.copy input { font-family: ui-monospace, monospace; font-size: 12px; }
ol.steps { padding-left: 18px; font-size: 14px; line-height: 1.6; }

#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(80px); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; transition: transform .2s; z-index: 30; }
#toast.show { transform: translateX(-50%) translateY(0); }

/* ---------- mobil: sekmeli görünüm ---------- */
.tabs { display: none; }
@media (max-width: 900px) {
  .topbar { flex-wrap: wrap; padding: 10px 12px; }
  .who { display: none; }
  .tabs { display: flex; overflow-x: auto; gap: 6px; padding: 10px 12px 0; }
  .tabs button { border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: 6px 12px; font-size: 13px; white-space: nowrap; }
  .tabs button.on { background: var(--ink); color: #fff; border-color: var(--ink); }
  .board { display: block; height: auto; padding: 10px 12px 20px; }
  .col { display: none; min-height: 70vh; }
  .col.active { display: flex; }
}

/* ---------- masaüstüne sabitle ---------- */
.card { position: relative; }
.desk-btn { position: absolute; top: 6px; right: 6px; border: 0; background: transparent; border-radius: 6px; font-size: 13px; padding: 2px 4px; opacity: 0; transition: opacity .1s; }
.card:hover .desk-btn, .card:focus-within .desk-btn, .desk-btn.on { opacity: 1; }
.desk-btn.on { background: rgba(0,0,0,.08); }
.desk-btn:hover { background: rgba(0,0,0,.12); }
@media (hover: none) { .desk-btn { opacity: .6; } }
.card h3 { padding-right: 22px; }

.desk-body { margin: 0; background: var(--bg); font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.desk-top { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px; background: var(--paper); border-bottom: 1px solid var(--line); position: sticky; top: 0; }
.desk-top .brand { font-size: 16px; }
.desk-list { padding: 8px; display: flex; flex-direction: column; gap: 8px; }
.desk-note { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: #fff; box-shadow: var(--shadow); }
.desk-note.yellow { background: #fffbea; border-color: #f3e5a8; }
.desk-note.blue { background: #eef4ff; border-color: #cddcfb; }
.desk-note.green { background: #ecfbf1; border-color: #c4ecd2; }
.desk-note.pink { background: #fdf0f5; border-color: #f6cfdf; }
.desk-note.gray { background: #f6f6f4; }
.desk-head { display: flex; align-items: center; gap: 6px; }
.desk-head b { flex: 1; font-size: 14px; }
.desk-x { border: 0; background: transparent; font-size: 18px; line-height: 1; color: var(--muted); border-radius: 6px; padding: 2px 6px; cursor: pointer; }
.desk-x:hover { background: rgba(0,0,0,.08); color: var(--ink); }
.desk-text { width: 100%; min-height: 90px; border: 0; background: transparent; resize: vertical; font: inherit; font-size: 14px; padding: 4px 0; outline: none; }
.desk-read { font-size: 14px; white-space: pre-wrap; padding: 4px 0; overflow-wrap: anywhere; }
.desk-meta { font-size: 11px; color: var(--muted); }

/* ---------- bildirimler ---------- */
.bell { position: relative; }
.bell-count { position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }
.overlay.notif { background: rgba(20, 22, 30, .15); place-items: start end; padding: 64px 16px 16px; }
.notif-panel { background: var(--paper); width: 100%; max-width: 400px; max-height: calc(100vh - 90px); border-radius: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.25); display: flex; flex-direction: column; overflow: hidden; }
.notif-head { display: flex; align-items: center; gap: 8px; padding: 12px 12px 10px 16px; border-bottom: 1px solid var(--line); }
.notif-head b { flex: 1; font-size: 15px; }
.notif-perm { display: flex; gap: 8px; align-items: center; font-size: 13px; padding: 10px 16px; background: var(--blue-soft); }
.notif-list { overflow-y: auto; }
.notif-item { display: flex; gap: 10px; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--line); background: #fff; padding: 10px 16px; }
.notif-item:hover { background: #f8f7f3; }
.notif-item.unread { background: #f3f5ff; }
.notif-item.unread b::before { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--blue); margin-right: 6px; vertical-align: middle; }
.notif-ic { font-size: 18px; line-height: 1.2; }
.notif-tx { display: flex; flex-direction: column; gap: 2px; font-size: 13px; min-width: 0; }
.notif-tx b { font-weight: 600; font-size: 14px; }
.notif-tx span { color: #3d4352; white-space: pre-wrap; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.notif-tx small { color: var(--muted); font-size: 11px; }

/* ---------- zamanlanmış işler ---------- */
.auto-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.auto-row { display: flex; gap: 12px; align-items: flex-start; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.auto-row.off { opacity: .6; }
.auto-main { flex: 1; min-width: 0; font-size: 14px; }
.auto-btns { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; max-width: 260px; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg label { display: flex; align-items: center; gap: 5px; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font-size: 13px; cursor: pointer; }
.seg label:has(input:checked) { background: var(--blue-soft); border-color: var(--blue); color: var(--blue); font-weight: 600; }
.seg input { margin: 0; }
h3.sec { font-size: 15px; margin: 20px 0 0; padding-top: 14px; border-top: 1px solid var(--line); }
td.muted { color: var(--muted); font-size: 13px; }

/* üst bar sığmazsa yalnızca simgeler */
@media (max-width: 1350px) { .topbar .lbl { display: none; } }
@media (max-width: 700px) { .auto-row { flex-direction: column; } .auto-btns { max-width: none; justify-content: flex-start; } }

/* ---------- yerleşim: üst bar + filtre + pano tam yükseklik ---------- */
.shell { display: flex; flex-direction: column; height: 100vh; }
.shell .board { flex: 1; min-height: 0; height: auto; }
.shell .topbar { position: static; }

/* ---------- filtre çubuğu ---------- */
.fbar { display: flex; align-items: center; gap: 6px; padding: 10px 20px 0; flex-wrap: wrap; }
.fbar .f-input { width: auto; padding: 6px 9px; font-size: 13px; }
.fb-q { flex: 1 1 220px; min-width: 160px; max-width: 420px; }
.fb-user { max-width: 180px; }
.fb-date { width: 140px !important; }
.fb-icon { font-size: 14px; }
.fb-dash { color: var(--muted); }
.fb-sep { flex: 1; }
.modal .fbar { padding: 10px 0 0; }
.board.filtering .col { box-shadow: 0 0 0 2px var(--blue-soft); }

/* ---------- arşiv / silinenler ---------- */
.arc-tabs { margin-top: 12px; }
.arc-list { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; max-height: 52vh; overflow-y: auto; padding: 2px; }
.arc-row { display: flex; gap: 10px; align-items: center; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: #fff; }
.arc-main { flex: 1; min-width: 0; border: 0; background: transparent; text-align: left; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.arc-main b { font-size: 14px; }
.arc-sub { font-size: 13px; color: #3d4352; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.arc-sub:empty { display: none; }
.arc-main .meta { margin-top: 2px; }
.arc-btns { display: flex; gap: 4px; flex-shrink: 0; }
.when.del { color: var(--danger); }

/* ziyaret kartında gerçekleşti düğmesi */
.done-btn { position: absolute; top: 8px; right: 8px; border: 1px solid #c4ecd2; background: #ecfbf1; color: var(--ok); border-radius: 6px; font-size: 11px; padding: 2px 7px; opacity: 0; }
.card:hover .done-btn, .card:focus-within .done-btn { opacity: 1; }
@media (hover: none) { .done-btn { opacity: 1; } }

@media (max-width: 900px) {
  .shell { height: auto; }
  .fbar { padding: 10px 12px 0; }
  .fb-q { max-width: none; flex-basis: 100%; }
  .fb-sep { display: none; }
  .arc-row { flex-direction: column; align-items: stretch; }
}

/* sütun içi arama */
.col-search { padding: 8px 10px 0; }
.col-q { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 5px 9px; font-size: 13px; background: #faf9f6; }
.col-q:focus { outline: none; border-color: var(--accent); background: #fff; }
.col-search.on .col-q { border-color: var(--accent); background: #fff; }
.modal .fb-q { flex-basis: calc(100% - 30px); max-width: none; }

/* ---------- roller / yetkiler / sayfam ---------- */
.perm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; margin-top: 10px; }
.perm-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 14px; padding: 4px 0; }
.perm-row .f-input { width: 150px; padding: 5px 8px; font-size: 13px; }
.perm-row.custom .f-input { border-color: var(--blue); background: var(--blue-soft); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 8px; vertical-align: middle; }
.dot.on { background: var(--ok); } .dot.off { background: #c9c6bd; }
.mod-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.tag.mod-on { background: #e7f6ed; color: var(--ok); }
.tag.mod-off { background: #f3f2ee; color: #b0b3ba; text-decoration: line-through; }
.mypage-list { display: flex; flex-direction: column; gap: 4px; }
.mypage-row { display: flex; align-items: center; gap: 4px; border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px 6px 12px; }
.mypage-row.locked { opacity: .55; }
.icon-btn:disabled { opacity: .3; cursor: default; }
@media (max-width: 700px) { .perm-grid { grid-template-columns: 1fr; } }

/* çok kişiye atanan görev: kişiler ve durumları */
.who-row { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.who-chip { display: inline-flex; align-items: center; gap: 2px; font-size: 12px; border-radius: 99px; padding: 2px 9px; background: #f1f0ec; color: #3d4352; border: 1px solid transparent; }
.who-chip b { font-weight: 700; }
.who-chip.doing { background: #fff3e0; color: var(--warn); }
.who-chip.done { background: #e7f6ed; color: var(--ok); }
.assignee-list { display: flex; flex-direction: column; gap: 6px; }
.assignee-row { display: grid; grid-template-columns: minmax(140px, auto) 1fr; gap: 4px 10px; align-items: center; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; }
.assignee-row .f-input { padding: 5px 8px; font-size: 13px; max-width: 180px; }
.assignee-row .muted { font-size: 13px; color: var(--muted); }
.assignee-comment { grid-column: 1 / -1; font-size: 13px; color: #3d4352; white-space: pre-wrap; }
