@import url("tokens.css");

.lucide-icon {
    display: block;
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    color: var(--color-text);
    background: var(--color-bg);
    font: var(--font-size-base)/1.4 var(--font-sans);
}

body {
    margin: 0;
}

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

button,
select,
input[type="text"],
input[type="password"],
input[type="date"] {
    min-height: var(--control-min-height);
}

a {
    color: var(--color-link);
    font-weight: 600;
    text-decoration: none;
}

a:hover {
    color: var(--color-link-hover);
    text-decoration: underline;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid var(--color-focus);
    outline-offset: 2px;
}

.app-shell {
    background: var(--color-bg);
}

.password-field {
    --password-toggle-size: calc(var(--space-3) * 2);
    position: relative;
    width: 100%;
    min-width: 0;
}

.password-field input,
.pma-modal__body .password-field input[type] {
    display: block;
    padding-right: calc(var(--password-toggle-size) + (var(--space-1) * 3));
}

.password-field__toggle {
    position: absolute;
    top: 50%;
    right: var(--space-1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--password-toggle-size);
    height: var(--password-toggle-size);
    min-height: var(--password-toggle-size);
    padding: 0;
    transform: translateY(-50%);
    border: 0;
    border-radius: var(--radius-sm);
    color: var(--color-text-muted);
    background: transparent;
    cursor: pointer;
}

.password-field__toggle:hover {
    color: var(--color-primary);
    background: var(--color-surface-muted);
}

.password-field__toggle:focus-visible {
    outline: var(--focus-ring-width) solid var(--color-focus);
    outline-offset: calc(-1 * var(--focus-ring-width));
}

.password-field__toggle svg {
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
}

.app-header {
    position: relative;
    z-index: 10;
    background: var(--color-header);
    box-shadow: var(--shadow-sm);
}

.app-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
    width: 100%;
    padding: 0 var(--space-5);
}

.app-nav__list {
    display: flex;
    flex: 0 0 auto;
    align-items: stretch;
    gap: var(--space-1);
    min-height: 52px;
    max-width: 100%;
    margin: 0;
    padding: 0;
    list-style: none;
}

.app-nav__identity {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: var(--space-2);
    max-width: 100%;
    margin-left: auto;
    color: var(--color-header-text);
    opacity: .78;
    white-space: nowrap;
}

.app-nav__identity .lucide-icon {
    flex: 0 0 16px;
}

.app-nav__identity-name {
    max-width: 14rem;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-nav__identity-role::before {
    content: "·";
    margin-right: var(--space-2);
}

.app-nav__link {
    display: flex;
    align-items: center;
    min-height: 52px;
    padding: 0 var(--space-4);
    color: var(--color-header-text);
    border-bottom: 3px solid transparent;
    font-weight: 650;
}

.app-nav__link:hover {
    color: #fff;
    background: rgb(255 255 255 / 8%);
    text-decoration: none;
}

.app-nav__link--active {
    color: var(--color-header-active);
    border-bottom-color: #6fb3e8;
    background: rgb(255 255 255 / 10%);
}

.app-main {
    width: 100%;
    min-width: 0;
    padding: var(--space-3) var(--space-5) var(--space-5);
}

.password-result {
    width: min(100%, var(--dialog-width));
    margin: var(--space-6) auto;
    padding: var(--space-5);
    border: var(--border-width) solid var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--color-surface);
    box-shadow: var(--shadow-sm);
}

.password-result h1 {
    margin-top: 0;
    color: var(--color-heading);
    font-size: var(--font-size-title);
}

.password-result .button {
    display: inline-flex;
    margin-top: var(--space-3);
}

.app-footer {
    padding: var(--space-4) var(--space-5);
    color: var(--color-text-muted);
    text-align: center;
}

.app-footer a {
    font-weight: 500;
}

.auth-shell {
    background: var(--color-bg);
}

.auth-page {
    display: grid;
    min-height: 100vh;
    padding: var(--space-5);
    place-items: center;
}

.auth-card,
.account-card {
    width: 100%;
    padding: var(--space-5);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.auth-card {
    max-width: 440px;
}

.card-title {
    margin: 0 0 var(--space-5);
    color: var(--color-heading);
    font-size: var(--font-size-title);
    line-height: 1.25;
}

.auth-form,
.account-form {
    display: grid;
    gap: var(--space-4);
}

.auth-card .alert,
.account-card .alert,
.account-card .notice {
    margin: 0 0 var(--space-4);
}

.form-row {
    display: grid;
    grid-template-columns: 190px minmax(0, 1fr);
    align-items: center;
    gap: var(--space-3);
}

.auth-card .form-row {
    grid-template-columns: 75px minmax(0, 1fr);
}

.form-row label {
    color: var(--color-heading);
    font-weight: 650;
}

.form-input {
    width: 100%;
    padding: var(--control-padding-block) var(--control-padding-inline);
    color: var(--color-text);
    background: var(--color-surface);
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-sm);
}

.form-input[readonly] {
    color: var(--color-text-muted);
    background: var(--color-surface-muted);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
}

.field-error {
    display: block;
    margin-top: var(--space-1);
    color: var(--color-danger);
    font-size: 0.88rem;
    font-weight: 650;
}

.checkbox-control {
    display: flex;
    align-items: center;
    min-height: var(--control-min-height);
}

.checkbox-control input {
    width: 17px;
    height: 17px;
    margin: 0;
}

.subscriber-account-page {
    width: min(1120px, 100%);
    margin: 0 auto;
}

.subscriber-message {
    margin: 0 0 var(--space-4);
}

.subscriber-message p {
    margin: 0;
}

.subscriber-message p + p {
    margin-top: var(--space-1);
}

.account-table-wrap {
    width: 100%;
    overflow-x: auto;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
}

.account-table {
    width: 100%;
    min-width: 780px;
    color: var(--color-text);
    border-spacing: 0;
    border-collapse: separate;
    font-size: 0.9rem;
}

.account-table th,
.account-table td {
    padding: 10px 12px;
    vertical-align: middle;
    border-right: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
}

.account-table th:last-child,
.account-table td:last-child {
    border-right: 0;
}

.account-table thead th {
    color: #263544;
    background: var(--color-table-heading);
    box-shadow: 0 1px 0 var(--color-border-strong);
    font-weight: 700;
    text-align: left;
    white-space: nowrap;
}

.account-table tbody tr:last-child td {
    border-bottom: 0;
}

.account-table tbody tr:hover td {
    background: var(--color-row-hover);
}

.numeric-cell {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.date-cell {
    text-align: center;
    white-space: nowrap;
}

.status-text {
    font-weight: 750;
}

.status-text--enabled {
    color: var(--color-success);
}

.status-text--disabled {
    color: var(--color-danger);
}

.payment-card {
    margin-top: var(--space-5);
}

.payment-options {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-3);
}

.payment-options form,
.payment-button {
    width: 100%;
}

.payment-button {
    min-height: 42px;
}

.form-card {
    max-width: 680px;
    margin: 0 auto;
}

.current-state {
    margin: 0 0 var(--space-4);
}

.subscriber-page {
    width: 100%;
    min-width: 0;
}

.notice,
.alert {
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-sm);
    font-weight: 650;
}

.notice {
    color: #205c31;
    background: #e8f5ec;
    border: 1px solid #a9d4b4;
}

.alert {
    color: #8f1e28;
    background: #fff0f1;
    border: 1px solid #e4a5aa;
}

.list-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    justify-content: space-between;
    gap: var(--space-3) var(--space-5);
    margin-bottom: var(--space-3);
    padding: var(--space-3);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow-anchor: none;
}

.list-toolbar__message {
    flex: 0 0 100%;
    width: 100%;
    margin: 0;
    padding: var(--space-2) var(--space-3);
    color: var(--color-danger);
    background: var(--color-alert-bg);
    border: var(--border-width) solid var(--color-alert-border);
    border-radius: var(--radius-sm);
    font-weight: 650;
}

.subscriber-page > .list-toolbar__message,
.admin-page > .list-toolbar__message {
    margin-bottom: var(--space-3);
}

.search-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
}

.search-form__label {
    color: var(--color-heading);
    font-weight: 650;
}

.search-form select,
.search-form input[type="text"] {
    padding: var(--control-padding-block) var(--control-padding-inline);
    color: var(--color-text);
    background: var(--color-surface);
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-sm);
}

.search-form input[type="text"] {
    width: min(240px, 40vw);
}

.button,
.action-button,
.sort-button,
.icon-button,
.status-button,
.page-button {
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.button {
    min-height: var(--button-min-height);
    padding: var(--button-padding-block) var(--button-padding-inline);
    color: var(--color-text);
    background: var(--color-button);
    border-color: var(--color-border-strong);
    font-weight: 600;
}

.button--with-icon {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
}

.button:hover {
    background: var(--color-button-hover);
}

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

.button--primary:hover {
    background: var(--color-primary-hover);
}

.list-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-1);
}

.action-button {
    min-height: 34px;
    padding: 4px 10px;
    color: var(--color-link);
    background: transparent;
}

.action-button:hover {
    color: var(--color-link-hover);
    background: #edf4ef;
    text-decoration: underline;
}

.list-actions__link {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
}

.subscriber-table-wrap {
    width: 100%;
    overflow: visible;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
}

.subscriber-table {
    width: 100%;
    min-width: 1218px;
    border-spacing: 0;
    border-collapse: separate;
    color: var(--color-text);
    font-size: 0.86rem;
}

.subscriber-table th,
.subscriber-table td {
    padding: 7px 8px;
    vertical-align: middle;
    border-right: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
}

.subscriber-table th:last-child,
.subscriber-table td:last-child {
    border-right: 0;
}

.subscriber-table thead th {
    position: sticky;
    z-index: 2;
    top: 0;
    color: #263544;
    background: var(--color-table-heading);
    box-shadow: 0 1px 0 var(--color-border-strong);
    font-weight: 700;
    text-align: left;
    white-space: nowrap;
}

.subscriber-table tbody tr:nth-child(even) td {
    background: var(--color-row-alt);
}

.subscriber-table tbody tr:hover td {
    background: var(--color-row-hover);
}

.subscriber-table tbody tr:last-child td {
    border-bottom: 0;
}

.subscriber-table__number,
.subscriber-table__balance {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.subscriber-table__number {
    width: 66px;
    font-weight: 700;
}

.subscriber-table__user {
    width: 1%;
    min-width: 210px;
    white-space: nowrap;
}

.subscriber-table__tariff {
    min-width: 115px;
    font-weight: 650;
}

.subscriber-table__balance {
    width: 105px;
}

.subscriber-table__status {
    width: 70px;
    text-align: center;
}

.subscriber-table__date {
    width: 108px;
    white-space: nowrap;
}

.subscriber-table__diagnostics {
    min-width: 236px;
    white-space: nowrap;
}

.subscriber-table__activity {
    width: 100%;
    min-width: 360px;
}

.sort-button {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 32px;
    margin: -5px -6px;
    padding: 5px 6px;
    color: #204f78;
    background: transparent;
    font-weight: 700;
}

.sort-button:hover {
    background: rgb(255 255 255 / 55%);
}

.sort-button__direction {
    width: 12px;
    height: 12px;
    flex-basis: 12px;
}

.sort-button__direction--desc {
    transform: rotate(180deg);
}

.user-cell {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    min-width: 0;
}

.user-actions {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    width: auto;
}

.row-icon {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    color: var(--color-warning-icon);
}

.icon-button,
.status-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    min-width: 32px;
    height: 32px;
    padding: 0;
    background: transparent;
}

.user-actions .icon-button {
    width: 20px;
    min-width: 20px;
}

.icon-button:hover,
.status-button:hover {
    background: #dbe9f3;
}

.icon-button {
    color: var(--color-text-muted);
}

.subscriber-table tbody tr:hover .icon-button {
    color: var(--color-primary);
}

.status-button .lucide-icon {
    width: 20px;
    height: 20px;
    flex-basis: 20px;
    fill: currentColor;
    stroke: var(--color-surface);
}

.status-button--active {
    color: var(--color-success);
}

.status-button--inactive {
    color: var(--color-danger);
}

.username-button,
.balance-button {
    min-height: 32px;
    padding: 3px 5px;
    color: var(--color-link);
    background: transparent;
    border: 0;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 700;
}

.username-button:hover,
.balance-button:hover {
    color: var(--color-link-hover);
    background: #edf4ef;
    text-decoration: underline;
}

.balance-button {
    color: inherit;
    width: 100%;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.balance-button:hover {
    color: inherit;
}

.amount--neutral {
    color: var(--color-text-muted);
}

.table-cell-action {
    padding: 2px 0;
    color: inherit;
    background: transparent;
    border: 0;
    border-radius: var(--radius-sm);
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.table-cell-action:hover {
    color: var(--color-link-hover);
    text-decoration: underline;
}

.table-cell-action:focus-visible {
    outline: var(--focus-ring-width) solid var(--color-focus);
    outline-offset: var(--focus-ring-offset);
}

.contract-cell {
    position: relative;
}

.contract-copy {
    font-weight: inherit;
    font-variant-numeric: tabular-nums;
}

.contract-copy__feedback {
    position: absolute;
    z-index: 2;
    top: 50%;
    left: calc(100% + var(--space-1));
    width: max-content;
    max-width: 220px;
    padding: var(--space-1) var(--space-2);
    color: var(--color-text);
    background: var(--color-surface);
    border: var(--border-width) solid var(--color-border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
    transform: translateY(-50%);
    white-space: normal;
}

.diagnostic-links {
    display: grid;
    grid-template-columns: 100px 56px 56px;
    align-items: center;
    justify-content: start;
    gap: var(--space-1);
}

.diagnostic-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-width: 0;
    min-height: 32px;
    padding: 4px 7px;
    color: #234e73;
    background: #f4f7fa;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    font-weight: 700;
}

.diagnostic-link:hover {
    color: #173a58;
    background: #e7eef4;
    text-decoration: none;
}

.diagnostic-link--warning,
.diagnostic-link--warning:hover {
    color: var(--color-signal-warning);
    background: var(--color-signal-warning-bg);
    border-color: var(--color-signal-warning);
}

.diagnostic-link--danger,
.diagnostic-link--danger:hover {
    color: var(--color-danger);
    background: var(--color-alert-bg);
    border-color: var(--color-danger);
}

.diagnostic-slot {
    display: block;
    width: 100%;
    height: 1px;
}

.activity-stack {
    display: grid;
    gap: var(--space-1);
}

.activity-row {
    display: grid;
    grid-template-columns: calc(var(--space-5) + var(--space-4)) minmax(0, 1fr);
    align-items: start;
    gap: var(--space-2);
}

.activity-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0 var(--space-1);
    color: var(--color-text-muted);
    background: var(--color-button);
    border: var(--border-width) solid var(--color-border-strong);
    border-radius: var(--radius-sm);
}

.activity-badge--ok {
    color: var(--color-success);
    background: var(--color-notice-bg);
    border-color: var(--color-notice-border);
}

.activity-badge--warning {
    color: var(--color-warning);
    background: var(--color-surface-muted);
    border-color: var(--color-warning);
}

.activity-values {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    min-width: 0;
    color: var(--color-text);
}

.activity-group {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
}

.activity-group + .activity-group::before {
    margin: 0 var(--space-2);
    color: var(--color-border-strong);
    content: "·";
}

.mac-mismatch {
    color: var(--color-danger);
}

.mono {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}

.pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    margin: var(--space-4) 0 0;
}

.pagination__pages {
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.page-button,
.pagination__current,
.pagination__disabled {
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: var(--button-min-height);
    min-height: var(--button-min-height);
    padding: var(--space-1) var(--space-2);
    border: var(--border-width) solid var(--color-border-strong);
    border-radius: var(--radius-sm);
    font: inherit;
    font-weight: 700;
}

.page-button {
    color: var(--color-link);
    background: var(--color-surface);
    cursor: pointer;
}

.page-button:hover {
    color: var(--color-link-hover);
    background: var(--color-row-hover);
}

.page-button:focus-visible {
    outline: var(--focus-ring-width) solid var(--color-focus);
    outline-offset: var(--focus-ring-offset);
}

.pagination__current {
    color: var(--color-header-active);
    background: var(--color-primary);
    border-color: var(--color-primary);
}

.pagination__disabled {
    color: var(--color-text-muted);
    background: var(--color-surface-muted);
    border-color: var(--color-border);
    cursor: default;
    opacity: 0.55;
}

.pagination__summary {
    flex-basis: 100%;
    margin: 0;
    color: var(--color-text-muted);
    text-align: center;
}

.pagination__size {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--color-text-muted);
    white-space: nowrap;
}

.pagination__size select {
    min-height: var(--control-min-height);
    padding: var(--control-padding-block) var(--control-padding-inline);
    color: var(--color-text);
    background: var(--color-surface);
    border: var(--border-width) solid var(--color-border-strong);
    border-radius: var(--radius-sm);
}

.back-to-top {
    position: fixed;
    z-index: calc(var(--dialog-z-overlay) - 1);
    right: var(--space-5);
    bottom: calc(var(--space-6) + var(--button-min-height) + var(--back-to-top-lift, 0px));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: calc(var(--control-min-height) + var(--space-2));
    height: calc(var(--control-min-height) + var(--space-2));
    padding: 0;
    color: var(--color-header-active);
    background: var(--color-primary);
    border: var(--border-width) solid var(--color-primary);
    border-radius: 50%;
    box-shadow: var(--shadow-md);
    cursor: pointer;
}

.back-to-top:hover {
    background: var(--color-primary-hover);
    border-color: var(--color-primary-hover);
}

.back-to-top:focus-visible {
    outline: var(--focus-ring-width) solid var(--color-focus);
    outline-offset: var(--focus-ring-offset);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.admin-page {
    min-width: 0;
}

.admin-graph {
    max-width: 1100px;
}

.admin-graph__scroll {
    overflow-x: auto;
}

.admin-graph__scroll svg {
    max-width: none;
    color: var(--color-text-muted);
    font: var(--font-size-base) var(--font-sans);
}

.admin-graph__axis {
    stroke: var(--color-border-strong);
}

.admin-graph__line {
    fill: none;
    stroke-width: 2;
}

.admin-graph__line--in {
    stroke: var(--color-success);
}

.admin-graph__line--out {
    stroke: var(--color-primary);
}

.admin-graph__controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3);
    margin: var(--space-4) 0;
}

.admin-graph__legend {
    display: flex;
    gap: var(--space-2);
}

.admin-graph__series {
    padding: var(--button-padding-block) var(--button-padding-inline);
    background: var(--color-button);
    border: var(--border-width) solid var(--color-border);
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.admin-graph__series:hover {
    background: var(--color-button-hover);
}

.admin-graph__series[aria-pressed="false"] {
    opacity: .5;
}

.admin-graph__reset[hidden] {
    display: none;
}

.admin-graph__legend-in {
    color: var(--color-success);
}

.admin-graph__legend-out {
    color: var(--color-primary);
}

.admin-graph__crosshair {
    stroke: var(--color-border-strong);
}

.admin-graph__point {
    stroke: var(--color-surface);
    stroke-width: 2;
}

.admin-graph__point--in {
    fill: var(--color-success);
}

.admin-graph__point--out {
    fill: var(--color-primary);
}

.admin-graph__selection {
    fill: var(--color-focus);
    stroke: var(--color-primary);
}

.admin-graph__hit {
    fill: transparent;
    cursor: crosshair;
}

.admin-graph__tooltip {
    position: fixed;
    z-index: calc(var(--dialog-z-overlay) - 1);
    padding: var(--space-2) var(--space-3);
    color: var(--color-text);
    background: var(--color-surface);
    border: var(--border-width) solid var(--color-border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
    white-space: pre-line;
    pointer-events: none;
}

.admin-toolbar {
    display: block;
}

.admin-toolbar .list-actions {
    margin-top: var(--space-2);
}

.admin-toolbar .pma-modal__message {
    margin-top: var(--space-2);
}

.admin-search__extended {
    flex: 0 0 100%;
    min-width: 0;
    margin: var(--space-2) 0 0;
    padding: var(--space-3);
    border: var(--border-width) solid var(--color-border);
    border-radius: var(--radius-sm);
}

.admin-search__extended legend {
    color: var(--color-heading);
    font-weight: 700;
}

.admin-search__options {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-5);
}

.admin-search__checks {
    display: grid;
    gap: var(--space-2);
}

.admin-search__checks label {
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.admin-table {
    min-width: 1380px;
    width: 100%;
}

.admin-table td:first-child,
.admin-table td:nth-last-child(4),
.admin-table td:last-child {
    text-align: center;
}

.admin-table td:nth-child(2) {
    min-width: 210px;
}

.admin-table tbody tr.admin-table__credit-debt td,
.admin-table tbody tr.admin-table__credit-debt:nth-child(even) td {
    background: var(--color-credit-debt);
}

.admin-table tbody tr:hover td,
.admin-table tbody tr.admin-table__credit-debt:hover td {
    background: var(--color-row-hover);
}

.admin-user-cell {
    white-space: nowrap;
}

.admin-user-actions {
    flex-basis: auto;
    width: auto;
    gap: var(--space-1);
}

.admin-credit-icon {
    color: var(--color-success);
}

.admin-indicator {
    display: inline-flex;
    vertical-align: middle;
}

.admin-indicator .lucide-icon {
    fill: currentColor;
    stroke: var(--color-surface);
}

.admin-indicator--on,
.admin-badge--yes,
.admin-amount--positive {
    color: var(--color-success);
}

.admin-indicator--off,
.admin-badge--no,
.admin-amount--negative,
.admin-delete {
    color: var(--color-danger);
}

.admin-ip-actions {
    display: grid;
    grid-template-columns: 9.5rem 5.5rem;
    gap: var(--space-1);
    justify-content: start;
    white-space: nowrap;
}

.admin-ip-actions__slot {
    min-width: 0;
}

.admin-ip-actions .button {
    width: 100%;
    min-height: var(--control-min-height);
    padding: var(--space-1) var(--space-2);
}

.admin-ip-actions__address {
    font-family: var(--font-mono);
}

.admin-groups-card {
    overflow: hidden;
    background: var(--color-surface);
    border: var(--border-width) solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
}

.admin-groups-tree,
.admin-modal-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.admin-groups-tree__item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
    min-height: var(--control-min-height);
    padding: var(--space-1) var(--space-3) var(--space-1) calc(var(--space-3) + var(--tree-depth) * var(--space-4));
    border-bottom: var(--border-width) solid var(--color-border);
}

.admin-groups-tree__item:nth-child(even) {
    background: var(--color-row-alt);
}

.admin-groups-tree__item:hover {
    background: var(--color-row-hover);
}

.admin-groups-tree__item:last-child {
    border-bottom: 0;
}

.admin-groups-tree__actions {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-1);
}

.admin-groups-tree__actions .action-button {
    min-height: var(--control-min-height);
    padding: var(--space-1) var(--space-2);
}

.admin-modal-list li {
    padding: var(--space-1) 0 var(--space-1) calc(var(--tree-depth, 0) * var(--space-4));
}

.admin-tariffs-table {
    min-width: 720px;
}

.admin-badge {
    display: inline-block;
    padding: var(--space-1) var(--space-2);
    background: var(--color-surface-muted);
    border: var(--border-width) solid var(--color-border);
    border-radius: var(--radius-sm);
    font-weight: 700;
}

.admin-page .search-form input[type="date"],
.admin-page .search-form select,
.subscriber-page .search-form input[type="date"],
.subscriber-page .search-form select {
    padding: var(--control-padding-block) var(--control-padding-inline);
    color: var(--color-text);
    background: var(--color-surface);
    border: var(--border-width) solid var(--color-border-strong);
    border-radius: var(--radius-sm);
}

.subscriber-table--payments {
    width: auto;
    max-width: 100%;
    min-width: 720px;
}

.subscriber-table-wrap--payments {
    width: fit-content;
    max-width: 100%;
}

.subscriber-table--payments .payments-id {
    white-space: nowrap;
}

.subscriber-table--payments .numeric-cell,
.subscriber-table--payments .payments-date {
    white-space: nowrap;
}

.payments-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    background: var(--color-surface);
    border: var(--border-width) solid var(--color-border);
    border-radius: var(--radius-md);
}

.payments-summary__amount {
    font-size: var(--font-size-title);
    font-weight: 700;
}

@media (max-width: 1100px) {
    .app-nav__list {
        flex: 1 0 100%;
        overflow-x: auto;
    }

    .app-nav__identity {
        min-height: var(--control-min-height);
    }

    .subscriber-table-wrap {
        overflow-x: auto;
        overflow-y: hidden;
    }

    .back-to-top {
        right: var(--space-3);
    }
}

@media (max-width: 480px) {
    .app-nav__identity-name,
    .app-nav__identity-role {
        display: none;
    }
}

@media (max-width: 720px) {
    .app-nav,
    .app-main {
        padding-right: var(--space-3);
        padding-left: var(--space-3);
    }

    .app-nav__list {
        overflow-x: auto;
    }

    .app-nav__link {
        padding-right: var(--space-3);
        padding-left: var(--space-3);
        white-space: nowrap;
    }

    .list-toolbar,
    .search-form {
        align-items: stretch;
    }

    .search-form,
    .search-form select,
    .search-form input[type="text"] {
        width: 100%;
    }

    .list-actions {
        width: 100%;
    }

    .auth-page {
        padding: var(--space-3);
    }

    .auth-card,
    .account-card {
        padding: var(--space-4);
    }

    .form-row,
    .auth-card .form-row {
        grid-template-columns: 1fr;
        gap: var(--space-1);
    }

    .payment-options {
        grid-template-columns: 1fr;
    }
}
