:root {
  --navy: #18193c;
  --navy-deep: #12132e;
  --blue: #0e83ff;
  --cyan: #62ecff;
  --blue-bg: #e8f4ff;
  --purple: #6b46c1;
  --purple-bg: #f0e9fa;
  --ink: #1c2430;
  --muted: #6b7380;
  --line: #e2e6eb;
  --line-strong: #cfd6de;
  --fill: #f5f7f9;
  --page: #eef1f5;
  --white: #fff;
  --green: #1f7a4d;
  --green-bg: #e8f6ee;
  --orange: #c05621;
  --orange-bg: #f8eadc;
  --red: #b42318;
  --red-bg: #f8e8e7;
  --yellow: #a16207;
  --yellow-bg: #f8f1d8;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px rgba(16, 24, 40, .06);
  --font: "DM Sans", "Segoe UI", system-ui, sans-serif;
  --control-h: 38px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--page);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { font-weight: 600; letter-spacing: -.02em; color: var(--navy); }
button, input, select, textarea { font: inherit; color: inherit; }
button { appearance: none; -webkit-appearance: none; }
input:not([type=checkbox]):not([type=radio]):not([type=file]),
select {
  appearance: none;
  -webkit-appearance: none;
}

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: var(--control-h);
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--ink);
  font-weight: 550;
  letter-spacing: .01em;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease;
}
button:hover { background: var(--fill); }
button:focus-visible, input:focus-visible, select:focus-visible, .editor:focus {
  outline: 2px solid rgba(14, 131, 255, .35);
  outline-offset: 1px;
}
.primary {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}
.primary:hover { background: #3aa8ff; border-color: #3aa8ff; color: #fff; }
.primary:active { background: var(--cyan); border-color: var(--cyan); color: var(--navy); }
.primary:disabled, #taskForm.is-saving button[type="submit"] {
  opacity: .75;
  cursor: wait;
}
#taskForm.is-saving { pointer-events: none; }
.ghost, .stack footer button:not(.primary):not(.danger), .detail footer button:not(.primary):not(.danger) {
  background: var(--white);
  color: var(--ink);
}
.danger, .table-actions .danger, button.danger {
  color: var(--red);
  border-color: #e8c4c0;
  background: var(--white);
}
.danger:hover, .table-actions .danger:hover { background: var(--red-bg); }
.icon {
  width: var(--control-h);
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 22px;
  color: var(--muted);
  line-height: 1;
}
.icon:hover { background: var(--fill); color: var(--ink); }

input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=color]),
select {
  height: var(--control-h);
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 0 12px;
  background: var(--white);
}
select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='%236b7380' d='M1.4 1.2 6 5.8l4.6-4.6 1.2 1.2L6 8.2 0.2 2.4z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}
input[type=file] {
  width: 100%;
  padding: 8px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--fill);
}
input[type=file]::file-selector-button {
  height: 30px;
  margin-right: 10px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--white);
  font: inherit;
  font-weight: 550;
  cursor: pointer;
}
.file-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 0;
}
.file-pills:empty { display: none; }
.file-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  height: 32px;
  padding: 0 6px 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--white);
  color: var(--navy);
  font-size: 13px;
  font-weight: 550;
}
.file-pill a {
  color: inherit;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 220px;
}
.file-pill a:hover { text-decoration: underline; }
.file-pill button {
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  flex-shrink: 0;
}
.file-pill button:hover { background: var(--red-bg); color: var(--red); }
#addFilesBtn { width: fit-content; }
fieldset {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 14px 12px;
}
legend {
  padding: 0 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: .02em;
  text-transform: uppercase;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 20px;
  background: var(--navy);
  color: var(--white);
  padding: 0 28px;
  height: 60px;
  min-height: 60px;
  max-height: 60px;
  overflow: hidden;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-size: 13px;
  color: #fff;
  text-decoration: none;
}
.brand-logo {
  height: 36px;
  width: auto;
  display: block;
  flex-shrink: 0;
}
.brand:hover { text-decoration: none; }
.topbar nav { display: flex; gap: 4px; flex: 1; }
.topbar nav a {
  padding: 8px 12px;
  border-radius: var(--radius);
  opacity: .78;
  color: #fff;
  font-weight: 500;
  font-size: 14px;
  text-decoration: none;
}
.topbar nav a.is-on, .topbar nav a:hover {
  background: rgba(255,255,255,.12);
  opacity: 1;
  text-decoration: none;
}
.who { display: flex; align-items: center; gap: 10px; font-size: 13px; flex-shrink: 0; white-space: nowrap; }
.who img, .who .avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.who .avatar-initials { font-size: 14px; }
.who button {
  height: 32px;
  padding: 0 10px;
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255,255,255,.28);
}
.who button:hover { background: rgba(255,255,255,.1); }

.wrap { padding: 24px 28px 48px; max-width: 1280px; margin: 0 auto; }
.wrap:has(.day-view), .wrap:has(.with-weekends) { max-width: none; }
.toolbar {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
}
.toolbar-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.toolbar-top .id-search { flex: 0 0 auto; }
.toolbar-top #newTaskBtn { margin-left: auto; }
.toolbar-main {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}
.toolbar-main .when { flex: 0 0 auto; }
.pagehead, .filters {
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 18px;
}
.filters { align-items: flex-end; }
.filters .primary { height: var(--control-h); }
.pagehead h1 { margin: 0; font-size: 22px; flex: 1; }
.pagehead .primary { white-space: nowrap; }
#weekendsBtn { white-space: nowrap; }
#weekendsBtn.is-on {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}
#weekendsBtn.is-on:hover { background: #3aa8ff; border-color: #3aa8ff; }
.when { display: flex; align-items: center; gap: 8px; }
.when strong { min-width: 140px; text-align: center; font-size: 15px; color: var(--navy); }
.when button { width: var(--control-h); padding: 0; }
.views {
  display: flex;
  background: var(--fill);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 3px;
  gap: 2px;
}
.views button {
  height: 32px;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: var(--muted);
}
.views button:hover { background: transparent; color: var(--ink); }
.views button.is-on {
  background: var(--white);
  color: var(--navy);
  box-shadow: 0 1px 2px rgba(16, 24, 40, .08);
}
.id-search {
  display: flex;
  align-items: center;
  gap: 6px;
}
.id-search input {
  width: 132px;
  min-width: 132px;
  padding: 0 10px;
  font-variant-numeric: tabular-nums;
}
.id-search button {
  width: var(--control-h);
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--navy);
}
.id-search button:hover { background: var(--fill); }
.toolbar #userSelect, .filters select, .inline-form input {
  width: auto;
  min-width: 180px;
}

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  box-shadow: var(--shadow);
  color: var(--muted);
  font-size: 13px;
}
.kpi b { display: block; font-size: 24px; font-weight: 650; letter-spacing: -.03em; color: var(--navy); line-height: 1.15; }
.kpi span { font-size: 13px; color: inherit; opacity: .85; }
.kpi.pending { background: var(--yellow-bg); color: var(--yellow); }
.kpi.pending b { color: var(--yellow); }
.kpi.late { background: var(--red-bg); color: var(--red); }
.kpi.late b { color: var(--red); }
.kpi.on_time { background: var(--green-bg); color: var(--green); }
.kpi.on_time b { color: var(--green); }
.kpi.delayed { background: var(--orange-bg); color: var(--orange); }
.kpi.delayed b { color: var(--orange); }
.kpi.delivered { background: var(--blue-bg); color: var(--blue); }
.kpi.delivered b { color: var(--blue); }
.kpi.adjustment { background: var(--purple-bg); color: var(--purple); }
.kpi.adjustment b { color: var(--purple); }
.kpi.tempo { background: var(--fill); color: var(--navy); }
.kpi.tempo b { color: var(--navy); }
.quote {
  background: var(--fill);
  border-radius: var(--radius);
  padding: 12px 14px;
  color: var(--muted);
  margin: 0;
}

.board { display: grid; gap: 12px; }
.week { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.week.with-weekends { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.day-view { display: grid; width: 100%; }
.day-view .day { min-height: 420px; padding: 18px 20px; }
.day {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  min-height: 280px;
  padding: 12px;
  box-shadow: var(--shadow);
}
.day.is-weekend, .month .cell.is-weekend { background: #f8fafc; }
.day h3 { margin: 0 0 10px; font-size: 13px; color: var(--muted); font-weight: 600; letter-spacing: 0; }
.day h3.day-title { cursor: pointer; }
.day h3.day-title:hover { color: var(--navy); }
.day-view .day h3 { font-size: 18px; color: var(--navy); margin-bottom: 16px; }
.empty-day { color: var(--muted); margin: 0 0 12px; }

.card {
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 8px;
  cursor: grab;
  background: var(--white);
  color: var(--ink);
  border: 1px solid var(--line);
  border-top-width: 5px;
}
.card.pending { border-top-color: var(--yellow); }
.card.late { border-top-color: var(--red); }
.card.delivered { border-top-color: var(--blue); }
.card.adjustment { border-top-color: var(--purple); }
.card.completed { border-top-color: var(--green); }
.card.completed.late-done { border-top-color: var(--orange); }
.card small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.task-code {
  display: block;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .04em;
  color: var(--muted);
  margin: 2px 0 0;
}

.day-task {
  cursor: pointer;
  padding: 16px 18px;
  margin-bottom: 12px;
  background: var(--white);
  color: var(--ink);
  border: 1px solid var(--line);
  border-top-width: 5px;
  box-shadow: none;
}
.day-view .card.day-task {
  background: var(--white);
  color: var(--ink);
  border: 1px solid var(--line);
  border-top-width: 5px;
}
.day-view .card.day-task.pending { border-top-color: var(--yellow); }
.day-view .card.day-task.late { border-top-color: var(--red); }
.day-view .card.day-task.delivered { border-top-color: var(--blue); }
.day-view .card.day-task.adjustment { border-top-color: var(--purple); }
.day-view .card.day-task.completed { border-top-color: var(--green); }
.day-view .card.day-task.completed.late-done { border-top-color: var(--orange); }
.day-task header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.day-task h4 { margin: 0; font-size: 17px; }
.day-task dl {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px 20px;
  margin: 0 0 12px;
}
.day-task dl div { min-width: 0; }
.day-task dt { font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.day-task dd { margin: 2px 0 0; font-size: 14px; }
.day-task-desc {
  background: var(--fill);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 14px;
  line-height: 1.5;
}
.day-task-desc img { max-width: 100%; height: auto; }
.day-task-files { display: flex; flex-wrap: wrap; gap: 8px 14px; margin: 10px 0 0; }

.add-day {
  width: 100%;
  border-style: dashed;
  background: transparent;
  color: var(--muted);
  font-weight: 500;
}
.add-day:hover { background: var(--fill); color: var(--ink); }
.user-block { margin: 0 0 14px; display: grid; gap: 8px; }
.user-block-name {
  margin: 0;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line-strong);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--navy);
}
.day-view .user-block { margin-bottom: 20px; gap: 12px; }
.day-view .user-block-name { font-size: 13px; }

.month { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.month.with-weekends { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.month .cell {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  min-height: 108px;
  padding: 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  box-shadow: var(--shadow);
}
.month .cell.is-weekend { background: #f8fafc; }
.month .cell:hover { border-color: var(--line-strong); }
.month .cell b { display: block; font-size: 18px; line-height: 1.1; color: var(--navy); }
.month .cell small { display: block; color: var(--muted); font-size: 12px; line-height: 1.25; }
.month .hd {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  min-height: auto;
  cursor: default;
  justify-content: center;
  align-items: center;
  text-align: center;
  box-shadow: none;
  background: transparent;
  border: 0;
  padding: 4px 8px;
}

.login-body {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 24px 24px 20vh;
  background: #041a44;
  overflow: hidden;
  font-family: var(--font);
}
.login-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  pointer-events: none;
}
.login-card {
  position: relative;
  z-index: 1;
  width: 380px;
  background: var(--white);
  padding: 28px;
  border-radius: 16px;
  display: grid;
  gap: 14px;
  box-shadow: var(--shadow);
}
.login-card h1 { margin: 0 0 4px; color: var(--navy); font-size: 22px; }
.login-card p { margin: 0; color: var(--muted); }
.login-card > label, .stack label:not(.choice-item):not(.inline):not(.day-chip), .stack .field, .filters label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 550;
  color: var(--ink);
}
.choice {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px 12px;
  margin: 0;
}
.choice-row { display: flex; gap: 8px; }
.choice-row.years {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}
.choice-row.years .choice-item {
  flex: none;
  min-width: 0;
  padding: 0 4px;
  gap: 4px;
  font-size: 12px;
}
.stack .choice-item, .choice-item {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: var(--control-h);
  margin: 0;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--fill);
  cursor: pointer;
  font-size: 14px;
  font-weight: 550;
  color: var(--ink);
}
.choice-item:hover { background: #eceff3; }
.choice-item:has(input:checked) {
  background: var(--white);
  border-color: var(--blue);
  color: var(--navy);
  box-shadow: 0 0 0 3px rgba(14, 131, 255, .15);
}
.choice-item input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--blue);
  flex: none;
}
#scheduleBlock:not([hidden]), #timedFields:not([hidden]), #reviewerField:not([hidden]), #rescheduleField:not([hidden]), #recurrenceYearFields:not([hidden]), #editScopeField:not([hidden]), #monthlyFields:not([hidden]), #monthlyNthFields:not([hidden]) { display: grid; gap: 14px; }
#rescheduleField:not([hidden]) .reschedule-days {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 10px;
  align-items: stretch;
}
.choice-row.wrap { flex-wrap: wrap; }
#deleteModal { width: min(480px, 92vw); }
#deleteModal p { margin: 0; color: var(--ink); line-height: 1.45; }
#rescheduleModal { width: min(420px, 92vw); }
#rescheduleModal p { margin: 0; color: var(--ink); line-height: 1.45; }
#rescheduleModal button:disabled { opacity: .45; cursor: not-allowed; }
.reschedule-cal {
  display: grid;
  gap: 10px;
  padding: 12px;
  background: var(--fill);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.reschedule-cal .when { justify-content: space-between; }
.reschedule-cal .when strong {
  min-width: 0;
  flex: 1;
  text-transform: capitalize;
}
.reschedule-weekdays,
.reschedule-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}
.reschedule-weekdays span {
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 4px 0;
}
.reschedule-day {
  height: 38px;
  padding: 0;
  border-radius: var(--radius);
  background: var(--white);
  border-color: var(--line);
  font-weight: 600;
  color: var(--navy);
}
.reschedule-day:hover:not(:disabled) {
  border-color: var(--blue);
  background: var(--blue-bg);
}
.reschedule-day.is-selected {
  background: var(--white);
  border-color: var(--blue);
  color: var(--navy);
  box-shadow: 0 0 0 3px rgba(14, 131, 255, .15);
}
.reschedule-day:disabled {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
  opacity: .38;
  cursor: not-allowed;
  box-shadow: none;
}
.reschedule-day.is-empty {
  visibility: hidden;
  pointer-events: none;
}
.error { color: var(--red); font-size: 13px; }

.modal {
  border: 0;
  border-radius: 16px;
  padding: 0;
  width: min(560px, 92vw);
  box-shadow: 0 24px 64px rgba(16, 24, 40, .2);
  font-family: var(--font);
}
.modal::backdrop { background: rgba(15, 23, 42, .48); }
.stack { display: grid; gap: 12px; padding: 20px; }
.stack header, .stack footer, .detail header, .detail footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.stack h2, .detail h2 { margin: 0; font-size: 18px; }
.inline { display: inline-flex; gap: 8px; margin-right: 14px; align-items: center; font-weight: 500; }
.inline input { width: auto; height: auto; }

.editor {
  min-height: 96px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 10px 12px;
  background: var(--white);
  cursor: text;
  outline: none;
  white-space: pre-wrap;
  word-break: break-word;
  font-weight: 400;
}
.editor-bar { display: flex; gap: 8px; margin-bottom: 8px; align-items: center; }
.editor-bar button { width: 36px; padding: 0; }
.color-label { font-size: 12px; color: var(--muted); font-weight: 600; margin-left: 2px; }
.color-swatches { display: flex; gap: 6px; }
.color-swatches button {
  width: 20px;
  height: 20px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,.12);
}

.table-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: transparent;
}
.table th, .table td {
  border-bottom: 1px solid var(--line);
  padding: 16px 18px;
  text-align: left;
  vertical-align: middle;
}
.table th {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--fill);
}
.table td:first-child,
.table th:first-child { padding-left: 20px; }
.table td:last-child,
.table th:last-child {
  padding-right: 20px;
  width: 1%;
  white-space: nowrap;
}
.table tbody tr:last-child td { border-bottom: 0; padding-bottom: 20px; }
.table-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  align-items: center;
  white-space: nowrap;
}
.table-actions button { height: 32px; padding: 0 12px; font-size: 13px; }
.inline-form { display: flex; gap: 8px; margin-left: auto; align-items: center; }
.avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.table .avatar { width: 52px; height: 52px; }
.table .avatar-initials { font-size: 18px; }
.avatar-initials {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #9aa3ad;
  color: #fff;
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0;
}
.toast {
  position: fixed;
  inset: auto 20px 20px auto;
  margin: 0;
  border: 0;
  background: var(--navy);
  color: #fff;
  padding: 12px 16px;
  border-radius: var(--radius);
  box-shadow: 0 12px 40px rgba(16, 24, 40, .28);
  font-size: 14px;
  max-width: min(420px, calc(100vw - 40px));
  z-index: 2147483647;
}
.card-form {
  max-width: 520px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.hint { color: var(--muted); font-size: 13px; margin: 0; font-weight: 400; }
.recurrence-extra:not([hidden]) {
  display: grid;
  gap: 10px;
  padding: 14px;
  background: var(--fill);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.recurrence-extra.split:not([hidden]) {
  grid-template-columns: 1fr 1fr;
  align-items: end;
  gap: 12px;
}
.recurrence-extra.split .span-2 { grid-column: 1 / -1; }
.recurrence-label { font-size: 13px; font-weight: 550; color: var(--ink); }
.weekdays { display: flex; gap: 8px; flex-wrap: wrap; }
.stack .day-chip, .day-chip {
  display: inline-flex;
  flex-direction: row;
  gap: 8px;
  align-items: center;
  justify-content: center;
  font-weight: 550;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--white);
  cursor: pointer;
  font-size: 13px;
}
.day-chip:has(input:checked) {
  border-color: var(--blue);
  color: var(--navy);
  box-shadow: 0 0 0 3px rgba(14, 131, 255, .15);
}
.day-chip input { width: 16px; height: 16px; margin: 0; accent-color: var(--blue); }
.detail { padding: 20px; display: grid; gap: 16px; }
.detail-head { align-items: flex-start; }
.detail-head > div:first-child { min-width: 0; }
.detail-head-right { display: flex; align-items: flex-start; gap: 8px; flex-shrink: 0; }
.detail-head .task-code { margin: 4px 0 0; font-size: 11px; color: var(--muted); }
.detail-head .badge { white-space: nowrap; margin-top: 2px; }
.detail footer { flex-wrap: wrap; }
.detail footer .danger { margin-left: auto; }
.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 16px;
  margin: 0;
}
.detail-grid div { min-width: 0; }
.detail-grid .span-2 { grid-column: 1 / -1; }
.detail-grid dt {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
}
.detail-grid dd { margin: 2px 0 0; font-size: 14px; }
.detail-block h3 {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
}
.detail-desc {
  background: var(--fill);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 14px;
  line-height: 1.5;
}
.detail-desc p { margin: 0; }
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  width: max-content;
}
.badge.pending { background: var(--yellow-bg); color: var(--yellow); }
.badge.late { background: var(--red-bg); color: var(--red); }
.badge.delivered { background: var(--blue-bg); color: var(--blue); }
.badge.adjustment { background: var(--purple-bg); color: var(--purple); }
.badge.completed { background: var(--green-bg); color: var(--green); }
.badge.completed.late-done { background: var(--orange-bg); color: var(--orange); }

#detailModal { width: min(640px, 92vw); }

@media (max-width: 900px) {
  .kpis, .week, .month { grid-template-columns: 1fr; }
  .topbar { height: auto; flex-wrap: wrap; padding: 12px 16px; }
  .wrap { padding: 16px; }
  .detail-grid { grid-template-columns: 1fr; }
}
