:root {
  --ink: #1e2a32;
  --muted: #62717d;
  --line: #d8e0e5;
  --panel: #ffffff;
  --canvas: #f5f7f8;
  --soft: #eef3fb;
  --teal: #183e8b;
  --teal-dark: #102d67;
  --coral: #d85f46;
  --gold: #c58b1b;
  --green: #2f855a;
  --red: #b42318;
  --blue: #183e8b;
  --shadow: 0 12px 32px rgba(30, 42, 50, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family:
    "Anuphan", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  line-height: 1.4;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 460px) minmax(0, 1fr);
}

.login-panel {
  background: var(--panel);
  padding: clamp(28px, 5vw, 56px);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 28px;
}

.login-visual {
  padding: clamp(20px, 3.2vw, 38px);
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0) 34%),
    linear-gradient(160deg, #183e8b 0%, #102d67 62%, #0b1f4d 100%);
}

.login-visual::before {
  content: "";
  position: absolute;
  inset: clamp(18px, 3vw, 36px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  pointer-events: none;
}

.login-visual-logo {
  position: relative;
  z-index: 1;
  width: clamp(260px, 34vw, 460px);
  max-width: 72%;
  height: auto;
  filter: drop-shadow(0 18px 34px rgba(0, 0, 0, 0.24));
}

.handoff-hero,
.destination-grid,
.handoff-flow {
  max-width: 820px;
}

.handoff-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(160px, 190px);
  gap: 14px;
  align-items: start;
}

.handoff-hero h2 {
  margin-bottom: 8px;
  font-size: clamp(28px, 3vw, 38px);
  line-height: 1.08;
}

.handoff-hero .muted {
  max-width: 640px;
  font-size: clamp(15px, 1.45vw, 18px);
  line-height: 1.45;
}

.handoff-status {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow);
  display: grid;
  gap: 6px;
}

.handoff-status strong,
.handoff-status span {
  display: block;
}

.handoff-status strong {
  font-size: 13px;
}

.handoff-status span:last-child {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.handoff-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(47, 133, 90, 0.14);
}

.destination-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.brand-mark {
  display: block;
  width: 170px;
  max-width: 100%;
  height: auto;
  object-fit: contain;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--teal);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.06em;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 12px;
  font-size: clamp(32px, 5vw, 56px);
  line-height: 1;
}

h2 {
  font-size: 22px;
  margin-bottom: 8px;
}

h3 {
  font-size: 16px;
  margin-bottom: 8px;
}

.muted {
  color: var(--muted);
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.client-name-picker {
  display: grid;
  gap: 8px;
}

.client-name-control {
  display: grid;
  gap: 8px;
}

.client-name-mode {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.client-name-mode-option {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #f7fafb;
  color: #33424d;
  font-weight: 700;
  cursor: pointer;
}

.client-name-mode-option:has(input:checked) {
  border-color: var(--blue);
  background: #edf4ff;
  color: var(--blue);
}

.client-name-mode-option input {
  width: auto;
}

.client-name-mode-option:has(input:disabled) {
  cursor: not-allowed;
  opacity: 0.55;
}

.field label,
.checklist-title {
  font-size: 12px;
  font-weight: 700;
  color: #40505b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.field-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.field-label-row .inline-link {
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.required-star {
  color: var(--red);
  margin-left: 4px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  border-radius: 8px;
  padding: 10px 12px;
  outline: none;
}

textarea {
  min-height: 88px;
  resize: vertical;
}

fieldset.plain-fieldset {
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(24, 62, 139, 0.15);
}

.btn {
  border: 0;
  border-radius: 8px;
  background: var(--teal);
  color: white;
  min-height: 40px;
  padding: 10px 14px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  white-space: nowrap;
}

.btn:hover {
  background: var(--teal-dark);
}

.btn.secondary {
  background: #e8eef9;
  color: var(--ink);
}

.btn.secondary:hover {
  background: #dce6f6;
}

.btn.ghost {
  background: transparent;
  color: var(--teal);
  border: 1px solid var(--line);
}

.btn.ghost:hover {
  background: var(--soft);
}

.btn.danger {
  background: var(--red);
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.btn.small {
  min-height: 32px;
  padding: 7px 10px;
  font-size: 13px;
}

.login-actions {
  display: grid;
  gap: 10px;
}

.signin-note {
  color: var(--muted);
  font-size: 13px;
}

.login-error {
  margin: 0;
  color: var(--red);
  font-size: 13px;
  font-weight: 700;
}

.mini-card,
.metric,
.job-card,
.client-card,
.detail-panel,
.billing-panel,
.clients-panel,
.client-detail-panel,
.sales-panel,
.form-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.mini-card {
  padding: 16px;
  min-height: 112px;
}

.mini-card strong {
  display: block;
  font-size: 22px;
  line-height: 1.25;
  margin-bottom: 8px;
}

.control-sheet-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.control-sheet-sections {
  display: grid;
  gap: 16px;
}

.control-sheet-section {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid #d7e0e7;
  border-radius: 8px;
  background: #f6f9fb;
}

.control-sheet-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.control-sheet-section-head h3 {
  margin: 0;
  font-size: 18px;
}

.control-sheet-section-head span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.control-sheet-card {
  display: grid;
  gap: 14px;
  align-content: space-between;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  min-width: 0;
}

.control-sheet-card.connected {
  border-color: #c7e6d1;
  background: #f5fbf7;
}

.control-sheet-card h3 {
  font-size: 18px;
  margin: 4px 0 6px;
}

.control-sheet-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 13px;
}

.mini-card span {
  color: var(--muted);
  line-height: 1.45;
}

.destination-card {
  display: grid;
  align-content: start;
  gap: 8px;
  position: relative;
  overflow: hidden;
}

.destination-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: var(--coral);
}

.destination-card.primary::before {
  background: var(--teal);
}

.destination-card .card-kicker {
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.handoff-flow {
  display: grid;
  gap: 10px;
  padding-top: 0;
}

.handoff-flow h3 {
  font-size: 20px;
  margin-bottom: 0;
}

.handoff-steps {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
}

.handoff-steps li {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  padding: 10px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  min-height: 92px;
}

.step-index {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--ink);
  color: white;
  display: inline-grid;
  place-items: center;
  font-weight: 700;
  font-size: 13px;
}

.handoff-steps strong {
  display: block;
  line-height: 1.25;
}

.handoff-steps p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(220px, 268px) minmax(0, 1fr);
}

.sidebar {
  background: #ffffff;
  border-right: 1px solid var(--line);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-row .brand-mark {
  width: 92px;
  flex: 0 0 auto;
}

.brand-row strong {
  display: block;
  line-height: 1.1;
}

.user-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--soft);
}

.user-box strong,
.user-box span {
  display: block;
}

.user-box strong {
  font-size: 20px;
  line-height: 1.2;
}

.profile-line {
  color: var(--ink);
  font-weight: 700;
  line-height: 1.25;
}

.role-pill,
.status-pill,
.priority-pill,
.dept-pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 700;
}

.role-pill {
  background: #e8eef9;
  color: var(--teal-dark);
}

.dept-pill {
  background: #f3ead9;
  color: #815a12;
}

.db-status {
  margin-top: 10px;
  border-radius: 999px;
  padding: 6px 10px;
  width: fit-content;
  font-size: 11px;
  font-weight: 700;
}

.db-status.connected {
  background: #e5f4ea;
  color: var(--green);
}

.db-status.offline {
  background: #fde8e5;
  color: var(--red);
}

.nav-group {
  display: grid;
  gap: 8px;
}

.nav-button {
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  padding: 10px 12px;
  border-radius: 8px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.nav-button.active,
.nav-button:hover {
  background: var(--soft);
  color: var(--teal-dark);
}

.nav-badge {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  background: var(--coral);
  color: white;
  font-size: 12px;
  font-weight: 700;
}

.nav-badge.billing {
  background: #e5f4ea;
  color: var(--green);
  box-shadow: inset 0 0 0 1px #c7e6d1;
}

.main {
  padding: 24px;
  display: grid;
  gap: 18px;
  align-content: start;
  min-width: 0;
  overflow-x: hidden;
}

.app-notice {
  border: 1px solid #ffd8a8;
  border-radius: 8px;
  background: #fff7ed;
  color: #805900;
  font-weight: 700;
  padding: 12px 14px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: flex-start;
  gap: 16px;
  min-width: 0;
}

.topbar > div:first-child {
  min-width: 0;
}

.topbar h1 {
  font-size: clamp(26px, 4vw, 40px);
  margin-bottom: 6px;
}

.top-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  min-width: 0;
}

.dashboard-band {
  margin: 8px 0 18px;
  padding: 14px;
  border: 1px solid #d4e3e2;
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(238, 244, 244, 0.92), rgba(255, 255, 255, 0.68));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  min-width: 0;
}

.metric {
  padding: 15px 16px;
  background: rgba(255, 255, 255, 0.92);
  border-color: #cfdcde;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.metric strong {
  display: block;
  font-size: 28px;
  margin-top: 4px;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(340px, 0.92fr) minmax(0, 1.35fr);
  gap: 18px;
  align-items: start;
  min-width: 0;
}

.clients-grid {
  display: grid;
  grid-template-columns: minmax(300px, 0.7fr) minmax(0, 1.3fr);
  gap: 18px;
  align-items: start;
  min-width: 0;
}

.tasks-panel {
  display: grid;
  gap: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  min-width: 0;
}

.task-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.task-list {
  display: grid;
  gap: 10px;
}

.task-list.compact .task-card {
  background: #fbfcfc;
}

.task-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: white;
}

.task-card.overdue {
  border-color: rgba(180, 35, 24, 0.35);
  background: #fff8f7;
}

.task-card.today {
  border-color: rgba(197, 139, 27, 0.4);
  background: #fffaf0;
}

.task-card-main,
.task-meta-grid {
  display: grid;
  gap: 12px;
}

.task-card-main {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
}

.task-card h3 {
  font-size: 18px;
  margin-bottom: 4px;
}

.task-meta-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 12px 0;
}

.task-meta-grid span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.task-meta-grid strong {
  display: block;
  margin-top: 3px;
  font-size: 13px;
}

.task-note {
  margin-bottom: 8px;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 18px;
  background: #fbfcfc;
  color: var(--muted);
}

.list-panel {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.client-list-panel {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.archive-notice {
  display: grid;
  gap: 4px;
  margin-bottom: 16px;
  padding: 12px;
  border: 1px solid rgba(180, 35, 24, 0.2);
  border-radius: 8px;
  background: #fff8f7;
  color: var(--red);
}

.archive-notice span {
  color: #6b7882;
}

.filters {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(130px, 0.55fr) minmax(140px, 0.55fr);
  gap: 10px;
}

.filters.single {
  grid-template-columns: 1fr;
}

.source-filter {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin: 10px 0 12px;
  padding: 4px;
  border-radius: 8px;
  background: #eef3f9;
}

.source-filter-button {
  min-height: 36px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #5f6f7d;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.source-filter-button.active {
  background: white;
  color: var(--teal);
  box-shadow: 0 1px 3px rgba(23, 42, 58, 0.12);
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.toggle-row input {
  width: auto;
}

.job-list {
  display: grid;
  gap: 10px;
}

.client-list {
  display: grid;
  gap: 10px;
}

.client-picker {
  display: grid;
  gap: 10px;
}

.selected-client-summary {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
}

.selected-client-summary strong,
.selected-client-summary span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.selected-client-summary > span:not(.billing-action) {
  color: var(--muted);
  font-size: 13px;
}

.job-card {
  padding: 14px;
  text-align: left;
  width: 100%;
  color: inherit;
}

.job-card.active {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(24, 62, 139, 0.1);
}

.job-card:hover {
  box-shadow: var(--shadow);
}

.client-card {
  width: 100%;
  padding: 12px;
  text-align: left;
  color: inherit;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
}

.client-card.active {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(24, 62, 139, 0.1);
}

.client-card strong,
.client-card span {
  display: block;
}

.client-card > div > span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.job-card-head,
.detail-head,
.section-head,
.step-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.job-title {
  font-weight: 700;
  margin-bottom: 2px;
}

.job-id {
  font-size: 12px;
  color: var(--muted);
}

.job-meta,
.detail-meta,
.inline-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

.status-pill.new {
  background: #e9eef9;
  color: #264c8f;
}

.status-pill.ready {
  background: #e8eef9;
  color: var(--teal-dark);
}

.status-pill.progress {
  background: #e9f0ff;
  color: var(--blue);
}

.status-pill.waiting {
  background: #fff2cf;
  color: #805900;
}

.status-pill.revision {
  background: #fff0e8;
  color: #a9471b;
}

.status-pill.done {
  background: #e5f4ea;
  color: var(--green);
}

.status-pill.na {
  background: #eceff1;
  color: #52616b;
}

.status-pill.blocked {
  background: #fde8e5;
  color: var(--red);
}

.status-pill.cancelled {
  background: #eceff1;
  color: #52616b;
}

.priority-pill.low {
  background: var(--soft);
  color: #587177;
}

.priority-pill.normal {
  background: #e8eef9;
  color: var(--teal-dark);
}

.priority-pill.high {
  background: #fff0d9;
  color: #8a5a00;
}

.priority-pill.urgent {
  background: #fde8e5;
  color: var(--red);
}

.detail-panel,
.billing-panel,
.clients-panel,
.client-detail-panel,
.sales-panel,
.form-panel {
  padding: 18px;
  min-width: 0;
  max-width: 100%;
}

.detail-panel.empty {
  min-height: 420px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
}

.detail-title h2 {
  margin-bottom: 4px;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.client-profile-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.info-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fbfcfc;
}

.info-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.info-item strong {
  display: block;
  margin-top: 4px;
}

.section {
  border-top: 1px solid var(--line);
  padding-top: 16px;
  margin-top: 16px;
}

.job-details-section,
.billing-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.job-details-section {
  background: #f1f8f8;
}

.billing-section {
  background: #e5f4ea;
  border-color: #a8d7b8;
}

.collapsible-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  background: #fbfcfc;
  overflow: hidden;
}

.collapsible-section summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 84px;
  padding: 14px 16px;
  cursor: pointer;
  list-style: none;
}

.collapsible-section summary::-webkit-details-marker {
  display: none;
}

.collapsible-section summary::before {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(-45deg);
  transition: transform 0.16s ease;
}

.collapsible-section[open] summary::before {
  transform: rotate(45deg);
}

.collapsible-section summary h3,
.collapsible-section summary p {
  margin: 0;
}

.collapsible-section summary h3 {
  font-size: 18px;
  line-height: 1.25;
}

.collapsible-section summary p {
  margin-top: 4px;
  line-height: 1.35;
}

.details-action-spacer {
  width: 144px;
  min-height: 1px;
}

.collapsible-section summary .btn.small {
  min-width: 144px;
}

.collapsible-section .client-profile-grid,
.collapsible-section .edit-work-form,
.collapsible-section .cancel-form {
  border-top: 1px solid var(--line);
  padding: 16px;
}

.edit-details,
.cancel-details {
  background: #fbfcfc;
}

.cancel-details {
  border-color: #efcac4;
  background: #fffafa;
}

.cancel-details summary h3 {
  color: var(--red);
}

.cancel-details summary::before {
  border-color: var(--red);
}

.steps {
  display: grid;
  gap: 10px;
}

.step {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
}

.step.locked {
  opacity: 0.78;
}

.step[open] {
  box-shadow: 0 8px 22px rgba(30, 42, 50, 0.06);
}

.step summary {
  list-style: none;
}

.step summary::-webkit-details-marker {
  display: none;
}

.step-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content 24px;
  align-items: center;
  column-gap: 14px;
  cursor: pointer;
  padding: 14px;
}

.step-head > div {
  min-width: 0;
}

.step-head > .status-pill {
  justify-self: end;
  white-space: nowrap;
}

.step-head::after {
  content: "⌄";
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  justify-self: end;
  transition: transform 0.18s ease;
}

.step[open] .step-head::after {
  transform: rotate(180deg);
}

.step-number {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  background: var(--teal);
  color: white;
  font-size: 12px;
  font-weight: 700;
  margin-right: 8px;
}

.step-title {
  font-weight: 700;
}

.step-body {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 10px;
  padding: 14px;
  background: white;
  border-radius: 0 0 8px 8px;
}

.step-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.step-form .full {
  grid-column: 1 / -1;
}

.updates {
  display: grid;
  gap: 8px;
}

.update-row {
  border-left: 3px solid var(--teal);
  padding: 8px 10px;
  background: white;
  border-radius: 0 8px 8px 0;
}

.update-row p {
  margin-bottom: 4px;
}

.link-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.resource-panel {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfc;
}

.resource-row {
  display: grid;
  gap: 6px;
}

.resource-row > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.resource-empty {
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

.resource-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.resource-status {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.folder-link-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
}

.folder-link {
  display: grid;
  gap: 2px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: white;
  text-decoration: none;
}

.folder-link span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.addon-summary {
  margin: 12px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fbfcfc;
}

.addon-summary span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.addon-summary strong {
  display: block;
  margin-top: 4px;
}

.cancel-notice {
  margin: 14px 0;
  border: 1px solid rgba(180, 35, 24, 0.25);
  border-radius: 8px;
  padding: 12px;
  background: #fff8f7;
}

.cancel-notice strong,
.cancel-notice span {
  display: block;
}

.cancel-notice p {
  margin: 6px 0;
}

.cancel-notice span {
  color: var(--muted);
  font-size: 13px;
}

.cancel-form {
  margin-top: 12px;
}

.link-chip {
  color: var(--teal-dark);
  background: #e8eef9;
  text-decoration: none;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 700;
}

.link-chip.primary {
  width: fit-content;
  color: white;
  background: var(--teal);
}

.calendar-status {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 700;
}

.calendar-status.linked {
  background: #e5f4ea;
  color: var(--green);
}

.calendar-status.missing {
  background: #eceff1;
  color: #52616b;
}

.calendar-status.retry {
  background: #fff2cf;
  color: #805900;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.form-grid .full {
  grid-column: 1 / -1;
}

.form-subsection {
  grid-column: 1 / -1;
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.form-subsection h3 {
  margin: 0;
  color: var(--ink);
  font-size: 16px;
}

.contact-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.staff-checks {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.addons-grid,
.boost-grid {
  display: grid;
  gap: 8px;
}

.addons-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 10px;
}

.boost-addon {
  grid-column: 1 / -1;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfcfc;
}

.boost-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 8px;
  padding-left: 28px;
}

.staff-check,
.addon-check,
.boost-platform {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px;
  background: white;
}

.boost-addon .boost-check {
  border: 0;
  padding: 0;
  background: transparent;
}

.boost-platform {
  display: grid;
  align-items: start;
}

.boost-platform span {
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
}

.staff-check input,
.addon-check input,
.boost-platform input[type="checkbox"] {
  width: auto;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  max-width: 100%;
  min-width: 0;
}

.billing-filter-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) minmax(180px, 0.8fr) minmax(180px, 0.8fr);
  gap: 10px;
  margin-bottom: 14px;
}

.billing-filter-field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.billing-filter-field label {
  color: #40505b;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.sales-sort-controls {
  display: grid;
  grid-template-columns: minmax(220px, 320px) minmax(150px, 180px);
  gap: 10px;
  align-items: end;
  margin: 0 0 14px;
}

.billing-table {
  min-width: 1100px;
}

.billing-row-form {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.billing-row-form select {
  min-width: 150px;
}

.table-subtext {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.billing-profile-mini {
  margin-top: 8px;
  display: grid;
  gap: 4px;
}

.billing-profile-mini > span:last-child {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.billing-profile-button {
  border: 0;
  cursor: pointer;
  font-family: inherit;
}

.billing-profile-button:hover {
  filter: brightness(0.97);
}

.billing-profile-button:focus-visible {
  outline: 3px solid rgba(24, 62, 139, 0.22);
  outline-offset: 2px;
}

.inline-link {
  color: var(--teal-dark);
  font-weight: 700;
}

.table-empty {
  border: 0;
  background: transparent;
}

.billing-action {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.billing-action.action {
  background: #fff2cf;
  color: #805900;
}

.billing-action.payment {
  background: #e9f0ff;
  color: var(--blue);
}

.billing-action.waiting {
  background: var(--soft);
  color: #587177;
}

.billing-action.complete {
  background: #e5f4ea;
  color: var(--green);
}

.billing-action.blocked {
  background: #fde8e5;
  color: var(--red);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
  background: white;
}

th,
td {
  border-bottom: 1px solid var(--line);
  text-align: left;
  padding: 10px;
  font-size: 13px;
  vertical-align: top;
}

th {
  background: var(--soft);
  color: #40505b;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.billing-status-pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.billing-status-pill.qt-needed {
  background: #fff2cf;
  color: #805900;
}

.billing-status-pill.qt-issued {
  background: #e8eef9;
  color: var(--teal-dark);
}

.billing-status-pill.in-process {
  background: #eaf2f8;
  color: #236176;
}

.billing-status-pill.work-done {
  background: #e5f4ea;
  color: var(--green);
}

.billing-status-pill.billed {
  background: #e9f0ff;
  color: var(--blue);
}

.billing-status-pill.collected {
  background: #d9f0e2;
  color: #20603f;
}

.billing-status-pill.cancelled {
  background: #fde8e5;
  color: var(--red);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  background: var(--ink);
  color: white;
  border-radius: 8px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  z-index: 20;
}

[hidden],
.hidden {
  display: none !important;
}

@media (max-width: 980px) {
  .login-page,
  .app-shell,
  .workspace-grid,
  .clients-grid {
    grid-template-columns: 1fr;
  }

  .login-visual {
    align-content: start;
    border-top: 1px solid var(--line);
  }

  .handoff-hero {
    grid-template-columns: 1fr;
  }

  .handoff-status {
    width: 100%;
  }

  .sidebar {
    height: auto;
    position: static;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .task-summary-grid,
  .task-meta-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .topbar {
    display: grid;
  }
}

@media (max-width: 680px) {
  .main {
    padding: 14px;
  }

  .filters,
  .billing-filter-grid,
  .info-grid,
  .client-profile-grid,
  .step-form,
  .form-grid,
  .control-sheet-grid,
  .contact-grid,
  .staff-checks,
  .addons-grid,
  .boost-grid,
  .metrics-grid,
  .task-summary-grid,
  .task-meta-grid,
  .task-card-main,
  .destination-grid,
  .source-filter,
  .handoff-steps {
    grid-template-columns: 1fr;
  }

  .boost-grid {
    padding-left: 0;
  }

  .detail-head,
  .section-head,
  .step-head,
  .job-card-head {
    display: grid;
  }

  h1 {
    font-size: 32px;
  }
}
