/* Architects PM tool — base styles. No build step, no external fonts. */

:root {
  --bg: #f5f3ee;
  --surface: #ffffff;
  --surface-2: #faf8f4;
  --border: #e3dfd5;
  --text: #1d1d1b;
  --muted: #6b6a64;
  --accent: #1f4e46;
  --accent-ink: #ffffff;
  --accent-soft: #e4eeeb;
  --danger: #b42318;
  --danger-soft: #fdeceb;
  --ok-soft: #e6f3ec;
  --shadow: 0 1px 2px rgba(20, 20, 18, .06), 0 4px 14px rgba(20, 20, 18, .05);
  --radius: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161614;
    --surface: #1f1f1c;
    --surface-2: #252522;
    --border: #36352f;
    --text: #efede6;
    --muted: #a09e94;
    --accent: #6fb3a5;
    --accent-ink: #0f1f1c;
    --accent-soft: #1e302c;
    --danger: #f08a80;
    --danger-soft: #3a1f1c;
    --ok-soft: #1c2f25;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
}
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .4em; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .8em; }
code { background: var(--surface-2); border: 1px solid var(--border); padding: 0 .3em; border-radius: 4px; font-size: .9em; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.2rem 0; }
[hidden] { display: none !important; }

.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* ----- layout ----- */
.topbar {
  display: flex; align-items: center; gap: 1.5rem;
  padding: .7rem 1rem; background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.brand { font-weight: 700; text-decoration: none; color: var(--text); letter-spacing: -.01em; }
.topnav { display: flex; gap: 1rem; flex: 1; }
.topnav a { text-decoration: none; color: var(--muted); }
.topnav a:hover { color: var(--text); }
.topbar-right { display: flex; align-items: center; gap: .75rem; }
.topbar-right form { margin: 0; }
.who { color: var(--text); text-decoration: none; font-size: .9rem; }

.page { max-width: 1200px; margin: 0 auto; padding: 1.5rem 1rem 4rem; }
body.auth .page { display: grid; place-items: center; min-height: 100vh; padding-top: 0; }
/* Project board page uses the full browser width, so more columns fit without scrolling. */
body.wide .page { max-width: none; padding-left: 1.5rem; padding-right: 1.5rem; }
/* Honeypot field on the registration form: invisible to people, tempting to bots. */
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.switch-link { margin: 1rem 0 0; text-align: center; }

.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.page-actions { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.crumbs { margin-bottom: .75rem; font-size: .9rem; }
.crumbs a { text-decoration: none; }
.section { margin-bottom: 2.25rem; }
.section > h2 { margin-bottom: .1em; }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1.25rem;
  box-shadow: var(--shadow);
}
.card.narrow { max-width: 440px; width: 100%; }

/* ----- forms and buttons ----- */
.form { display: flex; flex-direction: column; gap: .9rem; }
.form-row { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; }
.form-row .grow { flex: 1; min-width: 180px; }
label { display: flex; flex-direction: column; gap: .3rem; font-size: .9rem; font-weight: 550; }
label.check { flex-direction: row; align-items: center; gap: .45rem; font-weight: 500; }
input, textarea, select {
  font: inherit; color: inherit; background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; padding: .55rem .65rem; width: 100%;
}
input[type="checkbox"], input[type="radio"] { width: auto; }
textarea { resize: vertical; }
input:focus-visible, textarea:focus-visible, select:focus-visible, .btn:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
fieldset.choice { border: 1px solid var(--border); border-radius: 8px; padding: .6rem .8rem .8rem; margin: 0; }
fieldset.choice legend { font-size: .9rem; font-weight: 550; padding: 0 .3rem; }
label.radio { flex-direction: row; align-items: flex-start; gap: .6rem; font-weight: 400; padding: .3rem 0; }
label.radio span { display: flex; flex-direction: column; }
label.radio small { color: var(--muted); }
.field-error { color: var(--danger); font-size: .82rem; min-height: 0; font-weight: 500; }

.btn {
  font: inherit; font-weight: 550; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  padding: .5rem .9rem; border-radius: 8px; text-decoration: none; display: inline-block;
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .6; cursor: default; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent); filter: brightness(1.1); }
.btn-danger { color: var(--danger); border-color: var(--danger); background: transparent; }
.btn-danger:hover { background: var(--danger-soft); }
.btn-quiet { border-color: transparent; background: transparent; color: var(--muted); }
.btn-small { padding: .25rem .6rem; font-size: .85rem; }

.notice { padding: .65rem .85rem; border-radius: 8px; margin-bottom: 1rem; font-size: .92rem; }
.notice-error { background: var(--danger-soft); color: var(--danger); }
.notice-ok { background: var(--ok-soft); color: var(--accent); }

/* ----- tables ----- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { text-align: left; padding: .6rem .5rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { color: var(--muted); font-weight: 550; font-size: .82rem; }
.table tr.is-inactive td { color: var(--muted); }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.inline-form { display: flex; gap: .4rem; margin: 0; }
.inline-form input { width: 9rem; padding: .25rem .5rem; }

/* ----- project cards ----- */
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; margin-top: .9rem; }
.project-card {
  display: flex; flex-direction: column; gap: .35rem; padding: 1rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  text-decoration: none; color: inherit; box-shadow: var(--shadow);
  transition: border-color .12s, transform .12s;
}
.project-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.project-card.is-archived { opacity: .7; }
.project-card-head { display: flex; justify-content: space-between; gap: .5rem; align-items: flex-start; }
.project-name { margin: 0; overflow-wrap: anywhere; }
.project-desc { margin: 0; color: var(--muted); font-size: .9rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.project-owner { margin: 0; font-size: .82rem; color: var(--accent); }
.project-meta { margin: 0; font-size: .82rem; color: var(--muted); }
.progress { height: 5px; background: var(--border); border-radius: 99px; overflow: hidden; margin-top: .4rem; }
.progress-bar { display: block; height: 100%; background: var(--accent); }
.empty { color: var(--muted); padding: .5rem 0; margin: 0; grid-column: 1 / -1; }

.badges { display: flex; gap: .4rem; flex-wrap: wrap; margin: .3rem 0 0; }
.badge { font-size: .75rem; font-weight: 600; padding: .1rem .5rem; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); white-space: nowrap; }
.badge-public { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.badge-soft { font-weight: 500; }

/* ----- board ----- */
.board { display: flex; gap: 1rem; overflow-x: auto; padding-bottom: .75rem; align-items: flex-start; }
.column { flex: 1 1 260px; min-width: 240px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: .75rem; }
.column-head { display: flex; align-items: center; gap: .5rem; margin-bottom: .6rem; }
.column-head h3 { margin: 0; flex: 1; font-size: .95rem; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.count { font-size: .8rem; color: var(--muted); }
.column-body { display: flex; flex-direction: column; gap: .5rem; min-height: 3rem; }

/* ----- dialogs ----- */
.dialog { border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; width: min(480px, calc(100vw - 2rem)); background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
.dialog::backdrop { background: rgba(20, 20, 18, .45); }
.dialog-actions { display: flex; justify-content: flex-end; gap: .6rem; margin-top: .5rem; }
.danger-zone h3 { color: var(--danger); }
.danger-actions { display: flex; gap: .6rem; flex-wrap: wrap; margin-bottom: .5rem; }
.member-list { list-style: none; padding: 0; margin: 0 0 1rem; display: flex; flex-direction: column; gap: .4rem; }
.member { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .4rem .6rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; }

/* ----- toasts ----- */
.toasts { position: fixed; right: 1rem; bottom: 1rem; display: flex; flex-direction: column; gap: .5rem; z-index: 50; }
.toast { background: var(--text); color: var(--bg); padding: .6rem .9rem; border-radius: 8px; box-shadow: var(--shadow); max-width: 320px; font-size: .92rem; }
.toast-error { background: var(--danger); color: #fff; }

/* ----- small screens ----- */
@media (max-width: 640px) {
  .topbar { gap: .75rem; flex-wrap: wrap; }
  .topnav { order: 3; flex-basis: 100%; }
  .topbar-right { margin-left: auto; }
  .page { padding-top: 1rem; }
  .column { flex: 0 0 85vw; min-width: 0; }
  body.wide .page { padding-left: .75rem; padding-right: .75rem; }
  .dialog { padding: 1rem; }
}

/* ----- task cards ----- */
.column-head .badge { font-size: .68rem; padding: 0 .4rem; }
.column-body { min-height: 3.5rem; }
.column-body > .empty { padding: .6rem .25rem; text-align: center; border: 1px dashed var(--border); border-radius: 8px; }
.task-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  padding: .6rem .7rem; cursor: grab; display: flex; flex-direction: column; gap: .4rem;
  box-shadow: var(--shadow);
}
.task-card:hover { border-color: var(--accent); }
.task-card:active { cursor: grabbing; }
.task-title { font-weight: 550; overflow-wrap: anywhere; }
.drag-ghost { opacity: .4; }
.chips { display: flex; flex-wrap: wrap; gap: .3rem; }
.chip { font-size: .72rem; font-weight: 600; padding: .05rem .45rem; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); }
.chip-p1 { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.chip-p3 { opacity: .8; }
.chip-overdue { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.mini-subtasks { list-style: none; margin: 0; padding: .35rem 0 0; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: .2rem; font-size: .8rem; }
.mini-subtasks li { display: flex; align-items: center; gap: .4rem; min-width: 0; }
.mini-subtasks .dot { width: 8px; height: 8px; flex: none; }
.mini-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-status { color: var(--muted); font-size: .72rem; white-space: nowrap; }
.mini-subtasks li.is-done .mini-title { text-decoration: line-through; color: var(--muted); }
.mini-subtasks li.more { color: var(--muted); padding-left: 1rem; }

.add-task-btn { margin-top: .5rem; width: 100%; text-align: left; background: transparent; border: 0; color: var(--muted); font: inherit; padding: .4rem .3rem; border-radius: 6px; cursor: pointer; }
.add-task-btn:hover { background: var(--surface); color: var(--text); }
.add-form { margin-top: .5rem; display: flex; flex-direction: column; gap: .4rem; }
.add-actions { display: flex; gap: .4rem; }

/* ----- task dialog, subtasks ----- */
.dialog-wide { width: min(640px, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); overflow-y: auto; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; }
.dialog-head h2 { margin: 0; }
.dialog-actions.split { align-items: center; }
.spacer { flex: 1; }
.subtasks-head { display: flex; justify-content: space-between; align-items: baseline; }
.subtask-list { list-style: none; margin: .5rem 0 .75rem; padding: 0; display: flex; flex-direction: column; gap: .4rem; }
.subtask { display: grid; grid-template-columns: 1fr auto auto; gap: .4rem; align-items: center; }
.subtask .sub-title { padding: .35rem .5rem; }
.subtask .sub-title.is-done { text-decoration: line-through; color: var(--muted); }
.subtask .sub-status { width: auto; min-width: 9rem; padding: .35rem .5rem; }
.subtask-add { display: grid; grid-template-columns: 1fr auto auto; gap: .4rem; }

/* ----- status editor ----- */
.status-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.status-row { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.status-row input[type="text"] { flex: 1; min-width: 8rem; }
.status-row .check { white-space: nowrap; }
.status-confirm { flex-direction: column; align-items: stretch; background: var(--danger-soft); border-radius: 8px; padding: .6rem .75rem; }
.status-confirm p { margin: 0; }
.status-confirm-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.status-confirm-actions select { width: auto; flex: 1; min-width: 8rem; }
.status-add { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-top: .5rem; padding-top: .75rem; border-top: 1px solid var(--border); }
.status-add input[name="name"] { flex: 1; min-width: 8rem; }
.color-input { width: 2.4rem; height: 2.2rem; padding: .15rem; flex: none; cursor: pointer; }

@media (max-width: 640px) {
  .subtask { grid-template-columns: 1fr auto; }
  .subtask .sub-status { grid-column: 1; }
  .subtask-add { grid-template-columns: 1fr; }
}

/* Projects view full-screen */
.page:has(#project-root) {
  max-width: none;
  width: 90%;
}
