:root {
  font-family: system-ui, -apple-system, sans-serif;
  color: #202936;
  background: #f6f8fb;
  font-size: 15px;
  line-height: 1.5;
}
* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
.header {
  background: #fff;
  border-bottom: 1px solid #d9e0e9;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem clamp(1rem, 4vw, 3rem);
  flex-wrap: wrap;
}
.header strong { font-size: 1.05rem; }
.header strong span { font-weight: 400; color: #526173; margin-inline-start: .65rem; }
main { max-width: 1440px; margin: auto; padding: clamp(1rem, 4vw, 3rem); }
h1, h2, p { margin: 0; }
h1 { font-size: 1.7rem; margin-bottom: .75rem; }
h2 { font-size: 1.2rem; }
.secondary { color: #526173; font-size: 1rem; }
nav { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1.5rem; }
.marketplace-nav { margin-bottom: .9rem; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
button, input, select, textarea { font: inherit; color: inherit; }
button, input, select, textarea {
  border: 1px solid #aeb9c8;
  border-radius: .45rem;
  background: #fff;
  padding: .46rem .7rem;
}
button { cursor: pointer; }
button:hover:enabled { background: #eef2f8; }
button:disabled { cursor: default; opacity: .6; }
button.primary, nav button[aria-current="page"] { background: #224c91; border-color: #224c91; color: white; }
button.primary:hover:enabled, nav button[aria-current="page"]:hover { background: #193b75; }
button.action-accent { background: #edf4ff; border-color: #b9cbed; color: #224c91; }
button.action-accent:hover:enabled { background: #dfebff; }
button.danger { border-color: #e1b2b4; color: #922e33; }
button.danger:hover:enabled { background: #fff0f0; }
button.danger-solid { background: #a22e34; border-color: #a22e34; color: white; }
button.danger-solid:hover:enabled { background: #832228; }
button.primary, button.action-accent, button.danger, button.danger-solid { font-weight: 600; }
:focus-visible { outline: 2px solid #2757a1; outline-offset: 2px; }
label { display: grid; gap: .25rem; }
input, textarea { width: 100%; }
textarea { resize: vertical; }
.select-control { position: relative; display: block; }
.select-control select { appearance: none; width: 100%; padding-inline-end: 2.25rem; }
.select-control::after {
  content: "";
  position: absolute;
  inset-inline-end: .95rem;
  top: 50%;
  width: .45rem;
  height: .45rem;
  border: solid #526173;
  border-width: 0 2px 2px 0;
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}
@media (forced-colors: active) {
  .select-control select { appearance: auto; padding-inline-end: .7rem; }
  .select-control::after { display: none; }
}
.auth, dialog {
  background: white;
  padding: 1.5rem;
  border: 1px solid #d9e0e9;
  border-radius: .65rem;
  width: min(100%, 30rem);
}
.auth { margin: 1rem auto; }
dialog { width: min(calc(100% - 2rem), 32rem); color: inherit; box-shadow: 0 1rem 3rem rgb(18 29 45 / 18%); }
dialog::backdrop { background: rgb(18 29 45 / 45%); }
.stack { display: grid; gap: 1rem; }
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  align-items: end;
  margin: 0 0 1rem;
  padding: .85rem;
  background: white;
  border: 1px solid #d9e0e9;
  border-radius: .65rem;
}
.filters label:first-child:has(input) { flex: 1 1 15rem; }
.filters label { color: #526173; font-weight: 600; min-width: 0; }
.filters input, .filters select { color: #202936; font-weight: 400; }
.table-wrap { overflow: auto; background: #fff; border: 1px solid #d9e0e9; border-radius: .55rem; }
table { border-collapse: collapse; width: 100%; text-align: left; }
th, td { padding: .8rem 1rem; border-bottom: 1px solid #e4e8ef; vertical-align: middle; }
th { background: #eef2f8; color: #43536a; font-size: .9rem; font-weight: 650; }
td:first-child { min-width: 9rem; overflow-wrap: anywhere; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:nth-child(even) { background: #f6f8fc; }
tbody tr:hover { background: #eef2f8; }
.record-row { cursor: pointer; }
.record-row:hover, .record-row:focus-within { background: #ebf2ff; }
.record-row:has(.row-link[aria-expanded="true"]) { background: #e2edff; }
.record-row:active { background: #d6e5fc; }
.record-row:is(:active, :has(.row-link[aria-expanded="true"])) td:first-child {
  box-shadow: inset 3px 0 #3864a6;
}
.record-row td:last-child { width: 1%; }
button.row-link, button.row-link:hover:enabled {
  border: 0;
  padding: 0;
  background: transparent;
  color: #224c91;
  text-align: start;
  font-weight: 650;
  overflow-wrap: anywhere;
}
.row-link:hover { text-decoration: underline; }
.row-arrow {
  display: block;
  width: .45rem;
  height: .45rem;
  border: solid #627994;
  border-width: 2px 2px 0 0;
  transform: rotate(45deg);
}
.record-row:is(:hover, :focus-within, :active, :has(.row-link[aria-expanded="true"])) .row-arrow {
  border-color: #224c91;
}
.data-date { white-space: nowrap; }
.tag { display: inline-block; white-space: nowrap; padding: .12rem .45rem; border-radius: .35rem; background: #e9edf3; }
.tag.active { background: #e5f4eb; color: #245b3c; }
.tag.blocked { background: #fbe7e7; color: #87282b; }
.tag.expiring { background: #fff1d7; color: #764b12; }
.paging { display: flex; flex-wrap: wrap; gap: .7rem; align-items: center; margin-top: .85rem; }
.statistics-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: end;
  gap: .75rem 1.25rem;
  margin-bottom: 1rem;
}
.statistics-header h1 { margin-bottom: .2rem; }
.metric-period { color: #526173; font-size: .92rem; }
.metric-period strong { color: #202936; font-weight: 650; }
.metric-groups { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .9rem; }
.metric-group {
  --metric-accent: #3864a6;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: .8rem;
  background: white;
  border: 1px solid #d9e0e9;
  border-radius: .8rem;
  padding: .85rem;
  box-shadow: 0 .15rem .45rem rgb(18 29 45 / 5%);
}
.metric-group.subscriptions { --metric-accent: #24785e; }
.metric-group.restrictions { --metric-accent: #ab4d56; }
.metric-group h2 { display: flex; align-items: center; gap: .45rem; font-size: 1rem; }
.metric-group h2::before {
  content: "";
  width: .26rem;
  height: .95rem;
  border-radius: .2rem;
  background: var(--metric-accent);
}
.metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: 1fr; gap: .55rem; margin: 0; }
.metric { min-width: 0; padding: .65rem .7rem; border-radius: .55rem; background: #f4f7fb; }
.metric dt { color: #4a596d; font-size: .9rem; font-weight: 550; line-height: 1.25; min-height: 2.5em; }
.metric dd { margin: .22rem 0 0; }
.metric strong { display: block; font-size: clamp(1.35rem, 2.15vw, 1.85rem); line-height: 1.2; font-variant-numeric: tabular-nums; }
.metric-comparison { display: flex; flex-wrap: wrap; align-items: center; gap: .15rem .35rem; margin-top: .36rem; }
.metric-trend { padding: .1rem .4rem; border-radius: .35rem; font-size: .8rem; font-weight: 650; max-width: 100%; overflow-wrap: anywhere; }
.metric-trend.positive { color: #18573e; background: #dff2e8; }
.metric-trend.negative { color: #8b2b33; background: #fbe5e8; }
.metric-trend.steady { color: #526173; background: #e7edf5; }
.metric-previous { color: #526173; font-size: .8rem; }
@media (max-width: 1080px) {
  .metric-groups { grid-template-columns: minmax(0, 1fr); }
  .metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 660px) {
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.stats-group { display: grid; gap: .65rem; margin-top: 1.3rem; }
.stats-group .table-wrap { max-height: 25rem; }
.stats-group th { position: sticky; top: 0; }
meter { width: min(10vw, 7rem); margin-inline-start: .35rem; }
.error { color: #9a2228; }
#dialog-error:empty, #record-error:empty, #message:empty { display: none; }
#promo-error:empty { display: none; }
#promo-editor { width: min(calc(100% - 2rem), 43rem); }
#promo-editor h3 { margin: 0; font-size: 1rem; }
.promo-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); gap: .8rem; }
.checkbox-label { display: flex; align-items: center; gap: .55rem; align-self: end; min-height: 2.5rem; }
.checkbox-label input { width: auto; }
@media (forced-colors: none) {
  .visibility-switch input {
    appearance: none;
    flex: none;
    width: 2.6rem;
    height: 1.5rem;
    padding: .15rem;
    margin: 0;
    border-radius: 1rem;
    background: #dce3ed;
    cursor: pointer;
  }
  .visibility-switch input::before {
    content: "";
    display: block;
    width: 1.05rem;
    height: 1.05rem;
    border-radius: 50%;
    background: #fff;
  }
  .visibility-switch input:checked { background: #224c91; border-color: #224c91; }
  .visibility-switch input:checked::before { transform: translateX(1.08rem); }
}
#tariff-editor { width: min(calc(100% - 2rem), 48rem); }
#tariff-editor h3, .custom-tariff-form h3 { margin: 0; font-size: 1rem; }
.tariff-error:empty { display: none; }
.tariff-options { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,13rem),1fr)); gap: .25rem .75rem; }
.tariff-order { display: grid; gap: .45rem; list-style: none; margin: 0; padding: 0; }
.tariff-order li { display: flex; justify-content: space-between; align-items: center; gap: .65rem; background: #f6f8fb; padding: .45rem .6rem; border-radius: .5rem; }
.custom-tariff-form { max-width: 60rem; background: white; border: 1px solid #d9e0e9; border-radius: .65rem; padding: 1rem; }
#message { margin-block: .8rem; }
.invite-result { background: white; padding: .75rem; border: 1px solid #d9e0e9; border-radius: .55rem; margin-bottom: 1rem; }

.tag.approved, .tag.published { background: #e5f4eb; color: #245b3c; }
.tag.rejected { background: #fbe7e7; color: #87282b; }
.tag.changes_requested { background: #fff1d7; color: #764b12; }
#record {
  width: min(calc(100% - 2rem), 46rem);
  max-height: calc(100% - 2rem);
  padding: 0;
}
#record[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.record-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: .75rem;
  border-bottom: 1px solid #e4e8ef;
}
.record-header, #record-content, .record-footer { padding: 1rem clamp(.9rem, 4vw, 1.4rem); }
#record-title { overflow-wrap: anywhere; }
#record-title:focus { outline: none; }
.icon-button { padding: 0; width: 2rem; height: 2rem; font-size: 1.35rem; }
#record-content { overflow: auto; }
.record-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr));
  gap: .85rem 1rem;
  background: #f6f8fb;
  border: 1px solid #e4e8ef;
  border-radius: .55rem;
  padding: .9rem;
  margin: 0;
}
.record-fields dt { color: #526173; font-size: .9rem; }
.record-fields dd { margin: .15rem 0 0; overflow-wrap: anywhere; }
.record-subscription { border-top: 1px solid #e4e8ef; padding-top: .9rem; gap: .7rem; }
.record-subscription h3 { margin: 0; font-size: 1rem; }
.record-footer { background: #f6f8fb; border-top: 1px solid #e4e8ef; }
.record-footer:has(#record-error:empty):has(#record-actions:empty) { display: none; }
#record-error { margin-bottom: .65rem; }
.marketplace-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.feedback-photo { display: block; max-width: 100%; max-height: 320px; border-radius: .55rem; object-fit: contain; }
.feedback-voice { width: 100%; }
