/* =========================================================================
   KYSCALE Projects — design tokens taken from the KYSCALE logo
   navy #0B1F4B · blue #0D8CE0 · cyan #00C6E8 · gradient blue → cyan
   ========================================================================= */
:root {
  --navy: #0B1F4B;
  --navy-2: #13295E;
  --navy-3: #1D3672;
  --blue: #0D8CE0;
  --blue-hover: #0A78C2;
  --blue-soft: #E6F3FC;
  --cyan: #00C6E8;
  --gradient: linear-gradient(90deg, #0D8CE0 0%, #0D8CE0 44%, #00C6E8 100%);

  --bg: #F5F7FA;
  --surface: #FFFFFF;
  --surface-2: #F9FAFC;
  --border: #E3E8EF;
  --border-strong: #CBD3DF;
  --text: #0B1F4B;
  --text-2: #42526E;
  --muted: #6B7A90;

  --success: #1F9D55;
  --success-soft: #E3F5EA;
  --warning: #B7791F;
  --warning-soft: #FDF3DC;
  --danger: #D64545;
  --danger-soft: #FBE7E7;

  --t-epic: #7B5CD6;
  --t-story: #2BAA6E;
  --t-task: #0D8CE0;
  --t-bug: #E5484D;
  --t-subtask: #00A9C8;

  --radius: 8px;
  --radius-sm: 6px;
  --shadow-sm: 0 1px 2px rgba(11, 31, 75, .06);
  --shadow: 0 4px 16px rgba(11, 31, 75, .08);
  --shadow-lg: 0 16px 48px rgba(11, 31, 75, .18);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sidebar-w: 236px;
  --topbar-h: 58px;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.25; color: var(--navy); }
h1 { font-size: 22px; font-weight: 700; }
h2 { font-size: 17px; font-weight: 650; }
h3 { font-size: 14px; font-weight: 650; }
p { margin: 0 0 .75em; }
code { font-family: var(--mono); font-size: 12.5px; background: var(--bg); padding: 1px 5px; border-radius: 4px; }
pre { font-family: var(--mono); font-size: 12.5px; background: var(--navy); color: #E6EDF7; padding: 12px; border-radius: var(--radius-sm); overflow: auto; }
pre code { background: none; padding: 0; color: inherit; }
hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.grow { flex: 1; min-width: 0; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row { display: flex; align-items: center; gap: 8px; }
.row-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.spacer { flex: 1; }
.icon { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
.icon-sm { width: 14px; height: 14px; }
.icon-lg { width: 20px; height: 20px; }

/* ------------------------------------------------------------------ buttons & inputs */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s, box-shadow .12s; text-decoration: none !important; }
.btn:hover { background: var(--surface-2); border-color: var(--muted); }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-hover); border-color: var(--blue-hover); }
.btn-gradient { background: var(--gradient); border: 0; color: #fff; }
.btn-gradient:hover { filter: brightness(1.05); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: rgba(11, 31, 75, .06); border-color: transparent; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #BF3535; border-color: #BF3535; }
.btn-sm { height: 28px; padding: 0 10px; font-size: 13px; }
.btn-xs { height: 24px; padding: 0 8px; font-size: 12px; }
.btn-icon { width: 34px; padding: 0; }
.btn-icon.btn-sm { width: 28px; }
.btn-block { width: 100%; }

input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 7px 10px; width: 100%; transition: border-color .12s, box-shadow .12s; }
input, select { height: 34px; }
input[type=checkbox], input[type=radio] { width: auto; height: auto; accent-color: var(--blue); }
input[type=color] { padding: 2px; width: 48px; }
textarea { min-height: 90px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(13, 140, 224, .15); outline: none; }
select { padding-top: 0; padding-bottom: 0; line-height: normal; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236B7A90' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 8px center; background-size: 16px; padding-right: 30px; }
.input-sm { height: 28px; padding: 3px 8px; font-size: 13px; }
select.input-sm { padding-right: 26px; }
label { display: block; font-weight: 600; font-size: 13px; color: var(--text-2); }
label > input, label > select, label > textarea { margin-top: 4px; font-weight: 400; }
label small { display: block; font-weight: 400; margin-top: 3px; }
.form { display: flex; flex-direction: column; gap: 14px; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; color: var(--text); cursor: pointer; }

/* ------------------------------------------------------------------ auth pages */
.auth-page { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 24px; background: radial-gradient(1200px 600px at 10% -10%, rgba(0, 198, 232, .18), transparent 60%), radial-gradient(900px 500px at 110% 110%, rgba(13, 140, 224, .16), transparent 60%), var(--bg); }
.auth-card { width: 100%; max-width: 440px; background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 32px; position: relative; overflow: hidden; }
.auth-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--gradient); }
.auth-logo { height: 34px; display: block; margin: 0 auto 20px; }
.auth-card h1 { text-align: center; font-size: 20px; margin-bottom: 16px; }
.steps { display: flex; gap: 8px; list-style: none; padding: 0; margin: 0 0 16px; counter-reset: s; }
.steps li { flex: 1; font-size: 12px; font-weight: 600; color: var(--muted); padding-top: 8px; border-top: 3px solid var(--border); counter-increment: s; }
.steps li::before { content: counter(s) ". "; }
.steps li.active { color: var(--blue); border-color: var(--blue); }
.steps li.done { color: var(--success); border-color: var(--success); }
.alert { padding: 10px 12px; border-radius: var(--radius-sm); margin-bottom: 14px; font-size: 13px; }
.alert-error { background: var(--danger-soft); color: #9B2C2C; }
.alert-info { background: var(--blue-soft); color: var(--navy); }
.alert-warning { background: var(--warning-soft); color: #7A4F0E; }
.boot-loader { height: 100vh; display: flex; align-items: center; justify-content: center; }
.boot-loader img { height: 36px; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; } }

/* ------------------------------------------------------------------ app layout */
.topbar { position: fixed; inset: 0 0 auto 0; height: var(--topbar-h); background: var(--surface); display: flex; align-items: center; gap: 12px; padding: 0 16px; z-index: 50; box-shadow: var(--shadow-sm); }
.topbar::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--gradient); }
.topbar .logo { display: flex; align-items: center; width: calc(var(--sidebar-w) - 28px); }
.topbar .logo img { height: 28px; }
.topbar .search { position: relative; flex: 1; max-width: 460px; }
.topbar .search input { padding-left: 34px; background: var(--bg); border-color: transparent; }
.topbar .search input:focus { background: var(--surface); border-color: var(--blue); }
.topbar .search .icon { position: absolute; left: 10px; top: 9px; color: var(--muted); }
.topbar .kbd { position: absolute; right: 8px; top: 7px; }
.kbd { display: inline-block; font-family: var(--mono); font-size: 11px; color: var(--muted); border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; line-height: 18px; background: var(--surface); }
.menu-toggle { display: none; }
.bell { position: relative; }
.bell .dot { position: absolute; top: 3px; right: 3px; min-width: 16px; height: 16px; border-radius: 8px; background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; display: flex; align-items: center; justify-content: center; padding: 0 4px; }

.sidebar { position: fixed; top: var(--topbar-h); bottom: 0; left: 0; width: var(--sidebar-w); background: var(--navy); color: #C9D4EA; padding: 16px 10px; overflow-y: auto; z-index: 40; display: flex; flex-direction: column; gap: 2px; }
.sidebar a, .sidebar button.nav { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); color: #C9D4EA; font-weight: 550; text-decoration: none; border: 0; background: none; font: inherit; cursor: pointer; width: 100%; text-align: left; }
.sidebar a:hover, .sidebar button.nav:hover { background: var(--navy-2); color: #fff; }
.sidebar a.active { background: var(--navy-3); color: #fff; box-shadow: inset 3px 0 0 var(--cyan); }
.sidebar .section { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #7F8FB3; padding: 16px 10px 6px; font-weight: 700; }
.sidebar .pdot { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.sidebar .footer { margin-top: auto; padding: 12px 10px 0; font-size: 11px; color: #7F8FB3; }

.main { margin-left: var(--sidebar-w); padding: calc(var(--topbar-h) + 20px) 28px 40px; min-height: 100vh; }
.page-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.page-head .sub { color: var(--muted); margin-top: 2px; }
.breadcrumb { font-size: 13px; color: var(--muted); margin-bottom: 6px; display: flex; gap: 6px; align-items: center; }
.breadcrumb a { color: var(--muted); }

/* ------------------------------------------------------------------ surfaces */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-pad { padding: 18px; }
.card-head { display: flex; align-items: center; gap: 8px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.card-head h2, .card-head h3 { margin: 0; }
.card-body { padding: 14px 18px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-cards { grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.empty { text-align: center; color: var(--muted); padding: 36px 16px; }
.empty .icon { width: 36px; height: 36px; color: var(--border-strong); margin-bottom: 8px; }

.stat { padding: 16px 18px; }
.stat .label { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.stat .value { font-size: 28px; font-weight: 700; color: var(--navy); line-height: 1.2; margin-top: 4px; }
.stat .value.danger { color: var(--danger); }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a, .tabs button { padding: 9px 14px; color: var(--text-2); font-weight: 600; border: 0; background: none; font: inherit; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; text-decoration: none !important; display: inline-flex; gap: 6px; align-items: center; }
.tabs a:hover, .tabs button:hover { color: var(--navy); }
.tabs a.active, .tabs button.active { color: var(--blue); border-bottom-color: var(--blue); }
.tabs .count { background: var(--bg); border-radius: 9px; padding: 0 6px; font-size: 11px; color: var(--muted); }

/* ------------------------------------------------------------------ badges, avatars, chips */
.badge { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 8px; border-radius: 10px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; background: var(--bg); color: var(--text-2); white-space: nowrap; }
.badge-todo { background: #EEF1F6; color: #42526E; }
.badge-in_progress { background: var(--blue-soft); color: #0B5D99; }
.badge-done { background: var(--success-soft); color: #16703C; }
.badge-scrum { background: #EDE8FB; color: #5B3FB8; }
.badge-kanban { background: #E0F7FB; color: #00748A; }
.badge-active { background: var(--success-soft); color: #16703C; }
.badge-on_hold { background: var(--warning-soft); color: #7A4F0E; }
.badge-archived, .badge-closed { background: #EEF1F6; color: var(--muted); }
.badge-planned { background: #EEF1F6; color: #42526E; }
.badge-merged { background: #EDE8FB; color: #5B3FB8; }
.badge-open, .badge-pushed, .badge-created { background: var(--success-soft); color: #16703C; }
.badge-draft { background: #EEF1F6; color: var(--muted); }
.badge-admin { background: #FDE8EF; color: #A0174A; }
.badge-manager { background: #EDE8FB; color: #5B3FB8; }
.badge-member, .badge-developer { background: var(--blue-soft); color: #0B5D99; }
.badge-viewer { background: #EEF1F6; color: var(--muted); }

.avatar { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; color: #fff; font-weight: 700; font-size: 11px; width: 26px; height: 26px; flex: none; user-select: none; letter-spacing: .02em; box-shadow: 0 0 0 2px var(--surface); }
.avatar-sm { width: 22px; height: 22px; font-size: 10px; }
.avatar-lg { width: 36px; height: 36px; font-size: 14px; }
.avatar-empty { background: var(--surface); color: var(--muted); border: 1px dashed var(--border-strong); box-shadow: none; }
.avatars { display: flex; }
.avatars .avatar + .avatar { margin-left: -6px; }
.avatar-btn { cursor: pointer; border: 0; padding: 0; background: none; border-radius: 50%; }
.avatar-btn.selected .avatar { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--blue); }

.chip { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px; border-radius: 4px; font-size: 11.5px; font-weight: 600; background: #EEF1F6; color: var(--text-2); white-space: nowrap; max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.chip-epic { background: #EDE8FB; color: #5B3FB8; }
.chip-label { background: #E6F3FC; color: #0B5D99; }
.chip button { border: 0; background: none; padding: 0; color: inherit; cursor: pointer; display: inline-flex; }

.type-icon { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; border-radius: 3px; flex: none; color: #fff; }
.type-icon svg { width: 11px; height: 11px; stroke: #fff; stroke-width: 3; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.type-epic { background: var(--t-epic); }
.type-story { background: var(--t-story); }
.type-task { background: var(--t-task); }
.type-bug { background: var(--t-bug); }
.type-subtask { background: var(--t-subtask); }
.prio { display: inline-flex; flex: none; }
.prio svg { width: 16px; height: 16px; stroke-width: 2.5; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.prio-highest svg, .prio-high svg { stroke: #E5484D; }
.prio-medium svg { stroke: #E8A317; }
.prio-low svg, .prio-lowest svg { stroke: #0D8CE0; }
.points { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 18px; padding: 0 6px; border-radius: 9px; background: #EEF1F6; color: var(--text-2); font-size: 11px; font-weight: 700; }
.issue-key { font-family: var(--mono); font-size: 12px; color: var(--muted); white-space: nowrap; }
.issue-key.done { text-decoration: line-through; }

.progress { height: 6px; border-radius: 3px; background: #E8EDF3; overflow: hidden; display: flex; }
.progress > span { display: block; height: 100%; background: var(--gradient); }
.progress > span.p-done { background: var(--success); }
.progress > span.p-prog { background: var(--blue); }
.progress-lg { height: 8px; border-radius: 4px; }

/* ------------------------------------------------------------------ tables & lists */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
.table th.sortable { cursor: pointer; user-select: none; }
.table th.sortable:hover { color: var(--navy); }
.table td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr.clickable:hover td { background: var(--surface-2); }
.table-wrap { overflow-x: auto; }

.list { list-style: none; margin: 0; padding: 0; }
.issue-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--border); background: var(--surface); cursor: pointer; min-height: 42px; }
.issue-row:last-child { border-bottom: 0; }
.issue-row:hover { background: var(--surface-2); }
.issue-row .title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.issue-row.dragging { opacity: .4; }
.issue-row .meta { display: flex; align-items: center; gap: 8px; flex: none; }

/* ------------------------------------------------------------------ project cards */
.project-card { display: block; padding: 18px; color: inherit; text-decoration: none !important; transition: box-shadow .15s, transform .15s; position: relative; overflow: hidden; }
.project-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.project-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--pc, var(--blue)); }
.project-card .key { font-family: var(--mono); font-size: 12px; font-weight: 700; color: var(--muted); }
.project-card h3 { font-size: 16px; margin: 4px 0 6px; }
.project-card .desc { color: var(--text-2); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 39px; margin-bottom: 12px; }
.project-head { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.project-avatar { width: 40px; height: 40px; border-radius: 8px; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 800; font-size: 13px; flex: none; }

/* ------------------------------------------------------------------ board */
.board-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.board-toolbar input[type=search] { width: 220px; }
.board { display: flex; gap: 12px; align-items: flex-start; overflow-x: auto; padding-bottom: 12px; min-height: 60vh; }
.column { flex: 0 0 280px; background: #EBEFF5; border-radius: var(--radius); display: flex; flex-direction: column; max-height: calc(100vh - 230px); }
.column-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-2); }
.column-head .count { background: rgba(11, 31, 75, .08); border-radius: 9px; padding: 0 7px; }
.column-head .wip-over { background: var(--danger); color: #fff; }
.column.over-limit { background: #FBEDED; }
.column-body { padding: 4px 8px 8px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; min-height: 60px; flex: 1; }
.column-body.drop-target, .droplist.drop-target { background: rgba(13, 140, 224, .08); outline: 2px dashed rgba(13, 140, 224, .45); outline-offset: -4px; border-radius: var(--radius); }
.issue-card { background: var(--surface); border-radius: var(--radius-sm); padding: 10px 12px; box-shadow: 0 1px 2px rgba(11, 31, 75, .12); cursor: grab; border: 1px solid transparent; transition: box-shadow .12s, border-color .12s; }
.issue-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.issue-card.dragging { opacity: .4; }
.issue-card .title { font-weight: 500; margin-bottom: 8px; word-break: break-word; }
.issue-card .foot { display: flex; align-items: center; gap: 6px; }
.issue-card .chips { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.issue-card.overdue .due { color: var(--danger); font-weight: 700; }
.quick-add { padding: 4px 8px 10px; }
.quick-add button { width: 100%; justify-content: flex-start; color: var(--text-2); }
.quick-add input { background: var(--surface); }
.drop-placeholder { height: 4px; background: var(--blue); border-radius: 2px; margin: -2px 0; }

/* backlog */
.sprint-block { margin-bottom: 16px; }
.sprint-block .card-head { flex-wrap: wrap; }
.sprint-block .meta { color: var(--muted); font-size: 12.5px; }
.droplist { min-height: 44px; }
.droplist .empty-drop { color: var(--muted); font-size: 13px; padding: 12px; text-align: center; border: 1px dashed var(--border-strong); margin: 8px 12px; border-radius: var(--radius-sm); }

/* ------------------------------------------------------------------ issue detail */
.issue-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; }
.issue-title { font-size: 22px; font-weight: 700; padding: 4px 8px; margin: 0 -8px 12px; border-radius: var(--radius-sm); border: 1px solid transparent; cursor: text; word-break: break-word; }
.issue-title:hover { background: var(--surface); border-color: var(--border); }
.issue-title-input { font-size: 22px; font-weight: 700; height: auto; margin-bottom: 12px; }
.section-title { font-size: 13px; font-weight: 700; color: var(--navy); margin: 22px 0 8px; display: flex; align-items: center; gap: 8px; }
.description { padding: 10px 12px; margin: 0 -12px; border-radius: var(--radius-sm); cursor: text; min-height: 44px; border: 1px solid transparent; }
.description:hover { background: var(--surface); border-color: var(--border); }
.description.placeholder { color: var(--muted); }
.details { position: sticky; top: calc(var(--topbar-h) + 16px); }
.details .field { display: grid; grid-template-columns: 110px 1fr; align-items: center; gap: 8px; padding: 6px 0; min-height: 40px; }
.details .field > span:first-child { color: var(--muted); font-size: 13px; font-weight: 600; }
.details select, .details input { height: 34px; border-color: transparent; background-color: transparent; padding-left: 8px; }
.details select:hover, .details input:hover { border-color: var(--border-strong); background-color: var(--surface); }
.details select:focus, .details input:focus { background-color: var(--surface); }
.status-select { font-weight: 700; }
.status-select.cat-todo { background-color: #EEF1F6 !important; }
.status-select.cat-in_progress { background-color: var(--blue-soft) !important; color: #0B5D99; }
.status-select.cat-done { background-color: var(--success-soft) !important; color: #16703C; }
.timetrack { margin-top: 4px; }
.timetrack .labels { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 4px; }

.md { word-break: break-word; }
.md > *:last-child { margin-bottom: 0; }
.md ul, .md ol { padding-left: 22px; margin: 0 0 .75em; }
.md blockquote { margin: 0 0 .75em; padding: 4px 12px; border-left: 3px solid var(--border-strong); color: var(--text-2); }
.md h1, .md h2, .md h3 { margin-top: .6em; }
.md img { max-width: 100%; }
.mention { background: var(--blue-soft); color: #0B5D99; border-radius: 4px; padding: 0 3px; font-weight: 600; }
.md .issue-ref { font-family: var(--mono); font-size: 12.5px; }
.md-help { font-size: 12px; color: var(--muted); }

.comment { display: flex; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.comment:last-child { border-bottom: 0; }
.comment .head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; flex-wrap: wrap; }
.comment .head b { color: var(--navy); }
.comment .actions { display: flex; gap: 2px; margin-left: auto; opacity: 0; transition: opacity .12s; }
.comment:hover .actions { opacity: 1; }
.composer { display: flex; gap: 10px; margin-top: 12px; }
.composer textarea { min-height: 70px; }

.attachments { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.attachment { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); position: relative; }
.attachment .thumb { height: 92px; display: flex; align-items: center; justify-content: center; background: var(--surface-2); color: var(--muted); overflow: hidden; }
.attachment .thumb img { width: 100%; height: 100%; object-fit: cover; }
.attachment .thumb .icon { width: 30px; height: 30px; }
.attachment .info { padding: 6px 8px; font-size: 12px; }
.attachment .info a { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.attachment .del { position: absolute; top: 4px; right: 4px; opacity: 0; background: var(--surface); }
.attachment:hover .del { opacity: 1; }
.dropzone { border: 2px dashed var(--border-strong); border-radius: var(--radius); padding: 14px; text-align: center; color: var(--muted); cursor: pointer; transition: border-color .12s, background .12s; font-size: 13px; }
.dropzone:hover, .dropzone.over { border-color: var(--blue); background: var(--blue-soft); color: var(--navy); }

.history-item { display: flex; gap: 10px; padding: 8px 0; font-size: 13px; border-bottom: 1px solid var(--border); }
.history-item:last-child { border-bottom: 0; }
.history-item .old { text-decoration: line-through; color: var(--muted); }
.history-item .arrow { color: var(--muted); margin: 0 4px; }
.gh-item { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.gh-item:last-child { border-bottom: 0; }

/* ------------------------------------------------------------------ modal, dropdown, toast */
.modal-backdrop { position: fixed; inset: 0; background: rgba(11, 31, 75, .45); z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px 16px; overflow-y: auto; animation: fade .12s ease-out; }
.modal { background: var(--surface); border-radius: 12px; box-shadow: var(--shadow-lg); width: 100%; max-width: 620px; position: relative; animation: rise .15s ease-out; }
.modal-sm { max-width: 440px; }
.modal-lg { max-width: 820px; }
.modal-head { display: flex; align-items: center; gap: 8px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head h2 { margin: 0; flex: 1; }
.modal-body { padding: 18px 20px; max-height: calc(88vh - 130px); overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 12px 12px; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

.dropdown { position: fixed; z-index: 120; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); min-width: 200px; max-width: 380px; padding: 6px; animation: rise .1s ease-out; }
.dropdown .item { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 10px; border-radius: var(--radius-sm); border: 0; background: none; font: inherit; color: var(--text); cursor: pointer; text-align: left; text-decoration: none !important; }
.dropdown .item:hover { background: var(--bg); }
.dropdown .item.danger { color: var(--danger); }
.dropdown .sep { height: 1px; background: var(--border); margin: 6px 0; }
.dropdown .head { padding: 8px 10px; }
.notif-panel { width: 380px; max-height: 70vh; overflow-y: auto; padding: 0; }
.notif-panel .top { display: flex; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); }
.notif { display: flex; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); cursor: pointer; font-size: 13px; }
.notif:hover { background: var(--surface-2); }
.notif.unread { background: #F2F8FE; }
.notif.unread::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--blue); flex: none; margin-top: 6px; }

.toasts { position: fixed; bottom: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--navy); color: #fff; padding: 10px 16px; border-radius: var(--radius); box-shadow: var(--shadow-lg); font-weight: 500; max-width: 380px; animation: rise .15s ease-out; display: flex; gap: 8px; align-items: center; }
.toast.error { background: var(--danger); }
.toast.success { border-left: 4px solid var(--cyan); }

/* ------------------------------------------------------------------ charts */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { font-family: var(--font); font-size: 11px; fill: var(--muted); }
.chart .grid line { stroke: #EDF1F6; }
.chart .axis line { stroke: var(--border-strong); }
.chart .hit { fill: transparent; cursor: crosshair; }
.chart-legend { display: flex; gap: 14px; font-size: 12px; color: var(--text-2); margin-bottom: 8px; flex-wrap: wrap; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 12px; height: 3px; border-radius: 2px; display: inline-block; }
.chart-legend i.box { height: 10px; width: 10px; border-radius: 2px; }
.chart-legend i.dash { background: repeating-linear-gradient(90deg, #8A97AD 0 4px, transparent 4px 7px) !important; }
.chart-tip { position: fixed; z-index: 150; pointer-events: none; background: var(--navy); color: #fff; padding: 8px 10px; border-radius: var(--radius-sm); font-size: 12px; box-shadow: var(--shadow-lg); line-height: 1.5; }
.chart-tip b { color: #fff; }
.hbar { display: grid; grid-template-columns: 140px 1fr 70px; align-items: center; gap: 10px; padding: 5px 0; font-size: 13px; }
.hbar .track { height: 14px; background: #EEF2F7; border-radius: 0 4px 4px 0; overflow: hidden; }
.hbar .fill { height: 100%; background: var(--blue); border-radius: 0 4px 4px 0; min-width: 2px; }

/* ------------------------------------------------------------------ timesheet */
.ts-table td.num, .ts-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.ts-table td.weekend, .ts-table th.weekend { background: #F7F9FC; }
.ts-table tfoot td { font-weight: 700; background: var(--surface-2); border-top: 2px solid var(--border); }

/* ------------------------------------------------------------------ responsive */
@media (max-width: 1100px) {
  .issue-layout { grid-template-columns: 1fr; }
  .details { position: static; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .menu-toggle { display: inline-flex; }
  .topbar .logo { width: auto; }
  .topbar .kbd, .topbar .btn-label { display: none; }
  .sidebar { transform: translateX(-100%); transition: transform .2s; }
  body.nav-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  .main { margin-left: 0; padding: calc(var(--topbar-h) + 16px) 14px 32px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .row-2, .row-3 { grid-template-columns: 1fr; }
  .hbar { grid-template-columns: 100px 1fr 60px; }
}
@media (max-width: 560px) {
  .topbar .logo img { height: 22px; }
  .grid-4 { grid-template-columns: 1fr 1fr; }
  .column { flex-basis: 85vw; }
}
@media print {
  .topbar, .sidebar { display: none; }
  .main { margin: 0; padding: 0; }
}
