:root {
  --bg: #f4f6f7;
  --surface: #ffffff;
  --surface-soft: #eef3f1;
  --ink: #17211f;
  --muted: #64716e;
  --line: #d9e1df;
  --accent: #12685b;
  --accent-dark: #0b4d43;
  --accent-soft: #e0f0ec;
  --blue: #275f91;
  --gold: #9a6a16;
  --red: #a23a35;
  --shadow: 0 16px 38px rgba(22, 35, 32, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

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

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

button {
  cursor: pointer;
}

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

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 26px;
  padding: 24px 16px;
  background: #142622;
  color: #f7faf9;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px;
}

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

.brand-name {
  font-size: 17px;
  font-weight: 800;
}

.brand-subtitle {
  color: #aec1bc;
  font-size: 13px;
}

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

.nav-tab {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  padding: 10px 12px;
  background: transparent;
  color: #d7e5e1;
  text-align: left;
}

.nav-tab:hover,
.nav-tab.active {
  background: #203d38;
  color: #ffffff;
}

.nav-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 26px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.11);
  font-size: 13px;
  font-weight: 800;
}

.side-panel {
  margin-top: auto;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.05);
}

.side-label {
  color: #aec1bc;
  font-size: 12px;
  font-weight: 800;
}

.side-panel ul {
  margin: 12px 0 0;
  padding-left: 18px;
  color: #d7e5e1;
  line-height: 1.75;
  font-size: 13px;
}

.main {
  min-width: 0;
  padding: 28px;
}

.topbar,
.toolbar,
.panel-header,
.detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.topbar {
  margin-bottom: 24px;
}

.eyebrow {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

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

h1 {
  margin-bottom: 6px;
  font-size: 30px;
}

h2 {
  margin-bottom: 6px;
  font-size: 18px;
}

h3 {
  margin-bottom: 10px;
  font-size: 15px;
}

p {
  color: var(--muted);
  line-height: 1.55;
}

.topbar-copy {
  max-width: 780px;
  margin-bottom: 0;
}

.topbar-actions,
.toolbar-actions,
.form-actions,
.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.primary-button,
.ghost-button,
.icon-button {
  min-height: 40px;
  border-radius: 8px;
  font-weight: 750;
}

.primary-button {
  border: 1px solid var(--accent);
  padding: 0 15px;
  background: var(--accent);
  color: #ffffff;
}

.primary-button:hover {
  background: var(--accent-dark);
}

.ghost-button {
  border: 1px solid var(--line);
  padding: 0 14px;
  background: #ffffff;
  color: var(--ink);
}

.icon-button {
  display: grid;
  place-items: center;
  width: 34px;
  min-height: 34px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--red);
  font-size: 19px;
}

.view {
  display: none;
}

.view.active {
  display: grid;
  gap: 18px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.toolbar {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px 18px;
  background: var(--surface);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
  background: #ffffff;
  color: var(--ink);
}

textarea {
  resize: vertical;
}

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

label input,
label select,
label textarea {
  color: var(--ink);
  font-weight: 500;
}

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

.metric {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: var(--surface);
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

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

.split-layout {
  display: grid;
  grid-template-columns: minmax(330px, 0.88fr) minmax(0, 1.12fr);
  gap: 16px;
}

.request-list,
.customer-list,
.file-list,
.line-items-editor {
  display: grid;
  gap: 10px;
}

.request-card {
  display: grid;
  gap: 10px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #ffffff;
  color: var(--ink);
  text-align: left;
}

.request-card:hover,
.request-card.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.request-card strong,
.request-card span,
.customer-card strong,
.customer-card span,
.info-box strong,
.info-box span {
  display: block;
}

.request-card span,
.request-card-line,
.customer-card span,
.info-box span,
.file-list span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.request-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.status-pill,
.mini-pill,
.count-badge {
  display: inline-flex;
  align-items: center;
  width: max-content;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 9px;
  background: #edf2f1;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
}

.status-pill.strong {
  min-height: 34px;
  background: var(--accent-soft);
}

.mini-pill {
  background: #eef3f7;
  color: var(--blue);
}

.form-layout,
.customer-form {
  display: grid;
  gap: 16px;
}

.module-section {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #f9fbfb;
}

.module-section h3 {
  margin-bottom: 0;
}

.module-grid {
  display: grid;
  gap: 12px;
}

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

.sub-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #ffffff;
}

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

.form-section {
  display: grid;
  gap: 16px;
}

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

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

.info-box {
  display: grid;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f9fbfb;
}

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

.choice-card {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 10px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #ffffff;
  color: var(--ink);
}

.choice-card input {
  width: 18px;
  margin-top: 2px;
}

.choice-card span {
  grid-column: 2;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

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

.line-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.process-config {
  display: grid;
  gap: 12px;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f9fbfb;
}

.process-config h3 {
  margin-bottom: 0;
}

.process-config p {
  margin-bottom: 0;
  font-size: 13px;
}

.checkbox-field {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #ffffff;
}

.checkbox-field legend {
  padding: 0 5px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.check-chip {
  display: inline-flex;
  align-items: center;
  width: auto;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px 9px;
  background: #f9fbfb;
  color: var(--ink);
  font-size: 13px;
}

.check-chip input {
  width: 15px;
  margin: 0;
}

.item-file-drop {
  display: grid;
  gap: 8px;
  border: 1px dashed #a8bbb6;
  border-radius: 8px;
  padding: 12px;
  background: #ffffff;
}

.item-file-drop input {
  max-width: 420px;
}

.item-file-drop small,
.line-item-file-list {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.line-item-file-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.line-item-file-list span {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 9px;
  background: #ffffff;
}

.surface-treatment-panel,
.surface-kind-panel {
  display: grid;
  gap: 12px;
  grid-column: 1 / -1;
  width: 100%;
}

.surface-kind-panel.hidden {
  display: none !important;
}

.surface-kind-panel > .line-grid {
  grid-template-columns: repeat(4, minmax(180px, 1fr));
}

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

.scenario-grid {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.wide-label {
  grid-column: span 2;
}

.file-drop {
  display: grid;
  gap: 8px;
  place-items: center;
  min-height: 112px;
  border: 1px dashed #a8bbb6;
  border-radius: 8px;
  padding: 18px;
  background: #f9fbfb;
  text-align: center;
}

.file-drop input {
  max-width: 420px;
}

.file-drop small {
  color: var(--muted);
  font-weight: 500;
}

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

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

.service-grid label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: #ffffff;
  color: var(--ink);
}

.service-grid input {
  width: 16px;
}

.bulk-toolbar {
  display: grid;
  grid-template-columns: minmax(230px, 1.2fr) minmax(200px, 0.9fr) minmax(260px, 1.2fr) auto;
  gap: 12px;
  align-items: center;
  margin: 14px 0 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf9;
}

.bulk-toolbar-head {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.bulk-toolbar-head > div:first-child {
  display: grid;
  gap: 3px;
}

.bulk-toolbar-head strong {
  color: var(--ink);
  font-size: 15px;
}

.bulk-toolbar-head span,
.bulk-control > span,
.bulk-feedback {
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.bulk-status {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 76px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.bulk-status strong {
  font-size: 20px;
}

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

.bulk-control {
  display: grid;
  gap: 7px;
}

.bulk-control select {
  width: 100%;
}

.segmented-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.segmented-actions button {
  min-height: 38px;
  border: 0;
  border-right: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  font-weight: 750;
}

.segmented-actions button:last-child {
  border-right: 0;
}

.segmented-actions button:hover {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.compact-action {
  white-space: nowrap;
}

.bulk-feedback {
  grid-column: 1 / -1;
  margin: -2px 0 0;
}

.line-select-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.line-select-label input {
  width: 16px;
}

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

.summary-group-title {
  grid-column: 1 / -1;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  color: var(--green);
  font-size: 14px;
  font-weight: 800;
}

.summary-group-title:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

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

.summary-row span {
  color: var(--muted);
}

.detail-section {
  margin-top: 18px;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

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

th {
  background: #f3f7f6;
  color: var(--muted);
  font-weight: 800;
}

tr:last-child td {
  border-bottom: 0;
}

.detail-preview {
  min-height: 420px;
}

.empty-state {
  display: grid;
  place-items: center;
  align-content: center;
  min-height: 260px;
  text-align: center;
}

.empty-state.compact {
  min-height: 150px;
  border: 1px dashed var(--line);
  border-radius: 8px;
}

.customer-card {
  display: grid;
  grid-template-columns: 1.1fr 1fr 1.2fr 1.3fr;
  gap: 14px;
}

.hidden {
  display: none !important;
}

.muted-area {
  opacity: 0.62;
}

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

  .sidebar {
    position: static;
    height: auto;
  }

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

  .split-layout,
  .form-grid,
  .line-grid,
  .bulk-toolbar,
  .metric-grid,
  .service-grid,
  .module-grid.two-cols,
  .customer-card {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .main {
    padding: 18px;
  }

  .topbar,
  .toolbar,
  .panel-header,
  .detail-header,
  .summary-row {
    display: grid;
  }

  .nav-tabs,
  .split-layout,
  .form-grid,
  .line-grid,
  .bulk-toolbar,
  .metric-grid,
  .service-grid,
  .choice-grid,
  .summary-grid,
  .scope-summary,
  .module-grid.two-cols,
  .compact-module-grid,
  .customer-card {
    grid-template-columns: 1fr;
  }

  .wide-label {
    grid-column: auto;
  }

  .bulk-toolbar-head {
    display: grid;
  }

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

  .segmented-actions button:nth-child(2) {
    border-right: 0;
  }

  .segmented-actions button:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }
}
