:root {
  --text: #172b36;
  --muted: #172b36;
  --line: #0f4c75;
  --panel: #dee8ed;
  --bg: #dee8ed;
  --blue: #1487c9;
  --blue-dark: #0f4c75;
  --green: #5fad00;
  --shadow: 0 4px 10px #dee8ed;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #fff;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
  transition: transform 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}

button:hover {
  transform: translateY(-2px);
}

.app-shell {
  width: min(1840px, calc(100% - 72px));
  margin: 0 auto;
  padding: 34px 0 56px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 48px;
}

h1 {
  margin: 0;
  font-size: clamp(38px, 4vw, 45px);
  line-height: 0.95;
  letter-spacing: 0;
}

h1 span {
  color: var(--blue);
}

.topbar p {
  margin: 18px 0 0;
  color: #172b36;
  font-size: 24px;
}

.primary-action,
.save-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  min-height: 58px;
  border: 0;
  border-radius: 7px;
  padding: 0 34px;
  color: #fff;
  background: linear-gradient(90deg, var(--blue) 0%, #0f4c75 100%);
  box-shadow: 0 3px 8px #dee8ed;
  font-weight: 800;
  font-size: 20px;
}

.icon {
  font-size: 30px;
  line-height: 1;
  font-weight: 400;
}

.filter-panel {
  background: var(--panel);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 34px;
  margin-bottom: 34px;
}

.letter-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 13px;
}

.letter-button {
  min-width: 58px;
  height: 58px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #dee8ed;
  color: #172b36;
  box-shadow: 0 2px 4px #dee8ed;
  font-weight: 800;
  font-size: 20px;
}

.letter-button:hover {
  background: #fff;
}

.letter-button.active {
  border-color: var(--blue);
  background: var(--blue);
  color: #dee8ed;
  box-shadow: 0 3px 7px #dee8ed;
}

.customer-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(300px, 1fr));
  gap: 36px;
}

.empty-state {
  grid-column: 1 / -1;
  min-height: 220px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
  background: #dee8ed;
  border: 1px dashed #0f4c75;
  border-radius: 16px;
  padding: 28px;
}

.empty-state strong {
  display: block;
  color: var(--text);
  font-size: 26px;
  margin-bottom: 8px;
}

.customer-card {
  position: relative;
  overflow: hidden;
  min-height: 290px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: #dee8ed;
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 46px 34px 34px;
}

.customer-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 12px;
  background: linear-gradient(90deg, #1487c9, #0f4c75, #dee8ed);
}

.customer-head {
  display: grid;
  grid-template-columns: 64px 1fr;
  align-items: center;
  gap: 22px;
}

.building-icon {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 10px;
  color: var(--blue);
  background: #fff;
  font-size: 32px;
}

.company-mark {
  position: relative;
  display: block;
  width: 42px;
  height: 42px;
}

.company-mark::before,
.company-mark::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 4px;
  background: #0f4c75;
}

.tower,
.annex {
  position: absolute;
  bottom: 4px;
  border: 4px solid #0f4c75;
  background: #fff;
}

.tower {
  left: 3px;
  width: 19px;
  height: 36px;
}

.annex {
  right: 3px;
  width: 21px;
  height: 25px;
}

.tower::before,
.annex::before {
  content: "";
  position: absolute;
  background: #0f4c75;
}

.tower::before {
  top: 4px;
  left: 4px;
  width: 6px;
  height: 6px;
  box-shadow:
    0 10px 0 #0f4c75,
    0 20px 0 #0f4c75;
}

.annex::before {
  top: 5px;
  left: 5px;
  width: 5px;
  height: 6px;
  box-shadow:
    8px 0 0 #0f4c75,
    0 10px 0 #0f4c75,
    8px 10px 0 #0f4c75;
}

.customer-card h2 {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 28px;
  line-height: 1.15;
}

.stats {
  display: grid;
  gap: 10px;
  margin: 22px 0 20px 86px;
  font-size: 21px;
  color: var(--muted);
}

.stats div {
  display: flex;
  justify-content: space-between;
  gap: 22px;
}

.stats strong {
  color: #172b36;
}

.card-actions {
  display: grid;
  grid-template-columns: 1fr 0.65fr;
  gap: 12px;
}

.details-button,
.order-button {
  min-height: 52px;
  border: 0;
  border-radius: 6px;
  color: #fff;
  font-weight: 800;
  font-size: 19px;
  box-shadow: 0 3px 7px #dee8ed;
}

.details-button {
  background: linear-gradient(180deg, #1487c9, #0f4c75);
}

.order-button {
  background: linear-gradient(90deg, #5fad00, #006600);
}

.customer-detail-view {
  display: grid;
  gap: 32px;
}

.back-button {
  justify-self: start;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #dee8ed;
  color: #172b36;
  padding: 0 18px;
  font-weight: 800;
  box-shadow: 0 2px 4px #dee8ed;
}

.detail-hero {
  background: #dee8ed;
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.orders-panel {
  background: #fff;
  border: 1px solid #dee8ed;
  border-radius: 16px;
  box-shadow: 0 6px 16px #dee8ed;
}

.detail-hero {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 28px;
  min-height: 232px;
  padding: 64px 40px 42px;
}

.detail-hero::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 18px;
  background: linear-gradient(90deg, #0f4c75, #1487c9, #5fad00);
}

.detail-title h2 {
  margin: 0 0 22px;
  overflow-wrap: anywhere;
  font-size: clamp(34px, 3.4vw, 540px);
  line-height: 1;
  color: #0f4c75;
}

.detail-title p {
  margin: 0;
  color: #172b36;
  font-size: 18px;
  font-weight: 400;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-end;
}

.detail-actions .primary-action {
  background: linear-gradient(90deg, #5fad00, #006600);
}

.outline-action,
.danger-action {
  min-height: 58px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  border: 1px solid #0f4c75;
  border-radius: 7px;
  background: #dee8ed;
  padding: 0 28px;
  color: #172b36;
  box-shadow: 0 2px 5px #dee8ed;
  font-size: 21px;
  font-weight: 800;
}

.danger-action {
  color: #d10000;
}

.orders-panel {
  padding: 38px;
}

.orders-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 34px;
}

.orders-head h2 {
  margin: 0;
  font-size: 36px;
}

.search-box {
  width: min(590px, 100%);
  height: 58px;
  display: grid;
  grid-template-columns: 44px 1fr;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 2px 5px #dee8ed;
  padding: 0 16px;
  color: #0f4c75;
}

.search-box input {
  height: 54px;
  border: 0;
  background: #fff;
  box-shadow: none;
  padding: 0;
  font-size: 22px;
}

.order-groups {
  display: grid;
  gap: 48px;
}

.order-group h3 {
  margin: 0 0 18px;
  border-radius: 5px;
  background: #edf5ff;
  padding: 25px 20px;
  font-size: 29px;
}

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

.orders-table {
  width: 100%;
  min-width: 1160px;
  border-collapse: collapse;
  font-size: 22px;
}

.orders-table th,
.orders-table td {
  border-right: 1px solid #7b8990;
  padding: 18px 14px;
  text-align: left;
  vertical-align: middle;
}

.orders-table th:last-child,
.orders-table td:last-child {
  border-right: 0;
}

.orders-table thead th {
  background: #f6f7f8;
  color: #172b36;
  font-size: 24px;
  font-weight: 900;
}

.orders-table .ek-col {
  background: #f6f7f8;
}

.orders-table tbody tr:nth-child(odd) td {
  background: #dee8ed;
}

.orders-table tbody tr:nth-child(even) td {
  background: #fff;
}

.orders-table tbody tr:nth-child(odd) .ek-col {
  background: #dee8ed;
}

.orders-table tbody tr:nth-child(even) .ek-col {
  background: #fff;
}

.orders-table .sell-col {
  background: #edf9ef;
  color: #5fad00;
  font-weight: 900;
}

.orders-table thead .sell-col {
  background: #d9f6df;
  color: #172b36;
}

.orders-table a {
  color: var(--blue);
  text-decoration: none;
  font-weight: 700;
}

.margin-col {
  color: #5fad00;
  font-weight: 900;
}

.row-actions {
  width: 152px;
  white-space: nowrap;
}

.table-action {
  width: 40px;
  height: 40px;
  border: 0;
  background: transparent;
  color: var(--blue);
  font-size: 30px;
  line-height: 1;
}

.table-action.copy {
  color: #5fad00;
}

.table-action.delete {
  color: #d10000;
  font-size: 34px;
  font-weight: 500;
}

.duplicate-icon {
  position: relative;
  display: inline-block;
  width: 25px;
  height: 25px;
}

.duplicate-icon::before,
.duplicate-icon::after {
  content: "";
  position: absolute;
  width: 15px;
  height: 17px;
  border: 3px solid currentColor;
  border-radius: 4px;
  background: transparent;
}

.duplicate-icon::before {
  top: 2px;
  left: 3px;
}

.duplicate-icon::after {
  top: 8px;
  left: 10px;
  background: #fff;
}

.empty-state.compact {
  min-height: 130px;
  background: #dee8ed;
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: #0f4c75;
}

.modal {
  position: fixed;
  z-index: 20;
  top: 50%;
  left: 50%;
  width: min(1410px, calc(100% - 52px));
  max-height: calc(100vh - 52px);
  overflow: auto;
  transform: translate(-50%, -50%);
  background: #dee8ed;
  border: 1px solid #0f4c75;
  border-radius: 14px;
  box-shadow: 0 8px 18px #0f4c75;
  padding: 62px 54px 64px;
}

.modal-customer,
.modal-manage {
  width: min(1380px, calc(100% - 52px));
}

.modal-manage {
  width: min(900px, calc(100% - 28px));
}

.close-button {
  position: absolute;
  top: 22px;
  right: 30px;
  border: 0;
  background: transparent;
  color: #172b36;
  font-size: 46px;
  line-height: 1;
}

.modal h2 {
  margin: 0 0 66px;
  font-size: 48px;
  line-height: 1;
}

.modal-manage h2 {
  margin-bottom: 44px;
  font-size: 36px;
}

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

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

.form-grid .field {
  margin-bottom: 0;
}

label,
.label-row label {
  font-weight: 800;
  color: #172b36;
  font-size: 29px;
}

.modal-customer label {
  color: #172b36;
  font-size: 28px;
  letter-spacing: 2px;
  text-transform: uppercase;
}

input,
textarea {
  width: 100%;
  border: 2px solid #0f4c75;
  border-radius: 10px;
  background: #dee8ed;
  box-shadow: 0 2px 4px #dee8ed;
  color: #172b36;
  font-size: 28px;
  outline: none;
}

input {
  height: 72px;
  padding: 0 26px;
}

textarea {
  min-height: 154px;
  resize: vertical;
  padding: 24px 26px;
}

input:focus,
textarea:focus {
  border-color: #172b36;
}

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

.tool-button {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: #172b36;
  font-size: 34px;
}

.combo {
  position: relative;
}

.combo input {
  padding-right: 70px;
}

.combo-toggle {
  position: absolute;
  top: 0;
  right: 12px;
  width: 54px;
  height: 72px;
  border: 0;
  background: transparent;
  color: #0f4c75;
  font-size: 34px;
}

.combo-list {
  position: absolute;
  z-index: 30;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  max-height: 340px;
  overflow: auto;
  border: 1px solid #0f4c75;
  border-radius: 10px;
  background: #dee8ed;
  box-shadow: 0 4px 10px #dee8ed;
  padding: 8px;
}

.combo-option {
  width: 100%;
  min-height: 64px;
  border: 0;
  border-radius: 8px;
  padding: 0 18px;
  background: #dee8ed;
  text-align: left;
  font-size: 29px;
}

.combo-option:hover,
.combo-option:first-child {
  background: #dee8ed;
}

.modal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 32px;
  margin-top: 32px;
  padding-top: 48px;
  border-top: 1px solid #0f4c75;
}

.secondary-button,
.dark-button {
  min-height: 72px;
  border-radius: 10px;
  padding: 0 34px;
  font-size: 28px;
  font-weight: 800;
}

.secondary-button {
  border: 1px solid #0f4c75;
  background: #dee8ed;
  color: #172b36;
  box-shadow: 0 2px 4px #dee8ed;
}

.dark-button,
.dark-square {
  border: 0;
  background: #0f4c75;
  color: #dee8ed;
  box-shadow: 0 3px 8px #dee8ed;
}

.save-icon {
  width: 24px;
  height: 24px;
  display: inline-block;
  border: 3px solid currentColor;
  border-radius: 4px;
  position: relative;
}

.save-icon::before {
  content: "";
  position: absolute;
  left: 4px;
  right: 4px;
  top: -3px;
  height: 9px;
  border-left: 3px solid currentColor;
  border-right: 3px solid currentColor;
  background: currentColor;
  opacity: 0.25;
}

.add-row {
  display: grid;
  grid-template-columns: 1fr 80px;
  gap: 16px;
  align-items: end;
}

.dark-square {
  width: 80px;
  height: 66px;
  border-radius: 10px;
  font-size: 42px;
}

.modal-manage h3 {
  margin: 0 0 22px;
  font-size: 30px;
}

.manage-list {
  display: grid;
  gap: 16px;
}

.manage-row {
  display: grid;
  grid-template-columns: 1fr 48px 48px;
  align-items: center;
  gap: 16px;
  min-height: 80px;
  border-radius: 8px;
  background: #dee8ed;
  padding: 0 18px;
  font-size: 32px;
}

.manage-row input {
  height: 58px;
  font-size: 28px;
}

.icon-button {
  width: 48px;
  height: 48px;
  border: 0;
  background: transparent;
  color: var(--blue);
  font-size: 36px;
}

.icon-button.danger {
  color: #5fad00;
}

[hidden] {
  display: none !important;
}

@media (max-width: 1180px) {
  .customer-grid {
    grid-template-columns: repeat(2, minmax(280px, 1fr));
  }

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

  .detail-actions {
    justify-content: flex-start;
  }

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

@media (max-width: 780px) {
  .app-shell {
    width: min(100% - 28px, 720px);
    padding-top: 22px;
  }

  .topbar,
  .form-grid {
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .primary-action {
    width: 100%;
  }

  .filter-panel {
    padding: 18px;
  }

  .letter-button {
    min-width: 48px;
    height: 48px;
  }

  .customer-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .customer-card {
    padding: 36px 20px 22px;
  }

  .stats {
    margin-left: 0;
  }

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

  .detail-hero,
  .orders-panel {
    padding: 34px 18px 22px;
  }

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

  .outline-action,
  .danger-action {
    width: 100%;
  }

  .detail-title p {
    font-size: 20px;
  }

  .orders-head h2 {
    font-size: 28px;
  }

  .order-group h3 {
    font-size: 22px;
  }

  .orders-table {
    font-size: 18px;
  }

  .orders-table thead th {
    font-size: 20px;
  }

  .modal {
    width: calc(100% - 20px);
    padding: 42px 18px 28px;
  }

  .modal h2 {
    margin-bottom: 34px;
    font-size: 36px;
  }

  label,
  .label-row label,
  .modal-customer label {
    font-size: 20px;
    letter-spacing: 0;
  }

  input,
  textarea,
  .combo-option {
    font-size: 20px;
  }

  .modal-actions,
  .add-row {
    grid-template-columns: 1fr;
    display: grid;
  }

  .save-button,
  .secondary-button,
  .dark-button,
  .dark-square {
    width: 100%;
  }
}
