:root {
  color-scheme: light;
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-strong: #172033;
  --line: #dfe5ee;
  --text: #172033;
  --muted: #667085;
  --green: #1f7a5b;
  --blue: #1f5fbf;
  --orange: #a75b00;
  --red: #b42318;
  --shadow: 0 10px 24px rgba(23, 32, 51, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  min-width: 1120px;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  letter-spacing: 0;
}

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

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 18px;
  background: var(--surface-strong);
  color: #ffffff;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 6px 28px;
}

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

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

.brand-sub {
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.64);
  font-size: 12px;
}

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

.nav-item {
  width: 100%;
  padding: 11px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: rgba(255, 255, 255, 0.72);
  text-align: left;
}

.nav-item.active,
.nav-item:hover {
  background: rgba(255, 255, 255, 0.11);
  color: #ffffff;
}

.main {
  padding: 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

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

h1 {
  font-size: 26px;
  line-height: 1.3;
}

h2 {
  font-size: 18px;
}

.topbar p {
  margin-top: 6px;
  color: var(--muted);
}

.top-actions,
.dialog-actions,
.actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.actions {
  flex-wrap: wrap;
}

.primary-btn,
.ghost-btn,
.row-btn,
.icon-btn {
  min-height: 38px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0 14px;
  font-weight: 700;
}

.primary-btn {
  background: var(--green);
  color: #ffffff;
}

.ghost-btn,
.row-btn {
  border-color: #cdd5e1;
  background: #ffffff;
  color: #253047;
}

.row-btn {
  min-height: 32px;
  padding: 0 10px;
  font-size: 13px;
}

.icon-btn {
  min-width: 36px;
  border-color: #cdd5e1;
  background: #ffffff;
  color: #253047;
  font-size: 22px;
  line-height: 1;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

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

.metric,
.panel,
.workspace,
.delivery-board {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.metric {
  min-width: 0;
  padding: 18px;
}

.metric strong {
  display: block;
  margin-bottom: 5px;
  font-size: 26px;
}

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

.dashboard-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 18px;
}

.panel,
.delivery-board {
  padding: 16px;
}

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

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

.compact-list {
  display: grid;
  gap: 10px;
}

.compact-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid #edf1f6;
  border-radius: 8px;
  background: #fbfcfe;
}

.source-list {
  display: grid;
  gap: 14px;
}

.source-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 13px;
}

.bar {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #eef2f7;
}

.bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 140px 140px 140px;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.search-input,
select,
dialog input,
dialog textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid #cdd5e1;
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  padding: 0 12px;
}

dialog textarea {
  min-height: 96px;
  padding: 10px 12px;
  resize: vertical;
}

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

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 14px;
  border-bottom: 1px solid #edf1f6;
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

th {
  color: #475467;
  font-size: 12px;
  font-weight: 800;
}

tbody tr:hover {
  background: #f8fafc;
}

.customer-name {
  font-weight: 800;
}

.subtext {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.badge.waiting {
  background: #fff2df;
  color: var(--orange);
}

.badge.following,
.badge.role {
  background: #e8f1ff;
  color: var(--blue);
}

.badge.done {
  background: #e7f6ef;
  color: var(--green);
}

.badge.lost {
  background: #fdebea;
  color: var(--red);
}

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

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

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

.delivery-item {
  min-height: 150px;
  padding: 14px;
  border: 1px solid #e4e9f1;
  border-radius: 8px;
  background: #fbfcfe;
}

.delivery-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.delivery-top h3 {
  font-size: 15px;
}

.delivery-meta {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
}

.delivery-actions {
  margin-top: 12px;
}

dialog {
  width: min(520px, calc(100vw - 32px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: 0 24px 80px rgba(23, 32, 51, 0.24);
}

dialog::backdrop {
  background: rgba(15, 23, 42, 0.42);
}

dialog form {
  display: grid;
  gap: 14px;
  padding: 20px;
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

label {
  display: grid;
  gap: 8px;
  color: #475467;
  font-size: 13px;
  font-weight: 700;
}

@media (max-width: 1240px) {
  body {
    min-width: 980px;
  }

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

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