:root {
  --ink: #152033;
  --muted: #667085;
  --line: #d9dee8;
  --bg: #eef2f7;
  --panel: #ffffff;
  --blue: #0f6ddf;
  --green: #15803d;
  --amber: #b45309;
  --red: #b42318;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
}

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

button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}

button:hover {
  border-color: #8aa6cc;
}

.primary,
button.primary {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

.ghost {
  background: #f6f8fb;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(120deg, rgba(15, 109, 223, 0.12), rgba(21, 128, 61, 0.08)),
    #f7f9fc;
}

.login-card {
  width: min(440px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 32px;
  box-shadow: 0 24px 60px rgba(28, 40, 61, 0.12);
}

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

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--blue);
  font-weight: 800;
}

.brand p,
.topbar p,
.section-head p {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
}

.brand h1,
.topbar h2,
.section-head h3 {
  margin: 0;
}

.login-heading {
  margin: 28px 0;
}

.login-form,
.stack-form,
.drawer-form,
.customer-form {
  display: grid;
  gap: 12px;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.form-actions button {
  min-height: 40px;
  padding: 8px 14px;
  border-radius: 6px;
}

label {
  display: grid;
  gap: 6px;
}

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

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

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

.shell {
  display: grid;
  grid-template-columns: 310px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: #172033;
  color: #e8eef8;
  padding: 20px;
  overflow: auto;
}

.sidebar .brand p,
.sidebar .side-card span,
.sidebar small {
  color: #aab7cd;
}

.side-card {
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.055);
  border-radius: 8px;
  padding: 14px;
  margin-top: 16px;
  display: grid;
  gap: 10px;
}

.side-card p {
  margin: 0;
  color: #c4cee0;
  line-height: 1.45;
}

.side-card button,
.pool-nav button {
  color: #e8eef8;
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.13);
  border-radius: 6px;
  min-height: 38px;
}

.line-switcher button.active,
.pool-nav button.active {
  background: #f4f8ff;
  color: var(--ink);
}

.pool-nav {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.pool-nav button {
  display: flex;
  justify-content: space-between;
  align-items: center;
  text-align: left;
  padding: 10px;
}

.pool-nav span {
  display: grid;
  gap: 3px;
}

.pool-nav em {
  font-style: normal;
  font-weight: 800;
}

.workspace {
  padding: 20px;
  overflow: auto;
}

.topbar,
.scope-banner,
.kpis,
.main-grid,
.section-head,
.detail-head,
.task,
.user-table article {
  display: flex;
  align-items: center;
}

.topbar {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.top-actions {
  display: flex;
  gap: 8px;
}

.top-actions button,
.detail-head button,
.section-head button,
.task button,
.drawer-form button,
.customer-form button,
.login-form button,
.stack-form button {
  min-height: 38px;
  border-radius: 6px;
  padding: 8px 12px;
}

.toast,
.scope-banner {
  border: 1px solid #bfd6f7;
  background: #edf6ff;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 16px;
}

.scope-banner {
  justify-content: space-between;
  gap: 12px;
}

.scope-banner span {
  color: var(--muted);
}

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

.kpi,
.list-panel,
.detail-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.kpi {
  padding: 16px;
}

.kpi span,
.detail-grid span,
.customer-row small,
.customer-row span,
.task span,
.order small {
  color: var(--muted);
  font-size: 13px;
}

.kpi strong {
  display: block;
  margin: 8px 0;
  font-size: 28px;
}

.kpi p {
  margin: 0;
  color: var(--muted);
}

.kpi.blue {
  border-top: 3px solid var(--blue);
}

.kpi.amber {
  border-top: 3px solid var(--amber);
}

.kpi.green {
  border-top: 3px solid var(--green);
}

.kpi.red {
  border-top: 3px solid var(--red);
}

.main-grid {
  align-items: stretch;
  display: grid;
  grid-template-columns: minmax(360px, 42%) minmax(0, 1fr);
  gap: 16px;
}

.list-panel,
.detail-panel {
  min-height: 620px;
  padding: 16px;
}

.section-head,
.detail-head {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-head.compact {
  margin-top: 20px;
}

.filters {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) 150px 100px 140px;
  gap: 8px;
  margin-bottom: 12px;
}

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

.customer-row {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 12px;
  text-align: left;
  padding: 12px;
  border-radius: 8px;
}

.customer-row.active {
  border-color: var(--blue);
  background: #eff6ff;
}

.customer-row div {
  display: grid;
  gap: 4px;
}

.customer-row em {
  font-style: normal;
  color: var(--blue);
  font-size: 13px;
}

.detail-head h3 {
  margin: 4px 0;
  font-size: 24px;
}

.detail-head p,
.detail-head span {
  color: var(--muted);
  margin: 0;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

.detail-grid div,
.note-box,
.reminder-box,
.timeline,
.order,
.task,
.drawer-form,
.customer-form,
.admin-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.detail-grid div {
  padding: 12px;
  display: grid;
  gap: 6px;
}

.note-box {
  padding: 14px;
  background: #fafcff;
}

.reminder-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  margin-bottom: 14px;
  border-color: #fed7aa;
  background: #fff7ed;
}

.reminder-box div {
  display: grid;
  gap: 4px;
}

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

.reminder-box em {
  color: var(--amber);
  font-style: normal;
  white-space: nowrap;
}

.reminder-box p {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.note-box p {
  margin: 8px 0;
}

.tag {
  display: inline-flex;
  margin: 4px 6px 0 0;
  padding: 4px 8px;
  border-radius: 999px;
  background: #eaf2ff;
  color: #0f4f9e;
  font-size: 12px;
}

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.timeline,
.order {
  padding: 12px;
  margin-bottom: 8px;
}

.timeline p,
.order p {
  margin: 6px 0;
  line-height: 1.45;
}

.task {
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  margin-bottom: 8px;
}

.task div {
  display: grid;
  gap: 4px;
}

.task em {
  font-style: normal;
  color: var(--amber);
  white-space: nowrap;
}

.task.done {
  opacity: 0.65;
}

.drawer-form,
.customer-form,
.admin-panel {
  padding: 14px;
  margin-top: 16px;
  background: #fbfcff;
}

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

.admin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.user-table {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.user-table article {
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
}

.user-table span {
  color: var(--muted);
}

.user-table em {
  font-style: normal;
  color: var(--blue);
}

.empty {
  padding: 28px;
  color: var(--muted);
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
}

.empty.small {
  padding: 14px;
}

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

  .sidebar {
    position: static;
  }

  .main-grid,
  .kpis,
  .split,
  .admin-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .workspace,
  .sidebar {
    padding: 14px;
  }

  .topbar,
  .scope-banner,
  .detail-head {
    align-items: stretch;
    flex-direction: column;
  }

  .reminder-box {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

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