:root {
  --brand: #02aeca;
  --text: #333333;
  --muted: #6b7280;
  --line: #e5e7eb;
  --soft: #f5f5f5;
  --white: #ffffff;
  --danger: #b42318;
  --ok: #087443;
  --wait: #9a6700;
  --work: #075985;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--soft);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
}

a {
  color: var(--brand);
  text-decoration: none;
}

input,
select,
textarea,
button {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font: inherit;
  background: var(--white);
}

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

button,
.link-button {
  cursor: pointer;
  border: 0;
  font-weight: 700;
  text-align: center;
}

.primary {
  background: var(--brand);
  color: var(--white);
}

.small-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-height: 34px;
  padding: 7px 11px;
  border-radius: 8px;
  background: #eef2f7;
  color: #344054;
  font-size: 13px;
  font-weight: 700;
}

.danger-button {
  background: #fee4e2;
  color: var(--danger);
}

.compact-danger {
  width: auto;
  min-width: 64px;
  padding: 8px 12px;
  font-size: 12px;
}

td form {
  margin: 0;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.action-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.action-buttons form {
  margin: 0;
}

.danger-zone {
  margin-top: 18px;
  border-color: #fecdca;
  background: #fff8f7;
}

.project-detail-stack {
  display: grid;
  gap: 18px;
}

.project-summary-card h1 {
  margin: 0;
  font-size: clamp(24px, 3vw, 34px);
}

.project-summary-card p {
  margin: 4px 0 0;
  color: var(--muted);
}

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

.summary-grid div,
.project-description,
.sub-card {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fcfcfd;
}

.summary-grid dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.summary-grid dd {
  margin: 4px 0 0;
  overflow-wrap: anywhere;
  font-weight: 700;
}

.project-description {
  margin-top: 12px;
}

.project-description p {
  margin: 6px 0 0;
  overflow-wrap: anywhere;
}

.client-status-timeline {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fcfcfd;
}

.client-status-timeline h2 {
  margin: 0 0 10px;
  color: #1f2937;
  font-size: 15px;
}

.client-status-timeline ol {
  display: flex;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.client-status-timeline li {
  position: relative;
  display: grid;
  grid-template-rows: 34px auto;
  justify-items: center;
  flex: 1 1 0;
  min-width: 0;
  color: #6b7280;
  text-align: center;
}

.client-status-timeline li:not(:last-child)::after {
  content: "";
  position: absolute;
  left: calc(50% + 18px);
  right: calc(-50% + 18px);
  top: 16px;
  height: 2px;
  background: #e5e7eb;
}

.client-status-timeline .step-icon {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--white);
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 800;
}

.client-status-timeline strong {
  display: grid;
  gap: 2px;
  color: inherit;
  font-size: 12px;
  line-height: 1.25;
  white-space: normal;
  word-break: keep-all;
}

.client-status-timeline em {
  color: #037f93;
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
}

.client-status-timeline .is-done {
  color: #087443;
}

.client-status-timeline .is-done .step-icon {
  border-color: rgba(8, 116, 67, 0.25);
  background: var(--brand);
  color: var(--white);
}

.client-status-timeline .is-current {
  color: #075985;
}

.client-status-timeline .is-current .step-icon {
  width: 34px;
  height: 34px;
  border-color: var(--brand);
  border-width: 3px;
  background: var(--white);
  box-shadow: 0 0 0 4px rgba(2, 174, 202, 0.14);
}

.client-status-timeline .is-current .step-icon::after {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--brand);
}

.section-block {
  margin-top: 14px;
}

.request-step {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fcfcfd;
}

.request-step h2 {
  margin: 0;
  color: #1f2937;
  font-size: 15px;
  font-weight: 700;
}

.choice-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.choice-buttons label {
  display: block;
  cursor: pointer;
}

.choice-buttons input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.choice-buttons span {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 9px 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--white);
  color: var(--text);
  font-weight: 800;
}

.choice-buttons input:checked + span {
  border-color: var(--brand);
  background: rgba(2, 174, 202, 0.1);
  color: #037f93;
}

.request-schedule {
  gap: 8px;
}

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

.schedule-choice-grid label {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  cursor: pointer;
}

.schedule-choice-grid input {
  margin: 0;
}

.schedule-choice-grid span {
  color: #1f2937;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
}

.schedule-choice-grid label:has(input:checked) {
  border-color: var(--brand);
  background: rgba(2, 174, 202, 0.08);
}

.schedule-date {
  max-width: 280px;
}

.delivery-due-row {
  display: grid;
  grid-template-columns: minmax(180px, 280px) auto;
  gap: 10px;
  align-items: end;
}

.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  margin: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  font-weight: 700;
  cursor: pointer;
}

.inline-check input {
  width: auto;
}

.request-scope-list,
.request-target-grid {
  display: grid;
  gap: 6px;
}

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

.target-scope-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  min-height: 52px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  cursor: pointer;
}

.target-scope-card input {
  margin-top: 3px;
}

.target-scope-card strong {
  display: block;
  color: #222222;
  font-size: 14px;
  font-weight: 600;
}

.target-scope-card small {
  display: block;
  margin-top: 2px;
  color: #6b7280;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.55;
}

.target-scope-card:has(input:checked) {
  border-color: var(--brand);
  background: rgba(2, 174, 202, 0.08);
}

.target-scope-note {
  padding: 7px 10px;
  border-left: 4px solid var(--brand);
  border-radius: 8px;
  background: rgba(2, 174, 202, 0.08);
  color: #222222;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.55;
}

.request-target-detail {
  display: grid;
  gap: 6px;
}

.request-target-detail[hidden] {
  display: none;
}

.request-option,
.request-target {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  min-height: 48px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  cursor: pointer;
}

.request-option input,
.request-target input {
  margin-top: 3px;
}

.request-option span,
.request-target span {
  display: grid;
  gap: 2px;
  min-width: 0;
  color: #222222;
  font-weight: 600;
}

.request-option strong {
  color: #222222;
  font-weight: 600;
}

.request-target span {
  color: #222222;
  font-weight: 600;
}

.request-option small,
.request-target small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.55;
}

.request-target small {
  color: #6b7280;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.6;
}

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

.steel-quote-options {
  grid-column: 2;
  display: grid;
  gap: 5px;
  margin-top: 5px;
  padding: 6px 0 0 10px;
  border-left: 2px solid var(--brand);
}

.steel-quote-options[hidden] {
  display: none;
}

.steel-quote-options > strong {
  color: #1f2937;
  font-size: 12px;
}

.steel-quote-choice {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
}

.steel-quote-radio {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #1f2937;
  font-size: 12px;
  font-weight: 600;
}

.request-scope-description {
  padding: 8px 10px;
  border-left: 4px solid var(--brand);
  border-radius: 8px;
  background: rgba(2, 174, 202, 0.08);
  color: #222222;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.58;
}

.request-step-targets {
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.request-step-targets.is-pending {
  opacity: 0.72;
}

.request-other-detail {
  margin-top: 2px;
}

.request-description-field {
  margin-top: 2px;
}

.request-description-textarea {
  min-height: 96px;
  overflow: hidden;
  resize: none;
}

.compact-list {
  margin: 0;
  padding-left: 18px;
}

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

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

.compact-form-grid button,
.stack .compact-action {
  justify-self: start;
}

.readonly-field {
  display: grid;
  gap: 6px;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

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

.readonly-field strong {
  overflow-wrap: anywhere;
}

.quote-section,
.file-drawing-section,
.comments-section,
.internal-management-section {
  overflow: hidden;
}

.quote-section table,
.file-drawing-section table,
.internal-management-section table {
  min-width: 0;
  width: 100%;
}

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

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

.sub-card h3,
.section-block h3,
.danger-zone h3 {
  margin-top: 0;
}

.quote-layout {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(360px, 1.25fr);
  gap: 16px;
  align-items: start;
}

.quote-layout.is-client {
  grid-template-columns: 1fr;
}

.quote-register-column .sub-card {
  height: 100%;
}

.quote-register-column .compact-form-grid {
  grid-template-columns: 1fr;
}

.quote-register-column .file-picker,
.quote-register-column .selected-files,
.quote-register-column .selected-files-panel {
  width: 100%;
  min-width: 0;
}

.quote-register-column .file-drop-zone {
  width: 100%;
  min-width: 280px;
}

.quote-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid #bae6fd;
  border-radius: 8px;
  background: #f0f9ff;
}

.quote-current-column {
  display: grid;
  gap: 14px;
}

.shared-files-card {
  display: grid;
  gap: 14px;
}

.shared-files-card h3,
.shared-files-card h4 {
  margin: 0;
}

.shared-file-form {
  grid-template-columns: minmax(180px, 0.45fr) minmax(0, 1fr) auto;
  align-items: end;
}

.shared-file-form .full {
  grid-column: auto;
}

.shared-file-drop-form {
  display: block;
}

.shared-file-picker {
  display: block;
}

.shared-file-picker .file-drop-zone {
  min-height: 76px;
  padding: 12px 14px;
  border-radius: 8px;
}

.shared-file-picker .file-drop-zone span {
  font-weight: 800;
}

.shared-file-picker .file-select-button {
  min-width: 148px;
}

.shared-file-picker .file-help-note {
  margin: 8px 0 0;
}

.shared-file-picker .selected-files-panel {
  margin-top: 8px;
}

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

.shared-file-table-wrap {
  margin-top: 8px;
}

.shared-file-table {
  min-width: 0;
}

.shared-file-table th:first-child,
.shared-file-table td:first-child {
  width: 72px;
  text-align: center;
}

.shared-file-table td:nth-child(2) {
  min-width: 0;
}

.shared-file-table td:nth-child(2) a {
  display: block;
  overflow-wrap: anywhere;
  font-weight: 700;
}

.file-kind-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #e0f7fb;
  color: #075985;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.client-quote-amount-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.client-quote-breakdown {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 16px 24px;
}

.quote-download-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 8px;
  background: var(--brand);
  color: var(--white);
  font-weight: 800;
  white-space: nowrap;
  box-shadow: 0 8px 20px rgba(2, 174, 202, 0.18);
}

.quote-download-button span {
  margin-right: 6px;
}

.quote-amount {
  margin: 2px 0 0;
  color: #075985;
  font-size: clamp(40px, 5vw, 48px);
  line-height: 1;
  font-weight: 800;
}

.tax-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin: 0;
  color: #334155;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.45;
}

.quote-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.quote-response-box,
.quote-response-form {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #bae6fd;
}

.quote-history {
  margin-top: 12px;
}

.quote-current-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.quote-current-actions .small-button {
  width: auto;
}

.quote-history-toggle {
  margin-top: 10px;
}

.quote-history-toggle summary {
  display: inline-flex;
  align-items: center;
  width: auto;
  min-height: 34px;
  padding: 7px 12px;
  border-radius: 8px;
  background: var(--brand);
  color: var(--white);
  font-weight: 700;
  cursor: pointer;
}

.quote-history-toggle[open] summary {
  margin-bottom: 8px;
}

.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.inline-actions button,
.inline-actions .small-button {
  width: auto;
}

.inline-delete-form {
  display: inline-flex;
  width: auto;
  margin: 4px 0 0 8px;
  vertical-align: middle;
}

.inline-delete-form button {
  width: auto;
}

.material-admin {
  grid-column: 1 / -1;
}

.material-arrival-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.material-row {
  display: grid;
  grid-template-columns: minmax(128px, 0.8fr) minmax(112px, 0.8fr) minmax(140px, 1fr) minmax(112px, 0.8fr) minmax(160px, 1.4fr) auto auto;
  gap: 8px;
  align-items: center;
}

.material-row-client {
  grid-template-columns: minmax(128px, 0.8fr) minmax(112px, 0.8fr) minmax(112px, 0.8fr) minmax(180px, 1.6fr);
}

.material-row-form,
.material-row-existing {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fcfcfd;
  min-width: 0;
}

.material-row-edit {
  display: contents;
}

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

.supplier-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 110px 120px auto;
  gap: 8px;
  align-items: center;
  min-width: 0;
}

.client-user-row {
  grid-template-columns: minmax(150px, 1fr) minmax(180px, 1.2fr) minmax(140px, 1fr) 110px auto auto;
}

.client-user-actions {
  justify-content: flex-end;
  margin-bottom: 10px;
}

.supplier-disable-form {
  margin: -8px 0 8px;
  display: flex;
  justify-content: flex-end;
}

.purchase-management {
  display: grid;
  gap: 14px;
}

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

.purchase-summary div {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
}

.purchase-summary span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.purchase-summary strong {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
  font-size: 18px;
}

.purchase-form-inline {
  display: grid;
  grid-template-columns: minmax(170px, 1fr) minmax(120px, 0.7fr) minmax(260px, 1.4fr) auto;
  gap: 10px;
  align-items: end;
  padding-top: 4px;
}

.purchase-form-inline label {
  min-width: 0;
}

.purchase-file-inline {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
}

.purchase-file-inline input[type="file"] {
  width: min(150px, 42%);
  min-width: 118px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-size: 13px;
}

.purchase-file-inline span {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.purchase-form-inline .compact-action {
  min-height: 46px;
}

.compact-action {
  width: auto;
  min-width: 64px;
  padding: 8px 12px;
}

.material-calendar-wrap {
  overflow-x: auto;
}

.material-calendar {
  min-width: 880px;
  table-layout: fixed;
}

.material-calendar th {
  background: #f8fafc;
}

.material-calendar td {
  height: 128px;
  vertical-align: top;
}

.calendar-day.is-outside {
  background: #fafafa;
  color: var(--muted);
}

.calendar-day.is-today {
  box-shadow: inset 0 0 0 2px rgba(2, 174, 202, 0.35);
}

.calendar-date {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.calendar-event {
  display: grid;
  gap: 2px;
  margin-bottom: 6px;
  padding: 7px;
  border-left: 4px solid var(--brand);
  border-radius: 6px;
  background: #f0fbfd;
  color: var(--text);
  font-size: 12px;
}

.calendar-event strong {
  overflow-wrap: anywhere;
}

.calendar-event span {
  color: var(--muted);
}

.material-status-arrived {
  border-left-color: var(--ok);
  background: #ecfdf3;
}

.material-status-delayed {
  border-left-color: var(--wait);
  background: #fffbeb;
}

.material-status-cancelled {
  border-left-color: var(--danger);
  background: #fff1f0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
}

.brand {
  color: var(--text);
  font-weight: 800;
}

.brand span {
  color: var(--brand);
  margin-right: 6px;
}

.brand small {
  color: var(--muted);
  letter-spacing: 0;
}

.topbar nav {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.topbar nav a {
  color: var(--text);
  font-size: 14px;
}

.container {
  width: min(1180px, calc(100% - 32px));
  margin: 24px auto 56px;
}

.auth-card,
.panel {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.04);
}

.auth-card {
  max-width: 440px;
  margin: 72px auto;
}

.auth-card form {
  display: grid;
  gap: 14px;
}

.auth-card form > button.primary {
  margin-top: 12px;
}

.auth-card h1,
.panel h1,
.panel h2 {
  margin-top: 0;
}

.narrow {
  max-width: 760px;
  margin-inline: auto;
}

.hero,
.page-head,
.project-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.hero {
  padding: 24px;
  border-radius: 8px;
  background: var(--white);
  border-left: 5px solid var(--brand);
}

.hero h1,
.project-title h1,
.page-head h1 {
  margin: 0;
}

.hero p,
.project-title p,
.muted {
  color: var(--muted);
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

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

.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.stat-card strong {
  font-size: 30px;
}

.two-col,
.admin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.two-col.wide {
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.8fr);
}

.admin-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 18px;
}

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

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

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.stack {
  display: grid;
  gap: 12px;
}

.search {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(140px, 220px) 110px;
  gap: 10px;
  margin-bottom: 16px;
}

.project-search {
  grid-template-columns: minmax(220px, 1.3fr) repeat(5, minmax(130px, 1fr)) 96px;
  align-items: end;
}

.list-summary {
  margin: 4px 0 12px;
  color: var(--muted);
  font-size: 13px;
}

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

.section-title-row h2 {
  margin: 0;
}

.section-title-row span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.table-wrap {
  overflow-x: auto;
}

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

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

th {
  color: var(--muted);
  font-size: 13px;
}

.dashboard-table-scroll {
  max-height: 450px;
  overflow-x: auto;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #98a2b3 #f2f4f7;
}

.dashboard-table-scroll::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.dashboard-table-scroll::-webkit-scrollbar-track {
  background: #f2f4f7;
}

.dashboard-table-scroll::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: #98a2b3;
}

.dashboard-project-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--white);
  box-shadow: 0 1px 0 var(--line);
}

.dashboard-project-table th a {
  color: var(--muted);
  white-space: nowrap;
}

.dashboard-project-table td {
  background: var(--white);
}

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

.revenue-dashboard,
.attention-dashboard {
  margin-top: 18px;
}

.order-notifications {
  margin-top: 16px;
}

.order-notification-list {
  display: grid;
  gap: 12px;
}

.notification-lead {
  margin: 0 0 12px;
  color: var(--text);
  font-weight: 700;
}

.order-notification-card {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(240px, 1.2fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid #bae6fd;
  border-radius: 8px;
  background: #f0f9ff;
}

.order-notification-card h3 {
  margin: 4px 0;
  color: var(--text);
  font-size: 18px;
}

.order-notification-card p,
.order-notification-card dl {
  margin: 0;
}

.order-notification-card dl {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 6px 10px;
}

.order-notification-card dt {
  color: var(--muted);
  font-weight: 700;
}

.order-notification-card dd {
  margin: 0;
  font-weight: 700;
}

.client-notifications {
  margin-top: 16px;
}

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

.client-notification-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid #bae6fd;
  border-radius: 8px;
  background: #f0f9ff;
}

.client-notification-card h3 {
  margin: 4px 0;
  color: var(--text);
  font-size: 18px;
}

.client-notification-card p {
  margin: 0 0 4px;
  color: var(--muted);
  font-weight: 700;
}

.client-notification-card small {
  color: var(--muted);
}

.revenue-filter-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.client-filter-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
}

.client-filter-select {
  width: auto;
  min-width: 210px;
  height: 38px;
  padding: 6px 32px 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background-color: var(--white);
  color: var(--text);
  font-weight: 700;
}

.period-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.period-tabs .is-active {
  background: var(--brand);
  color: var(--white);
}

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

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

.revenue-card h3 {
  margin: 0 0 10px;
}

.revenue-note {
  margin: -4px 0 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.6;
}

.revenue-card dl {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 12px;
  margin: 0;
}

.revenue-card dt {
  color: var(--muted);
  font-weight: 700;
}

.revenue-card dd {
  margin: 0;
  font-weight: 800;
  text-align: right;
}

.profit-rate {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.revenue-chart {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
}

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

.revenue-chart-head h3 {
  margin: 0 0 4px;
}

.revenue-target-tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.revenue-target-tabs .is-active {
  background: var(--brand);
  color: var(--white);
}

.monthly-chart-wrap {
  width: 100%;
  min-height: 300px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
}

.monthly-revenue-canvas {
  display: block;
  width: 100%;
  min-width: 720px;
  height: 360px;
}

.monthly-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.monthly-chart-legend button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: auto;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--white);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.monthly-chart-legend button.is-muted {
  color: var(--muted);
  opacity: 0.45;
}

.monthly-chart-legend i {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chart-legend i {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

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

.chart-group {
  display: grid;
  gap: 8px;
  text-align: center;
}

.chart-bars {
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 12px;
  height: 180px;
  padding: 12px;
  border-radius: 8px;
  background: #f8fafc;
}

.chart-bar {
  width: 34px;
  min-height: 2%;
  border-radius: 6px 6px 0 0;
}

.bar-sales {
  background: #02aeca;
}

.bar-purchases {
  background: #64748b;
}

.bar-profit {
  background: #087443;
}

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

.attention-card {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fcfcfd;
  color: var(--text);
}

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

.attention-card strong {
  color: var(--brand);
  font-size: 24px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #eef2f7;
  color: #344054;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.badge-new {
  background: #e0f2fe;
  color: #0369a1;
}

.badge-done {
  background: #dcfae6;
  color: var(--ok);
}

.badge-hold {
  background: #f2f4f7;
  color: #475467;
}

.badge-lost {
  background: #fee4e2;
  color: var(--danger);
}

.badge-quote {
  background: #e0e7ff;
  color: #3730a3;
}

.badge-wait {
  background: #fef0c7;
  color: var(--wait);
}

.badge-work {
  background: #e0f2fe;
  color: var(--work);
}

.flash {
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 8px;
  background: #e0f2fe;
  color: var(--work);
}

.flash.error {
  background: #fee4e2;
  color: var(--danger);
}

.flash.success {
  background: #dcfae6;
  color: var(--ok);
}

.details {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 10px 16px;
}

.details dt {
  color: var(--muted);
  font-weight: 700;
}

.file-list,
.comment-list {
  display: grid;
  gap: 8px;
  padding: 0;
  list-style: none;
}

.file-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 12px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fcfcfd;
}

.comment-item,
.version-list a,
.note {
  display: block;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fcfcfd;
}

.file-list-main {
  min-width: 0;
}

.file-list-main a {
  overflow-wrap: anywhere;
  font-weight: 700;
}

.file-list-size {
  white-space: nowrap;
  text-align: right;
}

.file-list small,
.version-list small,
.note small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.file-picker input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.file-help {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px dashed var(--brand);
  border-radius: 8px;
  background: #f0fbfd;
  color: #075985;
  font-size: 13px;
  font-weight: 700;
}

.file-help[hidden] {
  display: none;
}

.file-help-note {
  margin: 4px 0 0;
  color: #6b7280;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.55;
}

.file-help::before {
  content: "ファイルを選択";
  margin-right: 10px;
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--brand);
  color: var(--white);
}

.file-picker > span:not(.file-help) {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.file-drop-zone {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 72px;
  padding: 12px;
  border: 1px dashed var(--brand);
  border-radius: 8px;
  background: #f0fbfd;
  color: #075985;
  font-size: 13px;
  font-weight: 700;
  transition: background-color 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.file-drop-zone span {
  min-width: 0;
  white-space: normal;
  word-break: keep-all;
  overflow-wrap: normal;
}

.file-drop-zone.is-dragging {
  border-color: #0284a8;
  background: #dff7fb;
  box-shadow: 0 0 0 3px rgba(2, 174, 202, 0.16);
}

.file-select-button {
  flex: 0 0 auto;
  width: auto;
  min-width: 116px;
  padding: 8px 12px;
  border: 0;
  background: var(--brand);
  color: var(--white);
  font-size: 13px;
  white-space: nowrap;
}

.selected-files {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.selected-files-panel {
  display: grid;
  gap: 10px;
  margin-top: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.selected-files-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.selected-files-head strong {
  color: var(--text);
  font-size: 14px;
}

.clear-files {
  width: auto;
  min-width: 92px;
  padding: 7px 10px;
  background: #f2f4f7;
  color: #475467;
  font-size: 12px;
}

.selected-files li {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fcfcfd;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
}

.file-number {
  color: var(--muted);
  font-weight: 700;
}

.file-icon {
  font-size: 18px;
  line-height: 1;
}

.file-meta {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.file-name {
  overflow-wrap: anywhere;
  color: var(--text);
  font-weight: 700;
}

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

.selected-files button {
  width: auto;
  min-width: 58px;
  padding: 8px 12px;
  border: 1px solid #fecdca;
  background: #fff1f0;
  color: var(--danger);
  font-size: 12px;
}

.status-pair {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.pagination a {
  min-width: 36px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  text-align: center;
}

.pagination a.current {
  border-color: var(--brand);
  background: var(--brand);
  color: var(--white);
}

.selected-files-empty {
  display: block !important;
  color: var(--muted) !important;
  font-weight: 500 !important;
}

.chat {
  display: grid;
  gap: 12px;
  max-height: 520px;
  overflow-y: auto;
  padding-right: 4px;
  margin-bottom: 14px;
}

.bubble {
  border-radius: 8px;
  padding: 12px;
  background: var(--soft);
}

.bubble.admin {
  border-left: 4px solid var(--brand);
}

.bubble.client {
  border-left: 4px solid #98a2b3;
}

.secret-box {
  margin-bottom: 16px;
  padding: 14px;
  border-radius: 8px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
}

.secret-box dd {
  margin: 0 0 8px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-weight: 700;
}

@media (max-width: 900px) {
  .quote-layout {
    grid-template-columns: 1fr;
  }

  .quote-register-column .file-drop-zone {
    min-width: 0;
  }
}

@media (max-width: 820px) {
  .topbar,
  .hero,
  .page-head,
  .project-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .container {
    width: min(100% - 20px, 1180px);
    margin-top: 14px;
  }

  .two-col,
  .two-col.wide,
  .admin-grid,
  .form-grid,
  .compact-form-grid,
  .quote-layout,
  .summary-grid,
  .management-grid,
  .request-target-grid,
  .target-scope-list,
  .schedule-choice-grid,
  .delivery-due-row,
  .search,
  .project-search {
    grid-template-columns: 1fr;
  }

  .auth-card,
  .panel {
    padding: 16px;
  }

  table {
    min-width: 580px;
  }

  .client-status-timeline ol {
    display: grid;
    gap: 0;
  }

  .client-status-timeline li {
    grid-template-columns: 34px minmax(0, 1fr);
    grid-template-rows: 1fr;
    justify-items: start;
    min-height: 36px;
    text-align: left;
  }

  .client-status-timeline li:not(:last-child)::after {
    left: 16px;
    right: auto;
    top: 28px;
    bottom: -8px;
    width: 2px;
    height: auto;
  }

  .client-status-timeline strong {
    align-self: center;
    font-size: 14px;
  }

  .client-quote-amount-row {
    align-items: stretch;
    flex-direction: column;
  }

  .client-quote-breakdown,
  .tax-breakdown {
    display: grid;
    gap: 6px;
  }

  .quote-amount {
    font-size: 40px;
  }

  .quote-download-button {
    width: 100%;
  }

  .selected-files-head {
    align-items: stretch;
    flex-direction: column;
  }

  .file-drop-zone {
    grid-template-columns: 1fr;
  }

  .material-row {
    grid-template-columns: 1fr;
  }

  .supplier-row {
    grid-template-columns: 1fr;
  }

  .purchase-summary {
    grid-template-columns: 1fr;
  }

  .revenue-summary-grid,
  .chart-groups,
  .attention-grid,
  .order-notification-card,
  .client-notification-card {
    grid-template-columns: 1fr;
  }

  .order-notification-card .inline-actions,
  .order-notification-card form,
  .order-notification-card a,
  .order-notification-card button {
    width: 100%;
  }

  .client-notification-card .inline-actions,
  .client-notification-card form,
  .client-notification-card a,
  .client-notification-card button {
    width: 100%;
  }

  .period-tabs {
    justify-content: stretch;
  }

  .period-tabs button {
    flex: 1 1 45%;
  }

  .revenue-filter-form,
  .client-filter-label,
  .client-filter-select {
    width: 100%;
  }

  .revenue-chart-head,
  .revenue-target-tabs {
    align-items: stretch;
    flex-direction: column;
  }

  .revenue-target-tabs button {
    flex: 1 1 auto;
  }

  .monthly-revenue-canvas {
    min-width: 640px;
    height: 320px;
  }

  .purchase-form-inline {
    grid-template-columns: 1fr;
  }

  .shared-file-form {
    grid-template-columns: 1fr;
  }

  .shared-file-form .full {
    grid-column: 1;
  }

  .purchase-file-inline {
    align-items: stretch;
    flex-direction: column;
  }

  .purchase-file-inline input[type="file"] {
    width: 100%;
  }

  .supplier-disable-form {
    justify-content: stretch;
  }

  .supplier-disable-form button {
    width: 100%;
  }

  .compact-action {
    width: 100%;
  }

  .file-select-button {
    width: 100%;
  }

  .clear-files {
    width: 100%;
  }

  .selected-files li {
    grid-template-columns: auto auto minmax(0, 1fr);
  }

  .selected-files li button {
    grid-column: 1 / -1;
    width: 100%;
  }

  .action-buttons,
  .action-buttons form,
  .action-buttons button,
  .action-buttons a {
    width: 100%;
  }

  .quote-actions {
    grid-template-columns: 1fr;
  }
}
