:root {
  color-scheme: dark;
  --bg: #070707;
  --surface: #101010;
  --surface-2: #171717;
  --surface-3: #202020;
  --border: #303030;
  --text: #f5f5f5;
  --muted: #a3a3a3;
  --red: #e11d2e;
  --red-light: #ff4655;
  --red-dark: #8f1020;
  --focus: #ff7a85;
  --radius: 14px;
  --shadow: 0 18px 50px rgb(0 0 0 / 45%);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: radial-gradient(circle at 20% -10%, #27050a 0, transparent 30rem), var(--bg);
  color: var(--text);
  font: 400 16px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input, textarea, select { font: inherit; }
button, select { cursor: pointer; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
.skip-link { position: fixed; z-index: 1000; left: 1rem; top: -5rem; padding: .65rem 1rem; color: white; background: var(--red); border-radius: 0 0 8px 8px; }
.skip-link:focus { top: 0; }
.app-header {
  position: sticky; top: 0; z-index: 20;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 1rem;
  min-height: 72px; padding: .75rem clamp(1rem, 3vw, 2rem);
  background: rgb(7 7 7 / 88%); border-bottom: 1px solid var(--border); backdrop-filter: blur(18px);
}
.impersonation-banner { position: sticky; top: 72px; z-index: 19; display: flex; align-items: center; justify-content: center; gap: 1rem; padding: .55rem 1rem; color: #fff; background: #6f1520; border-bottom: 1px solid var(--red-light); }
.brand-group, .header-actions, nav, .dialog-header, .dialog-actions, .field-grid, .board-actions { display: flex; align-items: center; gap: .75rem; }
.brand-mark, .lock-logo { display: grid; place-items: center; background: var(--red); color: white; font-weight: 900; transform: skew(-7deg); }
.brand-mark { width: 34px; height: 34px; border-radius: 9px; }
.board-switcher { display: grid; gap: .1rem; }
.board-switcher label { color: var(--muted); font-size: .68rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.board-switcher select { max-width: 240px; border: 0; background: transparent; color: var(--text); font-weight: 750; }
.header-actions { justify-content: flex-end; }
.nav-button, .icon-button, .text-button { border: 0; background: transparent; color: var(--muted); }
.nav-button { padding: .55rem .75rem; border-radius: 8px; }
.nav-button:hover, .nav-button.active { color: white; background: var(--surface-2); }
.icon-button { display: inline-grid; place-items: center; min-width: 40px; min-height: 40px; border-radius: 9px; }
.icon-button:hover { color: white; background: var(--surface-3); }
main { padding: clamp(1rem, 3vw, 2.25rem); }
.board-heading { display: flex; justify-content: space-between; align-items: end; gap: 1rem; max-width: 1800px; margin: 0 auto 1.5rem; }
.eyebrow { margin: 0 0 .25rem; color: var(--red-light); font-size: .72rem; font-weight: 850; letter-spacing: .14em; text-transform: uppercase; }
h1, h2, h3, p { overflow-wrap: anywhere; }
h1 { margin: 0; font-size: clamp(1.8rem, 4vw, 3.2rem); line-height: 1.08; letter-spacing: -.04em; }
h2 { margin: 0; font-size: 1.45rem; }
.board-description { margin: .45rem 0 0; color: var(--muted); }
.button { min-height: 42px; padding: .62rem 1rem; border: 1px solid transparent; border-radius: 10px; color: white; font-weight: 750; }
.button.primary { background: var(--red); box-shadow: 0 7px 24px rgb(225 29 46 / 20%); }
.button.primary:hover { background: var(--red-light); }
.button.subtle { background: var(--surface-2); border-color: var(--border); }
.button.subtle:hover { background: var(--surface-3); }
.button.danger { background: var(--red-dark); }
.button.small { min-height: 34px; padding: .35rem .6rem; font-size: .82rem; }
.button.wide { width: 100%; }
.kanban-board { display: grid; grid-auto-columns: minmax(290px, 340px); grid-auto-flow: column; gap: 1rem; max-width: 1800px; min-height: calc(100vh - 200px); margin: auto; padding-bottom: 1rem; overflow-x: auto; overscroll-behavior-inline: contain; scroll-snap-type: inline proximity; }
.column { display: flex; flex-direction: column; max-height: calc(100vh - 205px); background: rgb(16 16 16 / 82%); border: 1px solid var(--border); border-radius: var(--radius); scroll-snap-align: start; }
.column.drag-over { border-color: var(--red-light); box-shadow: inset 0 0 0 1px var(--red-light); }
.column-header { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .9rem 1rem; border-bottom: 1px solid var(--border); }
.column-title { display: flex; align-items: center; gap: .55rem; margin: 0; font-size: .92rem; letter-spacing: .02em; }
.count { display: inline-grid; min-width: 24px; height: 24px; place-items: center; padding: 0 .35rem; color: var(--muted); background: var(--surface-3); border-radius: 999px; font-size: .72rem; }
.column-menu { display: flex; }
.cards { display: flex; flex: 1; flex-direction: column; gap: .7rem; min-height: 120px; padding: .75rem; overflow-y: auto; }
.empty-column { margin: auto; padding: 2rem 1rem; color: #777; text-align: center; font-size: .86rem; }
.card { position: relative; padding: 1rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: 11px; box-shadow: 0 6px 18px rgb(0 0 0 / 16%); }
.card[draggable="true"] { cursor: grab; }
.card.dragging { opacity: .4; }
.card:hover { border-color: #4a4a4a; transform: translateY(-1px); }
.card-topline { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.priority { font-size: .67rem; font-weight: 850; letter-spacing: .09em; text-transform: uppercase; }
.priority.high { color: #ff5262; } .priority.medium { color: #f5a524; } .priority.low { color: #8aa2b7; }
.card h3 { margin: .5rem 0 .35rem; font-size: 1rem; line-height: 1.3; }
.card-description { display: -webkit-box; margin: 0; overflow: hidden; color: var(--muted); font-size: .85rem; -webkit-line-clamp: 4; -webkit-box-orient: vertical; }
.card-description p { margin: 0 0 .35rem; }
.card-description ul, .card-description ol { margin: .25rem 0; padding-left: 1.2rem; }
.card-description a { color: #ff7a85; text-decoration-thickness: 1px; text-underline-offset: 2px; }
.card-description a:hover { color: white; }
.card-footer { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-top: .8rem; padding-top: .65rem; border-top: 1px solid #292929; }
.due { color: var(--muted); font-size: .76rem; }
.due.overdue { color: var(--red-light); font-weight: 750; }
.card-actions { display: flex; gap: .12rem; }
.card-actions .icon-button { min-width: 30px; min-height: 30px; font-size: .78rem; }
.add-in-column { margin: .25rem .75rem .75rem; }
.lock-screen { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 1rem; background: radial-gradient(circle at 50% 15%, #38070d 0, #090909 42%, #050505 100%); }
.lock-screen[hidden] { display: none; }
.lock-panel { width: min(100%, 410px); padding: clamp(1.5rem, 5vw, 2.5rem); background: rgb(14 14 14 / 92%); border: 1px solid #3a2022; border-radius: 22px; box-shadow: var(--shadow); }
.lock-logo { width: 52px; height: 52px; margin-bottom: 1.5rem; border-radius: 13px; font-size: 1.5rem; }
.lock-panel h1 { margin-bottom: .5rem; font-size: 2rem; }
.lock-panel > p:not(.eyebrow) { color: var(--muted); }
.field { display: grid; gap: .38rem; margin: 1rem 0; }
.field label { font-size: .82rem; font-weight: 750; }
.field input, .field textarea, .field select, .rich-editor { width: 100%; padding: .72rem .8rem; color: var(--text); background: #0c0c0c; border: 1px solid #393939; border-radius: 9px; }
.field textarea { resize: vertical; }
.rich-toolbar { display: flex; flex-wrap: wrap; gap: .3rem; padding: .4rem; background: var(--surface-2); border: 1px solid #393939; border-bottom: 0; border-radius: 9px 9px 0 0; }
.rich-toolbar + .rich-editor { border-radius: 0 0 9px 9px; }
.rich-toolbar button { min-width: 36px; min-height: 32px; padding: .25rem .5rem; color: var(--muted); background: transparent; border: 0; border-radius: 6px; font-size: .8rem; }
.rich-toolbar button:hover { color: white; background: var(--surface-3); }
.rich-editor { min-height: 118px; max-height: 260px; overflow-y: auto; }
.rich-editor:empty::before { color: #666; content: attr(data-placeholder); pointer-events: none; }
.rich-editor p { margin: 0 0 .55rem; }
.rich-editor ul, .rich-editor ol { margin: .35rem 0; padding-left: 1.4rem; }
.field-hint { color: var(--muted); font-size: .75rem; }
.form-error { min-height: 1.5em; color: var(--red-light) !important; font-size: .84rem; }
.text-button { display: block; margin: 1rem auto 0; text-decoration: underline; }
.profile-button { margin-top: .65rem; }
.danger-text { color: #d27a82; }
.privacy-note { margin: 1.5rem 0 0; font-size: .72rem; text-align: center; }
dialog { width: min(calc(100% - 2rem), 540px); padding: 0; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow); }
dialog::backdrop { background: rgb(0 0 0 / 75%); backdrop-filter: blur(4px); }
.dialog-form { padding: 1.35rem; }
.dialog-form.compact { max-width: 430px; }
.dialog-header { justify-content: space-between; margin-bottom: 1.2rem; }
.dialog-actions { justify-content: flex-end; margin-top: 1.5rem; }
.field-grid > * { flex: 1; }
.boards-list { display: grid; gap: .55rem; margin: 1rem 0; }
.admin-dialog-form { width: 100%; }
#admin-dialog { width: min(calc(100% - 2rem), 780px); }
.admin-create-form { padding: 1rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; }
.admin-users-list { display: grid; gap: .65rem; margin-top: 1.25rem; }
.admin-user-row { display: grid; grid-template-columns: minmax(120px, 1fr) minmax(150px, .8fr) auto; align-items: center; gap: .75rem; padding: .8rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; }
.admin-user-row small { display: block; color: var(--muted); }
.admin-pin-reset { display: flex; gap: .4rem; }
.admin-pin-reset input { width: 125px; padding: .5rem .6rem; color: var(--text); background: #0c0c0c; border: 1px solid #393939; border-radius: 8px; }
.export-options { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; margin-top: 1.25rem; }
.share-users { display: grid; gap: .5rem; margin: 1rem 0; padding: 0; border: 0; }
.share-user { display: flex; align-items: center; gap: .7rem; padding: .7rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; }
.share-user input { width: 1.1rem; height: 1.1rem; accent-color: var(--red); }
.shared-badge { color: var(--red-light); font-size: .7rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.board-row { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .75rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; }
.board-row strong { display: block; }
.board-row small { color: var(--muted); }
.toast-region { position: fixed; right: 1rem; bottom: 1rem; z-index: 200; display: grid; gap: .5rem; }
.toast { max-width: 360px; padding: .75rem 1rem; color: white; background: #262626; border-left: 4px solid var(--red); border-radius: 8px; box-shadow: var(--shadow); animation: enter .2s ease-out; }
.noscript { position: fixed; inset: auto 1rem 1rem; z-index: 500; padding: 1rem; background: var(--red-dark); }
@keyframes enter { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 760px) {
  .app-header { grid-template-columns: 1fr auto; }
  .app-header nav { display: none; }
  .board-switcher select { max-width: 160px; }
  .header-actions .subtle { display: none; }
  .board-heading { align-items: center; }
  .board-heading h1 { font-size: 1.8rem; }
  .kanban-board { grid-auto-columns: minmax(85vw, 85vw); min-height: calc(100vh - 180px); }
  .column { max-height: calc(100vh - 185px); }
  .impersonation-banner { top: 66px; justify-content: space-between; }
  .admin-user-row { grid-template-columns: 1fr; }
}
@media (max-width: 420px) {
  .brand-mark { display: none; }
  .app-header { padding-inline: .75rem; }
  .board-heading { align-items: stretch; flex-direction: column; }
  .board-heading .button { width: 100%; }
  .field-grid { display: block; }
  .export-options { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; } }
