:root {
  color-scheme: light;
  --ink: #202124;
  --muted: #65707a;
  --line: #d8dee4;
  --paper: #ffffff;
  --canvas: #f5f7f8;
  --panel: #eef3f4;
  --brand: #0e6f68;
  --brand-strong: #09524d;
  --accent: #b7492f;
  --ok: #157347;
  --warn: #a36600;
  --danger: #b42318;
  --info: #2457a6;
  --radius: 8px;
  --shadow: 0 10px 30px rgba(20, 35, 38, 0.12);
  font-family:
    Inter, "Segoe UI", "Noto Sans TC", "Microsoft JhengHei", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
}

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

button {
  cursor: pointer;
}

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

.sidebar {
  background: #1f2d2f;
  color: #f7fbfb;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.brand {
  display: grid;
  gap: 4px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-weight: 800;
  background: #0e6f68;
}

.brand h1 {
  margin: 6px 0 0;
  font-size: 1.1rem;
  letter-spacing: 0;
}

.brand p {
  margin: 0;
  color: #b8c7c8;
  font-size: 0.82rem;
}

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

.segmented {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
}

.segmented button {
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #dbe7e8;
}

.segmented button.active {
  background: #f7fbfb;
  color: #1f2d2f;
}

.button,
.ghost-button,
.danger-button,
.small-button,
.icon-button {
  min-height: 38px;
  border-radius: 8px;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  font-weight: 650;
  white-space: nowrap;
}

.button {
  background: var(--brand);
  color: #fff;
}

.button:hover {
  background: var(--brand-strong);
}

.ghost-button {
  background: #fff;
  border-color: var(--line);
  color: var(--ink);
}

.danger-button {
  background: #fff;
  border-color: #f0b5ad;
  color: var(--danger);
}

.compact-danger {
  min-height: 34px;
  padding: 0 10px;
}

.compact-action {
  min-height: 34px;
  padding: 0 10px;
}

.small-button {
  min-height: 30px;
  padding: 0 10px;
  border-color: var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 0.82rem;
}

.small-button.active-soft {
  background: #e0f0ed;
  border-color: #9ac9c1;
  color: var(--brand-strong);
}

.icon-button {
  width: 38px;
  padding: 0;
  border-color: var(--line);
  background: #fff;
  color: var(--ink);
}

.project-list {
  display: grid;
  gap: 8px;
  overflow: auto;
}

.project-list button {
  min-height: 68px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: inherit;
  text-align: left;
  display: grid;
  gap: 4px;
}

.project-list button.active {
  background: #f7fbfb;
  color: #1f2d2f;
}

.project-list strong,
.project-list span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-list span {
  color: inherit;
  opacity: 0.7;
  font-size: 0.82rem;
}

.content {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  min-height: 72px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  padding: 14px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.topbar h2 {
  margin: 0;
  font-size: 1.18rem;
}

.topbar p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.workspace {
  padding: 22px;
  display: grid;
  gap: 18px;
  min-width: 0;
}

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

.metric {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  min-height: 94px;
}

.metric span {
  color: var(--muted);
  font-size: 0.82rem;
}

.metric strong {
  display: block;
  margin-top: 7px;
  font-size: 1.45rem;
}

.section {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-width: 0;
}

.section-header {
  min-height: 58px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.section-header h3 {
  margin: 0;
  font-size: 1rem;
}

.section-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  align-items: center;
}

.toggle-line {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.82rem;
}

.project-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 14px;
  background: var(--panel);
}

.field-readout {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.field-readout span {
  color: var(--muted);
  font-size: 0.78rem;
}

.field-readout strong {
  overflow-wrap: anywhere;
  font-size: 0.92rem;
}

.timeline {
  display: grid;
}

.task-row {
  display: grid;
  grid-template-columns: minmax(190px, 1.15fr) 118px 118px 132px 154px minmax(180px, 0.9fr) minmax(210px, 1fr) 192px;
  align-items: stretch;
  border-top: 1px solid var(--line);
}

.task-row:first-child {
  border-top: 0;
}

.task-cell {
  padding: 10px;
  border-left: 1px solid var(--line);
  display: grid;
  align-content: center;
  gap: 5px;
  min-width: 0;
}

.task-cell:first-child {
  border-left: 0;
}

.task-title {
  font-weight: 750;
  overflow-wrap: anywhere;
}

.task-phase {
  color: var(--muted);
  font-size: 0.78rem;
}

.task-cell input,
.task-cell select,
.task-cell textarea,
.form-grid input,
.form-grid select,
.form-grid textarea,
.inbox-form input,
.inbox-form select,
.inbox-form textarea,
.portal-form input,
.portal-form select,
.portal-form textarea,
.material-form input,
.material-form select,
.material-form textarea,
.deliverable-form input,
.deliverable-form select,
.deliverable-form textarea,
.quote-item-form input,
.quote-item-form select,
.quote-item-form textarea,
.finance-form input,
.finance-form select,
.finance-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px;
  background: #fff;
  color: var(--ink);
}

.task-cell textarea {
  min-height: 56px;
  resize: vertical;
}

.task-cell input[type="range"] {
  padding: 0;
  accent-color: var(--brand);
}

.status-pill {
  width: fit-content;
  max-width: 100%;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 0.76rem;
  font-weight: 750;
  white-space: nowrap;
}

.status-not-started {
  background: #edf1f4;
  color: #52616a;
}

.status-in-progress {
  background: #e7f1ff;
  color: var(--info);
}

.status-waiting-confirmation {
  background: #fff0d8;
  color: var(--warn);
}

.status-confirmed {
  background: #e4f4ec;
  color: var(--ok);
}

.status-issue {
  background: #fde8e6;
  color: var(--danger);
}

.status-delayed {
  background: #eee8ff;
  color: #5b3fa6;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px;
  border-bottom: 1px solid var(--line);
}

.tabs button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
}

.tabs button.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.panel-body {
  padding: 14px;
}

.campaign-panel {
  display: grid;
  gap: 14px;
}

.campaign-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 14px;
  align-items: stretch;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faf9;
}

.campaign-hero h3 {
  margin: 4px 0;
  font-size: 1.65rem;
  letter-spacing: 0;
}

.campaign-hero p,
.campaign-block p,
.campaign-block li,
.campaign-days span {
  overflow-wrap: anywhere;
}

.eyebrow {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.campaign-scoreboard {
  display: grid;
  gap: 6px;
  align-content: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.campaign-scoreboard span {
  color: var(--muted);
  font-size: 0.9rem;
}

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

.campaign-block {
  display: grid;
  gap: 10px;
  align-content: start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.campaign-block.wide {
  grid-column: 1 / -1;
}

.campaign-block h4 {
  margin: 0;
}

.campaign-block ul {
  margin: 0;
  padding-left: 18px;
}

.campaign-block li + li {
  margin-top: 8px;
}

.mini-record {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.mini-record p {
  margin: 0;
  color: var(--muted);
}

.campaign-days {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.campaign-days article {
  display: grid;
  gap: 6px;
  min-height: 118px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faf9;
}

.campaign-days strong {
  display: inline-grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
}

.design-seed-panel,
.design-seed-block {
  display: grid;
  gap: 14px;
}

.design-seed-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faf9;
}

.design-seed-intro h3 {
  margin: 4px 0;
  font-size: 1.35rem;
  letter-spacing: 0;
}

.design-seed-intro p,
.client-design-block p,
.output-card textarea,
.measurement-record p {
  overflow-wrap: anywhere;
}

.design-seed-block {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.mini-list {
  display: grid;
  gap: 8px;
}

.measurement-record {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

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

.output-card {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.82rem;
}

.output-card textarea {
  min-height: 190px;
  resize: vertical;
}

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

.client-design-block {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faf9;
}

.client-design-block p {
  margin: 0;
  color: var(--muted);
}

.quotation-panel {
  display: grid;
  gap: 14px;
}

.quotation-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faf9;
}

.quotation-toolbar h3 {
  margin: 4px 0;
  font-size: 1.35rem;
  letter-spacing: 0;
}

.quotation-toolbar p {
  margin: 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

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

.quote-item-form {
  display: grid;
  grid-template-columns: 1fr 96px minmax(180px, 2fr) 90px 80px 110px 110px auto;
  gap: 10px;
  align-items: end;
}

.quote-item-form label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.82rem;
}

.quotation-table-shell {
  overflow: auto;
}

.quotation-table {
  display: grid;
  min-width: 980px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.quote-row {
  display: grid;
  grid-template-columns: 148px 76px minmax(280px, 1fr) 82px 76px 112px 112px 158px;
  gap: 0;
  align-items: stretch;
  border-top: 1px solid var(--line);
}

.quote-head {
  border-top: 0;
  background: #172321;
  color: #fff;
  font-weight: 800;
}

.quote-head span,
.quote-row input,
.quote-row textarea {
  min-width: 0;
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  padding: 8px;
}

.quote-row textarea {
  resize: vertical;
}

.quote-section-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 140px;
  gap: 10px;
  align-items: center;
  padding: 9px 10px;
  border-top: 1px solid var(--line);
  background: #eef5f2;
}

.quote-section-row span {
  text-align: right;
  font-weight: 800;
}

.quote-row-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: flex-end;
  padding: 6px;
}

.quote-row-actions button {
  min-height: 32px;
  padding: 0 8px;
}

.quote-row.is-muted {
  opacity: 0.55;
}

.design-portal-shell {
  background: #f5f7f8;
}

.portal-hero {
  background: #1f2d2f;
  color: #fff;
  padding: 28px 18px;
}

.portal-hero p {
  max-width: 720px;
  color: #d7e3e4;
}

.portal-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.portal-steps article,
.payment-box {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.portal-steps strong {
  display: inline-grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
}

.portal-form,
.material-form,
.deliverable-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
}

.portal-form label,
.material-form label,
.deliverable-form label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.82rem;
}

.portal-form .wide,
.material-form .wide,
.deliverable-form .wide {
  grid-column: 1 / -1;
}

.material-choice {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.material-choice legend {
  padding: 0 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
}

.material-choice-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faf9;
}

.material-choice-card small {
  display: block;
  color: var(--muted);
  margin-top: 2px;
}

.material-grid,
.preview-grid,
.request-list,
.deliverable-list {
  display: grid;
  gap: 10px;
}

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

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

.material-card,
.preview-card,
.deliverable-card,
.request-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.material-card {
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr);
  gap: 12px;
  padding: 10px;
}

.material-card img,
.material-thumb {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 6px;
  object-fit: cover;
  background: #eef5f2;
}

.material-thumb {
  display: grid;
  place-items: center;
  color: var(--brand-strong);
  font-weight: 800;
}

.material-card p,
.preview-card p,
.request-card p,
.deliverable-card p,
.payment-box p {
  margin: 4px 0 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.preview-card {
  display: grid;
  gap: 8px;
  padding: 10px;
}

.preview-frame {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 6px;
  background: #eef3f4;
  color: var(--muted);
}

.preview-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preview-frame b {
  position: absolute;
  inset: auto 8px 8px auto;
  padding: 4px 7px;
  border-radius: 6px;
  background: rgba(31, 45, 47, 0.82);
  color: #fff;
  font-size: 0.72rem;
}

.request-card {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.request-card-head,
.deliverable-card,
.payment-box {
  grid-template-columns: minmax(0, 1fr) auto;
}

.request-card-head {
  display: grid;
  gap: 10px;
  align-items: start;
}

.request-card-body {
  display: grid;
  gap: 4px;
}

.deliverable-form {
  grid-template-columns: minmax(150px, 1.2fr) 130px 100px minmax(180px, 1fr) minmax(180px, 1fr);
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.deliverable-card {
  display: grid;
  gap: 10px;
  align-items: center;
  padding: 10px;
  background: #f7faf9;
}

.status-draft,
.status-submitted {
  background: #eef3f4;
  color: #52616a;
}

.status-needs-info,
.status-payment-pending {
  background: #fff3cd;
  color: #8a5a00;
}

.status-designing,
.status-preview-ready {
  background: #e8f0ff;
  color: #2457a6;
}

.status-paid,
.status-download-ready,
.status-completed {
  background: #dff5e8;
  color: #157347;
}

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

.source-list a {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--brand);
  background: var(--panel);
  font-size: 0.84rem;
  font-weight: 750;
  text-decoration: none;
}

.inbox-form {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) 150px auto;
  gap: 10px;
  align-items: end;
}

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

.finance-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
}

.message-list,
.file-list,
.template-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.record {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  display: grid;
  gap: 6px;
  background: #fff;
}

.record-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 0.82rem;
}

.record strong {
  overflow-wrap: anywhere;
}

.record p {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.checklist-record.is-done {
  background: #f5f8f6;
  color: #64716b;
}

.checklist-record.is-done p strong {
  text-decoration: line-through;
}

.checklist-helper {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faf9;
}

.checklist-helper strong,
.checklist-stage-header h4 {
  color: var(--ink);
}

.checklist-helper span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.86rem;
}

.checklist-stage-list {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.checklist-stage {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
  padding: 12px;
}

.checklist-stage-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.checklist-stage-header h4 {
  margin: 0;
  font-size: 0.98rem;
}

.checklist-stage-header span {
  color: var(--muted);
  font-size: 0.82rem;
  white-space: nowrap;
}

.daily-log-summary {
  display: grid;
  gap: 6px;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.78rem;
}

.daily-log-summary p {
  margin: 0;
  padding: 7px;
  border-radius: 6px;
  background: #f4f7f8;
}

.calendar-scroll {
  overflow: auto;
  padding: 12px;
}

.calendar-grid {
  min-width: 1320px;
  display: grid;
  grid-template-columns: 230px repeat(var(--days), 34px);
  grid-auto-rows: minmax(36px, auto);
  border: 1px solid var(--line);
  background: var(--line);
  gap: 1px;
}

.calendar-corner,
.calendar-day,
.calendar-task-label,
.calendar-track {
  background: #fff;
}

.calendar-corner,
.calendar-day {
  position: sticky;
  top: 0;
  z-index: 2;
  min-height: 36px;
  display: grid;
  place-items: center;
  font-size: 0.72rem;
  color: var(--muted);
}

.calendar-corner {
  left: 0;
  z-index: 3;
  font-weight: 750;
  color: var(--ink);
}

.calendar-day.weekend,
.calendar-track.weekend {
  background: #f7f0e7;
}

.calendar-task-label {
  position: sticky;
  left: 0;
  z-index: 1;
  padding: 8px;
  display: grid;
  gap: 3px;
  min-width: 0;
}

.calendar-task-label strong,
.calendar-task-label span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-task-label span {
  color: var(--muted);
  font-size: 0.75rem;
}

.calendar-track {
  grid-column: 2 / -1;
  display: grid;
  grid-template-columns: repeat(var(--days), 34px);
  align-items: center;
  min-height: 48px;
  background:
    repeating-linear-gradient(
      to right,
      #fff 0,
      #fff 33px,
      var(--line) 33px,
      var(--line) 34px
    );
}

.calendar-bar {
  height: 20px;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 0.68rem;
  min-width: 18px;
}

.calendar-bar.confirmed {
  background: var(--ok);
}

.calendar-bar.issue {
  background: var(--danger);
}

.calendar-bar.delayed {
  background: #6f55b5;
}

.calendar-bar.waiting-confirmation {
  background: var(--warn);
}

.gantt-scroll {
  overflow: auto;
  padding: 12px;
}

.gantt-grid {
  min-width: 1680px;
  display: grid;
  grid-template-columns: 520px repeat(var(--days), 28px);
  grid-auto-rows: minmax(38px, auto);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}

.gantt-left-head,
.gantt-left-row,
.gantt-month,
.gantt-day,
.gantt-track {
  background: #fff;
}

.gantt-left-head,
.gantt-left-row {
  position: sticky;
  left: 0;
  z-index: 3;
  display: grid;
  grid-template-columns: 34px minmax(150px, 1fr) 58px 92px 92px 68px 68px;
  align-items: center;
  gap: 7px;
  padding: 7px;
  min-width: 0;
}

.gantt-left-head {
  grid-row: span 2;
  font-size: 0.72rem;
  font-weight: 750;
  color: var(--muted);
  background: #f7faf9;
}

.gantt-left-row {
  font-size: 0.78rem;
}

.gantt-left-row strong,
.gantt-left-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gantt-month,
.gantt-day {
  display: grid;
  place-items: center;
  min-height: 30px;
  color: var(--muted);
  font-size: 0.7rem;
}

.gantt-month {
  font-weight: 750;
  background: #f7faf9;
}

.gantt-day.weekend {
  background: #f7efe4;
}

.gantt-day.today {
  background: #ffe7a6;
  color: #1f2d2f;
  font-weight: 900;
  box-shadow: inset 0 0 0 2px var(--warn);
}

.gantt-track {
  grid-column: 2 / -1;
  display: grid;
  grid-template-columns: repeat(var(--days), 28px);
  align-items: center;
  min-height: 42px;
  position: relative;
  background:
    repeating-linear-gradient(
      to right,
      #fff 0,
      #fff 27px,
      var(--line) 27px,
      var(--line) 28px
    );
}

.gantt-bar {
  grid-row: 1;
  height: 18px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--task-color, #0e6f68) 32%, white);
  border: 1px solid var(--task-color, #0e6f68);
  color: #1f2d2f;
  overflow: hidden;
  position: relative;
  z-index: 4;
  cursor: grab;
  pointer-events: auto;
  touch-action: none;
}

.gantt-bar i {
  display: block;
  height: 100%;
  background: var(--task-color, var(--brand));
  pointer-events: none;
}

.gantt-bar b {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #1f2d2f;
  font-size: 0.68rem;
  line-height: 1;
  pointer-events: none;
}

.gantt-label {
  grid-row: 1;
  z-index: 1;
  margin-left: 5px;
  color: var(--muted);
  font-size: 0.72rem;
  white-space: nowrap;
  pointer-events: none;
}

.gantt-today {
  grid-row: 1;
  align-self: stretch;
  width: 100%;
  background: rgba(243, 167, 18, 0.22);
  border-left: 2px solid var(--warn);
  border-right: 2px solid rgba(243, 167, 18, 0.55);
  z-index: 5;
  justify-self: stretch;
  pointer-events: none;
}

.client-progress {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: #e8eef0;
  overflow: hidden;
}

.client-progress span {
  display: block;
  height: 100%;
  background: var(--brand);
  border-radius: inherit;
}

.shared-gantt-shell {
  overflow: auto;
  padding: 10px 0 4px;
}

.shared-gantt-shell.is-large {
  max-height: 72vh;
}

.shared-gantt-grid {
  width: max-content;
  min-width: 100%;
  display: grid;
  grid-template-columns: var(--shared-left) repeat(var(--days), var(--shared-day));
  grid-auto-rows: minmax(38px, auto);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}

.shared-gantt-left-head,
.shared-gantt-left-row,
.shared-gantt-month,
.shared-gantt-day,
.shared-gantt-track {
  background: #fff;
}

.shared-gantt-left-head,
.shared-gantt-left-row {
  position: sticky;
  left: 0;
  z-index: 4;
  display: grid;
  align-content: center;
  gap: 3px;
  padding: 7px 9px;
  min-width: 0;
}

.shared-gantt-left-head {
  grid-row: span 2;
  background: #f7faf9;
}

.shared-gantt-left-head strong,
.shared-gantt-left-row strong {
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.18;
}

.shared-gantt-left-head span,
.shared-gantt-left-row span {
  color: var(--muted);
  font-size: 0.74rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shared-gantt-left-row.is-today-task {
  background: #fff9e8;
  box-shadow: inset 4px 0 0 var(--warn);
}

.shared-gantt-month,
.shared-gantt-day {
  display: grid;
  place-items: center;
  min-height: 26px;
  color: var(--muted);
  font-size: 0.66rem;
}

.shared-gantt-month {
  background: #f7faf9;
  font-weight: 850;
}

.shared-gantt-day {
  writing-mode: vertical-rl;
  text-orientation: mixed;
}

.shared-gantt-day.weekend {
  background: #f7efe4;
}

.shared-gantt-day.today {
  background: #ffe7a6;
  color: #1f2d2f;
  font-weight: 900;
  box-shadow: inset 0 0 0 2px var(--warn);
}

.shared-gantt-track {
  grid-column: 2 / -1;
  display: grid;
  grid-template-columns: repeat(var(--days), var(--shared-day));
  align-items: center;
  min-height: 40px;
  position: relative;
  background:
    repeating-linear-gradient(
      to right,
      #fff 0,
      #fff calc(var(--shared-day) - 1px),
      var(--line) calc(var(--shared-day) - 1px),
      var(--line) var(--shared-day)
    );
}

.shared-gantt-track.is-today-task {
  background-color: #fffdf5;
}

.shared-gantt-today {
  grid-row: 1;
  align-self: stretch;
  width: 100%;
  background: rgba(243, 167, 18, 0.2);
  border-left: 2px solid var(--warn);
  border-right: 1px solid rgba(243, 167, 18, 0.5);
  z-index: 5;
  pointer-events: none;
}

.shared-gantt-bar {
  grid-row: 1;
  height: 18px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--task-color, #0e6f68) 28%, white);
  border: 1px solid var(--task-color, #0e6f68);
  overflow: hidden;
  position: relative;
  z-index: 3;
}

.shared-gantt-bar i {
  display: block;
  height: 100%;
  background: var(--task-color, var(--brand));
}

.shared-gantt-bar b {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #1f2d2f;
  font-size: 0.66rem;
  font-weight: 850;
}

.shared-schedule {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.shared-schedule-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1.35fr) 148px 150px;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.shared-schedule-row.is-today-task {
  border-color: var(--warn);
  background: #fff9e8;
  box-shadow: inset 4px 0 0 var(--warn);
}

.shared-schedule-row strong {
  overflow-wrap: anywhere;
}

.compact-task-meta {
  margin: 4px 0 0;
  line-height: 1.35;
}

.shared-schedule-index {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: #eef4f2;
  color: var(--brand);
  font-weight: 800;
  font-size: 0.82rem;
}

.shared-schedule-dates {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  color: var(--ink);
  font-size: 0.82rem;
}

.shared-schedule-dates span {
  min-width: 0;
  padding: 5px 7px;
  border-radius: 6px;
  background: #f3f7f6;
  white-space: nowrap;
}

.shared-schedule-dates span.is-date-today {
  background: #ffe7a6;
  color: #1f2d2f;
  font-weight: 850;
}

.today-pill {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--warn);
  color: #1f2d2f;
  font-size: 0.72rem;
  font-weight: 900;
  vertical-align: middle;
}

.shared-schedule-dates span:first-child::before {
  content: "Start ";
  color: var(--muted);
}

.shared-schedule-dates span:last-child::before {
  content: "End ";
  color: var(--muted);
}

.schedule-disclosure {
  margin-top: 10px;
}

.schedule-disclosure summary {
  cursor: pointer;
  color: var(--brand);
  font-weight: 800;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
}

.schedule-modal {
  width: min(1280px, 98vw);
  max-height: 94vh;
}

.shared-schedule-large {
  max-height: 72vh;
  overflow: auto;
  padding-right: 4px;
}

.schedule-modal-toolbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  background: var(--paper);
}

.zoom-readout {
  min-width: 48px;
  text-align: center;
  color: var(--ink);
  font-weight: 850;
}

.shared-progress {
  margin-top: 8px;
}

.shared-progress span {
  background: var(--task-color, var(--brand));
}

.is-gantt-dragging,
.is-gantt-dragging * {
  cursor: grabbing !important;
  user-select: none;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  background: #1f2d2f;
  color: #fff;
  padding: 12px 14px;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
  z-index: 30;
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.toast button {
  min-height: 30px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  background: transparent;
  color: #fff;
  padding: 0 10px;
  font-weight: 750;
}

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

.form-grid label,
.inbox-form label,
.finance-form label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.82rem;
}

.form-grid .wide,
.finance-form .wide,
.quote-item-form .wide {
  grid-column: 1 / -1;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 25, 0.5);
  z-index: 20;
}

.modal {
  width: min(720px, 100%);
  max-height: min(760px, 92vh);
  overflow: auto;
  background: var(--paper);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.modal-header {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.05rem;
}

.modal-body {
  padding: 14px;
}

.client-shell {
  min-height: 100vh;
}

.client-hero {
  background: #1f2d2f;
  color: #fff;
  padding: 28px 22px;
}

.client-hero-inner {
  max-width: 1040px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 16px;
  align-items: center;
}

.admin-return {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.35);
}

.client-hero h1 {
  margin: 0;
  font-size: 2.35rem;
  letter-spacing: 0;
}

.client-hero p {
  color: #c7d6d7;
}

.client-main {
  max-width: 1040px;
  margin: 0 auto;
  padding: 18px;
  display: grid;
  gap: 14px;
}

.client-task {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 210px;
  gap: 14px;
}

.client-confirm {
  display: grid;
  gap: 8px;
  align-content: start;
}

.empty {
  padding: 22px;
  color: var(--muted);
  text-align: center;
}

.hint {
  color: var(--muted);
  font-size: 0.82rem;
}

.copy-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
}

.staff-link-label {
  grid-column: 1 / -1;
  margin: 0;
}

.copy-field input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px;
}

.staff-details {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #f7faf9;
}

.staff-details summary {
  cursor: pointer;
  color: var(--muted);
  font-weight: 750;
  font-size: 0.82rem;
}

.staff-detail-grid {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 7px 10px;
  margin-top: 10px;
  font-size: 0.82rem;
}

.staff-detail-grid span {
  color: var(--muted);
}

.staff-detail-grid strong {
  overflow-wrap: anywhere;
}

.link-helper,
.team-link-guide {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faf9;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 12px;
  align-items: center;
}

.link-helper strong,
.team-link-guide strong {
  color: var(--ink);
}

.link-helper span,
.team-link-guide span {
  color: var(--muted);
  font-size: 0.86rem;
}

.link-helper button {
  grid-row: span 2;
}

.team-link-guide {
  margin-top: 0;
  margin-bottom: 12px;
  grid-template-columns: 1fr;
}

@media (max-width: 1120px) {
  .summary-grid,
  .project-meta,
  .finance-summary,
  .finance-form,
  .campaign-grid,
  .portal-steps,
  .portal-form,
  .material-form,
  .deliverable-form,
  .material-grid,
  .preview-grid,
  .quotation-summary,
  .output-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .campaign-days {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .task-row {
    grid-template-columns: minmax(190px, 1fr) 132px 132px;
  }

  .task-cell:nth-child(n + 4) {
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 760px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .topbar,
  .section-header,
  .client-hero-inner {
    align-items: stretch;
    flex-direction: column;
    grid-template-columns: 1fr;
  }

  .summary-grid,
  .project-meta,
  .form-grid,
  .inbox-form,
  .finance-summary,
  .finance-form,
  .campaign-hero,
  .campaign-grid,
  .portal-steps,
  .portal-form,
  .material-form,
  .deliverable-form,
  .material-choice,
  .material-grid,
  .preview-grid,
  .material-card,
  .request-card-head,
  .deliverable-card,
  .payment-box,
  .design-seed-intro,
  .quotation-toolbar,
  .quotation-summary,
  .quote-item-form,
  .measurement-record,
  .output-grid,
  .client-task,
  .shared-schedule-row {
    grid-template-columns: 1fr;
  }

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

  .workspace {
    padding: 14px;
  }

  .client-hero h1 {
    font-size: 1.55rem;
  }

  .copy-field,
  .link-helper,
  .checklist-helper {
    grid-template-columns: 1fr;
  }

  .link-helper button {
    grid-row: auto;
  }

  .shared-schedule {
    gap: 10px;
  }

  .shared-schedule-row {
    grid-template-columns: 30px minmax(0, 1fr);
    gap: 8px;
  }

  .shared-schedule-row > div:nth-child(2) {
    grid-column: 2;
  }

  .shared-schedule-dates,
  .shared-schedule-row > div:nth-child(4) {
    grid-column: 1 / -1;
  }

  .shared-schedule-dates {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    font-size: 0.78rem;
  }

  .schedule-modal {
    width: min(100%, 96vw);
    max-height: 94vh;
  }

  .schedule-modal-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .task-row {
    grid-template-columns: 1fr;
    border: 1px solid var(--line);
    border-radius: 8px;
    margin: 10px;
  }

  .task-cell {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .task-cell:first-child {
    border-top: 0;
  }
}

@media (max-width: 480px) {
  .campaign-days {
    grid-template-columns: 1fr;
  }
}
