:root {
  font-family: system-ui, sans-serif; color: #192827; background: #f3f6f4;
  --line: #d9e2dc; --muted: #5d706b; --accent: #1d6449; --accent-soft: #e8f1e9; --danger: #a02121; --danger-soft: #fbe3e3;
  --warn: #8a5a00; --warn-soft: #fcefd4; --blue: #1f4f8a; --blue-soft: #e2ecf8;
}
* { box-sizing: border-box; }
body { margin: 0; display: flex; flex-direction: column; height: 100vh; }
button, input, textarea, select { font: inherit; color: inherit; }
input, textarea, select { width: 100%; border: 1px solid #a8b9b0; border-radius: 8px; padding: 9px 10px; background: white; }
textarea { min-height: 90px; resize: vertical; }
label { display: block; font-weight: 600; font-size: .85rem; color: var(--muted); margin: 14px 0 5px; }
button { background: var(--accent); border: 0; border-radius: 8px; color: white; padding: 9px 16px; font-weight: 650; cursor: pointer; }
button:hover { background: #15513a; }
button:disabled, select:disabled { opacity: .6; cursor: wait; }
.secondary { background: var(--accent-soft); color: var(--accent); }
.secondary:hover { background: #d9e9dd; }
.ghost { background: transparent; color: var(--muted); padding: 6px 8px; }
.ghost:hover { background: var(--accent-soft); color: var(--accent); }
.muted { color: var(--muted); }
.error { color: var(--danger); }
[hidden] { display: none !important; }
ul { list-style: none; margin: 0; padding: 0; }

.topbar { display: flex; gap: 12px; align-items: center; padding: 12px 20px; background: white; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.topbar h1 { font-size: 1.15rem; margin: 0 8px 0 0; white-space: nowrap; }
#quick-form { display: flex; gap: 8px; flex: 1 1 380px; }
#quick-form input { flex: 1; min-width: 0; }
#quick-form #quick-title { min-width: 200px; }
#quick-form select { width: auto; }
#quick-form input[name="redmineNumber"] { flex: 0 0 105px; }
.redmine-input { width: 140px; border-radius: 999px; padding: 6px 12px; font-weight: 600; }
.rm { font-weight: 600; color: var(--blue); }
#search { flex: 0 1 180px; min-width: 130px; }
.view-switch { display: flex; background: var(--accent-soft); border-radius: 8px; padding: 3px; }
.view-switch button { background: transparent; color: var(--accent); padding: 6px 12px; }
.view-switch button[aria-pressed="true"] { background: white; box-shadow: 0 1px 3px #1e38231f; }
#message { margin: 0; padding: 0 20px; min-height: 0; }
#message:not(:empty) { padding: 8px 20px; }

.layout { display: grid; grid-template-columns: minmax(280px, 380px) 1fr; flex: 1; min-height: 0; }
.list-pane { border-right: 1px solid var(--line); background: #fafcfb; display: flex; flex-direction: column; min-height: 0; }
.tabs { display: flex; gap: 4px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.tabs button { background: transparent; color: var(--muted); padding: 6px 10px; font-weight: 600; }
.tabs button[aria-selected="true"] { background: var(--accent-soft); color: var(--accent); }
.tabs .count { font-weight: 500; margin-left: 3px; opacity: .8; }
#items { overflow-y: auto; flex: 1; }
#items li { border-bottom: 1px solid #e6ece8; }
.item { display: block; width: 100%; text-align: left; background: transparent; color: inherit; border-radius: 0; padding: 12px 16px; font-weight: 400; border-left: 3px solid transparent; }
.item:hover { background: #eef4f0; }
.item[aria-current="true"] { background: #e3efe7; border-left-color: var(--accent); }
.item-title { display: flex; gap: 8px; align-items: baseline; font-weight: 650; }
.item-title span:first-child { flex: 1; overflow-wrap: anywhere; }
.item-meta { display: block; font-size: .85rem; color: var(--muted); margin-top: 4px; }
.num { color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; margin-right: 6px; }
/* Priority stripe on the left edge; selection uses the border so both can show together. */
.prio-edge-URGENT { box-shadow: inset 4px 0 0 var(--danger); }
.prio-edge-HIGH { box-shadow: inset 4px 0 0 #e08a00; }
.finished-item { opacity: .55; }
.finished-item .item-title > span:first-child, .card.finished-item .item-title > span:first-child { text-decoration: line-through; }
.sort-bar { display: flex; align-items: center; gap: 8px; padding: 8px 16px; border-bottom: 1px solid var(--line); font-size: .85rem; color: var(--muted); }
.sort-bar select { width: auto; padding: 4px 8px; font-size: .85rem; }
.sort-bar label { margin: 0; }
.late-text { color: var(--danger); font-weight: 600; }
.warn-text { color: var(--warn); font-weight: 600; }
#empty { padding: 16px; }

.prio { font-size: .72rem; font-weight: 700; border-radius: 999px; padding: 2px 8px; white-space: nowrap; }
.prio-HIGH { background: var(--warn-soft); color: var(--warn); }
.prio-URGENT { background: var(--danger-soft); color: var(--danger); }
.prio-LOW { background: #eef0ef; color: var(--muted); }

.detail-pane { overflow-y: auto; min-height: 0; }
#placeholder { display: grid; place-items: center; height: 100%; padding: 24px; text-align: center; }
#detail { max-width: 820px; padding: 20px 28px 64px; }
.title-input { font-size: 1.5rem; font-weight: 700; border-color: transparent; background: transparent; padding: 6px 8px; margin-left: -8px; }
.title-input:hover { border-color: var(--line); background: white; }
.title-input:focus { border-color: #a8b9b0; background: white; }
#meta { font-size: .85rem; margin: 4px 0 12px; }
.chips { display: flex; gap: 10px; flex-wrap: wrap; }
.chips label { margin: 0 0 4px; }
select.pill { width: auto; border-radius: 999px; padding: 6px 12px; font-weight: 600; border-color: transparent; background: #eef0ef; }
select.pill[data-value="ACTIVE"], select.pill[data-value="NORMAL"] { background: var(--accent-soft); color: var(--accent); }
select.pill[data-value^="WAITING"] { background: var(--blue-soft); color: var(--blue); }
select.pill[data-value="BLOCKED"], select.pill[data-value="URGENT"] { background: var(--danger-soft); color: var(--danger); }
select.pill[data-value="HIGH"] { background: var(--warn-soft); color: var(--warn); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
#save-bar { position: sticky; bottom: 0; display: flex; gap: 10px; align-items: center; margin-top: 16px; padding: 10px 14px; background: #fff8e6; border: 1px solid #f0d9a6; border-radius: 10px; }
#save-bar span { flex: 1; font-weight: 600; }
#edit-message { min-height: 22px; margin: 8px 0 0; }
#conflict { border: 1px solid #e0b4b4; background: #fdf3f3; border-radius: 10px; padding: 4px 16px 16px; margin-top: 12px; }
#conflict li { padding: 8px 0; border-top: 1px solid #efd2d2; }
#conflict li strong { display: block; }
#conflict button { margin: 10px 8px 0 0; }

/* Collapsible sections under a work item (Aksiyonlar, Sorular). The summary line stays visible. */
details.section { margin-top: 16px; border: 1px solid var(--line); border-radius: 12px; background: white; }
details.section:first-of-type { margin-top: 28px; }
details.section > summary { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; padding: 12px 16px; cursor: pointer; list-style: none; user-select: none; }
details.section > summary::-webkit-details-marker { display: none; }
details.section > summary::before { content: '▸'; color: var(--muted); transition: transform .15s; display: inline-block; }
details.section[open] > summary::before { transform: rotate(90deg); }
details.section > summary:hover { background: #f6f9f7; border-radius: 12px; }
.section-title { font-weight: 700; font-size: 1.05rem; }
.section-count { color: var(--muted); font-size: .9rem; }
.section-body { padding: 0 16px 12px; border-top: 1px solid #e6ece8; }
.entries > li { display: grid; grid-template-columns: auto 1fr auto; gap: 6px 12px; align-items: center; padding: 10px 8px 10px 12px; border-bottom: 1px solid #e6ece8; border-radius: 6px; }
#questions > li { grid-template-columns: 1fr auto; }
.entries > li.overdue { background: #fdf1f1; }
.entries > li.waiting-long { background: #fff8ec; }
.entries input[type="checkbox"] { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
.entry-title { font-weight: 600; overflow-wrap: anywhere; white-space: pre-wrap; }
.entry-title .prio { margin-left: 8px; vertical-align: 1px; }
.entries li.finished { opacity: .55; }
.entries li.finished .entry-title { text-decoration: line-through; }
.answer { margin-top: 6px; padding: 8px 10px; background: #eef6f1; border-left: 3px solid var(--accent); border-radius: 6px; white-space: pre-wrap; overflow-wrap: anywhere; }
.tag.soon { background: var(--warn-soft); color: var(--warn); }
.tag.done { background: #e2f1e6; color: var(--accent); }
.entries .controls { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.entries .controls select { width: auto; padding: 5px 8px; font-size: .85rem; }
.entries .edit-row { grid-column: 1 / -1; }
.entries .edit-row label { margin-top: 8px; }
.entries .edit-row textarea { min-height: 70px; }
.entries .edit-row .buttons { display: flex; gap: 8px; margin-top: 10px; }
.tag { display: inline-block; background: var(--accent-soft); border-radius: 999px; padding: 2px 8px; margin: 4px 6px 0 0; font-size: .78rem; }
.tag.late { background: var(--danger-soft); color: var(--danger); }
#action-form { display: grid; grid-template-columns: 1fr 110px 150px 160px auto; gap: 8px; margin-top: 12px; }
#question-form { display: grid; grid-template-columns: 1fr 200px auto; gap: 8px; margin-top: 12px; }
.section-message { min-height: 20px; margin: 8px 0 0; }
.back { display: none; margin-bottom: 8px; }

/* Daily / general notes: a plain checklist, independent of work items. */
.notes-wrap { flex: 1; overflow-y: auto; min-height: 0; padding: 24px 20px 48px; }
.notes-card { max-width: 760px; margin: 0 auto; background: white; border: 1px solid var(--line); border-radius: 14px; padding: 20px 24px; }
.notes-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.notes-head h2 { margin: 0; font-size: 1.3rem; flex: 1; }
.day-nav { display: flex; gap: 6px; align-items: center; }
.day-nav input { width: auto; padding: 6px 8px; }
.day-nav .ghost { font-size: 1.3rem; line-height: 1; padding: 4px 10px; }
.notes-sub { display: flex; gap: 12px; justify-content: space-between; color: var(--muted); margin: 8px 0 12px; }
.notes-list li { display: flex; gap: 12px; align-items: flex-start; padding: 8px 4px; border-bottom: 1px solid #eef2ef; }
.notes-list input[type="checkbox"] { width: 20px; height: 20px; margin: 3px 0 0; accent-color: #1f9d55; flex: none; cursor: pointer; }
.note-text { flex: 1; cursor: text; white-space: pre-wrap; overflow-wrap: anywhere; padding: 2px 6px; border-radius: 6px; line-height: 1.5; }
.note-text:hover { background: #f3f7f4; }
.notes-list li.done .note-text { color: var(--muted); text-decoration: line-through; }
.note-edit { flex: 1; padding: 4px 6px; }
.note-delete { opacity: .45; padding: 2px 10px; font-size: 1.1rem; }
.notes-list li:hover .note-delete, .note-delete:focus { opacity: 1; }
#note-form { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 12px; }
.done-count { color: #1f7a45; font-weight: 600; }
.board-wrap { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.summary { display: flex; gap: 12px; padding: 16px 20px 4px; flex-wrap: wrap; }
.stat { background: white; border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; min-width: 140px; }
.stat strong { display: block; font-size: 1.5rem; }
.stat span { color: var(--muted); font-size: .85rem; }
.stat.alert strong { color: var(--danger); }
#board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(170px, 1fr); gap: 10px; padding: 12px 20px 20px; overflow-x: auto; flex: 1; min-height: 0; }
.column { background: #e9efeb; border-radius: 12px; padding: 10px; display: flex; flex-direction: column; min-height: 0; }
.column h3 { font-size: .9rem; margin: 2px 4px 10px; display: flex; justify-content: space-between; }
.column ul { overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.card { display: block; width: 100%; text-align: left; background: white; color: inherit; font-weight: 400; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.card:hover { background: white; border-color: var(--accent); }
.card .item-title { font-size: .95rem; }

@media (max-width: 800px) {
  body { height: auto; }
  #quick-form { flex-wrap: wrap; flex-basis: 100%; }
  #quick-form input[name="title"] { flex: 1 1 100%; }
  #quick-form select, #quick-form input[name="redmineNumber"] { flex: 1 1 0; }
  .view-switch { flex: 1 1 100%; }
  .view-switch button { flex: 1; padding: 6px 4px; }
  .notes-card { padding: 16px; }
  #search { flex: 1 1 100%; }
  .layout { grid-template-columns: 1fr; }
  .list-pane { border-right: 0; }
  .layout.show-detail .list-pane, .layout:not(.show-detail) .detail-pane { display: none; }
  #detail { padding: 16px; }
  .back { display: inline-block; }
  .row { grid-template-columns: 1fr; }
  #action-form { grid-template-columns: 1fr 1fr 1fr; }
  #question-form { grid-template-columns: 1fr auto; }
  #question-form input[name="questionText"] { grid-column: 1 / -1; }
  #action-form input[name="title"] { grid-column: 1 / -1; }
  #board { grid-auto-flow: row; grid-auto-columns: auto; overflow-x: visible; }
}

/* ---- Login and setup pages ---- */
.auth-page { display: grid; place-items: center; min-height: 100vh; height: auto; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 420px; background: white; border: 1px solid var(--line); border-radius: 16px; padding: 28px 28px 24px; box-shadow: 0 8px 30px #1e38231a; }
.auth-card h1 { font-size: 1.4rem; margin: 10px 0 4px; }
.auth-card form > button[type="submit"] { width: 100%; margin-top: 18px; padding: 11px; }
.auth-logo { display: block; }
.password-field { display: flex; gap: 6px; }
.password-field input { flex: 1; min-width: 0; }
.password-field .ghost { flex: none; }
label.check { display: flex; gap: 8px; align-items: center; font-weight: 500; color: inherit; margin-top: 14px; cursor: pointer; }
label.check input { width: auto; margin: 0; }
.auth-message { min-height: 22px; margin: 12px 0 0; }
.auth-message.error { color: var(--danger); }
.auth-message.ok { color: #1f7a45; }
.auth-foot { margin: 16px 0 0; font-size: .9rem; }
.small { font-size: .82rem; margin: 6px 0 0; }
.strength { height: 6px; background: #eef0ef; border-radius: 999px; margin-top: 8px; overflow: hidden; }
.strength span { display: block; height: 100%; width: 0; background: var(--danger); transition: width .2s; }
.strength span[data-level="weak"] { width: 25%; }
.strength span[data-level="ok"] { width: 55%; background: #e08a00; }
.strength span[data-level="good"] { width: 80%; background: #3c9a5f; }
.strength span[data-level="strong"] { width: 100%; background: #1f7a45; }

/* ---- Signed-in user menu and password dialog ---- */
.user-menu { position: relative; margin-left: auto; }
.user-menu > summary { list-style: none; cursor: pointer; padding: 6px 10px; border-radius: 8px; font-weight: 600; color: var(--accent); white-space: nowrap; }
.user-menu > summary::-webkit-details-marker { display: none; }
.user-menu > summary:hover { background: var(--accent-soft); }
.user-menu-panel { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; display: flex; flex-direction: column; align-items: stretch; min-width: 220px;
  padding: 10px; background: white; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 24px #1e38231f; }
.user-menu-panel .ghost { text-align: left; }
.user-menu-panel .small { margin: 0 8px 6px; overflow-wrap: anywhere; }
.user-menu .user-name { display: inline-block; max-width: 140px; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }
dialog { border: 1px solid var(--line); border-radius: 14px; padding: 20px 24px; width: min(420px, calc(100vw - 32px)); }
dialog::backdrop { background: #1a2b2766; }
dialog h2 { margin: 0 0 8px; font-size: 1.2rem; }
dialog .buttons { display: flex; gap: 8px; margin-top: 16px; }

/* ---- Attachments ---- */
.attachments { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.attachments:empty { display: none; }
.attachment { position: relative; display: inline-flex; align-items: center; }
.attachment .thumb { display: block; width: 72px; height: 72px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background: #f3f6f4; }
.file-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 260px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: #f8faf9; color: inherit; text-decoration: none; font-size: .85rem; }
.file-chip:hover { border-color: var(--accent); }
.file-chip .file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-chip .file-size { color: var(--muted); white-space: nowrap; }
.attachment .remove-file { position: absolute; top: -8px; right: -8px; width: 22px; height: 22px; padding: 0; border-radius: 999px; font-size: .85rem; line-height: 1;
  background: white; color: var(--muted); border: 1px solid var(--line); opacity: 0; }
.attachment:hover .remove-file, .attachment .remove-file:focus { opacity: 1; }
@media (hover: none) { .attachment .remove-file { opacity: 1; } }
.attach-button { padding: 6px 8px; }
.attach-button .count { font-size: .75rem; margin-left: 2px; }
#item-files .attachments { margin: 10px 0; }
.note-body { flex: 1; min-width: 0; }
.note-body .note-text { display: block; }
.file-button { display: inline-flex; align-items: center; gap: 6px; margin: 4px 0 0; padding: 9px 14px; border-radius: 8px; font-weight: 650; font-size: .95rem; cursor: pointer; }
