:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f0f1f4;
  --border: #e1e3e8;
  --text: #1f2430;
  --text-2: #5f6676;
  --text-3: #8a90a0;
  --accent: #4f6bed;
  --accent-ink: #ffffff;
  --accent-soft: #eef1fe;
  --danger: #d83a52;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(20, 24, 40, .06), 0 2px 8px rgba(20, 24, 40, .05);
  --shadow-lg: 0 10px 40px rgba(20, 24, 40, .18);

  --st-new: #579bfc;
  --st-in_progress: #fdab3d;
  --st-waiting: #a25ddc;
  --st-resolved: #00c875;
  --st-closed: #8b8f99;

  --pr-low: #9aa0ad;
  --pr-normal: #579bfc;
  --pr-high: #f27a1a;
  --pr-urgent: #e2445c;

  --series-1: #257de0;
  --series-2: #f47230;
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
[hidden] { display: none !important; }

/* ---------- Butonlar & formlar ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--border); background: var(--surface);
  padding: 7px 14px; border-radius: 6px; cursor: pointer; white-space: nowrap;
  transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover { background: #3f5ad9; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { color: var(--danger); }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: default; }

.input, select.input, textarea.input {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface); outline: none; transition: border-color .12s, box-shadow .12s;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea.input { resize: vertical; min-height: 90px; line-height: 1.45; }
label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; font-size: 12px; font-weight: 600; color: var(--text-2); margin-bottom: 4px; }
.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: 13px; color: var(--text-2); }
.row { display: flex; gap: 10px; align-items: center; }
.grow { flex: 1; }
.muted { color: var(--text-2); }
.small-text { font-size: 12px; color: var(--text-3); }

/* ---------- Giriş ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 32px; }
.login-card h1 { margin: 12px 0 4px; font-size: 22px; }
.login-card p { margin: 0 0 22px; color: var(--text-2); }
.logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; }
.logo-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--accent); display: grid; place-items: center; }
.error-text { color: var(--danger); font-size: 13px; min-height: 18px; margin: 4px 0 8px; }

/* ---------- Üst bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 18px; padding: 10px 20px;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.nav { display: flex; gap: 2px; }
.nav a { padding: 7px 12px; border-radius: 6px; color: var(--text-2); font-weight: 500; }
.nav a:hover { background: var(--surface-2); text-decoration: none; }
.nav a.active { background: var(--accent-soft); color: var(--accent); }
.user-chip { display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 4px 8px; border-radius: 6px; position: relative; }
.user-chip:hover { background: var(--surface-2); }
.menu { position: absolute; right: 0; top: 110%; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow-lg); min-width: 190px; padding: 6px; z-index: 30; }
.menu button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 6px; cursor: pointer; }
.menu button:hover { background: var(--surface-2); }
.avatar {
  width: 28px; height: 28px; border-radius: 50%; display: inline-grid; place-items: center;
  font-size: 11px; font-weight: 700; color: #fff; flex: none; letter-spacing: .02em;
}
.avatar.sm { width: 24px; height: 24px; font-size: 10px; }
.avatar.empty { background: var(--surface-2) !important; color: var(--text-3); border: 1px dashed var(--border); }

main { padding: 18px 20px 40px; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.page-head h2 { margin: 0; font-size: 20px; }

/* ---------- Filtreler ---------- */
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
.filters .input { width: auto; min-width: 150px; padding: 6px 10px; }
.filters .search { min-width: 230px; }

/* ---------- Pano ---------- */
.board { display: grid; grid-template-columns: repeat(5, minmax(240px, 1fr)); gap: 14px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.col { background: var(--surface-2); border-radius: 10px; display: flex; flex-direction: column; max-height: calc(100vh - 190px); min-height: 160px; }
.col-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; font-weight: 600; border-top: 4px solid var(--c); border-radius: 10px 10px 0 0; background: var(--surface); }
.col-head .count { margin-left: auto; background: var(--surface-2); color: var(--text-2); font-size: 12px; padding: 1px 8px; border-radius: 10px; }
.col-body { padding: 10px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; flex: 1; transition: background .12s; border-radius: 0 0 10px 10px; }
.col-body.drop { background: var(--accent-soft); outline: 2px dashed var(--accent); outline-offset: -4px; }
.col-empty { color: var(--text-3); font-size: 13px; text-align: center; padding: 14px 0; }

.card {
  background: var(--surface); border-radius: 8px; padding: 10px 12px; box-shadow: var(--shadow);
  cursor: pointer; border-left: 4px solid var(--org, transparent); transition: transform .1s, box-shadow .1s;
}
.card:hover { box-shadow: 0 4px 14px rgba(20,24,40,.12); }
.card.dragging { opacity: .45; }
.card-top { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-3); margin-bottom: 4px; }
.card-title { font-weight: 600; line-height: 1.35; margin-bottom: 8px; word-break: break-word; }
.card-foot { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-2); }
.card-foot .spacer { flex: 1; }
.org-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; color: var(--text-2); max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.org-chip i { width: 8px; height: 8px; border-radius: 50%; background: var(--org); flex: none; }
.due { display: inline-flex; align-items: center; gap: 3px; }
.due.over { color: var(--danger); font-weight: 600; }
.teams-tag { color: #5b5fc7; font-weight: 700; font-size: 11px; }

/* rozetler */
.pill { display: inline-flex; align-items: center; justify-content: center; padding: 3px 10px; border-radius: 4px; color: #fff; font-size: 12px; font-weight: 600; white-space: nowrap; min-width: 86px; }
.pill.st-new { background: var(--st-new); } .pill.st-in_progress { background: var(--st-in_progress); }
.pill.st-waiting { background: var(--st-waiting); } .pill.st-resolved { background: var(--st-resolved); }
.pill.st-closed { background: var(--st-closed); }
.prio { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; }
.prio::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--p); }
.prio.p-low { --p: var(--pr-low); color: var(--text-2); } .prio.p-normal { --p: var(--pr-normal); color: var(--text-2); }
.prio.p-high { --p: var(--pr-high); color: #c45f0e; } .prio.p-urgent { --p: var(--pr-urgent); color: var(--pr-urgent); }

/* ---------- Tablo ---------- */
.table-wrap { background: var(--surface); border-radius: 10px; box-shadow: var(--shadow); overflow: auto; }
table.grid { width: 100%; border-collapse: collapse; }
table.grid th { text-align: left; font-size: 12px; font-weight: 600; color: var(--text-2); padding: 10px 12px; border-bottom: 1px solid var(--border); background: var(--surface); position: sticky; top: 0; white-space: nowrap; }
table.grid td { padding: 8px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.grid tr:last-child td { border-bottom: 0; }
table.grid tbody tr.clickable { cursor: pointer; }
table.grid tbody tr.clickable:hover td { background: #fafbfc; }
table.grid td.num, table.grid th.num { text-align: right; font-variant-numeric: tabular-nums; }
.cell-select { border: 0; padding: 4px 8px; border-radius: 4px; color: #fff; font-weight: 600; font-size: 12px; cursor: pointer; appearance: none; text-align: center; min-width: 100px; }
.cell-select option { color: var(--text); background: #fff; }
.empty-state { padding: 40px; text-align: center; color: var(--text-2); }

/* ---------- Çekmece (talep detayı) ---------- */
.overlay { position: fixed; inset: 0; background: rgba(20, 24, 40, .35); z-index: 40; animation: fade .15s; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(920px, 100vw); background: var(--surface);
  z-index: 41; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; animation: slide .18s ease-out;
}
@keyframes slide { from { transform: translateX(40px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
.drawer-head { display: flex; align-items: flex-start; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.drawer-head .tid { color: var(--text-3); font-weight: 600; padding-top: 6px; }
.title-input { font-size: 19px; font-weight: 700; border: 1px solid transparent; border-radius: 6px; padding: 3px 6px; width: 100%; background: transparent; }
.title-input:hover:not(:disabled) { border-color: var(--border); }
.title-input:focus { border-color: var(--accent); outline: none; }
.title-input:disabled { color: var(--text); }
.drawer-body { flex: 1; display: grid; grid-template-columns: 1fr 260px; min-height: 0; }
.drawer-main { padding: 18px 20px; overflow-y: auto; }
.drawer-side { border-left: 1px solid var(--border); padding: 18px; overflow-y: auto; background: #fbfbfc; }
.side-field { margin-bottom: 14px; }
.side-field > span { display: block; font-size: 12px; font-weight: 600; color: var(--text-2); margin-bottom: 4px; }
.side-field .value { padding: 6px 0; }
.section-title { font-size: 13px; font-weight: 700; color: var(--text-2); margin: 18px 0 8px; text-transform: uppercase; letter-spacing: .04em; }
.desc { white-space: pre-wrap; line-height: 1.5; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: 18px 0 12px; }
.tabs button { border: 0; background: none; padding: 8px 12px; cursor: pointer; color: var(--text-2); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.active { color: var(--accent); border-bottom-color: var(--accent); }
.comment { display: flex; gap: 10px; margin-bottom: 14px; }
.comment-body { flex: 1; background: var(--surface-2); border-radius: 8px; padding: 9px 12px; }
.comment.internal .comment-body { background: #fff7e6; border: 1px solid #ffe2a8; }
.comment-meta { font-size: 12px; color: var(--text-3); margin-bottom: 3px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.comment-meta b { color: var(--text); }
.comment-text { white-space: pre-wrap; line-height: 1.45; word-break: break-word; }
.tag { font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 4px; background: var(--surface); border: 1px solid var(--border); color: var(--text-2); }
.tag.warn { background: #fff0cc; border-color: #ffd98a; color: #8a5a00; }
.composer { border: 1px solid var(--border); border-radius: 8px; padding: 10px; margin-top: 8px; }
.composer textarea { border: 0; padding: 0; min-height: 70px; box-shadow: none !important; }
.event { display: flex; gap: 10px; font-size: 13px; padding: 6px 0; border-bottom: 1px dashed var(--border); }
.event time { color: var(--text-3); white-space: nowrap; min-width: 112px; }
.files { display: flex; flex-direction: column; gap: 6px; }
.file { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); }
.file a { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Modal ---------- */
.modal { position: fixed; left: 50%; top: 8vh; transform: translateX(-50%); width: min(560px, calc(100vw - 24px)); max-height: 84vh; overflow-y: auto; background: var(--surface); border-radius: 12px; box-shadow: var(--shadow-lg); z-index: 51; padding: 22px; animation: fade .15s; }
.modal h3 { margin: 0 0 16px; font-size: 18px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.overlay.top { z-index: 50; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }

/* ---------- Yönetim ---------- */
.admin-grid { display: grid; grid-template-columns: 360px 1fr; gap: 18px; align-items: start; }
.panel { background: var(--surface); border-radius: 10px; box-shadow: var(--shadow); }
.panel-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.panel-head h3 { margin: 0; font-size: 15px; flex: 1; }
.color-dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; vertical-align: middle; }
.role-tag { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 4px; }
.role-admin { background: #ffe3e8; color: #b0213a; } .role-staff { background: #e3edff; color: #2a55b8; } .role-customer { background: #e2f7ec; color: #1b7a4b; }
tr.inactive td { opacity: .5; }

/* ---------- Raporlar ---------- */
.viz-root { --surface-1: #ffffff; --text-primary: #1f2430; --text-secondary: #5f6676; --grid: #eceef2; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--surface); border-radius: 10px; box-shadow: var(--shadow); padding: 14px 16px; }
.tile .label { font-size: 12px; color: var(--text-2); font-weight: 600; }
.tile .big { font-size: 28px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.tile .sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.charts { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.chart-card { background: var(--surface); border-radius: 10px; box-shadow: var(--shadow); padding: 14px 16px; position: relative; }
.chart-card.wide { grid-column: 1 / -1; }
.chart-card h4 { margin: 0 0 2px; font-size: 14px; }
.chart-card .note { font-size: 12px; color: var(--text-3); margin-bottom: 10px; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--text-secondary); margin-bottom: 6px; }
.legend i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 5px; }
.viz-tip { position: absolute; pointer-events: none; background: #1f2430; color: #fff; font-size: 12px; padding: 7px 9px; border-radius: 6px; white-space: nowrap; z-index: 5; box-shadow: var(--shadow-lg); }
.viz-tip b { font-weight: 700; }
.hbar-row { display: grid; grid-template-columns: 140px 1fr 44px; gap: 10px; align-items: center; padding: 4px 0; font-size: 13px; }
.hbar-row .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-primary); }
.hbar-track { height: 14px; position: relative; }
.hbar-fill { height: 100%; border-radius: 0 4px 4px 0; background: var(--series-1); min-width: 2px; }
.hbar-row .val { text-align: right; font-variant-numeric: tabular-nums; color: var(--text-primary); font-weight: 600; }
.hbar-row:hover .hbar-fill { filter: brightness(.9); }
details.table-view { margin-top: 10px; font-size: 13px; }
details.table-view summary { cursor: pointer; color: var(--text-2); font-size: 12px; }

/* ---------- Bildirim ---------- */
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(20px); background: #1f2430; color: #fff; padding: 10px 16px; border-radius: 8px; opacity: 0; transition: .2s; z-index: 100; pointer-events: none; box-shadow: var(--shadow-lg); }
.toast.show { opacity: 1; transform: translateX(-50%); }
.toast.err { background: var(--danger); }

@media (max-width: 900px) {
  .drawer-body { grid-template-columns: 1fr; }
  .drawer-side { border-left: 0; border-top: 1px solid var(--border); }
  .admin-grid, .charts { grid-template-columns: 1fr; }
  .topbar { flex-wrap: wrap; gap: 8px; }
  .board { grid-template-columns: repeat(5, 260px); }
}
