:root {
  color-scheme: dark;
  --ink: #0b0d10;
  --panel: #15181d;
  --panel-raised: #1c2027;
  --line: #2b3039;
  --paper: #f4f0e8;
  --muted: #999eaa;
  --violet: #8b5cf6;
  --violet-soft: #b7a1ff;
  --danger: #ff7a90;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--ink); color: var(--paper); }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--violet-soft); outline-offset: 2px; }
svg { display: block; width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }

.login-shell { min-height: 100dvh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 50% -15%, #302653 0, transparent 35%), var(--ink); }
.login-card { width: min(100%, 390px); padding: 30px; border: 1px solid var(--line); background: rgba(21, 24, 29, .92); box-shadow: 0 28px 90px #0008; }
.brand { width: 178px; height: auto; display: block; object-fit: contain; }
.login-card .brand { margin-bottom: 54px; }
.eyebrow { margin: 0 0 8px; color: var(--violet-soft); font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 9px; font-size: 30px; letter-spacing: -.05em; }
.muted { color: var(--muted); }
.field { display: grid; gap: 7px; margin-top: 18px; color: #c6c9d0; font-size: 13px; font-weight: 700; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 12px 13px; color: var(--paper); background: #0e1014; }
textarea { resize: vertical; line-height: 1.5; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 8px; padding: 12px 16px; color: #110d1e; background: var(--violet); font-weight: 850; }
.button:hover { background: #a785ff; }
.button.ghost { border: 1px solid var(--line); color: var(--paper); background: transparent; }
.button.danger { color: white; background: #a93448; }
.login-card .button { width: 100%; margin-top: 24px; }
.error { min-height: 20px; margin: 14px 0 0; color: var(--danger); font-size: 13px; }

.app-shell { display: grid; min-height: 100dvh; grid-template-columns: 246px minmax(0, 1fr); }
.sidebar { display: flex; position: sticky; top: 0; height: 100dvh; flex-direction: column; gap: 26px; padding: 28px 16px; border-right: 1px solid var(--line); background: #0e1014; }
.sidebar .brand { width: 136px; margin: 0 10px; }
.nav { display: grid; gap: 5px; }
.nav button, .bottom-nav button { border: 0; color: var(--muted); background: transparent; }
.nav button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 12px; border-radius: 7px; text-align: left; }
.nav button:hover, .nav button.active { color: var(--paper); background: var(--panel); }
.nav-icon { display: grid; width: 18px; place-items: center; color: var(--violet-soft); font-size: 17px; text-align: center; }
.nav-icon svg { width: 18px; height: 18px; }
.side-footer { margin-top: auto; padding: 12px; color: var(--muted); font-size: 12px; }
.side-footer button { padding: 0; border: 0; color: var(--paper); background: transparent; font-weight: 700; }

.main { width: min(1320px, 100%); margin: 0 auto; padding: 34px 40px 56px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 30px; }
.page-head h1 { margin: 0; }
.page-head p { margin: 6px 0 0; }
.utility { display: flex; align-items: center; gap: 10px; }
.round-button { display: inline-grid; width: 40px; height: 40px; place-items: center; border: 1px solid var(--line); border-radius: 50%; color: var(--paper); background: var(--panel); }
.round-button svg { width: 18px; height: 18px; }
.mobile-account { display: none; }
.timecode { color: var(--violet-soft); font: 700 11px ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .08em; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 32px 0 14px; }
.section-title h2 { margin: 0; font-size: 15px; letter-spacing: -.01em; }
.task-list, .file-list { display: grid; gap: 8px; }
.task-card, .file-row, .project-card { border: 1px solid var(--line); background: var(--panel); }
.task-card { display: grid; width: 100%; grid-template-columns: 4px minmax(0, 1fr) 48px; gap: 0; align-items: stretch; min-height: 66px; overflow: hidden; color: var(--paper); text-align: left; }
.task-open { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 13px; align-items: center; min-width: 0; padding: 0 13px; border: 0; color: inherit; background: transparent; text-align: left; }
.task-open:hover { background: var(--panel-raised); }
.task-complete { display: grid; place-items: center; border: 0; border-left: 1px solid var(--line); color: var(--muted); background: transparent; }
.task-complete:hover { color: var(--violet-soft); background: #211d33; }
.task-complete.is-done { color: #120d20; background: var(--violet); }
.task-complete svg { width: 20px; height: 20px; stroke-width: 2.5; }
.task-card.completed .task-open { opacity: .62; }
.task-card.completed .task-copy strong { text-decoration: line-through; }
.task-card .bar { align-self: stretch; background: var(--violet); }
.task-copy { padding: 11px 0; min-width: 0; }
.task-copy strong, .file-row strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-copy small, .file-row small { display: block; margin-top: 4px; color: var(--muted); }
.due { padding-right: 15px; color: var(--violet-soft); font-size: 12px; font-weight: 750; white-space: nowrap; }
.empty { padding: 31px 22px; border: 1px dashed var(--line); color: var(--muted); background: #101217; text-align: center; }

.calendar { overflow: hidden; border: 1px solid var(--line); background: var(--panel); }
.calendar-filters, .file-toolbar { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 0 0 14px; }
.calendar-filters label, .file-toolbar label { display: grid; gap: 6px; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.calendar-filters select, .file-toolbar input, .file-toolbar select { padding: 10px 11px; font-size: 13px; font-weight: 500; letter-spacing: normal; text-transform: none; }
.calendar-toolbar { display: flex; align-items: center; justify-content: space-between; padding: 15px; border-bottom: 1px solid var(--line); }
.calendar-toolbar strong { font-size: 16px; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(88px, 1fr)); overflow-x: auto; }
.weekday { padding: 10px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .1em; text-align: right; text-transform: uppercase; }
.day { min-height: 122px; padding: 9px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.day:nth-child(7n) { border-right: 0; }
.day.outside { background: #111318; color: #5b606a; }
.day.today .day-number { display: grid; width: 25px; height: 25px; place-items: center; border-radius: 50%; color: white; background: var(--violet); }
.day-number { margin-left: auto; width: max-content; color: var(--muted); font-size: 12px; font-weight: 800; }
.event { display: block; overflow: hidden; margin-top: 8px; border-left: 3px solid var(--violet); padding: 4px 5px; color: var(--paper); background: #25223a; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }

.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 12px; }
.project-card { position: relative; display: block; min-height: 156px; padding: 17px; overflow: hidden; border-top: 3px solid var(--project-color, var(--violet)); color: var(--paper); text-align: left; transition: border-color .16s ease, transform .16s ease, background .16s ease; }
.project-card:hover { border-color: var(--violet-soft); background: var(--panel-raised); transform: translateY(-2px); }
.project-card h2 { margin: 34px 0 7px; font-size: 18px; letter-spacing: -.03em; }
.project-card p { display: -webkit-box; overflow: hidden; color: var(--muted); font-size: 13px; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.project-open { display: inline-flex; position: absolute; right: 16px; bottom: 15px; align-items: center; gap: 7px; color: var(--violet-soft); font-size: 11px; font-weight: 800; }
.project-open svg { width: 14px; height: 14px; }
.back-link { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 17px; padding: 0; border: 0; color: var(--violet-soft); background: transparent; font-size: 12px; font-weight: 800; }
.back-link svg { width: 15px; height: 15px; }
.project-summary { display: flex; align-items: center; gap: 15px; margin: -10px 0 25px; padding: 13px 15px; border: 1px solid var(--line); color: var(--muted); background: var(--panel); font-size: 13px; }
.project-swatch { width: 10px; height: 10px; border-radius: 50%; box-shadow: 0 0 16px currentColor; }
.production-section { margin-top: 30px; }
.production-section:first-of-type { margin-top: 0; }
.production-section-head { display: flex; align-items: end; justify-content: space-between; gap: 14px; margin-bottom: 11px; padding: 0 2px 10px; border-bottom: 1px solid #3b3551; }
.production-section-head h2 { margin: 3px 0 0; font-size: 18px; letter-spacing: -.035em; }
.section-index { color: var(--violet-soft); font: 800 10px ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .13em; }
.section-actions { display: flex; align-items: center; gap: 9px; }
.section-add-task, .section-menu, .section-order { border: 0; color: var(--violet-soft); background: transparent; font-size: 12px; font-weight: 850; }
.section-add-task:hover, .section-menu:hover, .section-order:hover { color: var(--paper); }
.section-order { padding: 2px 3px; color: var(--muted); font-size: 16px; line-height: 1; }
.section-order:disabled { cursor: default; opacity: .25; }
.section-menu { min-width: 28px; padding: 2px 0 6px; color: var(--muted); font-size: 18px; line-height: .5; }
.section-empty { padding: 17px; border: 1px dashed #3d3a47; color: var(--muted); background: #101217; font-size: 13px; }
.unassigned-section .production-section-head { border-color: var(--line); }
.task-editor { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 18px; }
.task-main, .task-controls { padding: 20px; border: 1px solid var(--line); background: var(--panel); }
.task-main .field:first-child, .task-controls .field:first-child { margin-top: 0; }
.task-dates { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.done-switch { display: flex; align-items: center; gap: 9px; margin-bottom: 22px; padding: 12px; border: 1px solid #4e3f83; color: var(--violet-soft); background: #211d33; font-size: 13px; font-weight: 800; }
.done-switch input { width: 17px; height: 17px; accent-color: var(--violet); }
.task-controls output { float: right; color: var(--violet-soft); }
.task-controls .button { width: 100%; margin-top: 8px; }
.advanced-link { text-decoration: none; }
.small-action { width: 100%; margin-top: 9px; padding: 9px 0; border: 0; color: var(--violet-soft); background: transparent; font-size: 12px; font-weight: 800; text-align: left; }
.small-action:hover { color: var(--paper); }
.danger-action { display: flex; align-items: center; gap: 7px; margin-top: 22px; border-top: 1px solid var(--line); padding-top: 17px; color: #ec7e91; }
.danger-action:hover { color: #ffadb9; }
.danger-action svg { width: 15px; height: 15px; }
.task-extras { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-top: 18px; }
.extra-card { padding: 20px; border: 1px solid var(--line); background: var(--panel); }
.extra-card h2 { margin-bottom: 14px; font-size: 15px; }
.chips { display: flex; min-height: 25px; flex-wrap: wrap; gap: 7px; align-items: center; }
.chip { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--chip); border-radius: 999px; padding: 4px 8px; color: var(--paper); background: color-mix(in srgb, var(--chip) 18%, var(--panel)); font-size: 12px; }
.chip button { display: grid; width: 15px; height: 15px; place-items: center; padding: 0; border: 0; border-radius: 50%; color: var(--paper); background: transparent; font-size: 15px; line-height: 1; }
.inline-form, #attachment-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; margin-top: 14px; }
.compact-form { grid-template-columns: minmax(0, 1fr) 42px auto; }
.compact-form input[type="color"] { min-height: 42px; padding: 3px; }
.relation-form { grid-template-columns: minmax(0, 1fr) minmax(110px, .7fr) auto; }
.relations { display: grid; gap: 7px; }
.relation-row { display: flex; align-items: center; justify-content: space-between; gap: 9px; padding: 8px 10px; border-left: 2px solid var(--violet); color: var(--paper); background: #101217; font-size: 12px; }
.relation-row button { border: 0; color: var(--muted); background: transparent; font-size: 18px; }
.inline-form .button, #attachment-form .button, #comment-form .button { margin: 0; }
.upload-label { display: block; overflow: hidden; border: 1px dashed var(--line); padding: 10px; color: var(--muted); font-size: 12px; text-align: center; }
.upload-label input { display: none; }
.attachments { display: grid; gap: 7px; }
.attachment-row { display: grid; grid-template-columns: 34px 1fr; align-items: center; gap: 9px; width: 100%; padding: 7px; border: 1px solid var(--line); color: var(--paper); background: #101217; text-align: left; }
.attachment-row:hover { border-color: #565d6a; }
.attachment-row .file-icon { width: 30px; height: 30px; font-size: 10px; }
.extra-comments { grid-column: 1 / -1; }
.comments { display: grid; gap: 10px; margin-bottom: 14px; }
.comment { border-left: 2px solid var(--violet); padding: 8px 11px; background: #101217; }
.comment strong { color: var(--violet-soft); font-size: 12px; }
.comment p { margin: 5px 0 0; color: var(--paper); font-size: 13px; white-space: pre-wrap; }
#comment-form { display: grid; gap: 9px; }
#comment-form .button { justify-self: end; }
.account-sheet { width: min(420px, 100%); }
.account-sheet .button { width: 100%; margin-top: 24px; }
.file-row { display: grid; width: 100%; grid-template-columns: 38px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px; color: var(--paper); text-align: left; }
.file-download:hover { border-color: #565d6a; background: var(--panel-raised); }
.file-icon { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 7px; color: var(--violet-soft); background: #2a2541; font-weight: 900; }
.file-row .project-chip { border: 1px solid var(--line); border-radius: 999px; padding: 5px 8px; color: var(--muted); font-size: 11px; }
.file-row-actions { display: flex; gap: 7px; align-items: center; }
.file-row-actions button { border: 1px solid var(--line); border-radius: 7px; padding: 7px 9px; color: var(--violet-soft); background: #101217; font-size: 11px; font-weight: 800; }
.file-row-actions button:hover { border-color: var(--violet); color: var(--paper); }
.file-count { margin: -4px 0 12px; font-size: 12px; }
.preview-backdrop { position: fixed; z-index: 40; inset: 0; display: grid; place-items: center; padding: 20px; background: #000c; }
.file-preview-sheet { display: grid; width: min(100%, 1000px); max-height: calc(100dvh - 40px); overflow: hidden; border: 1px solid var(--line); background: #111319; box-shadow: 0 30px 100px #000b; }
.preview-head { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 12px 15px; border-bottom: 1px solid var(--line); }
.preview-head strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-preview-sheet img { display: block; max-width: 100%; max-height: calc(100dvh - 110px); margin: 0 auto; object-fit: contain; }
.file-preview-sheet iframe { width: 100%; height: min(75dvh, 760px); border: 0; background: white; }

.bottom-nav { display: none; }
.sheet-backdrop { position: fixed; z-index: 20; inset: 0; display: grid; align-items: end; background: #0009; }
.sheet { width: min(700px, 100%); max-height: 90dvh; margin: 0 auto; overflow: auto; border: 1px solid var(--line); border-bottom: 0; border-radius: 18px 18px 0 0; padding: 24px; background: #14171c; box-shadow: 0 -20px 80px #0008; }
.sheet-head { display: flex; justify-content: space-between; gap: 18px; }
.sheet h2 { margin-bottom: 6px; }
.choice-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 22px 0; }
.choice-row button { padding: 13px 8px; border: 1px solid var(--line); border-radius: 8px; color: var(--paper); background: var(--panel); font-size: 13px; font-weight: 800; }
.choice-row button.active { border-color: var(--violet); color: var(--violet-soft); background: #211d33; }
.sheet .button { margin-top: 22px; }
.sheet .actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 22px; }
.section-sheet { width: min(560px, 100%); }
.section-help { margin: 12px 0 0; font-size: 12px; line-height: 1.5; }
.section-danger-zone { margin-top: 28px; border-top: 1px solid var(--line); padding-top: 20px; }
.section-danger-zone h3 { margin: 0 0 6px; color: var(--danger); font-size: 14px; }
.section-danger-zone p { margin-bottom: 0; font-size: 12px; }
.delete-sheet, .project-actions-sheet { width: min(500px, 100%); }
.delete-copy { margin: 20px 0 0; color: #e2c4ca; line-height: 1.5; }
.delete-sheet .field strong { color: #ffadb9; letter-spacing: .08em; }
.delete-sheet .button.danger:disabled { cursor: not-allowed; opacity: .45; }
.project-actions-sheet .button { width: 100%; }
.hidden { display: none !important; }

@media (max-width: 720px) {
  .app-shell { display: block; padding-bottom: calc(67px + env(safe-area-inset-bottom)); }
  .sidebar { display: none; }
  .main { padding: 24px 17px 30px; }
  .page-head { align-items: flex-start; margin-bottom: 24px; }
  .page-head h1 { font-size: 27px; }
  .page-head .button { display: none; }
  .page-head .mobile-account { display: inline-grid; }
  .page-head .project-actions-button { display: inline-grid; }
  .bottom-nav { position: fixed; z-index: 15; right: 0; bottom: 0; left: 0; display: grid; grid-template-columns: 1fr 1fr 62px 1fr 1fr; align-items: stretch; height: calc(67px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); border-top: 1px solid var(--line); background: #101217f2; backdrop-filter: blur(16px); }
  .bottom-nav button { display: grid; place-items: center; gap: 2px; padding: 7px 2px; font-size: 10px; }
  .bottom-nav .bottom-icon { display: grid; height: 18px; place-items: center; color: var(--violet-soft); font-size: 18px; line-height: 18px; }
  .bottom-nav .bottom-icon svg { width: 18px; height: 18px; }
  .bottom-nav button.active { color: var(--paper); }
  .bottom-nav .fab-wrap { display: grid; place-items: center; }
  .bottom-nav .fab { display: grid; width: 46px; height: 46px; margin-top: -23px; place-items: center; border: 5px solid var(--ink); border-radius: 50%; color: #130d23; background: var(--violet); font-weight: 400; }
  .bottom-nav .fab svg { width: 22px; height: 22px; stroke-width: 2.3; }
  .calendar { margin: 0 -1px; }
  .calendar-grid { grid-template-columns: repeat(7, minmax(48px, 1fr)); }
  .weekday { padding: 8px 4px; font-size: 8px; }
  .day { min-height: 86px; padding: 5px; }
  .event { margin-top: 4px; padding: 3px; font-size: 9px; }
  .project-grid { grid-template-columns: 1fr; }
  .project-summary { flex-wrap: wrap; margin-top: -10px; }
  .project-head .section-add { display: inline-flex; padding: 10px 11px; font-size: 12px; }
  .production-section { margin-top: 27px; }
  .production-section-head { align-items: flex-start; }
  .production-section-head h2 { font-size: 17px; }
  .section-actions { gap: 7px; padding-top: 3px; }
  .section-actions .timecode { display: none; }
  .choice-row { grid-template-columns: repeat(2, 1fr); }
  .task-editor { grid-template-columns: 1fr; }
  .task-extras { grid-template-columns: 1fr; }
  .calendar-filters, .file-toolbar { grid-template-columns: 1fr; }
  .relation-form { grid-template-columns: 1fr; }
  .task-dates { grid-template-columns: 1fr; }
  .task-head .advanced-link { display: inline-flex; }
  .file-row { grid-template-columns: 35px minmax(0, 1fr); }
  .file-row-actions { grid-column: 2; justify-content: flex-start; }
}
