/* =========================================================
   Mia Projects — app styles
   Brand palette from the shared Mia design system (public.css in Mia Invest,
   Mia Accounting and Mia Documents):
     #dd7904  primary (burnt orange)   #c46412 deep   #f7931e bright
     #333333  ink (charcoal)           #faf8f5 page
     #118ed4 blue, #63ad71 green, #c13936 red, #f5bb3b amber: status accents only
   Statuses never use the brand orange: a task's state must not read as a
   brand accent.
   ========================================================= */

:root {
  --mb-primary: #dd7904;
  --mb-primary-deep: #c46412;
  --mb-primary-bright: #f7931e;
  --mb-amber: #f5bb3b;
  --mb-ink: #333333;
  --mb-page: #faf8f5;
  --mb-surface: #ffffff;
  --mb-sunk: #f3efe9;
  --mb-muted: #6b6b6b;
  --mb-line: #ececec;
  --mb-line-strong: #d8d8d8;
  --mb-link: #c46412;
  --mb-link-hover: #dd7904;
  --mb-chrome: #212529;          /* the signed-in navbar every Mia app uses */
  --mb-focus: rgba(247, 147, 30, 0.35);

  --mb-danger: #8e2825;
  --mb-danger-soft: rgba(193, 57, 54, 0.08);
  --mb-danger-line: rgba(193, 57, 54, 0.25);
  --mb-ok-soft: rgba(99, 173, 113, 0.14);
  --mb-ok-line: rgba(99, 173, 113, 0.35);

  --st-todo: #8a8a8a;
  --st-doing: #118ed4;
  --st-blocked: #e0a21f;
  --st-done: #63ad71;
  --st-dropped: #b0b0b0;

  --radius: 8px;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}

/* Dark: the same shades Mia Invest uses. The brand orange moves to its bright
   variant, because the deep one dies on a dark ground. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --mb-ink: #e6e8ea; --mb-page: #15181c; --mb-surface: #1d2126; --mb-sunk: #181b20;
    --mb-muted: #9aa2ab; --mb-line: #2b3036; --mb-line-strong: #3a4149;
    --mb-link: #f7a53a; --mb-link-hover: #ffbe63;
    --mb-danger: #f07b78; --mb-danger-soft: rgba(240, 123, 120, 0.10); --mb-danger-line: rgba(240, 123, 120, 0.3);
    --mb-ok-soft: rgba(76, 195, 138, 0.12); --mb-ok-line: rgba(76, 195, 138, 0.3);
    --st-todo: #9aa2ab; --st-doing: #4aa8e6; --st-blocked: #f5bb3b; --st-done: #6fc27e; --st-dropped: #5d656e;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --mb-ink: #e6e8ea; --mb-page: #15181c; --mb-surface: #1d2126; --mb-sunk: #181b20;
  --mb-muted: #9aa2ab; --mb-line: #2b3036; --mb-line-strong: #3a4149;
  --mb-link: #f7a53a; --mb-link-hover: #ffbe63;
  --mb-danger: #f07b78; --mb-danger-soft: rgba(240, 123, 120, 0.10); --mb-danger-line: rgba(240, 123, 120, 0.3);
  --mb-ok-soft: rgba(76, 195, 138, 0.12); --mb-ok-line: rgba(76, 195, 138, 0.3);
  --st-todo: #9aa2ab; --st-doing: #4aa8e6; --st-blocked: #f5bb3b; --st-done: #6fc27e; --st-dropped: #5d656e;
  color-scheme: dark;
}

* { box-sizing: border-box; }
/* Components set display, which would otherwise override the hidden attribute. */
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--mb-page); color: var(--mb-ink);
  font: 15px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -0.015em; text-wrap: balance; }
h1 { font-size: 22px; font-weight: 700; }
h2 { font-size: 17px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 600; }
a { color: var(--mb-link); }
a:hover { color: var(--mb-link-hover); }
.mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--mb-muted); }
.label {
  display: block; font-size: 12px; font-weight: 600; letter-spacing: .01em;
  color: var(--mb-ink); margin-bottom: 5px;
}

/* ---- brand lockup: Mia mark + "mia projects" ---- */
.mia-logo { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; color: inherit; }
.mia-logo img { height: 26px; width: auto; display: block; }
.mia-logo-word { font-size: 19px; letter-spacing: 0.01em; white-space: nowrap; }
.mia-logo-bold { font-weight: 700; }
.mia-logo-light { font-weight: 400; opacity: 0.8; }
.mia-logo .on-light { display: block; }
.mia-logo .on-dark { display: none; }
.bar .mia-logo .on-light { display: none; }
.bar .mia-logo .on-dark { display: block; }

/* ---- top bar (charcoal, as in every signed-in Mia app) ---- */
.bar {
  background: var(--mb-chrome); color: #fff;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 20px 10px;
  display: flex; align-items: center; gap: 22px; flex-wrap: wrap;
}
.bar nav { display: flex; gap: 2px; }
.bar nav a {
  color: rgba(255, 255, 255, 0.72); text-decoration: none; padding: 6px 10px;
  font-weight: 500; font-size: 14px; border-radius: 6px;
}
.bar nav a:hover { color: #fff; }
.bar nav a[aria-current="page"] { color: var(--mb-primary-bright); }
.bar .who { margin-left: auto; display: flex; gap: 12px; align-items: center; font-size: 14px; color: rgba(255, 255, 255, 0.78); }
.bar .who button { background: none; border-color: rgba(255, 255, 255, 0.28); color: #fff; }
.bar .who button:hover { border-color: #fff; }
/* ---- Icon button on the charcoal bar (theme toggle), as in Mia Tools ---- */
.bar .who .mia-icon-btn {
  width: 34px; height: 34px;
  display: inline-grid; place-items: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: rgba(255, 255, 255, 0.78);
  cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.bar .who .mia-icon-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.14);
}
.mia-icon-btn svg {
  width: 18px; height: 18px;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
:root[data-theme="dark"] .ico-moon,
:root:not([data-theme="dark"]) .ico-sun { display: none; }
.project-picks { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.project-picks .check { padding: 4px 0; }
.person-row .who { flex: 1 1 200px; }
.person-row .project-picks { flex: 2 1 320px; }

main { padding-inline: 20px; padding-block: 22px 56px; max-width: 1400px; margin: 0 auto; }
main.narrow { max-width: 900px; }

/* ---- controls ---- */
input, select, textarea, button { font: inherit; color: inherit; }
input, select, textarea {
  width: 100%; background: var(--mb-surface); border: 1px solid var(--mb-line-strong);
  border-radius: var(--radius); padding: 8px 12px; font-size: 14px;
  transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 96px; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--mb-primary); box-shadow: 0 0 0 3px var(--mb-focus);
}
button:focus-visible, a:focus-visible, summary:focus-visible {
  outline: none; box-shadow: 0 0 0 3px var(--mb-focus);
}
button {
  border: 1px solid var(--mb-line-strong); background: var(--mb-surface); border-radius: var(--radius);
  padding: 8px 16px; cursor: pointer; font-weight: 600; font-size: 14px; white-space: nowrap;
}
button:hover { border-color: var(--mb-muted); }
button.primary { background: var(--mb-primary); border-color: var(--mb-primary); color: #fff; }
button.primary:hover { background: var(--mb-primary-deep); border-color: var(--mb-primary-deep); }
button.primary:active { transform: translateY(1px); }
button.danger { color: var(--mb-danger); }
button.link { border: 0; background: none; padding: 2px 4px; color: var(--mb-link); font-weight: 600; }
button.link:hover { color: var(--mb-link-hover); text-decoration: underline; }
button.link.danger { color: var(--mb-danger); }
button[disabled] { opacity: .55; cursor: default; }
.field { display: flex; flex-direction: column; min-width: 0; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; }
.row > .field { flex: 1 1 160px; }
.check { display: inline-flex; gap: 7px; align-items: center; font-size: 14px; cursor: pointer; }
.check input { width: auto; accent-color: var(--mb-primary); }

/* ---- messages ---- */
.banner {
  border-radius: var(--radius); padding: 10px 14px; margin-bottom: 16px; font-size: 14px;
  background: var(--mb-danger-soft); border: 1px solid var(--mb-danger-line); color: var(--mb-danger);
  display: flex; gap: 12px; align-items: center;
}
.banner.ok { background: var(--mb-ok-soft); border-color: var(--mb-ok-line); color: var(--mb-ink); }
.banner button { margin-left: auto; }

/* ---- status ---- */
.pill {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600;
  padding: 2px 10px 2px 8px; border-radius: 999px; white-space: nowrap;
  background: var(--mb-surface); border: 1px solid var(--mb-line-strong);
}
.pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--st, var(--st-todo)); }
[data-status="todo"] { --st: var(--st-todo); }
[data-status="doing"] { --st: var(--st-doing); }
[data-status="blocked"] { --st: var(--st-blocked); }
[data-status="done"] { --st: var(--st-done); }
[data-status="dropped"] { --st: var(--st-dropped); }

/* ---- board ---- */
.page-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin-bottom: 20px;
  background: var(--mb-surface); border: 1px solid var(--mb-line); border-radius: 12px; padding: 14px;
}
.toolbar .field { flex: 0 1 200px; }
.toolbar .grow { flex: 1 1 220px; }
.toolbar .push { margin-left: auto; }

.board { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); align-items: start; }
.lane { background: var(--mb-sunk); border: 1px solid var(--mb-line); border-radius: 12px; padding: 10px; min-width: 0; }
.lane > header { display: flex; align-items: center; gap: 8px; padding: 2px 2px 10px; }
.lane > header .count { font-family: var(--mono); color: var(--mb-muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.lane .cards { display: flex; flex-direction: column; gap: 8px; }
.lane .empty { color: var(--mb-muted); font-size: 13px; padding: 2px 4px 6px; }

.card {
  display: block; width: 100%; text-align: left; font-weight: 400; white-space: normal;
  background: var(--mb-surface); border: 1px solid var(--mb-line); border-left: 3px solid var(--st);
  border-radius: var(--radius); padding: 10px 12px; cursor: pointer;
  transition: box-shadow .15s, border-color .15s;
}
.card:hover { border-color: var(--mb-primary-bright); border-left-color: var(--st); box-shadow: 0 6px 20px rgba(51, 51, 51, 0.06); }
.card .title { font-weight: 600; overflow-wrap: anywhere; }
.card .meta { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 6px; font-size: 12.5px; color: var(--mb-muted); }
.card .reason { margin-top: 7px; font-size: 13px; color: var(--mb-ink); background: var(--mb-sunk); border-radius: 6px; padding: 5px 8px; }
.overdue { color: var(--mb-danger); font-weight: 600; }

/* ---- meetings ---- */
.meeting-list { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.meeting-card {
  display: flex; flex-direction: column; gap: 4px; align-items: flex-start; text-align: left;
  background: var(--mb-surface); border: 1px solid var(--mb-line); border-radius: 12px;
  padding: 14px 16px; cursor: pointer; font-weight: 400; white-space: normal;
}
.meeting-card:hover { border-color: var(--mb-primary-bright); box-shadow: 0 6px 20px rgba(51, 51, 51, 0.06); }
.meeting-card .when { color: var(--mb-muted); }
.meeting-card .title { font-weight: 700; font-size: 16px; overflow-wrap: anywhere; }
.meeting-card .meta { color: var(--mb-muted); font-size: 13px; }

.meeting-notes { white-space: pre-wrap; color: var(--mb-muted); margin: 0 0 18px; max-width: 70ch; }

.agenda { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; counter-reset: agenda; }
.agenda-item {
  background: var(--mb-surface); border: 1px solid var(--mb-line); border-radius: 12px; padding: 14px 16px;
}
.agenda-item.is-discussed { background: var(--mb-sunk); }
.agenda-item.is-discussed .agenda-head h3 { color: var(--mb-muted); }
.agenda-head { display: flex; align-items: baseline; gap: 10px; }
.agenda-head h3 { flex: 1; overflow-wrap: anywhere; counter-increment: agenda; }
.agenda-head h3::before { content: counter(agenda) ". "; color: var(--mb-muted); font-weight: 400; }
.agenda-actions { display: flex; gap: 4px; }
.agenda-item .carried { font-size: 12.5px; margin: 4px 0 0; }
.agenda-item .detail { white-space: pre-wrap; margin: 8px 0 0; max-width: 70ch; }

.item-tasks, .comments { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.item-tasks li { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; font-size: 14px; }
.comments li {
  border-left: 3px solid var(--mb-line-strong); padding: 2px 0 2px 10px;
  display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline;
}
.comments .who { font-weight: 600; font-size: 13.5px; }
.comments p { margin: 2px 0 0; flex-basis: 100%; white-space: pre-wrap; overflow-wrap: anywhere; }

.item-add { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; align-items: center; }
.item-add form { display: flex; gap: 8px; flex: 1 1 260px; }
.item-edit { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.minutes { width: 100%; min-height: 220px; font-family: var(--mono); font-size: 12.5px; margin-bottom: 18px; }

.from-meeting { color: var(--mb-muted); }

/* ---- dialog ---- */
dialog {
  border: 1px solid var(--mb-line); border-radius: 14px; padding: 0; width: min(640px, calc(100vw - 32px));
  background: var(--mb-surface); color: var(--mb-ink); box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
}
dialog::backdrop { background: rgba(33, 37, 41, .5); }
dialog form { padding: 22px; display: flex; flex-direction: column; gap: 14px; }
dialog header { display: flex; align-items: baseline; gap: 10px; }
dialog footer { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 4px; }
dialog footer .push { margin-left: auto; }
.links { display: flex; flex-direction: column; gap: 6px; }
.links ul { margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.links li { display: flex; gap: 8px; align-items: baseline; list-style: none; overflow-wrap: anywhere; }

/* ---- admin ---- */
section.block {
  background: var(--mb-surface); border: 1px solid var(--mb-line); border-radius: 12px;
  padding: 20px; margin-bottom: 20px; display: flex; flex-direction: column; gap: 14px;
}
section.block > header { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.list { border-top: 1px solid var(--mb-line); }
.list > div { border-bottom: 1px solid var(--mb-line); padding: 10px 0; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.list .who { flex: 1 1 220px; min-width: 0; overflow-wrap: anywhere; }
details.project { border: 1px solid var(--mb-line); border-radius: var(--radius); }
details.project + details.project { margin-top: 8px; }
details.project[open] { border-color: var(--mb-line-strong); }
details.project > summary { padding: 11px 14px; cursor: pointer; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
details.project > div { padding: 4px 14px 16px; display: flex; flex-direction: column; gap: 14px; }
.linkbox {
  background: rgba(247, 147, 30, 0.08); border: 1px solid rgba(247, 147, 30, 0.25);
  border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; gap: 8px;
}
.linkbox input { font-family: var(--mono); font-size: 12.5px; }

/* ---- sign-in pages (the shared Mia auth card) ---- */
.entry {
  min-height: 100vh; display: grid; place-items: center; padding: 40px 16px;
  background: radial-gradient(ellipse at top, rgba(247, 147, 30, 0.08), transparent 50%), var(--mb-page);
}
.entry .panel { width: 100%; max-width: 440px; display: flex; flex-direction: column; gap: 22px; align-items: center; }
.entry-brand { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.entry-brand img { width: 230px; max-width: 100%; height: auto; display: block; }
.entry-brand span {
  font-size: 13px; font-weight: 600; letter-spacing: 0.32em; text-transform: uppercase;
  color: var(--mb-muted); padding-left: 0.32em;
}
.entry form {
  width: 100%; background: var(--mb-surface); border: 1px solid var(--mb-line); border-radius: 14px;
  padding: 32px 30px; box-shadow: 0 8px 32px rgba(51, 51, 51, 0.06);
  display: flex; flex-direction: column; gap: 16px;
}
.entry h1 { font-size: 26px; letter-spacing: -0.02em; }
.entry input { padding: 11px 14px; font-size: 15px; }
.entry button.primary { padding: 12px 18px; font-size: 15px; border-radius: 10px; }
.entry .fineprint { margin: 0; font-size: 12.5px; color: var(--mb-muted); }

/* ---- footer: the parent brand ---- */
.site-foot {
  max-width: 1400px; margin: 0 auto; padding-inline: 20px;
  padding-block: 18px calc(24px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--mb-line);
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  color: var(--mb-muted); font-size: 13px;
}
main.narrow + .site-foot { max-width: 900px; }
.site-foot a { display: inline-flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.site-foot img { height: 22px; width: auto; display: block; }

@media (max-width: 520px) {
  .site-foot { padding-inline: 16px; }
  main { padding-inline: 16px; }
  .bar { padding-inline: 16px; }
  .bar .who { margin-left: 0; width: 100%; justify-content: space-between; }
  .entry form { padding: 24px 20px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
