:root {
  --ink: #202522;
  --muted: #65716a;
  --line: #d8d5cb;
  --paper: #f6f4ef;
  --panel: #fffdf8;
  --green: #1f3f3a;
  --green-2: #2f6f61;
  --blue: #315b8f;
  --amber: #c77d3b;
  --red: #9e463f;
  --good: #e2eee8;
  --warn: #f6ead9;
  --info: #e5ebf4;
  --shadow: 0 18px 40px rgba(35, 36, 31, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--paper);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  letter-spacing: 0;
  background:
    linear-gradient(180deg, rgba(246, 244, 239, 0.94), rgba(246, 244, 239, 1)),
    url("portal-icon.svg") center 28px / 180px 180px no-repeat;
}

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

button {
  cursor: pointer;
}

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

.rail {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
  height: 100vh;
  padding: 22px 16px;
  color: #f8f5ed;
  background: var(--green);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  color: var(--green);
  font-weight: 800;
  background: #f8f5ed;
  border-radius: 8px;
}

.brand-copy {
  font-weight: 700;
}

.nav-list {
  display: grid;
  gap: 6px;
  overflow: auto;
  padding-right: 2px;
}

.nav-item,
.bottom-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 0;
  color: inherit;
  text-align: left;
  background: transparent;
  border-radius: 8px;
}

.nav-item {
  min-height: 42px;
  padding: 8px 10px;
}

.nav-item span {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  color: #16302c;
  font-size: 11px;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.78);
  border-radius: 6px;
}

.nav-item strong,
.bottom-nav-item strong {
  font-size: 13px;
}

.nav-item:hover,
.nav-item.is-active {
  color: #17312d;
  background: #f8f5ed;
}

.workspace {
  min-width: 0;
  padding: 22px 26px 46px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 76px;
  padding: 10px 0 16px;
  background: rgba(246, 244, 239, 0.95);
  backdrop-filter: blur(14px);
}

.topbar-title {
  min-width: 0;
}

.eyebrow {
  display: block;
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: 30px;
  line-height: 1.1;
}

h2 {
  margin-bottom: 0;
  font-size: 17px;
}

.topbar-actions,
.toolbar-group,
.section-actions,
.card-actions,
.modal-actions,
.inline-fields {
  display: flex;
  align-items: center;
  gap: 10px;
}

.inline-upload-form {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.topbar-actions,
.toolbar-group {
  flex-wrap: wrap;
}

body[data-role="logged-out"] .topbar-actions .field,
body[data-role="logged-out"] .topbar-actions > button,
body[data-role="logged-out"] #saveBtn {
  display: none;
}

body:not([data-role="admin"]) [data-admin-action="true"] {
  display: none;
}

.user-session {
  display: flex;
  align-items: center;
}

.session-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 4px 5px 4px 10px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
}

.session-pill span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.session-pill strong {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.content {
  display: grid;
  gap: 18px;
  outline: 0;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 12px;
}

.metric,
.panel,
.toolbar-panel,
.selection-card,
.message-item,
.user-card,
.task-card,
.client-hero,
.log-item {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.metric {
  min-height: 116px;
  padding: 16px;
}

.metric span,
.metric small {
  display: block;
  color: var(--muted);
}

.metric strong {
  display: block;
  margin: 9px 0 5px;
  font-size: 24px;
  line-height: 1.1;
}

.metric.warn {
  background: var(--warn);
}

.metric.good {
  background: var(--good);
}

.metric.info {
  background: var(--info);
}

.layout-grid {
  display: grid;
  gap: 18px;
}

.layout-grid.two {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.panel,
.toolbar-panel {
  padding: 16px;
}

.toolbar-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.toolbar-note {
  display: grid;
  gap: 2px;
  justify-items: end;
  color: var(--muted);
  font-size: 13px;
}

.toolbar-note strong {
  color: var(--ink);
  font-size: 16px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.section-title h2 {
  font-size: 18px;
}

.icon-text-btn,
.text-btn,
.icon-btn {
  min-height: 38px;
  border: 1px solid var(--line);
  color: var(--ink);
  background: #fff;
  border-radius: 8px;
}

.icon-text-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 13px;
  font-weight: 700;
}

.icon-text-btn span,
.icon-btn {
  display: inline-grid;
  place-items: center;
}

.icon-text-btn span {
  width: 22px;
  height: 22px;
  color: #fff;
  background: rgba(0, 0, 0, 0.22);
  border-radius: 6px;
}

.icon-text-btn.primary,
.text-btn.primary {
  color: #fff;
  border-color: var(--green);
  background: var(--green);
}

.icon-text-btn.is-dirty {
  border-color: var(--amber);
  box-shadow: 0 0 0 3px rgba(199, 125, 59, 0.18);
}

.text-btn {
  padding: 0 12px;
  font-weight: 700;
}

.text-btn.warning {
  color: #6d3718;
  background: var(--warn);
}

.compact-action {
  min-height: 32px;
  padding: 0 9px;
  font-size: 12px;
}

.icon-btn {
  width: 38px;
  padding: 0;
  font-size: 12px;
  font-weight: 800;
}

.field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.field input,
.field select,
.field textarea,
td input,
td select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  color: var(--ink);
  background: #fff;
  border-radius: 8px;
}

.field input,
.field select,
td input,
td select {
  padding: 0 10px;
}

.field textarea {
  resize: vertical;
  padding: 10px;
}

.field.wide {
  grid-column: 1 / -1;
}

.compact-field {
  min-width: 230px;
}

.check-row,
.check-field {
  display: flex;
  align-items: center;
  gap: 8px;
}

.check-field {
  align-self: end;
  min-height: 38px;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
}

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

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

td small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

tfoot td {
  font-weight: 800;
  background: #f8f5ed;
}

.money {
  text-align: right;
  white-space: nowrap;
}

.positive {
  color: var(--green-2);
}

.negative {
  color: var(--red);
}

.signal-list,
.timeline-list,
.audit-list,
.log-list,
.task-stack,
.message-list,
.lien-list {
  display: grid;
  gap: 10px;
}

.signal {
  display: grid;
  grid-template-columns: 12px 1fr;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.signal > span {
  width: 10px;
  height: 100%;
  min-height: 36px;
  background: var(--blue);
  border-radius: 4px;
}

.signal.warn > span {
  background: var(--amber);
}

.signal.good > span {
  background: var(--green-2);
}

.signal strong,
.signal small {
  display: block;
}

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

.timeline-item,
.audit-row,
.approval-row,
.client-budget-row,
.photo-item {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.timeline-item span,
.audit-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.timeline-item p,
.audit-row p {
  margin: 4px 0 0;
  color: var(--muted);
}

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

.success-note {
  margin-top: 12px;
  padding: 10px 12px;
  color: #1f5f43;
  background: #eaf6ef;
  border: 1px solid #b9dfc8;
  border-radius: 8px;
  font-weight: 800;
}

.inline-fatal {
  margin-top: 12px;
}

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

.summary-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.summary-row span {
  font-weight: 900;
}

.gantt {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.gantt.compact {
  grid-template-columns: 230px minmax(0, 1fr);
}

.gantt-left {
  border-right: 1px solid var(--line);
  background: #fbfaf6;
}

.gantt-head {
  height: 58px;
  padding: 8px 12px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: flex-end;
  padding-bottom: 6px;
}

.gantt-task-label {
  display: grid;
  align-content: center;
  height: 42px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
}

.gantt-task-label strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.8em;
}

.gantt-task-label span {
  color: var(--muted);
  font-size: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gantt-scroll {
  overflow-x: auto;
}

.gantt-timeline {
  position: relative;
  min-width: 100%;
}

.gantt-months {
  position: relative;
  height: 30px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(31, 63, 58, 0.08) 1px, transparent 1px) 0 0 / 70px 100%;
}

.gantt-months span {
  position: absolute;
  top: 0;
  height: 30px;
  padding: 7px 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  border-right: 1px solid var(--line);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.gantt-weeks {
  position: relative;
  height: 28px;
  border-bottom: 2px solid var(--line);
  background: linear-gradient(90deg, rgba(31, 63, 58, 0.06) 1px, transparent 1px) 0 0 / 70px 100%;
}

.gantt-weeks span {
  position: absolute;
  top: 0;
  height: 28px;
  padding: 6px 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  border-right: 1px dashed rgba(31, 63, 58, 0.15);
  white-space: nowrap;
}

.gantt-row {
  position: relative;
  height: 42px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(216, 213, 203, 0.35) 1px, transparent 1px) 0 0 / 70px 100%;
}

.gantt-bar {
  position: absolute;
  top: 8px;
  height: 26px;
  overflow: hidden;
  border: 0;
  background: var(--green-2);
  border-radius: 8px;
  box-shadow: 0 4px 10px rgba(31, 63, 58, 0.16);
  touch-action: none;
}

.gantt-bar.status-active {
  background: var(--blue);
}

.gantt-bar.status-blocked {
  background: var(--red);
}

.gantt-bar.status-complete {
  background: var(--green);
}

.gantt-bar.status-waiting {
  background: var(--amber);
}

.gantt-bar span {
  display: block;
  height: 100%;
  background: rgba(255, 255, 255, 0.32);
}

.gantt-bar.is-dragging {
  z-index: 4;
  box-shadow: 0 8px 18px rgba(31, 63, 58, 0.3);
}

/* ── User Settings table ────────────────────────────────────────────────── */
.user-settings-table th,
.user-settings-table td {
  vertical-align: middle;
}
.user-row-self {
  background: #f7fbf9;
}
.you-badge {
  display: inline-block;
  font-size: 0.7em;
  background: var(--accent, #1f3f3a);
  color: #fff;
  border-radius: 3px;
  padding: 1px 5px;
  margin-left: 5px;
  vertical-align: middle;
}
.inline-role-select {
  font-size: 0.85em;
  padding: 3px 6px;
  border-radius: 4px;
  border: 1px solid var(--border, #ccc);
  background: #fff;
}
.invite-link-input {
  font-size: 0.75em;
  width: 160px;
  padding: 3px 5px;
  border: 1px solid var(--border, #ccc);
  border-radius: 3px;
  color: var(--text-muted, #555);
}
.danger-btn {
  color: #c0392b !important;
}
.danger-btn:hover {
  background: #fdf0f0;
}

/* ── Change Order signed doc tag ────────────────────────────────────────── */
.co-file-tag {
  display: inline-block;
  font-size: 0.78em;
  background: #eaf2ee;
  color: #2e7d60;
  border-radius: 4px;
  padding: 2px 6px;
  max-width: 140px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

/* ── Calendar Views ─────────────────────────────────────────────────────── */
.cal-month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  font-size: 0.82em;
}
.cal-head-cell {
  text-align: center;
  font-weight: 600;
  padding: 6px 2px;
  color: var(--text-muted, #666);
  font-size: 0.9em;
}
.cal-cell {
  min-height: 90px;
  border: 1px solid var(--border, #dde2e0);
  border-radius: 4px;
  padding: 4px;
  background: var(--surface, #fff);
}
.cal-cell-empty {
  background: transparent;
  border-color: transparent;
}
.cal-today {
  background: #f0f7f5;
  border-color: var(--accent, #1f3f3a);
}
.cal-day-num {
  display: block;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text-muted, #555);
  font-size: 0.9em;
}
.cal-task-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cal-task-bar {
  border-radius: 3px;
  padding: 2px 5px;
  font-size: 0.78em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #fff;
  background: var(--accent, #1f3f3a);
  cursor: default;
}
.cal-task-bar.status-active { background: #2e7d60; }
.cal-task-bar.status-blocked { background: #c0392b; }
.cal-task-bar.status-complete { background: #5a8a6a; opacity: 0.75; }
.cal-task-bar.status-waiting { background: #7f8c8d; }

.cal-week-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  font-size: 0.85em;
}
.cal-week-col {
  border: 1px solid var(--border, #dde2e0);
  border-radius: 6px;
  padding: 6px;
  background: var(--surface, #fff);
  min-height: 180px;
}
.cal-week-head {
  font-weight: 600;
  margin-bottom: 8px;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--border, #eee);
  font-size: 0.85em;
  color: var(--text-muted, #555);
}
.cal-week-col.cal-today {
  background: #f0f7f5;
  border-color: var(--accent, #1f3f3a);
}

.cal-day-view {
  border: 1px solid var(--border, #dde2e0);
  border-radius: 8px;
  padding: 16px;
  background: var(--surface, #fff);
}
.cal-day-header {
  font-size: 1.1em;
  font-weight: 600;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border, #eee);
}
.cal-day-task {
  display: flex;
  flex-direction: column;
  gap: 3px;
  border-left: 4px solid var(--accent, #1f3f3a);
  padding: 10px 14px;
  border-radius: 0 6px 6px 0;
  background: #f8fbfa;
  margin-bottom: 8px;
}
.cal-day-task.status-active { border-color: #2e7d60; }
.cal-day-task.status-blocked { border-color: #c0392b; background: #fdf5f5; }
.cal-day-task.status-complete { border-color: #5a8a6a; opacity: 0.8; }
.cal-day-task.status-waiting { border-color: #7f8c8d; }
.cal-day-task strong { font-size: 0.95em; }
.cal-day-task span { font-size: 0.8em; color: var(--text-muted, #666); }

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

.selection-card,
.message-item,
.user-card,
.task-card,
.log-item {
  padding: 15px;
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.card-head span {
  color: var(--muted);
  font-size: 12px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.detail-grid div {
  padding: 10px;
  background: #f8f5ed;
  border-radius: 8px;
}

dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

dd {
  margin: 2px 0 0;
  font-weight: 800;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  background: var(--good);
  border-radius: 999px;
  white-space: nowrap;
}

.status-draft,
.status-waiting,
.status-needs-client-decision,
.status-sent-to-client {
  color: #70400e;
  background: var(--warn);
}

.status-blocked,
.status-rejected {
  color: #7f241f;
  background: #f4dedb;
}

.status-client-approved,
.status-approved,
.status-signed,
.status-complete,
.status-installed {
  color: var(--green);
  background: var(--good);
}

.message-item p,
.selection-card p,
.task-card p,
.log-item p,
.lien-row p {
  color: var(--muted);
}

.lien-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
}

.lien-row h2 {
  margin-bottom: 3px;
}

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

.lien-row small {
  display: block;
  overflow-wrap: anywhere;
  color: var(--muted);
}

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

.export-check,
.export-doc-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
}

.export-check input,
.export-doc-row input {
  margin-top: 3px;
}

.prominent-check {
  margin-top: 14px;
  font-weight: 800;
  background: var(--info);
}

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

.export-mini-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 2px;
}

.export-doc-row span {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.export-doc-row small {
  overflow-wrap: anywhere;
  color: var(--muted);
}

.export-result {
  display: grid;
  gap: 14px;
}

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

.result-path span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.result-path strong {
  overflow-wrap: anywhere;
}

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

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

.missing-list h3 {
  margin: 0;
  font-size: 15px;
}

.missing-row {
  display: grid;
  gap: 2px;
  padding: 10px;
  border: 1px solid var(--line);
  background: var(--warn);
  border-radius: 8px;
}

.missing-row span {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.meta-line {
  display: flex;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}

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

.photo-item {
  overflow: hidden;
  padding: 0;
  background: #fff;
}

.photo-item img,
.photo-placeholder {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.photo-placeholder {
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 800;
  background: linear-gradient(135deg, var(--green), var(--blue));
}

.photo-item div:last-child {
  padding: 12px;
}

.photo-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.client-shell {
  display: grid;
  gap: 18px;
}

.client-hero {
  min-height: 190px;
  padding: 24px;
  color: #fff;
  background:
    linear-gradient(90deg, rgba(31, 63, 58, 0.9), rgba(49, 91, 143, 0.55)),
    url("portal-icon.svg") right 26px center / 150px 150px no-repeat,
    var(--green);
}

.client-hero span {
  font-weight: 800;
  text-transform: uppercase;
}

.client-hero h2 {
  max-width: 720px;
  margin: 18px 0 8px;
  font-size: 44px;
}

.client-budget-row,
.approval-row,
.task-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.client-budget-totals {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 2px solid var(--line);
}

.client-budget-row.subtotal-row {
  color: var(--muted);
  font-size: 0.9em;
  border-top: 1px solid var(--line);
  padding-top: 8px;
  margin-top: 4px;
}

.client-budget-row.total-row {
  font-size: 1.05em;
  border-top: 2px solid var(--accent, #1f3f3a);
  padding-top: 10px;
  margin-top: 4px;
}

.client-budget-row.total-row strong,
.client-budget-row.total-row span {
  font-weight: 700;
  color: var(--accent, #1f3f3a);
}

.preference-block {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.invite-link-box {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.invite-link-box input {
  width: 100%;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
}

.preference-block label {
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.event-list strong {
  grid-column: 1 / -1;
}

.switch {
  display: inline-flex;
  align-items: center;
}

.switch input {
  position: absolute;
  opacity: 0;
}

.switch span {
  position: relative;
  width: 42px;
  height: 24px;
  background: #c8c5bb;
  border-radius: 999px;
}

.switch span::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  content: "";
  background: #fff;
  border-radius: 50%;
  transition: transform 0.18s ease;
}

.switch input:checked + span {
  background: var(--green-2);
}

.switch input:checked + span::after {
  transform: translateX(18px);
}

.modal-root {
  display: none;
}

.modal-root.is-open {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 24, 22, 0.5);
}

.modal {
  position: relative;
  width: min(860px, 100%);
  max-height: min(86vh, 820px);
  overflow: auto;
  background: var(--panel);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.modal-head,
.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.modal-actions {
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.modal-body {
  padding: 16px;
}

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

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

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 30;
  padding: 12px 14px;
  color: #fff;
  background: var(--green);
  border-radius: 8px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.fatal {
  padding: 24px;
  color: #7f241f;
  background: #f4dedb;
  border: 1px solid #e1b3ad;
  border-radius: 8px;
}

.login-panel {
  display: grid;
  gap: 18px;
  max-width: 980px;
}

.login-panel > div:first-child {
  padding: 18px;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 8px;
}

.login-panel p {
  max-width: 640px;
  color: var(--muted);
}

.muted-note {
  font-size: 13px;
  overflow-wrap: anywhere;
}

.login-form {
  display: grid;
  gap: 14px;
  max-width: 420px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

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

.login-card {
  display: grid;
  gap: 10px;
  align-content: start;
  padding: 16px;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 8px;
}

.login-card p {
  margin-bottom: 4px;
  overflow-wrap: anywhere;
}

.bottom-nav {
  display: none;
}

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

  .rail {
    display: none;
  }

  .workspace {
    padding: 16px 16px 92px;
  }

  .bottom-nav {
    position: fixed;
    right: 10px;
    bottom: 10px;
    left: 10px;
    z-index: 10;
    display: flex;
    gap: 4px;
    overflow-x: auto;
    padding: 6px;
    color: var(--ink);
    background: rgba(255, 253, 248, 0.96);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
  }

  .bottom-nav-item {
    display: grid;
    justify-items: center;
    flex: 0 0 82px;
    min-height: 54px;
    padding: 6px 2px;
    color: var(--muted);
  }

  .bottom-nav-item span {
    font-size: 11px;
    font-weight: 800;
  }

  .bottom-nav-item strong {
    overflow: hidden;
    width: 100%;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .bottom-nav-item.is-active {
    color: #fff;
    background: var(--green);
  }

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

  .layout-grid.two,
  .selection-grid,
  .user-grid,
  .summary-grid,
  .photo-grid {
    grid-template-columns: 1fr;
  }

  .gantt {
    grid-template-columns: 210px minmax(0, 1fr);
  }
}

@media (max-width: 720px) {
  body {
    font-size: 14px;
  }

  .topbar {
    position: static;
    display: grid;
    align-items: start;
  }

  .topbar-actions,
  .toolbar-panel,
  .inline-upload-form,
  .section-title,
  .card-head,
  .client-budget-row,
  .approval-row,
  .task-card,
  .lien-row {
    align-items: stretch;
    flex-direction: column;
  }

  .compact-field {
    min-width: 0;
  }

  .metrics-grid,
  .detail-grid,
  .form-grid,
  .export-option-grid,
  .export-metrics,
  .login-grid {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 26px;
  }

  .client-hero h2 {
    font-size: 32px;
  }

  .gantt {
    grid-template-columns: 160px minmax(0, 1fr);
  }

  .gantt-task-label {
    padding: 0 8px;
  }

  .modal-root.is-open {
    padding: 8px;
  }
}
