:root {
  --canvas: #f5f7f6;
  --surface: #ffffff;
  --surface-muted: #edf1ef;
  --border: #d8dfdb;
  --text: #172321;
  --muted: #66736f;
  --accent: #087d6b;
  --accent-hover: #056757;
  --orange: #b45d12;
  --red: #b33b3b;
  --blue: #326a8c;
  --shadow: 0 1px 3px rgb(20 35 30 / 10%);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  color: var(--text);
  background: var(--canvas);
}

* { box-sizing: border-box; }

body { margin: 0; min-width: 320px; }

button, input, textarea, select { font: inherit; }

button { cursor: pointer; }

.app-shell { min-height: 100vh; }

.topbar {
  height: 58px;
  padding: 0 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.brand, .login-brand {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  color: inherit;
  text-decoration: none;
  font-weight: 700;
}

.brand-mark {
  width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  background: var(--accent);
  color: #fff;
  border-radius: 6px;
  font-size: 15px;
}

.topbar-actions, .column-actions, .dialog-heading, .dialog-footer {
  display: flex;
  align-items: center;
}

.topbar-actions { gap: 12px; }
.current-user { font-size: 14px; color: var(--muted); }

.planner {
  min-height: calc(100vh - 58px);
  padding: 24px 28px 28px;
}

.planner-toolbar {
  max-width: 1760px;
  margin: 0 auto 18px;
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
}

.board-switcher { display: flex; align-items: center; gap: 4px; }
.board-switcher select { width: min(310px, 58vw); min-height: 38px; padding: 7px 30px 7px 10px; font-size: 21px; font-weight: 700; border-color: transparent; background: transparent; }
.board-switcher select:hover, .board-switcher select:focus { border-color: var(--border); background: var(--surface); }

h1, h2, p { margin: 0; }
h1 { font-size: 24px; font-weight: 700; letter-spacing: 0; }
h2 { font-size: 14px; font-weight: 700; letter-spacing: 0; }

.task-summary { display: inline-block; margin-top: 5px; color: var(--muted); font-size: 13px; }

.primary-button, .quiet-button, .icon-button {
  border: 0;
  border-radius: 6px;
  min-height: 34px;
  transition: background-color 130ms ease, color 130ms ease, border-color 130ms ease;
}

.primary-button {
  padding: 0 14px;
  color: #fff;
  background: var(--accent);
  font-weight: 650;
}

.primary-button:hover { background: var(--accent-hover); }

.quiet-button {
  padding: 0 12px;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--border);
}

.quiet-button:hover { background: var(--surface-muted); }

.icon-button {
  width: 30px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  color: var(--muted);
  background: transparent;
  font-size: 19px;
  line-height: 1;
  text-decoration: none;
}

.icon-button:hover { background: var(--surface-muted); color: var(--text); }

.board {
  max-width: 1760px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(5, minmax(230px, 1fr));
  gap: 14px;
  align-items: start;
  overflow-x: auto;
  padding-bottom: 12px;
}

.board-column {
  min-height: calc(100vh - 152px);
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.column-header {
  height: 46px;
  padding: 0 8px 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}

.column-actions { gap: 4px; }
.column-count { min-width: 22px; font-size: 12px; text-align: center; color: var(--muted); }

.task-list {
  min-height: 90px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.task-list.is-over { background: rgb(8 125 107 / 7%); outline: 2px solid rgb(8 125 107 / 28%); outline-offset: -2px; }

.task-card {
  width: 100%;
  padding: 11px;
  text-align: left;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.task-card:hover { border-color: #adbbb5; }
.task-card.dragging { opacity: .42; }

.task-title {
  overflow-wrap: anywhere;
  font-size: 14px;
  font-weight: 650;
  line-height: 1.35;
}

.task-meta { margin-top: 9px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

.badge, .priority-dot {
  min-height: 20px;
  display: inline-flex;
  align-items: center;
  border-radius: 4px;
  font-size: 11px;
}

.badge { padding: 0 6px; color: #3f504a; background: #e6ede9; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge.due { background: #edf2f5; color: var(--blue); }
.badge.overdue { background: #f9e5e5; color: var(--red); }
.priority-dot { width: 20px; justify-content: center; font-size: 15px; }
.priority-high { color: var(--red); background: #f9e5e5; }
.priority-normal { color: var(--orange); background: #fbefe2; }
.priority-low { color: var(--blue); background: #e8f0f4; }

.empty-column { padding: 18px 8px; text-align: center; color: #83908b; font-size: 12px; }

.task-dialog {
  width: min(680px, calc(100vw - 28px));
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 18px 55px rgb(20 35 30 / 26%);
}

.task-dialog::backdrop { background: rgb(12 26 21 / 40%); }
.settings-dialog { width: min(520px, calc(100vw - 28px)); }
.task-form { padding: 20px; }
.dialog-heading { justify-content: space-between; margin-bottom: 20px; }
.dialog-heading h2 { font-size: 18px; }

label { display: grid; gap: 6px; margin-bottom: 14px; color: #44514c; font-size: 13px; font-weight: 600; }
input, textarea, select {
  width: 100%;
  min-height: 36px;
  padding: 7px 9px;
  color: var(--text);
  border: 1px solid #bbc6c1;
  border-radius: 5px;
  background: #fff;
  outline: none;
}

textarea { resize: vertical; min-height: 94px; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgb(8 125 107 / 14%); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.full-field { grid-column: 1 / -1; }
.dialog-footer { gap: 8px; margin-top: 6px; }
.dialog-spacer { flex: 1; }
.danger-button { color: var(--red); border-color: #e0b1b1; }
.danger-button:hover { background: #f9e5e5; }

.task-discussion { padding: 0 20px 20px; border-top: 1px solid var(--border); }
.discussion-heading { padding: 16px 0 10px; }
.discussion-heading h3 { margin: 0; font-size: 15px; }
.task-attachments-field { margin-bottom: 14px; }
.task-attachments-field label { margin-bottom: 0; }
.comment-actions { display: flex; align-items: center; gap: 8px; }
.comment-actions input { min-width: 0; padding: 5px; font-size: 12px; }
.attachment-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.attachment-link { max-width: 100%; padding: 4px 7px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border: 1px solid var(--border); border-radius: 4px; color: var(--blue); font-size: 12px; text-decoration: none; }
.attachment-link:hover { background: #e8f0f4; }
.comments-list { display: grid; gap: 10px; margin: 12px 0; }
.comment { padding: 10px; border: 1px solid var(--border); border-radius: 5px; background: var(--surface-muted); }
.comment-meta { margin-bottom: 5px; color: var(--muted); font-size: 12px; }
.comment-body { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; line-height: 1.45; }
.comment-form { display: grid; gap: 8px; }
.comment-form textarea { min-height: 72px; }
.comment-actions { justify-content: space-between; }
.badge.comment-unread { color: #fff; background: var(--accent); }

.inline-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; margin-bottom: 16px; }
.settings-list { display: grid; gap: 6px; max-height: 300px; overflow-y: auto; }
.settings-row { min-height: 40px; padding: 4px 4px 4px 10px; display: flex; align-items: center; justify-content: space-between; gap: 10px; border: 1px solid var(--border); border-radius: 5px; background: var(--surface-muted); font-size: 13px; }
.settings-row span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.login-page {
  min-height: 100vh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 28px;
  padding: 24px;
}

.login-brand { font-size: 21px; }
.login-brand div { display: grid; gap: 2px; }
.login-brand span:last-child { color: var(--muted); font-size: 13px; font-weight: 500; }
.login-panel { width: min(390px, calc(100vw - 48px)); padding: 22px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); box-shadow: var(--shadow); }
.login-panel h1 { margin-bottom: 18px; font-size: 19px; }
.notice { margin-bottom: 16px; padding: 10px; border-radius: 5px; font-size: 13px; line-height: 1.45; }
.notice-error { background: #f9e5e5; color: #7c2929; }
code { padding: 1px 4px; border-radius: 3px; background: rgb(0 0 0 / 8%); }

@media (max-width: 760px) {
  .topbar { padding: 0 16px; }
  .current-user { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .planner { padding: 18px 16px; }
  .planner-toolbar { align-items: center; }
  .board { grid-template-columns: repeat(5, minmax(274px, 82vw)); gap: 12px; margin-right: -16px; }
  .board-column { min-height: calc(100vh - 136px); }
  .form-grid { grid-template-columns: 1fr; }
  .full-field { grid-column: auto; }
  .inline-form { grid-template-columns: 1fr; }
  .comment-actions { align-items: stretch; flex-direction: column; }
}
