:root {
  color-scheme: light;
  font-family: "Segoe UI", system-ui, sans-serif;
  color: #17263d;
  background: #eef2f8;
  line-height: 1.5;
  --ink: #17263d;
  --muted: #506079;
  --line: #dce4ef;
  --control: #a5b4c8;
  --surface: #fff;
  --blue: #214cb5;
  --shadow: 0 1px 2px #1023450a, 0 7px 15px -5px #10234519, 0 18px 30px -18px #10234525;
  --radius: 16px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; background: linear-gradient(160deg, #e5edf9, #f4f6fa 30rem); }

.topbar {
  color: #fff;
  background: linear-gradient(105deg, #101c32, #192e50);
  border-bottom: 1px solid #304666;
  box-shadow: 0 3px 14px #0c23452a;
}

.topbar-inner, main { max-width: 1536px; margin-inline: auto; padding-inline: clamp(16px, 4vw, 56px); }

.topbar-inner, .brand, .account-menu, .workspace-header, .toolbar, .actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-inner, .workspace-header { flex-wrap: wrap; justify-content: space-between; }
.topbar-inner { padding-block: 9px; }
.topbar button { min-height: 34px; padding-block: 5px; }
.brand, .account-menu { min-width: 0; }
.brand-mark {
  flex: 0 0 34px;
  display: grid;
  place-items: center;
  height: 34px;
  border: 1px solid #86a4fa;
  border-radius: 11px;
  background: linear-gradient(145deg, #517de6, #2d55bb);
  box-shadow: inset 0 1px #ffffff45, 0 4px 9px #0003;
  font-size: 1.3rem;
  font-weight: 700;
}

h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: clamp(1.08rem, 2vw, 1.32rem); font-weight: 650; }
h2 { font-size: 1.5rem; letter-spacing: -.025em; }
h3 { font-size: 1.05rem; }
.account-menu { flex-wrap: wrap; }
#account {
  padding: 5px 11px;
  border: 1px solid #586e90;
  border-radius: 999px;
  color: #e4edff;
  font-size: .875rem;
  overflow-wrap: anywhere;
}

main { display: grid; gap: 14px; padding-block: clamp(16px, 2vw, 28px); }
main > * { min-width: 0; }
.workspace, .worklist {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.workspace { padding: 14px clamp(14px, 2vw, 24px); }
.workspace-header { gap: 12px; }
.workspace h2 { font-size: clamp(1.55rem, 2.5vw, 1.9rem); }
.toolbar, .actions { flex-wrap: wrap; }

.statistics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stat-card {
  --accent: #2b52ac;
  --tint: #e9f0ff;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 15px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: linear-gradient(160deg, #fff 45%, #f5f8fe);
  box-shadow: var(--shadow);
}
.stat-card:nth-child(2) { --accent: #805019; --tint: #fff0d7; }
.stat-card:nth-child(3) { --accent: #982c40; --tint: #fcebf0; }
.stat-card:nth-child(4) { --accent: #1c694e; --tint: #e4f4ed; }
.stat-icon {
  flex: 0 0 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--tint);
  color: var(--accent);
  font-size: 1.2rem;
  font-weight: 750;
}
.stat-card div { min-width: 0; }
.stat-card div > span { display: block; color: var(--muted); font-size: .875rem; font-weight: 600; line-height: 1.25; }
.stat-card strong { display: block; font-size: 1.45rem; line-height: 1.2; font-variant-numeric: tabular-nums; }

button, .file {
  min-height: 40px;
  padding: 8px 13px;
  border: 1px solid var(--control);
  border-radius: 9px;
  color: var(--ink);
  background: linear-gradient(#fff, #f7f9fc);
  box-shadow: 0 1px 2px #17263d0d;
  font: inherit;
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color .16s, border-color .16s, box-shadow .16s, transform .12s;
}

button:not(:disabled):hover, .file:hover { background: #edf3ff; border-color: #7894cb; }
button:not(:disabled):active, .file:active { transform: translateY(1px); }
button:disabled { opacity: .6; cursor: wait; }
button.primary {
  color: #fff;
  background: linear-gradient(#315dce, #2149aa);
  border-color: #244db3;
  box-shadow: 0 2px 5px #244db340, inset 0 1px #ffffff30;
}
button.primary:not(:disabled):hover { background: #1b409f; border-color: #1b409f; }
#newTask span { margin-right: 3px; font-size: 1.1em; }
#newTask { padding-inline: 17px; box-shadow: 0 3px 8px #2149aa38, inset 0 1px #ffffff45; }
.topbar button { border-color: #7589a8; background: #ffffff12; color: #fff; }
.topbar button:not(:disabled):hover { background: #ffffff25; border-color: #9bb1d4; }
:focus-visible, .file:focus-within { outline: 3px solid #2861d0; outline-offset: 2px; }
.topbar :focus-visible { outline-color: #a9c9ff; }

.file { position: relative; display: inline-flex; align-items: center; margin: 0; }
.file input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; pointer-events: none; }

#status {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 11px 0 0;
  padding: 4px 10px;
  border: 1px solid #d4e3fb;
  border-radius: 10px;
  background: #eff5ff;
  color: #274982;
  font-size: .875rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
#status::before { content: ""; flex: 0 0 8px; height: 8px; border-radius: 50%; background: currentColor; }
#status[data-tone="success"] { border-color: #c1e3d4; background: #eaf7f0; color: #176245; }
#status[data-tone="warning"] { border-color: #f0d0ae; background: #fff3e5; color: #873a16; }
.hint { margin: 5px 0 0; color: var(--muted); font-size: .8125rem; }

#tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
  border-radius: var(--radius) var(--radius) 0 0;
  background: #f8faff;
}

#tabs button {
  min-height: 37px;
  padding: 6px 11px;
  color: var(--muted);
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}
#tabs button[aria-pressed="true"] { background: #e1ebff; border-color: #abc3f1; color: #173f98; box-shadow: inset 0 -2px #587dce; }
#tabs button:last-child { margin-inline-start: auto; }

.search-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding: 10px 18px;
}

label { display: block; margin: 14px 0 5px; font-size: .875rem; font-weight: 600; }
.search-bar label { margin: 0; color: var(--muted); }
input:not([type="file"]), textarea, select {
  width: 100%;
  min-height: 42px;
  padding: 8px 11px;
  border: 1px solid var(--control);
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}
.search-field { position: relative; flex: 0 1 335px; min-width: 0; color: #526b92; }
.search-field::before, .search-field::after { content: ""; position: absolute; pointer-events: none; }
.search-field::before { top: calc(50% - 8px); left: 13px; width: 12px; height: 12px; border: 2px solid currentColor; border-radius: 50%; }
.search-field::after { top: calc(50% + 3px); left: 23px; width: 7px; height: 2px; background: currentColor; transform: rotate(45deg); transform-origin: left; }
#search { padding-inline-start: 38px; background: #f8faff; }
textarea { min-height: 94px; resize: vertical; }

.table { overflow-x: auto; border-block: 1px solid var(--line); }
.table:focus-visible { outline-offset: -3px; }
table { width: 100%; min-width: 900px; border-collapse: collapse; }
th, td { padding: 11px 14px; text-align: start; }
th:first-child, td:first-child { padding-inline-start: 20px; }
th:last-child, td:last-child { padding-inline-end: 20px; }
th { background: #edf2fa; color: #3d5272; font-size: .875rem; white-space: nowrap; }
th button {
  min-height: 34px;
  margin: -6px -4px;
  padding: 4px;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  color: inherit;
}
th button span { margin-inline-start: 4px; color: #506789; }
th[aria-sort] { color: var(--blue); background: #e5eefc; }
th[aria-sort] span { display: inline-block; font-size: 0; }
th[aria-sort="ascending"] span::after { content: "↑"; font-size: .875rem; }
th[aria-sort="descending"] span::after { content: "↓"; font-size: .875rem; }

td { border-top: 1px solid var(--line); vertical-align: middle; font-size: .875rem; }
td:first-child { width: 32%; max-width: 420px; overflow-wrap: anywhere; }
tbody tr:nth-child(even) { background: #f8faff; }
tbody tr { transition: background-color .15s; }
tbody tr:hover, tbody tr:focus-within { background: #edf3ff; }
.task-title {
  min-height: 34px;
  padding: 2px 5px;
  margin-inline-start: -5px;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  color: #1d4699;
  font-size: .9375rem;
  font-weight: 700;
  text-align: start;
  overflow-wrap: anywhere;
}
.sub { margin: 3px 0 0; color: var(--muted); white-space: pre-wrap; }
.sub:empty { display: none; }
.timestamp, .deadline { color: var(--muted); font-variant-numeric: tabular-nums; }
.timestamp { min-width: 103px; }
.deadline { white-space: nowrap; }
.deadline .badge { display: table; }
.deadline .badge[data-tone] { margin-top: 4px; }

.badge {
  display: inline-block;
  padding: 3px 9px;
  border: 1px solid #d7e0ee;
  border-radius: 999px;
  background: #edf2f8;
  color: #40536d;
  font-size: .875rem;
  font-weight: 650;
  white-space: nowrap;
}
.badge[data-state="Devam ediyor"], .badge[data-tone="soon"] { color: #234794; background: #e8f0ff; border-color: #c6d8fb; }
.badge[data-state="Beklemede"], .badge[data-tone="today"] { color: #774907; background: #fff2d7; border-color: #ecd29b; }
.badge[data-state="Tamamlandı"] { color: #176245; background: #e4f5ed; border-color: #bedfce; }
.badge[data-state="İptal edildi"] { color: #684080; background: #f3eafb; border-color: #e2d2ed; }
.badge[data-tone="overdue"] { color: #972e3f; background: #ffebef; border-color: #f3c6cf; }

.row-actions { white-space: nowrap; }
.row-actions button, .note button { min-height: 36px; padding: 6px 9px; margin: 2px 4px 2px 0; }
.row-actions button:first-child { color: #234794; background: #edf3ff; border-color: #a5bae6; }
.row-actions button:first-child:hover { background: #dde9ff; }
.row-actions button:last-child, .note button:last-of-type { color: #942d41; }
.row-actions button:last-child:hover, .note button:last-of-type:hover { color: #832639; background: #fff0f3; border-color: #cd8696; }

#empty { margin: 0; padding: 42px 18px; text-align: center; color: var(--muted); }
#conflicts:empty { display: none; }
#conflicts { display: grid; gap: 12px; }
.conflict {
  padding: 16px 20px;
  border: 1px solid #e6c988;
  border-inline-start: 4px solid #ad7419;
  border-radius: 12px;
  background: #fffaee;
  box-shadow: var(--shadow);
  color: #67430e;
  overflow-wrap: anywhere;
}
.conflict p { margin: 6px 0 10px; white-space: pre-wrap; }
.conflict button { margin: 4px 8px 0 0; }
.conflict button:first-of-type { color: #234794; border-color: #a5bae6; background: #edf3ff; }
.conflict button:first-of-type:hover { background: #dde9ff; }

dialog {
  width: min(640px, calc(100% - 32px));
  max-height: min(90vh, 880px);
  padding: clamp(18px, 3vw, 28px);
  border: 1px solid var(--line);
  border-radius: 18px;
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 10px 28px #0b173030, 0 28px 72px #0b173045;
  overflow: auto;
  overflow-wrap: anywhere;
}
dialog[open] { animation: show-dialog .18s ease-out; }
dialog::backdrop { background: #101d39a6; }
@keyframes show-dialog { from { opacity: 0; transform: translateY(6px); } }
#login { max-width: 460px; }
#login form > p { color: var(--muted); }
#login #loginError { padding: 9px 12px; border-radius: 8px; color: #942d41; background: #fff0f3; }
#loginError:empty { display: none; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.actions { justify-content: flex-end; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }

#detail, #editor { --dialog-padding: clamp(14px, 3vw, 24px); padding: 0; max-height: min(90dvh, 880px); }
#detail { max-width: 740px; overflow: hidden; }
#detail[open] { display: flex; flex-direction: column; }
.dialog-header {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 12px var(--dialog-padding);
  border-bottom: 1px solid var(--line);
  background: #f9fbff;
  box-shadow: 0 3px 8px #10234509;
}
.dialog-header h2 { min-width: 0; align-self: center; font-size: clamp(1.1rem, 3.5vw, 1.45rem); }
#detailTitle { max-height: 15dvh; overflow-y: auto; }
.dialog-header button { flex-shrink: 0; min-height: 35px; padding-block: 5px; }
#taskForm { padding: 0 var(--dialog-padding) var(--dialog-padding); }
#taskForm .dialog-header { margin-inline: calc(-1 * var(--dialog-padding)); }
#taskForm { scroll-padding-top: 68px; }
#editor { scroll-padding-top: 68px; }
.detail-body { min-height: 0; overflow: auto; padding: 0 var(--dialog-padding) var(--dialog-padding); }
#detail h3 { margin-top: 18px; }
#detailText { margin: 14px 0; white-space: pre-wrap; color: var(--muted); }
.note {
  margin: 9px 0;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f6f9fd;
  white-space: pre-wrap;
}
.note > p { margin: 0 0 8px; }
.note small { display: block; margin-bottom: 6px; color: var(--muted); font-size: .8125rem; }
.disclosure { border: 1px solid var(--line); border-radius: 10px; background: #f8faff; white-space: normal; }
.disclosure summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 13px;
  border-radius: 9px;
  list-style: none;
  color: #24477e;
  font-weight: 650;
  cursor: pointer;
}
.disclosure summary::-webkit-details-marker { display: none; }
.disclosure summary:hover { background: #edf3ff; }
.disclosure summary::after {
  content: "";
  flex: 0 0 8px;
  height: 8px;
  margin-inline: 2px 3px;
  border: solid currentColor;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  transition: transform .18s ease;
}
.disclosure[open] summary::after { transform: rotate(225deg); }
@supports (interpolate-size: allow-keywords) {
  .disclosure::details-content {
    interpolate-size: allow-keywords;
    height: 0;
    overflow: clip;
    transition: height .18s ease, content-visibility .18s allow-discrete;
  }
  .disclosure[open]::details-content { height: auto; }
}
.note-history { margin-top: 8px; background: #fff; font-size: .875rem; }
.timeline {
  max-height: min(330px, 48dvh);
  overflow-y: auto;
  overscroll-behavior: contain;
  margin: 0;
  padding: 8px 14px 12px 25px;
  border-top: 1px solid var(--line);
  list-style: none;
  scrollbar-gutter: stable;
}
.timeline:focus-visible { outline-offset: -3px; }
.event { position: relative; padding: 5px 12px 10px; border-inline-start: 2px solid #c3d4ef; font-size: .875rem; }
.event::before {
  content: "";
  position: absolute;
  top: 11px;
  inset-inline-start: -5px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #536fa9;
}
.event time { display: block; color: var(--muted); font-size: .8125rem; font-variant-numeric: tabular-nums; }
.event p { margin: 3px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.history-empty { margin: 0; padding: 0 13px 12px; color: var(--muted); }
#noteForm { margin-top: 10px; padding: 0 14px 13px; border: 1px solid var(--line); border-radius: 10px; }
#noteForm button { margin-top: 8px; }

@media (max-width: 1040px) {
  #tabs button:last-child { margin-inline-start: 0; }
}
@media (max-width: 760px) {
  .statistics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
}
@media (max-width: 600px) {
  main { gap: 14px; }
  .search-bar, #tabs { padding-inline: 12px; }
  .search-field { flex-basis: 100%; }
  .stat-card { padding: 8px; gap: 7px; }
  .stat-icon { flex-basis: 30px; height: 30px; }
  .stat-card div > span { overflow-wrap: anywhere; }
  .form-grid { grid-template-columns: 1fr; gap: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
