/* Base + shared components */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  font-size: var(--fs-body);
  line-height: 1.45;
  color: var(--c-ink);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.2; font-weight: 700; letter-spacing: -0.01em; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--c-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 3px solid #84adff; outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Top bar ---------- */
.topbar {
  height: 64px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 var(--s-6); background: var(--c-surface); border-bottom: 1px solid var(--c-line);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: var(--s-3); }
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px; background: var(--grad-hero);
  color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 15px;
}
.brand-name { font-weight: 700; font-size: 16px; line-height: 1.15; }
.brand-sub { font-size: 13px; color: var(--c-muted); }
.topbar-right { display: flex; align-items: center; gap: var(--s-4); }
.topbar-date { color: var(--c-muted); font-size: var(--fs-sm); }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; background: var(--c-primary-soft);
  color: var(--c-primary); display: grid; place-items: center; font-weight: 700; font-size: 14px; flex: none;
}
.user-chip { display: flex; align-items: center; gap: var(--s-2); font-weight: 600; font-size: var(--fs-sm); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: var(--tap); padding: 0 var(--s-5); border-radius: 10px;
  border: 1px solid var(--c-line); background: var(--c-surface); color: var(--c-ink);
  font-weight: 600; font-size: var(--fs-body); cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { background: var(--c-line-2); }
.btn-primary { background: var(--c-primary); border-color: var(--c-primary); color: #fff; }
.btn-primary:hover { background: var(--c-primary-hover); }
.btn-white { background: #fff; border-color: #fff; color: var(--c-primary); }
.btn-white:hover { background: var(--c-primary-soft); }
.btn-outline { border: 2px solid var(--c-primary); color: var(--c-primary); background: #fff; }
.btn-outline:hover { background: var(--c-primary-soft); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--c-muted); }
.btn[disabled] { cursor: default; opacity: 1; }
.btn-done { border: 2px solid var(--c-green); color: var(--c-green-ink); background: var(--c-green-soft); }

/* ---------- Cards ---------- */
.card {
  background: var(--c-surface); border: 1px solid var(--c-line); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-head { display: flex; align-items: center; justify-content: space-between; padding: var(--s-4) var(--s-5); border-bottom: 1px solid var(--c-line-2); }
.card-title { font-size: var(--fs-h); }
.card-sub { color: var(--c-muted); font-size: var(--fs-sm); }

/* ---------- Pills ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: var(--fs-sm); font-weight: 700; white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill-red { background: var(--c-red-soft); color: var(--c-red-ink); }
.pill-amber { background: var(--c-amber-soft); color: var(--c-amber-ink); }
.pill-green { background: var(--c-green-soft); color: var(--c-green-ink); }
.pill-grey { background: var(--c-grey-soft); color: var(--c-grey-ink); }

/* ---------- Progress ---------- */
.bar { height: 8px; background: var(--c-line-2); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 99px; }
.bar-red > i { background: var(--c-red); }
.bar-amber > i { background: var(--c-amber); }
.bar-green > i { background: var(--c-green); }
.bar-grey > i { background: var(--c-grey); }

/* ---------- Toast ---------- */
.toast-wrap { position: fixed; left: 50%; top: 76px; transform: translateX(-50%); z-index: 100; display: grid; gap: 8px; }
.toast {
  background: var(--c-ink); color: #fff; padding: 14px 22px; border-radius: 12px; box-shadow: var(--shadow-lg);
  font-weight: 600; font-size: var(--fs-body); animation: toast-in .2s ease-out;
}
.toast.ok { background: var(--c-green-ink); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Dialog ---------- */
.dialog-backdrop {
  position: fixed; inset: 0; background: rgba(16, 24, 40, .45); display: grid; place-items: center;
  z-index: 50; padding: var(--s-4);
}
.dialog {
  width: min(640px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; overflow: hidden;
  background: var(--c-surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
}
.dialog-head { display: flex; justify-content: space-between; align-items: center; padding: var(--s-5) var(--s-6); border-bottom: 1px solid var(--c-line); }
.dialog-body { padding: var(--s-5) var(--s-6); overflow: auto; flex: 1; min-height: 0; }
.dialog-foot { display: flex; justify-content: space-between; gap: var(--s-3); padding: var(--s-4) var(--s-6); border-top: 1px solid var(--c-line); }
.steps { display: flex; gap: var(--s-2); color: var(--c-muted); font-size: var(--fs-sm); font-weight: 600; }
.steps .on { color: var(--c-primary); }

/* ---------- Form ---------- */
.field { display: grid; gap: var(--s-2); margin-bottom: var(--s-5); }
.field label { font-weight: 700; }
.input, .textarea, .select {
  width: 100%; min-height: var(--tap); padding: 10px 14px; border: 2px solid var(--c-line);
  border-radius: 10px; background: #fff;
}
.input:focus, .textarea:focus, .select:focus { border-color: var(--c-primary); outline: none; }
.textarea { min-height: 120px; resize: vertical; }
.hint { color: var(--c-muted); font-size: var(--fs-sm); }

/* ---------- Demo bar (Phase 1 only) ---------- */
.demo-bar {
  display: flex; align-items: center; gap: var(--s-2);
  background: #fffbeb; border: 1px solid #fde68a; border-radius: 10px; padding: 4px 10px;
  font-size: 13px; color: #78350f;
}
.demo-bar select { font-size: 13px; padding: 2px 6px; border-radius: 6px; border: 1px solid #fcd34d; background: #fff; }
.demo-bar .btn-link { background: none; border: 0; color: #92400e; font-weight: 700; cursor: pointer; text-decoration: underline; font-size: 13px; }

@media (max-width: 760px) {
  .topbar { height: auto; min-height: 60px; flex-wrap: wrap; gap: 8px; padding: 8px 16px; }
  .topbar-right { gap: 8px; flex-wrap: wrap; }
  .user-chip { font-size: 0; gap: 0; }
  .demo-bar { order: 9; flex-basis: 100%; }
  .demo-bar select { max-width: 160px; }
}

/* ---------- Shared page parts ---------- */
.pill-blue { background: var(--c-primary-soft); color: var(--c-primary); }
.prio { font-size: var(--fs-sm); font-weight: 700; padding: 2px 8px; border-radius: 6px; white-space: nowrap; }
.prio-high { background: #fff1f3; color: #c01048; }
.prio-medium { background: #fef6ee; color: #b93815; }
.prio-low { background: var(--c-grey-soft); color: var(--c-grey-ink); }
.badge-chair { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-sm); font-weight: 700; color: #6927da; background: #f4f3ff; padding: 2px 8px; border-radius: 6px; white-space: nowrap; }

.page { max-width: 1320px; margin: 0 auto; padding: 18px 24px 40px; display: grid; gap: 18px; }
.back-link { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: var(--fs-body); color: var(--c-primary); min-height: var(--tap); }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-title { font-size: var(--fs-title); }
.page-sub { color: var(--c-muted); font-size: var(--fs-body); margin-top: 4px; }

.section-title { font-size: var(--fs-h); margin-bottom: 12px; display: flex; align-items: baseline; gap: 10px; }
.section-title small { font-size: var(--fs-sm); color: var(--c-muted); font-weight: 600; }

.att-link { color: var(--c-ink); display: block; }
.att-link:hover { color: var(--c-primary); }

/* Plans */
.plans-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.plan-card { background: var(--c-surface); border: 1px solid var(--c-line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); display: grid; gap: 6px; }
.plan-top { display: flex; justify-content: space-between; gap: 8px; font-size: var(--fs-sm); }
.plan-horizon { font-weight: 700; color: var(--c-primary); }
.plan-dates { color: var(--c-muted); }
.plan-title { font-weight: 700; font-size: calc(var(--fs-body) + 1px); }
.plan-meta { color: var(--c-muted); font-size: var(--fs-sm); }
.plan-progress { display: grid; gap: 6px; margin-top: 6px; font-size: var(--fs-sm); color: var(--c-ink-2); }

/* Task rows */
.task-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 12px 20px; border-bottom: 1px solid var(--c-line-2); }
.task-row:last-child { border-bottom: 0; }
.task-main { min-width: 0; }
.task-title { font-weight: 700; color: var(--c-ink); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.task-title:hover { color: var(--c-primary); text-decoration: none; }
.task-meta { color: var(--c-muted); font-size: var(--fs-sm); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 2px; }
.task-side { display: flex; align-items: center; gap: 10px; }

/* ---------- Top navigation (everyone except the Chairman) ---------- */
.user-role { display: block; font-size: 12px; color: var(--c-muted); font-weight: 500; }
.has-nav .topbar { height: auto; min-height: 72px; flex-wrap: wrap; gap: 0 var(--s-6); }
.topnav { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; }
.nav-link { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 12px; color: var(--c-ink-2); font-weight: 600; font-size: var(--fs-sm); white-space: nowrap; cursor: pointer; list-style: none; }
.btn-signout { width: 44px; min-height: 44px; padding: 0; justify-content: center; border-radius: 12px; }
.btn-signout:hover { background: var(--c-line-2); color: var(--c-ink-2); }
.nav-link:hover { background: var(--c-line-2); text-decoration: none; }
.nav-link.on { background: var(--c-primary-soft); color: var(--c-primary); }
@media (max-width: 1600px) {
  .has-nav .topbar-date { display: none; }
  .has-nav .topnav { order: 3; flex-basis: 100%; padding: 0 0 10px; margin-top: -4px; overflow-x: auto; }
}
@media (max-width: 760px) {
  .has-nav .topbar { gap: 8px; }
  .has-nav .topnav { gap: 2px; }
  .nav-link { padding: 0 12px; }
}

/* =====================================================================
   VISUAL LANGUAGE v2 (approved 2026-11-24) — roomy cards, calm colour,
   soft buttons. Applies to every screen.
   ===================================================================== */
body { background: #f3f5f9; }
.page { max-width: 1640px; padding: 32px 48px 56px; gap: 32px; }
.page-title { font-size: 30px; letter-spacing: -0.02em; }
.page-sub { font-size: 16px; }
.section-title { font-size: 22px; letter-spacing: -0.01em; margin-bottom: 16px; }

.card { border-radius: 20px; border-color: #e6e9ef; box-shadow: 0 1px 2px rgba(16, 24, 40, .04); }
.card-head { padding: 20px 26px; border-bottom-color: #f0f2f6; }
.card-title { font-size: 20px; letter-spacing: -0.01em; }

/* Soft buttons instead of heavy outlines */
.btn { border-radius: 12px; }
.btn-outline { border: 0; background: #eef4ff; color: #1d4ed8; }
.btn-outline:hover { background: #dfe9ff; }
.btn-done { border: 0; background: #ecfdf3; color: #067647; }
.btn-primary { box-shadow: 0 6px 16px -8px rgba(29, 78, 216, .6); }

/* Pills */
.pill { padding: 5px 12px; font-size: 14px; }

/* Progress bars: always the calm brand gradient; status is shown by the pill */
.bar { height: 10px; background: #eef1f6; }
.bar > i, .bar-red > i, .bar-amber > i, .bar-green > i { background: linear-gradient(90deg, #2563eb, #22b8cf); }
.bar-grey > i { background: #d0d5dd; }

/* Rows */
.task-row { padding: 16px 26px; border-bottom-color: #f0f2f6; gap: 18px; }
.task-title { font-size: calc(var(--fs-body) + 1px); }
.task-group-head { padding: 12px 26px; }
.team-row { padding: 14px 26px; }
.facts div { padding: 14px 26px; }
.comment { padding: 16px 26px; }
.comment-form { padding: 18px 26px; }

/* Plan + person cards */
.plans-grid { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; }
.plan-card { border-radius: 20px; padding: 22px 24px; gap: 8px; border-color: #e6e9ef; }
.people-grid { grid-template-columns: repeat(auto-fill, minmax(400px, 1fr)); gap: 20px; }
.person-card { border-radius: 20px; padding: 22px 24px; gap: 14px; border-left: 1px solid #e6e9ef; border-color: #e6e9ef; }

/* Update banner */
.upd-banner { border-radius: 20px; padding: 20px 26px; }

/* Shared attention item (Chairman lists + company page) */
.att-list .att-item:first-child { border-top: 0; }
.att-title-link { color: var(--c-ink); }
.att-title-link:hover { color: var(--c-primary); text-decoration: none; }

@media (max-width: 1100px) {
  .page { padding: 24px 24px 40px; gap: 24px; }
  .people-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .page { padding: 16px 16px 32px; }
  .page-title { font-size: 24px; }
  .task-row, .team-row, .facts div, .comment, .comment-form { padding-left: 18px; padding-right: 18px; }
}
