:root { --ink: #111111; --muted: #666666; --paper: #f4f4f4; --surface: #ffffff; --line: #d5d5d5; --red: #cc0000; --red-dark: #9d0000; --shadow: 0 4px 14px rgba(0, 0, 0, .12); }

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: Arial, Helvetica, sans-serif; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; border-top: 8px solid var(--red); background: var(--paper); }
.auth-panel { width: min(100%, 400px); padding: 28px; border: 1px solid var(--line); background: var(--surface); }
.auth-form-wrap { width: min(100%, 390px); }
.auth-form-wrap h1 { margin: 0 0 6px; font-size: 28px; }
.muted { color: var(--muted); }
form label { display: grid; gap: 7px; margin: 20px 0; font-size: 13px; font-weight: 600; }
.checkbox-label { grid-template-columns: auto 1fr; align-items: start; line-height: 1.4; }
.checkbox-label input { width: auto; margin: 2px 0 0; }
input, textarea, select { width: 100%; border: 1px solid #cfd5ce; border-radius: 6px; padding: 12px 13px; color: var(--ink); background: white; outline: none; }
textarea { resize: vertical; }
input:focus, textarea:focus, select:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(204,0,0,.12); }
.primary, .secondary { min-height: 42px; border-radius: 6px; padding: 0 17px; border: 1px solid transparent; font-weight: 700; }
.primary { color: white; background: var(--red); }.primary:hover { background: var(--red-dark); }
.secondary { color: var(--ink); background: white; border-color: var(--line); }
.wide { width: 100%; }
.text-button { margin-top: 18px; padding: 0; border: 0; color: var(--red-dark); background: none; font-weight: 700; }
.form-error { min-height: 18px; margin: 4px 0 10px; color: #a33f30; font-size: 13px; }

.app-shell { min-height: 100vh; }
.topbar { height: 60px; display: flex; align-items: center; justify-content: space-between; padding: 0 clamp(20px, 4vw, 56px); border-top: 6px solid var(--red); border-bottom: 1px solid var(--line); background: #111111; }
.brand { color: white; text-decoration: none; font-size: 16px; font-weight: 700; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.topbar-button { min-height: 34px; padding: 0 10px; border: 1px solid #555; border-radius: 4px; color: white; background: #222; font-size: 13px; font-weight: 700; }
.user-chip { color: white; font-size: 13px; font-weight: 700; }
.icon-button { display: grid; place-items: center; width: 38px; height: 38px; padding: 0; border: 1px solid var(--line); border-radius: 4px; color: var(--ink); background: white; }
.icon-button svg { width: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.workspace { padding: 42px clamp(20px, 4vw, 56px) 56px; }
.workspace-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.workspace-heading h1 { margin: 0 0 3px; font-size: 28px; }
.workspace-heading p:last-child { margin: 0; }
.board { display: grid; grid-template-columns: repeat(5, minmax(200px, 1fr)); gap: 14px; align-items: start; }
.board-column { min-height: 420px; border-top: 3px solid #111111; background: rgba(255,255,255,.55); }
.board-column[data-column="in_progress"] { border-color: #666666; }.board-column[data-column="under_review"] { border-color: #999999; }.board-column[data-column="ready_to_submit"] { border-color: var(--red); }.board-column[data-column="submitted"] { border-color: #111111; }
.board-column > header { display: flex; align-items: center; gap: 9px; min-height: 54px; padding: 0 14px; border-bottom: 1px solid var(--line); }
.board-column h2 { margin: 0; font-size: 14px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #111111; }.status-dot.progress { background: #666666; }.status-dot.review { background: #999999; }.status-dot.ready { background: var(--red); }.status-dot.submitted { background: #111111; }
.count { margin-left: auto; color: var(--muted); font-size: 12px; }
.task-list, .assignment-list { min-height: 360px; padding: 12px; }
.task-list.drag-over { background: rgba(204,0,0,.06); outline: 2px dashed rgba(204,0,0,.45); outline-offset: -4px; }
.assignment-group { margin-bottom: 13px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); box-shadow: 0 2px 8px rgba(20,39,31,.04); overflow: hidden; }
.assignment-head { padding: 13px 13px 10px; border-bottom: 1px solid #edf0ec; }
.assignment-title-row { display: flex; align-items: start; justify-content: space-between; gap: 8px; }
.assignment-head h3, .assignment-card h3 { margin: 0; font-size: 14px; line-height: 1.35; }
.assignment-meta { display: flex; gap: 9px; margin-top: 6px; color: var(--muted); font-size: 11px; }
.task-card { margin: 8px; padding: 11px; border: 1px solid #e5e9e4; border-left: 3px solid #a4afa7; border-radius: 5px; background: #fbfcfa; cursor: grab; }
.task-card:active { cursor: grabbing; }.task-card.dragging { opacity: .45; }
.task-card[data-status="in_progress"] { border-left-color: #666666; }
.task-title { margin: 8px 0 10px; font-size: 13px; font-weight: 600; line-height: 1.4; }
.task-controls, .item-actions { display: flex; gap: 7px; align-items: center; }
.bump-controls { display: flex; gap: 4px; }
.bump-controls button { display: grid; place-items: center; width: 25px; height: 22px; padding: 0; border: 1px solid var(--line); border-radius: 3px; color: var(--ink); background: white; font-weight: 700; }
.bump-controls button:disabled { color: #a8b0aa; background: #f0f2ef; cursor: default; }
.assignment-bumps { margin-bottom: 9px; }
.assignee-select { min-width: 0; padding: 6px 7px; border: 0; background: #edf1ed; font-size: 11px; }
.add-task-button, .edit-button, .delete-button, .onedrive-row button { border: 0; background: none; color: var(--muted); font-size: 12px; font-weight: 700; }
.edit-button { padding: 2px 3px; color: var(--red-dark); }
.add-task-button { color: var(--red-dark); }.delete-button { margin-left: auto; padding: 1px 4px; font-size: 16px; font-weight: 400; }
.onedrive-row button, .onedrive-row a { color: var(--red-dark); }
.assignment-footer { display: flex; align-items: center; justify-content: space-between; padding: 8px 11px; background: #f8faf7; }
.review-check { display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; }
.review-check input { width: auto; }
.onedrive-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 6px; margin-top: 9px; }
.onedrive-row input { min-width: 0; padding: 7px; font-size: 11px; }
.onedrive-row a { font-size: 11px; font-weight: 700; text-decoration: none; }
.empty-state { padding: 50px 18px; color: #929d96; text-align: center; font-size: 13px; line-height: 1.5; }
.assignment-card { margin-bottom: 12px; padding: 15px; border: 1px solid var(--line); border-left: 3px solid var(--red); border-radius: 7px; background: white; box-shadow: var(--shadow); }
.assignment-card p { margin: 8px 0 13px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.assignment-card footer { display: flex; justify-content: space-between; gap: 8px; align-items: center; font-size: 11px; color: var(--muted); }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.messages-dialog { width: min(820px, calc(100% - 32px)); }
.messages-shell { height: min(650px, calc(100vh - 48px)); }
.messages-heading { min-height: 60px; display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.messages-heading h2 { margin: 0; font-size: 16px; }
.conversation-panel { min-width: 0; display: grid; grid-template-rows: 60px 1fr auto; }
.message-list { min-height: 0; overflow-y: auto; padding: 16px; background: white; }
.message { width: fit-content; max-width: 76%; margin: 0 0 12px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 6px; background: #f4f4f4; }
.message.own { margin-left: auto; border-color: #e2bcbc; background: #fff0f0; }
.message header { margin-bottom: 4px; font-size: 11px; font-weight: 700; color: var(--red-dark); }
.message.unlinked header { color: var(--muted); }
.message p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; line-height: 1.4; }
.message time { display: block; margin-top: 5px; color: var(--muted); font-size: 10px; }
.message-status { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; text-transform: capitalize; }
.message-status button { padding: 0; border: 0; color: var(--red-dark); background: none; font-weight: 700; }
#message-form { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 8px; padding: 12px; border-top: 1px solid var(--line); }
#message-form textarea { resize: none; }

dialog { width: min(500px, calc(100% - 32px)); padding: 0; border: 0; border-radius: 8px; box-shadow: 0 28px 80px rgba(16,37,29,.28); }
dialog::backdrop { background: rgba(14,28,23,.56); backdrop-filter: blur(2px); }
dialog form { padding: 25px; }
.dialog-body { padding: 25px; }
.dialog-body code { display: block; padding: 12px; border: 1px solid var(--line); background: var(--paper); font-size: 16px; overflow-wrap: anywhere; }
.dialog-heading { display: flex; align-items: start; justify-content: space-between; }.dialog-heading h2 { margin: 5px 0 0; font-size: 24px; }
.dialog-actions { display: flex; justify-content: end; gap: 9px; margin-top: 24px; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 10; max-width: 360px; padding: 12px 16px; border-radius: 6px; color: white; background: #24372f; box-shadow: var(--shadow); opacity: 0; transform: translateY(10px); pointer-events: none; transition: .2s ease; }
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 1100px) {
  .board { grid-template-columns: repeat(2, minmax(240px, 1fr)); }
}
@media (max-width: 650px) {
  .board { grid-template-columns: 1fr; }.board-column { min-height: 220px; }.task-list, .assignment-list { min-height: 150px; }
}
@media (max-width: 520px) {
  .auth-panel { padding: 24px 20px; }.workspace { padding-top: 28px; }.workspace-heading { align-items: stretch; flex-direction: column; }.workspace-heading .primary { width: 100%; }.topbar { padding: 0 12px; }.user-chip { display: none; }
  .conversation-panel { min-height: 0; }.message { max-width: 88%; }
}