:root {
  color-scheme: light;
  font: 16px/1.5 Inter, system-ui, sans-serif;
  color: #211b33;
  background: #f4f4fc;
  --surface: #fff;
  --line: #e2dfeb;
  --muted: #625b70;
  --accent: #5633bc;
  --accent-dark: #422396;
  --accent-soft: #eee9fc;
}
* { box-sizing: border-box; }
body { margin: 0; }
a { color: var(--accent); text-underline-offset: .2em; }
a:hover { color: var(--accent-dark); }
.workspace { min-height: 100svh; display: grid; grid-template: auto 1fr / 238px minmax(0, 1fr); }
.topbar {
  grid-column: 1 / -1;
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 11px; font-weight: 750; color: inherit; text-decoration: none; }
.mark { display: grid; place-items: center; flex: 0 0 34px; height: 34px; border-radius: 9px; background: var(--accent); color: white; }
.sidebar { padding: 24px 14px; background: var(--surface); border-right: 1px solid var(--line); }
.sidebar nav { display: grid; gap: 5px; }
.sidebar a {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 12px; border-radius: 8px; color: #453d54;
  font-size: .875rem; font-weight: 650; text-decoration: none;
}
.sidebar a:hover, .sidebar a[aria-current="page"] { color: var(--accent-dark); background: var(--accent-soft); }
.nav-icon { width: 14px; height: 15px; flex: 0 0 14px; border: 1.5px solid currentColor; border-radius: 3px; position: relative; }
.nav-icon.orders::after { content: ''; position: absolute; inset: 4px 3px; border-block: 1px solid currentColor; }
.nav-icon.clients { border-color: transparent; }
.nav-icon.clients::before, .nav-icon.clients::after { content: ''; position: absolute; border: 1.5px solid currentColor; }
.nav-icon.clients::before { width: 5px; height: 5px; border-radius: 50%; top: 0; left: 2.5px; }
.nav-icon.clients::after { width: 11px; height: 5px; border-radius: 5px 5px 2px 2px; bottom: 0; left: -.5px; }

.dashboard { min-width: 0; padding: clamp(20px, 4vw, 48px); }
.content { max-width: 1260px; margin-inline: auto; }
.page-head, .card-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.page-head { margin-bottom: 22px; }
h1 { font-size: clamp(1.65rem, 4vw, 2.2rem); letter-spacing: -.03em; line-height: 1.16; margin: 0; overflow-wrap: anywhere; }
h2 { font-size: 1.15rem; margin: 0 0 14px; }
h3 { font-size: 1rem; margin: 0; }
.back { display: inline-flex; font-size: .875rem; font-weight: 650; margin-bottom: 16px; }
.content > h1 + p, .muted, small { color: var(--muted); }
small { display: block; margin-top: 4px; overflow-wrap: anywhere; }
.badge {
  width: fit-content; display: inline-block; border-radius: 999px; padding: 4px 10px;
  font-size: .78rem; line-height: 1.4; font-weight: 700;
}
.neutral { color: #504767; background: #eeebf4; }
.good, .notice { color: #14613f; background: #e8f7ee; }
.warning { color: #795213; background: #fff1d5; }
.notice { border: 1px solid #c4e8d3; border-radius: 9px; padding: 12px 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 22px; }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.metric { display: grid; gap: 4px; }
.metric span { font-size: .85rem; color: var(--muted); font-weight: 600; }
.metric strong { font-size: 1.8rem; line-height: 1.2; }
.data-panel { padding: 0; }
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; padding: 20px; }
.filters div:first-child { flex: 1 1 240px; min-width: 0; }
.filters label { margin-bottom: 5px; }
.filters a { padding: 10px 0; }
.count { margin: 0; padding: 0 20px 12px; color: var(--muted); font-size: .875rem; }
.table-wrap { overflow-x: auto; border-top: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; text-align: left; min-width: 610px; font-size: .9rem; }
th, td { padding: 13px 18px; border-bottom: 1px solid var(--line); vertical-align: top; }
thead { background: #f8f7fc; }
thead th { color: #504761; font-size: .8rem; }
tbody tr:last-child > * { border-bottom: 0; }
tbody tr:hover { background: #faf9ff; }
.action { display: inline-block; padding: 5px 9px; border-radius: 6px; background: var(--accent-soft); font-weight: 700; text-decoration: none; white-space: nowrap; }
.empty { margin: 0; padding: 24px 20px; border-top: 1px solid var(--line); color: var(--muted); }
.data-panel > .error { margin: 0; border: 0; }
.sections { display: flex; flex-wrap: wrap; gap: 16px; padding: 15px 20px; }
.sections:empty { display: none; }

label { display: block; font-size: .875rem; font-weight: 650; }
input, select, textarea, button { font: inherit; border-radius: 8px; padding: 9px 12px; min-height: 43px; }
input, select, textarea { width: 100%; background: var(--surface); color: inherit; border: 1px solid #bcb5cc; }
button { border: 1px solid transparent; background: var(--accent); color: white; font-weight: 700; cursor: pointer; }
button:hover { background: var(--accent-dark); }
.secondary { background: var(--surface); border-color: var(--line); color: #453d54; font-size: .875rem; }
.secondary:hover { background: var(--accent-soft); color: var(--accent-dark); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.error { color: #9b262d; }
.login { min-height: 100svh; display: grid; place-items: center; padding: 20px; }
.login .card { width: min(100%, 408px); padding: 28px; box-shadow: 0 8px 35px #41268b12; }
.login h1 { margin: 26px 0 18px; }
.login-form { display: grid; gap: 8px; }
.login-form button { margin-top: 10px; }
.activation { display: grid; gap: 14px; margin-block: 14px; max-width: 690px; }
.activation h2, .activation p { margin: 0; }
.activation fieldset { border: 1px solid var(--line); border-radius: 8px; min-width: 0; }
.activation input, .activation textarea { display: block; margin-top: 5px; }
.activation input[type="hidden"] { display: none; }
.activation textarea { min-height: 5rem; resize: vertical; }
.activation button { justify-self: start; }
.contact { display: flex; flex-wrap: wrap; gap: 16px 42px; margin: 0 0 24px; }
.contact dt { font-size: .8rem; font-weight: 650; color: var(--muted); }
.contact dd { margin: 2px 0 0; overflow-wrap: anywhere; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 20px; }
.service-card { max-width: none; margin: 0 0 14px; }
.history { list-style: none; padding: 0; margin: 0; }
.history li { padding: 12px 16px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.history li + li { border-top: 1px solid var(--line); }

@media (max-width: 850px) {
  .workspace { grid-template: auto auto 1fr / minmax(0, 1fr); }
  .sidebar { padding: 8px 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar nav { display: flex; flex-wrap: wrap; }
  .topbar { padding-inline: 16px; }
}
@media (max-width: 600px) {
  .metrics, .detail-grid { grid-template-columns: minmax(0, 1fr); }
  .metric { display: flex; align-items: center; justify-content: space-between; }
  .dashboard { padding-inline: 16px; }
  .filters { padding: 15px; }
}

.nav-icon.renewals { border-radius: 50%; }
.nav-icon.renewals::after { content: ''; position: absolute; top: 2px; left: 5px; bottom: 5px; width: 3px; border-left: 1px solid; border-bottom: 1px solid; }
.renewal-form { display: grid; gap: 7px; min-width: 160px; }
.renewal-form select { display: block; margin-top: 3px; }
.payment-check { display: flex; align-items: center; gap: 6px; }
.payment-check input { width: auto; min-height: 0; accent-color: var(--accent); }

.nav-icon.accounts::before { content: '▤'; }
.account-fields { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); }
.account-fields dd { margin: .35rem 0 0; overflow-wrap: anywhere; }
.account-edit { margin: 1rem 0; max-width: 38rem; }
.data-panel details + details { margin-top: 1rem; }
.data-panel + .data-panel { margin-top: 1rem; }

.alerts { margin-bottom: 24px; }
.alert-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 14px; }
.alert-grid .card { min-width: 0; padding: 18px; }
.alert-grid p, .alert-grid li { font-size: .875rem; overflow-wrap: anywhere; }
.alert-grid .muted { margin: 8px 0 14px; }
.alert-list { list-style: none; margin: 10px 0 14px; padding: 0; }
.alert-list li { border-top: 1px solid var(--line); padding: 10px 0; }
.alert-links { display: flex; flex-wrap: wrap; gap: 12px; font-size: .875rem; }

.nav-icon.history-icon::after { content: ''; position: absolute; inset: 4px 3px; border-block: 1px solid currentColor; }
.history-filters { padding: 0 0 14px; }
.movement-preview { margin-top: 16px; }
.movement-list { list-style: none; padding: 0; margin: 0 0 12px; }
.movement-list li { border-top: 1px solid var(--line); padding: 12px 0; overflow-wrap: anywhere; }
.movement-list p { margin: 5px 0 0; font-size: .875rem; }

.accounting-tabs, .accounting-form { display: flex; align-items: end; flex-wrap: wrap; gap: 10px; margin: 0 0 16px; }
.accounting-tabs a { border-radius: 6px; padding: 8px 12px; font-weight: 650; }
.accounting-tabs a[aria-current="page"] { background: var(--accent-soft); }
.accounting-form { margin: 12px 0; }
.accounting-form label { flex: 1 1 125px; }
.accounting-form label input, .accounting-form label select { margin-top: 4px; }
.accounting-form .payment-check input { width: auto; min-height: auto; }
.accounting-form td { vertical-align: top; }

.stock-plans { display: grid; gap: 10px; justify-items: start; }
.stock-plans .payment-check { display: flex; gap: 8px; align-items: center; }
.stock-plans input { width: auto; min-height: auto; }
