/* ==========================================================================
   Issue Track – stylesheet
   Light/dark via prefers-color-scheme. Layout: sidebar shell (CSS grid + flexbox), no framework.
   ========================================================================== */

:root {
  --bg: #f1f3f7;
  --surface: #ffffff;
  --surface-2: #f6f7f9;
  --surface-3: #e9ecf1;
  --border: #e1e5eb;
  --border-strong: #cdd3dc;
  --text: #1f2430;
  --text-2: #424a5a;
  --muted: #6b7486;
  --accent: #1a73e8;
  --accent-hover: #1462c9;
  --accent-soft: #e8f0fe;
  --accent-ink: #0b57c2;
  --danger: #c62828;
  --danger-soft: #fdecec;
  --ok: #1e7d4f;
  --ok-soft: #e6f5ec;
  --warn: #a15c00;
  --warn-soft: #fff3e0;
  --info-soft: #e8f1fd;
  --info: #1d5fb8;
  /* dark navy side navigation, Zoho Projects style */
  --sidebar: #1e2534;
  --side-text: #c9d0dd;
  --side-muted: #8b95a9;
  --side-hover: rgba(255, 255, 255, .07);
  --side-active: rgba(26, 115, 232, .22);
  --side-border: rgba(255, 255, 255, .09);
  --header: #ffffff;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06);
  --shadow-md: 0 3px 10px rgba(16, 24, 40, .09);
  --shadow-lg: 0 14px 36px rgba(16, 24, 40, .2);
  --radius: 6px;
  --radius-sm: 4px;
  --font: "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
  --sidebar-w: 248px;

  /* chart palette (validated categorical order; text never wears these) */
  --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #eda100;
  --series-5: #e87ba4; --series-6: #008300; --series-7: #6250d6; --series-8: #e34948;
  --series-9: #6b7a90;
  /* extra icon hues for the dashboard tiles */
  --violet: #7c3aed; --rose: #d6336c; --teal: #0f8a7e; --slate: #5b6b82;
  --grid: #e8ebf0;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1017;
    --surface: #151a23;
    --surface-2: #1b212c;
    --surface-3: #232a37;
    --border: #262d3a;
    --border-strong: #354052;
    --text: #e8ebf1;
    --text-2: #c3c9d4;
    --muted: #949db0;
    --accent: #5c9dff;
    --accent-hover: #7db1ff;
    --accent-soft: #17294a;
    --accent-ink: #a9c8ff;
    --danger: #ff8a80;
    --danger-soft: #3a1f22;
    --ok: #6fd3a0;
    --ok-soft: #173126;
    --warn: #ffb866;
    --warn-soft: #3a2a14;
    --info-soft: #182a42;
    --info: #8ab8ff;
    --sidebar: #0f131b;
    --side-text: #c3cad6;
    --side-muted: #7f8aa0;
    --side-hover: rgba(255, 255, 255, .06);
    --side-active: rgba(92, 157, 255, .2);
    --side-border: rgba(255, 255, 255, .07);
    --header: #151a23;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-md: 0 4px 14px rgba(0, 0, 0, .45);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, .6);
    --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500;
    --series-5: #d55181; --series-6: #008300; --series-7: #9085e9; --series-8: #e66767;
    --series-9: #8a97ab;
    --violet: #b197fc; --rose: #f783ac; --teal: #4fd1c5; --slate: #a3b1c6;
    --grid: #232a36;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0; letter-spacing: -.01em; }
h1 { font-size: 20px; font-weight: 650; }
h2 { font-size: 16px; font-weight: 650; }
h3 { font-size: 14px; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ico { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- app shell: sidebar ---------- */
.topbar {
  position: fixed; inset: 0 auto 0 0; z-index: 20; width: var(--sidebar-w);
  display: flex; flex-direction: column; gap: 14px;
  padding: 16px 10px 12px;
  background: var(--sidebar);
  border-right: 0;
}
body.signed-in { padding-left: var(--sidebar-w); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: #fff; font-size: 15.5px; padding: 2px 8px 10px; letter-spacing: -.01em; border-bottom: 1px solid var(--side-border); }
.brand:hover { text-decoration: none; }
.brand-logo { width: 40px; height: 32px; object-fit: contain; background: #000; border-radius: 6px; padding: 2px; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text small { font-size: 11px; font-weight: 600; color: var(--side-muted); letter-spacing: .02em; }
.brand-mark {
  display: grid; place-items: center; width: 30px; height: 30px;
  border-radius: 6px; background: var(--accent); color: #fff; font-size: 15px;
}
.mainnav { display: flex; flex-direction: column; gap: 1px; }
.mainnav a {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px; border-radius: var(--radius-sm); color: var(--side-text); font-weight: 500; font-size: 13.5px;
}
.mainnav a .ico { color: var(--side-muted); }
.mainnav a:hover { background: var(--side-hover); color: #fff; text-decoration: none; }
.mainnav a:hover .ico { color: #fff; }
.mainnav a.active { background: var(--side-active); color: #fff; font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }
.mainnav a.active .ico { color: #fff; }
.quicksearch { position: relative; }
.quicksearch .ico { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--side-muted); width: 16px; height: 16px; }
.quicksearch input { width: 100%; padding-left: 32px; background: rgba(255, 255, 255, .08); border-color: transparent; color: #fff; }
.quicksearch input::placeholder { color: var(--side-muted); }
.quicksearch input:focus { background: rgba(255, 255, 255, .13); border-color: var(--accent); box-shadow: none; }
.usermenu {
  margin-top: auto; display: flex; align-items: center; gap: 10px;
  padding: 12px 8px 4px; border-top: 1px solid var(--side-border); color: var(--side-text);
}
.usermenu .icon-btn { color: var(--side-muted); }
.usermenu .icon-btn:hover { background: var(--side-hover); color: #fff; }
.usermenu .avatar { box-shadow: 0 0 0 2px var(--side-border); }
.me-who { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; border-radius: 8px; cursor: default; }
.me-who:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* hover card on the signed-in user: e-mail, role, department, sign-in time */
.me-card {
  position: fixed; z-index: 150; width: 270px; padding: 12px 14px; border-radius: 12px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); box-shadow: var(--shadow-lg);
  font-size: 12.5px; animation: confirm-in .12s ease-out;
}
.me-card[hidden] { display: none; }
.me-card-head { display: flex; align-items: center; gap: 10px; padding-bottom: 10px; margin-bottom: 8px; border-bottom: 1px solid var(--border); }
.me-card-head strong { display: block; font-size: 13.5px; }
.me-card dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 0; }
.me-card dt { color: var(--muted); }
.me-card dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.me-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; flex: 1; }
.me-text strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13.5px; color: #fff; }
.me-text small { color: var(--side-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- generic ---------- */
.view { --vpt: 20px; --vpx: 26px; max-width: none; margin: 0; padding: var(--vpt) var(--vpx) 36px; outline: none; }
.loading { color: var(--muted); padding: 40px 0; text-align: center; }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
/* Zoho-style white header band across the top of every page */
.view > .page-head:first-child, .view > .crumbs:first-child + .page-head {
  margin: calc(-1 * var(--vpt)) calc(-1 * var(--vpx)) 18px; padding: 14px var(--vpx); background: var(--header);
  border-bottom: 1px solid var(--border);
}
.view > .page-head:first-child:has(.view-toggle) { padding-bottom: 0; }
.page-head .spacer, .spacer { flex: 1; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.crumbs { color: var(--muted); font-size: 13px; margin-bottom: 4px; }
.crumbs a { color: var(--muted); }
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card-pad { padding: 18px 20px; }
.muted { color: var(--muted); }
.empty { color: var(--muted); text-align: center; padding: 36px 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ---------- buttons & forms ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px; padding: 0 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font: 560 13.5px var(--font); cursor: pointer; white-space: nowrap;
  transition: background .12s, border-color .12s, box-shadow .12s;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: none; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.icon-btn {
  display: inline-grid; place-items: center;
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
  width: 32px; height: 32px; border-radius: var(--radius-sm); font-size: 15px;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.linkish { border: 0; background: none; padding: 0; color: var(--muted); cursor: pointer; font: inherit; font-size: 12.5px; }
.linkish:hover { color: var(--accent); text-decoration: underline; }

input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 6px 10px; min-height: 32px;
  transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { resize: vertical; min-height: 90px; line-height: 1.5; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field > span { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field small.hint { color: var(--muted); font-size: 12px; }
.field .err { color: var(--danger); font-size: 12px; }
.field.invalid input, .field.invalid select, .field.invalid textarea { border-color: var(--danger); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.form-error {
  margin: 0 20px 4px; padding: 9px 12px; border-radius: var(--radius-sm);
  background: var(--danger-soft); color: var(--danger); font-size: 13px;
}
.check { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); font-size: 13px; }
.check input { min-height: 0; }

/* ---------- auth (sign-in page) ---------- */
body:not(.signed-in) .view { max-width: none; padding: 0; }
.auth-wrap {
  --gold: #c9a24b; --gold-2: #e6c97a;
  min-height: 100vh; min-height: 100dvh;
  display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(400px, 1fr);
}
.auth-hero {
  position: relative; overflow: hidden; color: #f3f1ea;
  display: flex; flex-direction: column; justify-content: space-between; gap: 24px;
  padding: 40px 48px 44px;
  background:
    radial-gradient(60% 45% at 50% 52%, rgba(98, 140, 255, .18), transparent 70%),
    radial-gradient(40% 30% at 50% 100%, rgba(201, 162, 75, .14), transparent 70%),
    #050507;
}
.auth-logo { width: 168px; height: auto; border-radius: 3px; box-shadow: 0 6px 24px rgba(0, 0, 0, .5); }
.auth-diamond {
  align-self: center; width: min(74%, 440px); height: auto; mix-blend-mode: screen;   /* photo's black background disappears */
  -webkit-mask-image: radial-gradient(70% 70% at 50% 45%, #000 60%, transparent 100%);
  mask-image: radial-gradient(70% 70% at 50% 45%, #000 60%, transparent 100%);
  animation: diamond-float 7s ease-in-out infinite;
}
@keyframes diamond-float { 50% { transform: translateY(-10px); } }
@media (prefers-reduced-motion: reduce) { .auth-diamond { animation: none; } }
.auth-tagline { max-width: 420px; }
.auth-kicker {
  display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: .22em; text-transform: uppercase;
  color: var(--gold-2); padding-bottom: 8px; border-bottom: 1px solid rgba(201, 162, 75, .5); margin-bottom: 10px;
}
.auth-tagline p { margin: 0; font-size: 18px; line-height: 1.5; color: #d9d6cc; font-family: Georgia, "Times New Roman", serif; }

.auth-panel {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 24px;
  padding: 40px 28px 24px; background: var(--surface);
}
.auth-card { width: min(400px, 100%); }
.auth-card h1 { font-size: 28px; letter-spacing: -.02em; margin-bottom: 6px; }
.auth-card .lead { color: var(--muted); margin: 0 0 22px; }
.auth-card .field input { width: 100%; height: 44px; }
.auth-card .btn-primary { background: #111216; border-color: #111216; box-shadow: 0 2px 8px rgba(0, 0, 0, .18); }
.auth-card .btn-primary:hover { background: #000; border-color: #000; }
.auth-card .tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--gold, #c9a24b); }
.btn-block { width: 100%; height: 46px; font-size: 15px; margin-top: 4px; }
.auth-help { font-size: 12.5px; text-align: center; margin: 14px 0 0; }
.auth-foot { font-size: 12px; text-align: center; margin-top: auto; }
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-right: 44px; }
.pw-toggle {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  display: grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 6px;
  background: transparent; color: var(--muted); cursor: pointer;
}
.pw-toggle:hover, .pw-toggle.on { color: var(--text); background: var(--surface-2); }
@media (prefers-color-scheme: dark) {
  .auth-card .btn-primary { background: #c9a24b; border-color: #c9a24b; color: #111; }
  .auth-card .btn-primary:hover { background: #e6c97a; border-color: #e6c97a; }
}

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.tab {
  border: 0; background: none; padding: 9px 12px; cursor: pointer; font: 600 13.5px var(--font);
  color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }

/* ---------- team: department tree ---------- */
.role-summary { display: flex; flex-wrap: wrap; gap: 6px; margin: -8px 0 18px; }
.org-tree { display: flex; flex-direction: column; gap: 14px; position: relative; padding-left: 26px; }
.org-tree::before { content: ""; position: absolute; left: 10px; top: 28px; bottom: 28px; width: 2px; background: var(--border); border-radius: 2px; }
.org-root { display: flex; align-items: center; gap: 12px; padding: 12px 16px; margin-left: -26px; position: relative; }
.org-root div { display: flex; flex-direction: column; }
.dept { position: relative; }
.dept::before { content: ""; position: absolute; left: -16px; top: 26px; width: 16px; height: 2px; background: var(--border); }
.dept-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 14px 16px 10px; border-bottom: 1px solid var(--border); }
.dept-head small { display: block; margin-top: 2px; }
.dept-loose { border-style: dashed; }
.warn-text { color: var(--warn); font-weight: 600; }
.people { list-style: none; margin: 0; padding: 4px 8px 8px; }
.person { display: flex; align-items: center; gap: 12px; padding: 9px 8px; border-radius: 8px; }
.person + .person { border-top: 1px solid var(--border); }
.person.inactive { opacity: .55; }
.person-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.person-name { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.person-main small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty-row { padding: 12px 8px; }
.badge-head { background: #fff3d6; color: #8a6116; }
.role-badge { border: 1px solid transparent; }
.role-IT_ADMIN { background: #ede9fe; color: #5b21b6; }
.role-HOD { background: #fff3d6; color: #8a6116; }
.role-MEMBER { background: var(--info-soft); color: var(--info); }
.role-TESTER { background: #e0f5ef; color: #0f6b52; }
.role-NET_ENG { background: #e6f0ff; color: #1e4fa3; }
.role-EXTERNAL { background: #fde8ef; color: #9d2350; }
.role-GUEST { background: var(--surface-3); color: var(--text-2); }
@media (prefers-color-scheme: dark) {
  .badge-head, .role-HOD { background: #3a2e12; color: #f0cd7a; }
  .role-IT_ADMIN { background: #2c2350; color: #c7b8ff; }
  .role-TESTER { background: #12352b; color: #7fdcb9; }
  .role-NET_ENG { background: #172a4a; color: #9cc2ff; }
  .role-EXTERNAL { background: #3d1826; color: #f5a3c0; }
}
.role-help { margin-top: 16px; }
.role-help summary { cursor: pointer; }
.role-help .props { grid-template-columns: 110px 1fr; margin-top: 12px; }

/* ---------- badges & avatars ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 9px;
  border-radius: 4px; font-size: 11.5px; font-weight: 620; white-space: nowrap;
  background: var(--surface-3); color: var(--text-2);
}
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.st-TODO { background: var(--surface-3); color: var(--text-2); }
.st-IN_PROGRESS { background: var(--info-soft); color: var(--info); }
.st-DONE { background: var(--ok-soft); color: var(--ok); }
/* QA outcomes stand out from the other in-progress steps */
.badge.st-qa-failed { background: var(--danger-soft); color: var(--danger); }
.badge.st-reopen { background: var(--warn-soft); color: var(--warn); }
.badge.st-qa-pass, .badge.st-deployed { background: var(--ok-soft); color: var(--ok); }
.pr { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.pr-1 { background: #d93025; } .pr-2 { background: #f57c00; } .pr-3 { background: #f9ab00; }
.pr-4 { background: #34a853; } .pr-5 { background: #9aa0a6; }
.type { font-size: 10.5px; font-weight: 700; letter-spacing: .04em; padding: 1px 6px; border-radius: 4px; background: var(--surface-2); }
.type-BUG { color: #d93025; } .type-TASK { color: var(--info); } .type-STORY { color: var(--ok); }
.type-EPIC { color: #8e44ad; } .type-IMPROVEMENT { color: var(--warn); }
.type-REQUIREMENT { color: var(--accent); } .type-SUGGESTION { color: var(--ok); }
.avatar {
  display: inline-grid; place-items: center; flex: none;
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-soft), var(--surface-3)); color: var(--accent-ink); font-size: 11px; font-weight: 700;
}
.avatar.sm { width: 22px; height: 22px; font-size: 9.5px; }
.avatar.none { background: var(--surface-2); color: var(--muted); }
.key { font-family: var(--mono); font-size: 12px; color: var(--muted); white-space: nowrap; }

/* ---------- projects ---------- */
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }

/* ---------- milestones (project issues only) ---------- */
.milestone-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; margin-bottom: 18px; }
.section-title { font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin: 22px 0 10px; }
.milestone-card { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; border-left: 3px solid var(--accent); }
.milestone-card.is-late { border-left-color: var(--danger); }
.milestone-card header { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.milestone-card h3 { margin: 0; font-size: 15px; }
.milestone-desc { margin: 0; font-size: 12.5px; }
.milestone-meta { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; font-size: 12.5px; }
.milestone-meta dt { color: var(--muted); }
.milestone-meta dd { margin: 0; }
.milestone-progress { display: flex; align-items: center; gap: 10px; }
.milestone-progress .bar-track { flex: 1; }
.milestone-progress .bar-fill { background: var(--ok); }
.milestone-counts { margin: 0; font-size: 12.5px; color: var(--text-2); }
.milestone-card footer { display: flex; align-items: center; gap: 6px; padding-top: 8px; border-top: 1px solid var(--border); }
.board-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.milestone-filter select { min-width: 180px; }
.inline-select { padding: 4px 8px; min-height: 0; font-size: 13px; max-width: 100%; }

/* ---------- dashboard: Project view ---------- */
.pd-progress { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 170px; }
.pd-progress > span:not(.bar-track) { font-weight: 650; font-size: 12.5px; white-space: nowrap; }
.pd-progress small { flex-basis: 100%; }
.pd-bar { flex: 1; min-width: 80px; height: 8px; }
.pd-bar .pd-ok { background: var(--ok); }
.pd-bar .pd-over { background: var(--danger); }
.pd-table td { vertical-align: top; }
.pd-milestones { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.pd-ms-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; font-size: 13px; }

/* ---------- timeline (Gantt) and dependencies (project issues only) ---------- */
.tl { display: grid; grid-template-columns: 260px minmax(0, 1fr); }
.tl-left { border-right: 1px solid var(--border); min-width: 0; }
.tl-right { overflow-x: auto; min-width: 0; }
.tl-head { height: 48px; border-bottom: 1px solid var(--border); background: var(--surface-2); position: relative; }
.tl-head-left { display: flex; align-items: flex-end; padding: 0 12px 8px; font-size: 11.5px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.tl-months, .tl-ticks { position: relative; height: 24px; }
.tl-months span, .tl-ticks span { position: absolute; top: 0; height: 24px; line-height: 24px; font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; border-left: 1px solid var(--border); padding-left: 4px; }
.tl-months span { font-weight: 650; color: var(--text-2); }
.tl-ticks span.is-weekend { background: var(--surface-3); }
.tl-rows { position: relative; }
.tl-grid { background-image: linear-gradient(to right, var(--border) 1px, transparent 1px), linear-gradient(to bottom, var(--border) 1px, transparent 1px); }
.tl-label { position: absolute; left: 0; right: 0; height: 34px; line-height: 34px; padding: 0 12px; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); border-bottom: 1px solid var(--border); }
a.tl-label:hover { background: var(--surface-2); text-decoration: none; }
.tl-heading { font-weight: 650; color: var(--violet); background: var(--surface-2); }
.tl-bar { position: absolute; height: 20px; border-radius: 6px; font-size: 11px; font-weight: 650; color: #fff; overflow: hidden; white-space: nowrap; z-index: 2; box-shadow: 0 1px 2px rgba(0, 0, 0, .15); }
.tl-bar span { padding: 0 6px; line-height: 20px; }
.tl-bar:hover { text-decoration: none; filter: brightness(1.08); }
.tl-bar.is-todo { background: var(--slate); }
.tl-bar.is-progress { background: var(--info); }
.tl-bar.is-done { background: var(--ok); }
.tl-bar.is-overdue { background: var(--danger); }
.tl-bar.is-partial { opacity: .75; background-image: repeating-linear-gradient(45deg, transparent 0 5px, rgba(255, 255, 255, .25) 5px 10px); }
.tl-band { position: absolute; height: 16px; border-radius: 4px; background: color-mix(in srgb, var(--violet) 30%, transparent); border: 1px solid var(--violet); z-index: 1; }
.tl-band.is-done { opacity: .5; }
.tl-today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--danger); opacity: .6; z-index: 3; }
.tl-links { position: absolute; top: 0; left: 0; pointer-events: none; z-index: 4; overflow: visible; }
.tl-links path { fill: none; stroke: var(--text-2); stroke-width: 1.5; }
.tl-links marker path { fill: var(--text-2); stroke: none; }
.tl-links path.is-clash { stroke: var(--danger); }
.tl-links marker path.is-clash { fill: var(--danger); }
.tl-legend { padding: 10px 14px; border-top: 1px solid var(--border); }
.tl-unscheduled { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.dep-label { margin: 10px 0 4px; font-size: 11.5px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.dep-list { list-style: none; margin: 0; padding: 0; font-size: 12.5px; }
.dep-list li { display: flex; align-items: center; gap: 6px; padding: 4px 0; }
.dep-list .dep-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dep-list .icon-btn { width: 22px; height: 22px; font-size: 11px; }
.dep-add { display: flex; gap: 6px; margin-top: 6px; }
.dep-add input { flex: 1; min-width: 0; }
.dep-warning { margin: 0 0 6px; padding: 6px 8px; border-radius: 6px; background: var(--warn-soft); color: var(--warn); font-size: 12.5px; font-weight: 600; }
@media (max-width: 760px) { .tl { grid-template-columns: 140px minmax(0, 1fr); } }

/* ---------- timesheets (project issues only) ---------- */
.time-bar { margin-top: 8px; height: 8px; }
.time-bar .bar-fill { background: var(--ok); }
.time-bar.is-over .bar-fill { background: var(--danger); }
.time-list { list-style: none; margin: 6px 0 0; padding: 0; font-size: 12.5px; }
.time-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 6px 0; border-top: 1px solid var(--border); }
.time-list .time-when { color: var(--muted); min-width: 52px; }
.time-list .time-who { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.time-list .time-note { flex-basis: 100%; color: var(--text-2); }
.time-list .icon-btn { width: 24px; height: 24px; font-size: 12px; }
.week-table .num { text-align: right; white-space: nowrap; }
.week-table th.is-today, .week-table td.is-today { background: var(--accent-soft); }
.week-table tfoot th { border-top: 2px solid var(--border-strong); text-transform: none; letter-spacing: 0; font-size: 13px; color: var(--text); }
.table .num { text-align: right; white-space: nowrap; }
.project-card { display: flex; flex-direction: column; gap: 10px; padding: 20px; color: var(--text); transition: border-color .15s, transform .15s, box-shadow .15s; }
.project-card:hover { border-color: var(--accent); text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-md); }
.project-card .pkey {
  display: grid; place-items: center; width: 42px; height: 42px; border-radius: 10px;
  background: var(--accent-soft); color: var(--accent-ink); font: 700 12px var(--mono);
}
.project-card p { margin: 0; color: var(--muted); font-size: 13px; flex: 1; }
.project-card footer { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); padding-top: 10px; border-top: 1px solid var(--border); }

/* ---------- board ---------- */
.board {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(240px, 1fr);
  gap: 14px; overflow-x: auto; padding-bottom: 8px; align-items: start;
}
.column {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius);
  display: flex; flex-direction: column; max-height: calc(100vh - 190px); min-height: 160px;
  transition: background .12s, border-color .12s;
}
.column-head { display: flex; align-items: center; gap: 8px; padding: 12px 12px 8px; font-weight: 600; }
.column-head .count { margin-left: auto; color: var(--muted); font-weight: 600; font-size: 12px; background: var(--surface); border-radius: 999px; padding: 0 8px; }
.column-body { padding: 4px 8px 10px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.column.drop-ok { border-color: var(--accent); background: var(--accent-soft); }
.column.drop-no { opacity: .45; }
.column .more { text-align: center; font-size: 12px; color: var(--muted); padding: 4px; }
.issue-card {
  display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); border-left: 3px solid var(--accent);
  padding: 11px 12px; color: var(--text); box-shadow: var(--shadow); cursor: grab;
  transition: border-color .12s, box-shadow .12s;
}
.issue-card:hover { border-color: var(--accent); text-decoration: none; box-shadow: var(--shadow-md); }
.issue-card.dragging { opacity: .4; }
.issue-card .title { margin: 0 0 9px; font-weight: 520; overflow-wrap: anywhere; }
.issue-card .meta { display: flex; align-items: center; gap: 8px; }
.issue-card .meta .avatar { margin-left: auto; }
.due { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.due.overdue { color: var(--danger); font-weight: 600; }
/* Zoho-style tab bar under the page title (Board / List / Timeline / Milestones) */
.view-toggle { display: flex; gap: 2px; order: 20; flex-basis: 100%; border-bottom: 1px solid var(--border); margin-top: 2px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.view-toggle::-webkit-scrollbar { display: none; }
.view-toggle a { padding: 9px 14px; color: var(--text-2); font-weight: 550; font-size: 13.5px; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.view-toggle a.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 650; }
.view-toggle a:hover { text-decoration: none; color: var(--accent); }

/* ---------- lists / tables ---------- */
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.filters input[type="search"] { min-width: 220px; flex: 1; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { font-size: 11.5px; font-weight: 650; color: var(--muted); background: var(--surface-2); white-space: nowrap; text-transform: uppercase; letter-spacing: .04em; }
.table th button { border: 0; background: none; font: inherit; color: inherit; cursor: pointer; padding: 0; text-transform: inherit; letter-spacing: inherit; }
.table th button:hover { color: var(--text); }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table td.title-cell a { color: var(--text); font-weight: 520; }
.table td.title-cell a:hover { color: var(--accent); }
.who { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; }
.table-scroll { overflow-x: auto; }

/* ---------- issue detail ---------- */
.issue-layout { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 20px; align-items: start; }
.issue-main { display: flex; flex-direction: column; gap: 16px; }
.issue-title { font-size: 23px; margin: 4px 0 0; overflow-wrap: anywhere; }
.description { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; line-height: 1.6; }
.description.empty-desc { color: var(--muted); font-style: italic; }
.side { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 20px; }
.side h3 { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 10px; }
.status-current { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.transitions { display: flex; flex-wrap: wrap; gap: 6px; }
.props { display: grid; grid-template-columns: 96px 1fr; gap: 10px 10px; margin: 0; font-size: 13px; }
.props dt { color: var(--muted); }
.props dd { margin: 0; display: flex; align-items: center; gap: 6px; min-width: 0; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.timeline li:last-child { border-bottom: 0; }
.timeline .body { flex: 1; min-width: 0; }
.timeline .head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.timeline time { color: var(--muted); font-size: 12px; }
.comment-text { white-space: pre-wrap; overflow-wrap: anywhere; margin: 4px 0 0; }
.comment-actions { display: flex; gap: 12px; margin-top: 4px; }
.change { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.change .arrow { color: var(--muted); }
.change .old { text-decoration: line-through; color: var(--muted); }
.comment-form textarea { width: 100%; min-height: 76px; }
.comment-form .row { justify-content: flex-end; margin-top: 8px; }
.section-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); padding: 0 16px; }
.section-tabs .tab { padding: 12px 10px; }
.edit-form .field input, .edit-form .field textarea, .edit-form .field select { width: 100%; }

/* ---------- attachments ---------- */
.file-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.file-list.compact { margin-top: 8px; }
.file {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2);
}
.file-icon { font-size: 18px; line-height: 1; }
.file-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.file-main a { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-main small { font-size: 12px; }
#files-card { transition: border-color .12s, background .12s; }
#files-card.drop-target { border-color: var(--accent); background: var(--accent-soft); }

/* ---------- project members ---------- */
.avatars { display: inline-flex; margin-left: auto; }
.avatars .avatar { border: 2px solid var(--surface); margin-left: -6px; }
.member-picker { border: 0; padding: 0; margin: 0 0 14px; }
.member-picker .checks {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px 12px;
  max-height: 200px; overflow-y: auto; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.member-picker .check { color: var(--text); white-space: nowrap; }
.modal-body .member-picker .check input { width: auto; flex: none; }
.member-picker .check small { margin-left: 2px; }

/* ---------- dashboard ---------- */
.dash-mode { margin-bottom: 10px; }
.dash-mode span { padding: 7px 18px; font-size: 13.5px; }
.dash-filter input[type="date"] { min-width: 150px; }
.dash-filters { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; padding: 12px 16px; margin-bottom: 18px; }
.dash-filter { display: flex; flex-direction: column; gap: 4px; }
.dash-filter > span { font-size: 11.5px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.dash-filter select { min-width: 200px; }
.segmented { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 3px; gap: 2px; }
.segmented label { cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: block; white-space: nowrap; padding: 5px 12px; border-radius: 3px; font-size: 13px; font-weight: 560; color: var(--muted); }
.segmented input:checked + span { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.segmented input:focus-visible + span { outline: 2px solid var(--accent); }
#dash-body { transition: opacity .15s; }
#dash-body.is-loading { opacity: .5; pointer-events: none; }

.kpi-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.kpi {
  position: relative; display: flex; flex-direction: column; gap: 1px; padding: 10px 14px 9px;
  color: var(--text); overflow: hidden; transition: border-color .15s, transform .15s, box-shadow .15s;
}
.kpi::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--border-strong); }
a.kpi:hover { text-decoration: none; border-color: var(--accent); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.kpi-label { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--text-2); }
.kpi-value { font-size: 22px; font-weight: 750; letter-spacing: -.02em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.kpi-hint { font-size: 11.5px; color: var(--muted); }
.kpi-label { padding-right: 34px; }
/* icon top-right on a light tint of its own color */
.kpi-icon {
  position: absolute; top: 50%; right: 12px; width: 28px; height: 28px; border-radius: 8px; transform: translateY(-50%);
  display: grid; place-items: center; color: var(--accent);
  background: color-mix(in srgb, currentColor 13%, transparent);
}
.kpi-icon svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ic-accent { color: var(--accent); } .ic-info { color: var(--info); } .ic-violet { color: var(--violet); }
.ic-danger { color: var(--danger); } .ic-warn { color: var(--warn); } .ic-rose { color: var(--rose); }
.ic-teal { color: var(--teal); } .ic-ok { color: var(--ok); } .ic-slate { color: var(--slate); }
.kpi-danger::before { background: var(--danger); }
.kpi-danger .kpi-value { color: var(--danger); }
.kpi-warn::before { background: var(--warn); }
.kpi-ok::before { background: var(--ok); }
.kpi-info::before { background: var(--info); }

.dash-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.dash-card { padding: 16px 18px 18px; min-width: 0; }
.dash-card.span-2 { grid-column: span 2; }
.dash-card.span-3 { grid-column: 1 / -1; }
.dash-card-head { display: flex; align-items: flex-start; gap: 12px; justify-content: space-between; margin-bottom: 14px; flex-wrap: wrap; }
.dash-card-head p { margin: 3px 0 0; font-size: 12.5px; }
.dash-card .empty { padding: 28px 8px; }

.legend { list-style: none; margin: 0; padding: 0; display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-2); }
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: none; margin-right: 4px; vertical-align: -1px; }
.legend-rows { flex-direction: column; gap: 8px; margin-top: 16px; }
.legend-rows li { display: grid; grid-template-columns: 14px 1fr auto 40px 40px; align-items: center; gap: 6px; }
.legend-rows .legend-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend-rows strong { text-align: right; font-variant-numeric: tabular-nums; }
.legend-rows .pct { text-align: right; font-size: 12px; }

.stack { display: flex; gap: 2px; height: 14px; border-radius: 4px; overflow: hidden; background: var(--surface-2); }
.stack-seg { min-width: 3px; transition: opacity .12s; }
.stack-seg:hover { opacity: .8; }

.bars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.bars li { display: grid; grid-template-columns: minmax(90px, 40%) 1fr 36px; align-items: center; gap: 10px; font-size: 13px; }
.bar-label { display: inline-flex; align-items: center; gap: 7px; color: var(--text-2); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
a.bar-label:hover { color: var(--accent); }
.bar-track { display: block; height: 10px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--series-1); border-radius: 0 4px 4px 0; transition: width .4s ease; }
.bar-fill.bar-warn { background: var(--series-4); }
.bar-value { text-align: right; font-weight: 650; font-variant-numeric: tabular-nums; }

.trend { position: relative; }
.trend svg { display: block; width: 100%; height: 220px; overflow: visible; }
.trend .grid { stroke: var(--grid); stroke-width: 1; }
.trend .axis { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.trend .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.trend .area { opacity: .08; }
.trend .crosshair { stroke: var(--border-strong); stroke-width: 1; stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; }
.trend-dot { position: absolute; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--surface); transform: translate(-50%, -50%); pointer-events: none; }
.data-table { margin-top: 10px; font-size: 12.5px; }
.data-table summary { cursor: pointer; color: var(--muted); }
.data-table .table { margin-top: 8px; }
.data-table .table td, .data-table .table th { padding: 6px 10px; }
.data-table[open] { max-height: 260px; overflow-y: auto; }

.workload .wl-bar { display: flex; align-items: center; gap: 10px; min-width: 160px; }
.workload .wl-bar .bar-track { flex: 1; }
.workload .wl-bar strong { width: 28px; text-align: right; font-variant-numeric: tabular-nums; }
.who-link { color: var(--text); }
.who-link:hover { color: var(--accent); }

.mini-list { list-style: none; margin: 0; padding: 0; }
.mini-list li + li { border-top: 1px solid var(--border); }
.mini-list a { display: flex; align-items: center; gap: 9px; padding: 9px 4px; color: var(--text); border-radius: 6px; }
.mini-list a:hover { background: var(--surface-2); text-decoration: none; }
.mini-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-time { font-size: 12px; white-space: nowrap; }

.tooltip {
  position: fixed; z-index: 200; pointer-events: none;
  background: var(--text); color: var(--bg); padding: 7px 10px; border-radius: 8px;
  font-size: 12.5px; line-height: 1.5; box-shadow: var(--shadow-lg); max-width: 260px;
}

/* ---------- modal ---------- */
.modal {
  border: 0; padding: 0; border-radius: 16px; width: min(580px, calc(100vw - 32px));
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
}
.modal::backdrop { background: rgba(10, 14, 22, .5); backdrop-filter: blur(2px); }
.modal-inner { margin: 0; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px 6px; }
.modal-body { padding: 10px 22px 2px; max-height: 68vh; overflow-y: auto; }
.modal-body .field input, .modal-body .field select, .modal-body .field textarea { width: 100%; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 22px 20px; }

/* confirm / info popup */
.modal-confirm { width: min(440px, calc(100vw - 32px)); }
.modal-confirm[open] { animation: confirm-in .14s ease-out; }
@keyframes confirm-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.confirm-body { display: flex; gap: 14px; padding: 22px 22px 6px; }
.confirm-body h2 { margin: 2px 0 6px; font-size: 16px; }
.confirm-body p { margin: 0; color: var(--text-2); line-height: 1.5; white-space: pre-line; }
.confirm-icon {
  flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 700; font-size: 17px; background: var(--surface-2); color: var(--accent);
}
.modal-confirm.danger .confirm-icon { background: var(--danger-soft); color: var(--danger); }
.modal-confirm.success .confirm-icon { background: var(--ok-soft); color: var(--ok); }
.confirm-body p:empty { display: none; }
.confirm-body:has(p:empty) { align-items: center; }
.confirm-body:has(p:empty) h2 { margin: 0; }
.btn-solid-danger { background: var(--danger); border-color: var(--danger); color: #fff; box-shadow: none; }
.btn-solid-danger:hover { background: var(--danger); border-color: var(--danger); filter: brightness(.92); }

/* ---------- toasts ---------- */
.toast-host { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast {
  background: var(--text); color: var(--bg); padding: 11px 15px; border-radius: 10px;
  box-shadow: var(--shadow-lg); font-size: 13.5px; max-width: 380px;
  animation: toast-in .18s ease-out;
}
.toast.error { background: var(--danger); color: #fff; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }

/* ---------- responsive ----------
   > 1100px  full sidebar
   761-1100  tablet: icon rail (labels as tooltips)
   <= 760    phone: top bar (brand, search, user) + bottom tab bar
   ------------------------------------------------------------------ */
@media (max-width: 1200px) {
  .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dash-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1100px) {
  .issue-layout { grid-template-columns: minmax(0, 1fr) 290px; }
}

@media (min-width: 761px) and (max-width: 1100px) {
  :root { --sidebar-w: 76px; }
  .topbar { align-items: center; padding: 16px 10px; }
  .brand { padding: 0; }
  .brand-text, .mainnav a span, .me-text, .quicksearch { display: none; }
  .mainnav { width: 100%; }
  .mainnav a { justify-content: center; padding: 11px 0; }
  .mainnav a .ico { width: 21px; height: 21px; }
  .usermenu { flex-direction: column; padding: 10px 0 0; }
  .view { --vpt: 24px; --vpx: 24px; padding: var(--vpt) var(--vpx) 24px; }
}

@media (max-width: 960px) {
  .issue-layout { grid-template-columns: 1fr; }
  .side { position: static; }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-hero {
    flex-direction: row; align-items: center; justify-content: space-between;
    padding: 18px 22px; min-height: 0;
  }
  .auth-logo { width: 116px; }
  .auth-diamond { width: 150px; align-self: center; animation: none; }
  .auth-tagline { display: none; }
  .auth-panel { justify-content: flex-start; padding: 32px 20px 20px; }
}

@media (max-width: 760px) {
  body.signed-in { padding-left: 0; padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  .topbar {
    position: sticky; inset: auto; top: 0; width: auto; flex-direction: row; flex-wrap: nowrap;
    align-items: center; gap: 10px; padding: 10px 14px; border-right: 0; border-bottom: 1px solid var(--border);
    padding-top: calc(10px + env(safe-area-inset-top));
  }
  .brand { padding: 0; }
  .brand-text { display: none; }
  .quicksearch { flex: 1; min-width: 0; }
  .usermenu { margin: 0; border: 0; padding: 0; gap: 4px; }
  .usermenu .avatar { display: none; }
  .me-text { display: none; }

  /* bottom tab bar */
  .mainnav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    flex-direction: row; justify-content: space-around; gap: 0;
    background: var(--sidebar); border-top: 1px solid var(--border);
    padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 16px rgba(16, 24, 40, .06);
  }
  .mainnav a {
    flex: 1; flex-direction: column; gap: 2px; padding: 6px 2px; min-width: 0;
    font-size: 10.5px; font-weight: 600; border-radius: 10px;
  }
  .mainnav a span { display: none; }
  .mainnav a::after { content: attr(data-short); white-space: nowrap; }
  .mainnav a .ico { width: 21px; height: 21px; }
  .mainnav a.active { background: transparent; box-shadow: none; }
  .mainnav a.active .ico { background: var(--side-active); border-radius: 999px; padding: 2px 10px; width: 42px; box-sizing: content-box; height: 21px; }

  .view { --vpt: 16px; --vpx: 14px; padding: var(--vpt) var(--vpx) 24px; }
  h1 { font-size: 21px; }
  .page-head { gap: 8px; margin-bottom: 16px; }
  .page-head > div:first-child { flex-basis: 100%; }
  .page-head .spacer { display: none; }
  .page-head .btn { flex: 1 1 auto; }
  .grid-2 { grid-template-columns: 1fr; }
  .board { grid-auto-columns: 84%; scroll-snap-type: x mandatory; }
  .column { scroll-snap-align: start; max-height: none; }
  .hide-sm { display: none; }
  .table th, .table td { padding: 10px 10px; }
  .filters { padding: 10px; }
  .filters input[type="search"] { min-width: 0; flex-basis: 100%; }
  .filters select { flex: 1 1 45%; min-width: 0; }
  .pager { flex-wrap: wrap; }
  .project-grid { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .kpi { padding: 9px 12px 8px; }
  .kpi-value { font-size: 20px; }
  .dash-grid { grid-template-columns: 1fr; }
  .dash-card.span-2, .dash-card.span-3 { grid-column: auto; }
  .dash-filters { padding: 12px; gap: 10px; }
  .dash-filter select { min-width: 0; width: 100%; }
  .dash-filter { flex: 1 1 140px; }
  .bars li { grid-template-columns: minmax(80px, 38%) 1fr 30px; }
  .org-tree { padding-left: 0; }
  .org-tree::before, .dept::before { display: none; }
  .org-root { margin-left: 0; }
  .person { flex-wrap: wrap; }
  .person-main { flex-basis: calc(100% - 50px); }
  .person .role-badge { margin-left: 42px; }
  .person .btn { margin-left: auto; }
  .toast-host { left: 12px; right: 12px; bottom: calc(76px + env(safe-area-inset-bottom)); }
  .toast { max-width: none; }

  /* modals become bottom sheets */
  .modal { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 16px 16px 0 0; max-height: 92dvh; }
  .modal-body { max-height: calc(92dvh - 150px); }
  .modal-foot { padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
  .modal-foot .btn { flex: 1; }

  .auth-hero { padding: 14px 18px; }
  .auth-logo { width: 96px; }
  .auth-diamond { width: 104px; }
  .auth-panel { padding: 26px 18px 18px; }
  .auth-card h1 { font-size: 24px; }
}

/* fingers, not mouse pointers: bigger targets, and 16px inputs so iOS doesn't zoom */
@media (pointer: coarse) {
  .btn { min-height: 40px; }
  .btn-sm { min-height: 34px; }
  .icon-btn { width: 40px; height: 40px; }
  input, select, textarea { font-size: 16px; min-height: 42px; }
  .linkish { padding: 6px 0; }
}
