:root {
  --ink: #151f2a;
  --muted: #66737d;
  --line: #dce3df;
  --paper: #fffdf8;
  --panel: #ffffff;
  --mint: #dff4ed;
  --blush: #ffe5de;
  --dark: #111923;
  --success: #13795b;
  --warning: #9a5b00;
  --danger: #a52828;
  --shadow: 0 22px 70px rgba(21, 31, 42, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--paper);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 8%, rgba(223, 244, 237, 0.75), transparent 30%),
    radial-gradient(circle at 90% 0%, rgba(255, 229, 222, 0.75), transparent 26%),
    linear-gradient(135deg, #fffdf8, #f8fbf8 52%, #fff4ef);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button {
  cursor: pointer;
}

.dashboard-app {
  min-height: 100vh;
}

.loading-screen,
.login-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.loading-screen {
  gap: 14px;
  align-content: center;
  color: var(--muted);
  font-weight: 800;
}

.loading-screen img {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: #050505;
}

.login-card {
  width: min(460px, 100%);
  padding: clamp(24px, 5vw, 42px);
  border: 1px solid rgba(21, 31, 42, 0.12);
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
}

.login-brand {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 26px;
}

.login-brand img,
.topbar img {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: #050505;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 10px;
  font-size: clamp(34px, 5vw, 58px);
  line-height: 0.98;
}

h2 {
  margin-bottom: 12px;
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.05;
}

h3 {
  margin-bottom: 8px;
  font-size: 18px;
}

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

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

.field {
  display: grid;
  gap: 7px;
}

.field label {
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #ffffff;
  color: var(--ink);
  outline: none;
}

.field textarea {
  min-height: 112px;
  padding-top: 12px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 4px rgba(223, 244, 237, 0.8);
}

.notice {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid rgba(165, 40, 40, 0.18);
  border-radius: 14px;
  background: rgba(255, 229, 222, 0.58);
  color: var(--danger);
  font-size: 13px;
  font-weight: 800;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--dark);
  color: #ffffff;
  font-weight: 900;
  text-decoration: none;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 34px rgba(21, 31, 42, 0.16);
}

.btn.secondary {
  background: var(--mint);
  border-color: rgba(21, 31, 42, 0.14);
  color: var(--ink);
}

.btn.ghost {
  background: rgba(255, 255, 255, 0.72);
  border-color: rgba(21, 31, 42, 0.14);
  color: var(--ink);
}

.btn.danger {
  background: #fff2f0;
  border-color: rgba(165, 40, 40, 0.22);
  color: var(--danger);
}

.btn.small {
  min-height: 36px;
  padding: 0 12px;
  font-size: 12px;
}

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

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 24px;
  min-height: 100vh;
  padding: 22px;
  background: var(--dark);
  color: #ffffff;
}

.sidebar-brand {
  display: flex;
  gap: 12px;
  align-items: center;
}

.sidebar-brand img {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #050505;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.sidebar-brand strong,
.sidebar-brand small {
  display: block;
}

.sidebar-brand small {
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.62);
  font-size: 11px;
}

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

.nav-list button {
  display: flex;
  justify-content: space-between;
  width: 100%;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  background: transparent;
  color: rgba(255, 255, 255, 0.72);
  font-weight: 900;
}

.nav-list button.active,
.nav-list button:hover {
  background: rgba(223, 244, 237, 0.14);
  color: #ffffff;
}

.sidebar-foot {
  display: grid;
  gap: 10px;
}

.content {
  min-width: 0;
  padding: clamp(18px, 3vw, 34px);
}

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

.topbar-left {
  display: flex;
  gap: 14px;
  align-items: center;
}

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

.panel {
  border: 1px solid rgba(21, 31, 42, 0.12);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 18px 52px rgba(21, 31, 42, 0.08);
}

.panel-pad {
  padding: clamp(18px, 3vw, 26px);
}

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

.metric-card {
  min-height: 126px;
  padding: 20px;
  border: 1px solid rgba(21, 31, 42, 0.1);
  border-radius: 20px;
  background:
    radial-gradient(circle at 85% 18%, rgba(255, 255, 255, 0.9), transparent 22%),
    linear-gradient(145deg, var(--mint), rgba(255, 255, 255, 0.88));
}

.metric-card:nth-child(even) {
  background:
    radial-gradient(circle at 85% 18%, rgba(255, 255, 255, 0.9), transparent 22%),
    linear-gradient(145deg, var(--blush), rgba(255, 255, 255, 0.88));
}

.metric-card strong {
  display: block;
  margin-bottom: 8px;
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1;
}

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

.toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) repeat(2, minmax(160px, 220px)) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 16px;
}

.toolbar .field {
  margin: 0;
}

.table-wrap {
  overflow-x: auto;
  border-radius: 18px;
}

table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
  background: #ffffff;
}

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

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

td {
  color: var(--ink);
  font-size: 14px;
}

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

.record-title {
  display: grid;
  gap: 4px;
}

.record-title strong {
  font-size: 14px;
}

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

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid rgba(21, 31, 42, 0.1);
  border-radius: 999px;
  background: var(--mint);
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
}

.pill.order,
.pill.processing {
  background: #e7f0ff;
}

.pill.delivered,
.pill.active {
  background: #e2f7ed;
  color: var(--success);
}

.pill.pending,
.pill.quote {
  background: #fff4dc;
  color: var(--warning);
}

.pill.lost,
.pill.closed {
  background: #fff1ef;
  color: var(--danger);
}

.empty-state {
  display: grid;
  min-height: 220px;
  place-items: center;
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

.split-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.45fr);
  gap: 16px;
}

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

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

.compact-record {
  display: grid;
  gap: 7px;
  padding: 14px;
  border: 1px solid rgba(21, 31, 42, 0.1);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(17, 25, 35, 0.48);
}

.modal {
  width: min(860px, 100%);
  max-height: min(760px, calc(100vh - 36px));
  overflow: auto;
  border: 1px solid rgba(21, 31, 42, 0.12);
  border-radius: 24px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.modal-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  padding: 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.96);
}

.modal-body {
  padding: 22px;
}

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

.detail-item {
  padding: 12px;
  border: 1px solid rgba(21, 31, 42, 0.1);
  border-radius: 14px;
  background: #ffffff;
}

.detail-item span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.detail-item strong {
  font-size: 14px;
}

pre {
  max-height: 260px;
  overflow: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #ffffff;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.checkbox-row {
  display: flex;
  gap: 9px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.checkbox-row input {
  width: 18px;
  height: 18px;
}

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

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

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

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

  .toolbar,
  .split-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .content {
    padding: 16px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions,
  .topbar-actions .btn {
    width: 100%;
  }

  .nav-list {
    grid-template-columns: 1fr 1fr;
  }

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

  .modal-head {
    flex-direction: column;
  }
}
