:root {
  --bg: #dfe4ec;
  --surface: #f6f7fa;
  --card: #ffffff;
  --card-soft: #edf1f5;
  --ink: #151a2d;
  --muted: #697285;
  --line: #d8dee8;
  --accent: #e64b32;
  --accent-soft: #ffe8e3;
  --blue: #4c8bc9;
  --ok: #20835b;
  --warn: #a76612;
  --error: #bd2d2d;
  --radius: 26px;
  --small-radius: 16px;
  --shadow: 0 24px 80px rgba(29, 35, 52, 0.14);
}

* {
  box-sizing: border-box;
}

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

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

button {
  border: 0;
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.shell {
  width: min(1540px, calc(100vw - 48px));
  min-height: calc(100vh - 48px);
  margin: 24px auto;
  padding: 36px 40px;
  border-radius: 34px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-view {
  min-height: calc(100vh - 120px);
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 56px;
}

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

.brand-row span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-top: 2px;
}

.brand-row.compact span {
  font-size: 12px;
}

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

.login-card {
  width: min(460px, 100%);
  align-self: center;
  justify-self: center;
  background: var(--card);
  border-radius: var(--radius);
  padding: 36px;
}

.login-card h1 {
  margin: 0 0 8px;
  font-size: 42px;
  letter-spacing: 0;
}

.login-card p {
  color: var(--muted);
  margin: 0 0 26px;
}

label {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 8px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  padding: 13px 14px;
  outline: 0;
}

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

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(76, 139, 201, 0.13);
}

.login-card button,
.small-button {
  min-height: 42px;
  padding: 0 18px;
  border-radius: 999px;
  color: #fff;
  background: var(--ink);
}

.small-button.secondary {
  background: var(--card-soft);
  color: var(--ink);
}

.message {
  min-height: 24px;
  margin-top: 14px;
  color: var(--error);
}

.topbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 28px;
  margin-bottom: 34px;
}

.tabs {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  overflow-x: auto;
}

.tab {
  color: var(--muted);
  background: transparent;
  border-radius: 999px;
  padding: 10px 14px;
  white-space: nowrap;
}

.tab.active {
  color: var(--ink);
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--line);
}

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

.icon-button {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #fff;
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(360px, 0.65fr);
  gap: 28px;
  margin-bottom: 30px;
}

.hero-card,
.side-card,
.panel,
.customer-card {
  background: var(--card);
  border-radius: var(--radius);
}

.hero-card {
  min-height: 270px;
  padding: 34px;
}

.side-card {
  min-height: 270px;
  padding: 26px;
}

.card-title-row,
.panel-head,
.section-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.eyebrow {
  display: block;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}

h1,
h2,
h3,
p {
  letter-spacing: 0;
}

h1 {
  margin: 0;
  font-size: clamp(32px, 4vw, 52px);
  line-height: 1.02;
}

h2 {
  margin: 0;
  font-size: 22px;
}

h3 {
  margin: 24px 0 12px;
  font-size: 16px;
}

.hero-card p,
.section-title span {
  color: var(--muted);
}

.metric-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-top: 44px;
}

.metric-row div {
  border-left: 2px solid var(--line);
  padding-left: 16px;
}

.metric-row strong {
  display: block;
  font-size: 34px;
}

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

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.pill.ok {
  color: var(--ok);
  background: #e6f5ee;
}

.pill.warn {
  color: var(--warn);
  background: #fff0d8;
}

.pill.error {
  color: var(--error);
  background: #ffe5e5;
}

.pill.neutral {
  color: var(--muted);
  background: var(--card-soft);
}

.log-preview {
  height: 178px;
  margin: 18px 0 0;
  padding: 16px;
  overflow: auto;
  border-radius: var(--small-radius);
  background: #111827;
  color: #e5edf8;
  font-size: 12px;
  white-space: pre-wrap;
}

.view {
  display: none;
}

.active-view {
  display: block;
}

.section-title {
  margin: 8px 0 16px;
}

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

.customer-card {
  min-height: 210px;
  padding: 24px;
}

.customer-card h3 {
  margin-top: 0;
  font-size: 20px;
}

.customer-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 24px;
}

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

.card-stats div {
  min-height: 68px;
  padding: 12px;
  border-radius: var(--small-radius);
  background: var(--card-soft);
}

.card-stats strong {
  display: block;
  font-size: 20px;
}

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

.split-layout {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 24px;
}

.panel {
  padding: 24px;
}

.detail-panel {
  min-height: 620px;
}

.customer-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.customer-list button {
  width: 100%;
  min-height: 64px;
  padding: 12px 14px;
  text-align: left;
  border-radius: 18px;
  background: var(--card-soft);
  color: var(--ink);
}

.customer-list button.active {
  background: var(--ink);
  color: #fff;
}

.customer-list small {
  display: block;
  color: inherit;
  opacity: 0.7;
  margin-top: 4px;
}

.client-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.field-full {
  grid-column: 1 / -1;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 0 12px;
  border-radius: 14px;
  background: var(--card-soft);
}

.toggle-row input {
  width: auto;
}

.notice {
  margin: 18px 0 0;
  padding: 12px 14px;
  border-radius: var(--small-radius);
  color: var(--warn);
  background: #fff0d8;
}

.validation-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.validation-result {
  margin-top: 18px;
}

.result-card {
  padding: 16px;
  border-radius: var(--small-radius);
  background: var(--card-soft);
}

.table-wrap {
  width: 100%;
  overflow: auto;
  border-radius: var(--small-radius);
  border: 1px solid var(--line);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 780px;
  background: #fff;
}

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

th {
  color: var(--muted);
  background: #f5f7fa;
}

code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

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

.plan-card {
  padding: 24px;
  border-radius: var(--radius);
  background: var(--card);
}

.plan-card ul {
  margin: 16px 0 0;
  padding-left: 18px;
  color: var(--muted);
}

.plan-card li {
  margin: 8px 0;
}

@media (max-width: 1120px) {
  .shell {
    width: min(100vw - 24px, 1540px);
    margin: 12px auto;
    padding: 24px;
  }

  .topbar,
  .hero-grid,
  .split-layout,
  .customer-grid,
  .plan-grid {
    grid-template-columns: 1fr;
  }

  .client-form {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .shell {
    border-radius: 22px;
    padding: 18px;
  }

  .hero-card,
  .side-card,
  .panel,
  .customer-card,
  .login-card {
    border-radius: 20px;
    padding: 20px;
  }

  .metric-row,
  .card-stats {
    grid-template-columns: 1fr;
  }
}
