:root {
    color-scheme: light;
    --bg: #f7f7fc;
    --ink: #333333;
    --muted: #7a8c99;
    --line: #d7e6ee;
    --card: #ffffff;
    --blue: #0098d7;
    --blue-bright: #17c8f3;
    --blue-deep: #1d99d6;
    --orange: #ff7a00;
    --accent-ink: #ffffff;
    --danger: #d64545;
    --ok: #1f8a4c;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Ubuntu", "Segoe UI", sans-serif;
    font-weight: 300;
    background: var(--bg);
    color: var(--ink);
    line-height: 1.5;
}

h1, h2, button, .button, .brand-name, th {
    font-family: "Open Sans", "Segoe UI", sans-serif;
    font-weight: 500;
}

a { color: var(--blue); }

.wrap {
    width: min(1080px, calc(100% - 32px));
    margin: 0 auto;
}

body.has-sidebar {
    display: flex;
    min-height: 100vh;
    align-items: stretch;
}

.sidebar {
    width: 260px;
    flex: 0 0 260px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 22px 18px;
    background: #fff;
    border-right: 1px solid #eef3f7;
    min-height: 100vh;
    position: sticky;
    top: 0;
    align-self: flex-start;
}

.shell {
    flex: 1 1 auto;
    min-width: 0;
}

.side-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.side-nav a {
    color: var(--muted);
    text-decoration: none;
    text-transform: uppercase;
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    padding: 10px 12px;
    border-radius: 12px;
}

.side-nav a.active,
.side-nav a:hover {
    color: var(--blue);
    background: #f3fbff;
}

.sidebar-subscribe {
    width: 100%;
    text-align: center;
}

.sidebar-until {
    width: 100%;
    text-align: center;
    color: #6b7280;
    font-size: 0.82rem;
    line-height: 1.35;
}

.order-columns {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-top: 8px;
}

.order-block h2 {
    margin: 0 0 12px;
    font-size: 1.1rem;
}

.sort-list {
    list-style: none;
    margin: 0 0 16px;
    padding: 0;
    display: grid;
    gap: 8px;
}

.sort-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 10px;
    align-items: center;
    padding: 12px 14px;
    border: 1px solid #e5edf3;
    border-radius: 12px;
    background: #fff;
    cursor: grab;
    user-select: none;
}

.sort-item.is-dragging {
    opacity: 0.55;
    cursor: grabbing;
}

.sort-item.is-over {
    border-color: var(--blue-bright);
    background: #f4fcff;
}

.sort-handle {
    color: #9aa3ad;
    letter-spacing: -2px;
    font-size: 1rem;
    line-height: 1;
}

.sort-name {
    font-weight: 500;
}

.price-old {
    text-decoration: line-through;
    color: #9aa3ad;
    font-weight: 400;
    margin-right: 6px;
}

.price-new {
    color: #c5221f;
    font-weight: 600;
}

.price-until {
    display: block;
    margin-top: 4px;
    color: #c5221f;
    font-size: 0.82rem;
    font-weight: 500;
}

.price-stack {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.tariff-price-list li {
    align-items: flex-start;
}

.promo-dialog {
    max-width: min(640px, calc(100vw - 24px));
}

.promo-form {
    max-height: min(85vh, 900px);
    overflow: auto;
}

.promo-checks {
    display: grid;
    gap: 8px;
    margin: 0 0 14px;
}

.promo-checks .check.is-disabled {
    opacity: 0.55;
}

.promo-form .user-create-actions {
    margin-top: 8px;
}

.promo-form .button {
    margin-top: 0;
}

.tariffs-archive-link {
    display: inline-block;
    margin-top: 22px;
    color: #9aa3ad;
    font-size: 0.82rem;
    text-decoration: none;
}

.tariffs-archive-link:hover {
    color: #6b7280;
    text-decoration: underline;
}

.sidebar-foot {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid #eef3f7;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sidebar-user-row {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-user {
    flex: 1 1 auto;
    min-width: 0;
    font-family: "Open Sans", "Segoe UI", sans-serif;
    font-weight: 500;
    font-size: 0.98rem;
    color: #222;
}

.sidebar-user-name {
    display: block;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.sidebar-user-tip {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    bottom: calc(100% + 8px);
    z-index: 30;
    padding: 6px 8px;
    background: #fff;
    color: #222;
    border: 1px solid #e4eef5;
    border-radius: 8px;
    box-shadow: 0 8px 20px rgba(33, 33, 33, 0.12);
    font-size: 0.78rem;
    font-weight: 500;
    line-height: 1.35;
    white-space: normal;
}

.sidebar-user.is-truncated:hover .sidebar-user-tip,
.sidebar-user.is-truncated:focus-within .sidebar-user-tip {
    display: block;
}

.sidebar-actions {
    display: flex;
    flex: 0 0 auto;
    gap: 6px;
    align-items: center;
}

.sidebar-icon {
    margin: 0;
}

.logout-dialog {
    border: 0;
    border-radius: 20px;
    padding: 0;
    box-shadow: 0 18px 48px rgba(33, 33, 33, 0.18);
    max-width: calc(100% - 32px);
}

.logout-dialog::backdrop {
    background: rgba(33, 45, 58, 0.35);
}

.logout-card {
    margin: 0;
    padding: 28px;
    width: min(380px, 100%);
}

.logout-card p {
    margin: 0 0 18px;
    font-size: 1.05rem;
}

.logout-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    align-items: center;
}

.notice-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    align-items: center;
    margin-top: 18px;
    flex-wrap: wrap;
}

.notice-actions .button {
    margin-top: 0;
}

.logout-actions .button,
.logout-actions button {
    margin-top: 0;
}

.top {
    background: #fff;
    border-bottom: 1px solid #eef3f7;
}

.top-inner {
    display: flex;
    justify-content: flex-start;
    gap: 20px;
    align-items: center;
    padding: 18px 0;
    flex-wrap: wrap;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: inherit;
    text-decoration: none;
}

.brand-name {
    display: block;
    font-size: 1.35rem;
    letter-spacing: -0.03em;
    line-height: 1;
    color: #222;
}

.brand-sub {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 0.75rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

nav {
    margin-left: auto;
    display: flex;
    gap: 6px 22px;
    flex-wrap: wrap;
    align-items: center;
    border: 2px solid var(--blue-bright);
    border-radius: 28px;
    padding: 8px 22px;
    background: #fff;
}

nav a {
    color: var(--muted);
    text-decoration: none;
    text-transform: uppercase;
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    padding: 6px 0;
}

nav a.active, nav a:hover { color: var(--blue); }

.subscribe {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    background: var(--orange);
    color: #fff;
    text-decoration: none;
    border-radius: 25px;
    padding: 8px 16px;
    font-family: "Open Sans", "Segoe UI", sans-serif;
    font-size: 0.92rem;
    line-height: 1.15;
}

.subscribe-until {
    margin-top: 2px;
    font-size: 0.68rem;
    font-weight: 400;
    letter-spacing: 0;
    opacity: 0.92;
}

.subscribe:hover { background: #e86e00; color: #fff; }

main { padding: 32px 0 72px; }

.card {
    background: var(--card);
    border: 0;
    border-radius: 20px;
    padding: 28px;
    margin-bottom: 16px;
    box-shadow: 0 10px 30px rgba(33, 33, 33, 0.06);
}

h1 { font-size: 2rem; margin: 0 0 10px; color: #333; letter-spacing: -0.02em; }

h2 { font-size: 1.15rem; margin: 0 0 8px; }

.muted { color: var(--muted); }

.flash, .error, .secret {
    border-radius: 16px;
    padding: 12px 16px;
    margin-bottom: 16px;
}

.flash { background: #e8f8ef; color: var(--ok); }

.error { background: #fff1f1; color: var(--danger); }

.secret { color: var(--ink); background: #f3fbff; border: 1px solid #d4eef8; }

label { display: block; font-size: 0.92rem; margin: 14px 0 6px; color: #4b5560; }

input, select, textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: white;
    color: inherit;
    font: inherit;
}

input:focus, select:focus, textarea:focus {
    outline: 2px solid rgba(23, 200, 243, 0.45);
    border-color: var(--blue-bright);
}

textarea { min-height: 90px; resize: vertical; }

input[type="checkbox"] { width: auto; }

button, .button {
    display: inline-block;
    margin-top: 16px;
    background: var(--orange);
    color: var(--accent-ink);
    border: 1px solid var(--orange);
    border-radius: 25px;
    padding: 11px 22px;
    text-decoration: none;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1.2;
}

button:hover, .button:hover { background: #e86e00; border-color: #e86e00; }

.button.secondary, button.secondary {
    background: #fff;
    color: #222;
    border: 2px solid var(--blue-bright);
}

.button.secondary:hover, button.secondary:hover {
    background: #f4fcff;
    color: var(--blue);
}

span.button.is-disabled {
    background: #c5d0d6;
    border-color: #c5d0d6;
    color: #fff;
    cursor: not-allowed;
    pointer-events: none;
}

.button.danger, button.danger {
    background: var(--danger);
    border-color: var(--danger);
    color: #fff;
}

.button.danger:hover, button.danger:hover { background: #c33636; border-color: #c33636; }

table .button, .inline button, .inline .button { margin-top: 0; }

.users-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 8px;
}

.users-head h1 { margin: 0; }

.users-add {
    flex: 0 0 auto;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--blue);
    color: #fff;
    border-color: var(--blue);
}

.users-add:hover {
    background: var(--blue-deep);
    border-color: var(--blue-deep);
    color: #fff;
}

.user-create-dialog {
    border: 0;
    border-radius: 20px;
    padding: 0;
    width: min(560px, calc(100% - 32px));
    max-width: calc(100% - 32px);
    max-height: calc(100% - 32px);
    overflow: auto;
    box-shadow: 0 18px 48px rgba(33, 33, 33, 0.18);
}

.user-create-dialog::backdrop {
    background: rgba(33, 45, 58, 0.35);
}

.user-create-card {
    margin: 0;
    padding: 24px;
}

.user-create-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    margin-bottom: 8px;
}

.user-create-head h2 {
    margin: 0;
    font-size: 1.35rem;
}

.user-create-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    align-items: center;
    margin-top: 8px;
}

.user-create .account-switch { margin-bottom: 8px; }

.user-create .password-tools { margin-bottom: 0; }

.table-scroll { overflow-x: auto; }

.users { width: 100%; min-width: 0; }

.users th, .users td { text-align: center; white-space: nowrap; }

.users th:first-child,
.users td[data-col="type"] {
    width: 1%;
    max-width: 70px;
    padding-left: 6px;
    padding-right: 6px;
}

.users .user-filters th:first-child .filter-field {
    max-width: 70px;
}

.users .user-filters th:first-child input {
    width: 56px;
}

.users .user-filters th {
    font-weight: 400;
    vertical-align: top;
    white-space: normal;
    text-align: center;
}

.users .user-filters .filter-field {
    align-items: center;
    margin: 0 auto;
    max-width: 160px;
}

.users .user-filters input {
    width: 140px;
    margin: 0 auto;
    padding: 6px 8px;
    font-size: 0.82rem;
    text-align: center;
}

.users .user-filters .reset {
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--blue);
    font-size: 0.75rem;
    text-transform: none;
    letter-spacing: 0;
}

.users .user-filters .reset:hover {
    background: transparent;
    color: var(--blue-deep);
}

body:has(.payments) .wrap,
.statement .users-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.statement-invoices .pay-links {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: flex-start;
}

.statement-invoices .pay-links form.inline {
    margin: 0;
}

.statement-invoices .pay-links button {
    white-space: nowrap;
}

body:has(.statement) .wrap,
body:has(.finance-table) .wrap,
body:has(.users) .wrap {
    width: min(1680px, calc(100% - 32px));
}

.finance-table { min-width: 960px; }

.finance-table th, .finance-table td { text-align: left; vertical-align: top; }

.finance-table td.docs { min-width: 160px; }

.pay-status {
    display: inline-block;
    font-weight: 600;
}

.pay-status-paid { color: #1e7a3a; }

.pay-status-awaiting { color: #b8860b; }

.pay-status-overdue { color: #c62828; }

.pay-status-cancelled { color: #8a6d3b; }

.pay-status-neutral { color: #5f6368; }

.statement h2 { margin: 28px 0 12px; font-size: 1.15rem; }

.statement form.inline { margin-top: 8px; }

.statement-groups, .statement-ops { font-size: 0.84rem; }

.statement-groups th, .statement-groups td, .statement-ops th, .statement-ops td { text-align: center; vertical-align: top; }

.statement-ops { min-width: 3200px; }

.statement-ops td.cell-text, .statement-groups td { white-space: normal; }

.statement-ops td.cell-text { min-width: 240px; text-align: left; }

.payments-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 8px;
}

.payments-head h1 { margin: 0 0 8px; }

.payments-head .muted { margin: 0; }

.payments-bulk {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 0 0 auto;
    padding-top: 4px;
}

.payments { min-width: 1520px; }

.payments th, .payments td { text-align: center; vertical-align: middle; }

.payments tr.is-clickable { cursor: pointer; }

.payments tr.is-clickable:hover td { background: #f5fbff; }

.payments tr.is-blocked td { opacity: 0.62; }

.pay-check-col {
    width: 44px;
    min-width: 44px;
    padding-left: 8px !important;
    padding-right: 8px !important;
}

.pay-check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    cursor: pointer;
}

.pay-check input {
    width: 18px;
    height: 18px;
    margin: 0;
    cursor: pointer;
}

.bulk-actions-dialog {
    border: 0;
    border-radius: 20px;
    padding: 0;
    width: min(440px, calc(100% - 32px));
    max-width: calc(100% - 32px);
    box-shadow: 0 18px 48px rgba(33, 33, 33, 0.18);
}

.bulk-actions-dialog::backdrop {
    background: rgba(33, 45, 58, 0.35);
}

.bulk-actions-card {
    margin: 0;
    padding: 28px;
}

.bulk-actions-card h2 {
    margin: 0 0 8px;
    font-size: 1.25rem;
}

.bulk-actions-list {
    border: 0;
    margin: 12px 0 8px;
    padding: 0;
    display: grid;
    gap: 10px;
}

.bulk-actions-list .check {
    margin: 0;
}

.bulk-action-hint {
    margin: -2px 0 0 28px;
}

.bulk-access-until,
.bulk-add-period,
.bulk-delete-confirm {
    margin: 0 0 4px 28px;
}

.bulk-delete-confirm strong {
    font-size: 1.2rem;
    letter-spacing: 0.12em;
    color: var(--danger);
}

.bulk-access-until label,
.bulk-add-period label {
    margin-top: 0;
}

.bulk-access-until input[type="date"] {
    width: auto;
}

.bulk-period-options {
    border: 0;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 8px;
}

.bulk-period-options input[type="number"] {
    width: 140px;
    margin: 0 0 0 28px;
}

.danger-text { color: var(--danger); }

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.pay-history-dialog {
    border: 0;
    border-radius: 20px;
    padding: 0;
    width: min(1100px, calc(100% - 32px));
    max-width: calc(100% - 32px);
    box-shadow: 0 18px 48px rgba(33, 33, 33, 0.18);
}

.pay-history-dialog::backdrop {
    background: rgba(33, 45, 58, 0.35);
}

.pay-history-card {
    padding: 24px;
}

.pay-history-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 12px;
}

.pay-history-head h2 {
    margin: 0 0 4px;
}

.pay-history-status {
    margin-bottom: 16px;
    padding: 12px 14px;
    border-radius: 14px;
    background: #f3fbff;
}

.pay-history-status p {
    margin: 0 0 6px;
}

.pay-history-status p:last-child {
    margin-bottom: 0;
}

.pay-history-table .pay-history-filters th {
    font-weight: 400;
    vertical-align: top;
}

.pay-history-table .pay-history-filters input {
    width: 100%;
    min-width: 88px;
    margin: 0;
    padding: 6px 8px;
    font-size: 0.82rem;
}

.pay-history-table .pay-history-filters .reset {
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--blue);
    font-size: 0.5rem;
    line-height: 1.2;
    text-transform: none;
    letter-spacing: 0;
}

.pay-history-table .pay-history-filters .reset:hover {
    background: transparent;
    color: var(--blue-deep);
}

.payments td.bills, .payments td.docs { text-align: left; white-space: normal; min-width: 210px; }

.payments td.archive-row-actions {
    white-space: nowrap;
    vertical-align: middle;
}

.payments td.archive-row-actions .pay-links {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: stretch;
}

.payments td.archive-row-actions .pay-links .mini {
    width: 100%;
}

.payments .pay-filters th {
    font-weight: 400;
    vertical-align: top;
    text-align: center;
}

.payments .pay-filters .filter-field {
    align-items: center;
    margin: 0 auto;
    max-width: 160px;
}

.payments .pay-filters input {
    width: 132px;
    margin: 0 auto;
    padding: 6px 8px;
    font-size: 0.82rem;
    text-align: center;
}

.filter-field { display: flex; flex-direction: column; align-items: stretch; gap: 4px; }

.pay-filters button.reset {
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--blue);
    font-size: 0.75rem;
    text-transform: none;
    letter-spacing: 0;
}

.pay-filters button.reset:hover { background: transparent; color: var(--blue-deep); }

.until-head {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
}

.until-arrows {
    display: inline-flex;
    flex-direction: column;
    gap: 1px;
    line-height: 1;
}

.until-arrow {
    margin: 0;
    padding: 0 4px;
    min-width: 0;
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 0.78rem;
    line-height: 1;
    cursor: pointer;
}

.until-arrow:hover,
.until-arrow.is-on {
    background: transparent;
    color: var(--blue);
}

.until-filter {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 168px;
    margin: 0 auto;
    text-align: center;
}

.until-filter label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 0;
    width: 100%;
    font-size: 0.75rem;
    text-transform: none;
    letter-spacing: 0;
    color: var(--ink);
    text-align: center;
}

.until-filter input[type="date"] {
    width: 132px;
    margin: 0;
    padding: 4px 6px;
    font-size: 0.78rem;
    text-align: center;
}

.until-filter .reset {
    align-self: center;
}

.pay-history-table .pay-history-filters th { text-align: center; }

.pay-history-table .pay-history-filters .filter-field {
    align-items: center;
    margin: 0 auto;
}

.pay-history-table .pay-history-filters input { text-align: center; }

.access-confirm-dialog {
    border: 0;
    border-radius: 20px;
    padding: 0;
    box-shadow: 0 18px 48px rgba(33, 33, 33, 0.18);
    max-width: calc(100% - 32px);
}

.access-confirm-dialog::backdrop {
    background: rgba(33, 45, 58, 0.35);
}

.access-confirm-card {
    margin: 0;
    padding: 28px;
    width: min(420px, 100%);
}

.access-confirm-card h2 {
    margin: 0 0 12px;
    font-size: 1.25rem;
}

.access-confirm-card p {
    margin: 0 0 18px;
}

.access-confirm-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    align-items: center;
}

.payments input[type="date"], .payments select { width: auto; padding: 8px 10px; }

.payments select { min-width: 180px; }

.payments button { margin-top: 0; }

.access-until-edit {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.basis-status {
    display: inline-block;
    font-weight: 500;
}

.basis-trial { color: var(--blue-deep); }
.basis-paid { color: var(--ok); }
.basis-manager { color: #6b5b95; }
.basis-blocked { color: #6b7280; }
.basis-archive { color: #64748b; }
.basis-awaiting { color: var(--orange); }
.basis-overdue { color: var(--danger); }

.access-confirm-reason {
    margin: 0 0 18px;
}

.access-confirm-reason label {
    display: block;
    margin-bottom: 6px;
}

.access-confirm-reason select {
    width: 100%;
    margin: 0;
}

.access-confirm-reason .muted {
    margin: 0;
}

.pay-links { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }

.pay-links a { color: var(--blue); }

.icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    margin: 0;
    padding: 0;
    border-radius: 50%;
    border: 2px solid var(--blue-bright);
    background: #fff;
    color: var(--blue);
}

.icon-button:hover { background: #f4fcff; }

.icon-button.danger { color: var(--danger); border-color: #f3b4b4; }

.icon-button.danger:hover { background: #fff5f5; color: var(--danger); }

.password-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.password-tools input { flex: 1 1 180px; }

.password-tools button { margin-top: 0; flex: 0 0 auto; }

.eye .eye-shut { display: none; }

.eye.is-open .eye-open { display: none; }

.eye.is-open .eye-shut { display: block; }

.brand-preview { max-height: 120px; background: #fff; }

button.mini {
    font-size: 0.72rem;
    line-height: 1.1;
    padding: 4px 10px;
}

.check { display: flex; gap: 8px; align-items: center; }

.check input { width: auto; }

.apps { display: grid; gap: 12px; }

.app {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
}

.cabinet-subscriptions {
    margin: 16px 0 0;
}

.cabinet-subscriptions-title {
    margin: 0 0 10px;
    font-size: 1.05rem;
    font-weight: 600;
}

.cabinet-subscriptions-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 8px;
}

.cabinet-subscriptions-list li {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 10px 14px;
    align-items: baseline;
    padding: 10px 12px;
    background: #f4fafc;
    border-radius: 12px;
}

.cabinet-sub-kind {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--blue);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.cabinet-sub-title {
    font-weight: 500;
}

.cabinet-sub-until {
    color: #1e7a3a;
    font-weight: 600;
    white-space: nowrap;
}

.cabinet-sub-until.is-scheduled {
    color: #b8860b;
}

.check.is-disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

@media (max-width: 640px) {
    .cabinet-subscriptions-list li {
        grid-template-columns: 1fr;
        gap: 4px;
    }
}

.app-card-until {
    margin: 0;
    text-align: center;
    font-size: 0.92rem;
    color: var(--muted);
}

.app-card-until.is-paid {
    color: #1e7a3a;
    font-weight: 600;
}

.apps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}

.app-card {
    background: var(--card);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(33, 33, 33, 0.06);
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-height: 100%;
}

.app-card-title {
    margin: 0;
    font-size: 1.15rem;
    text-align: center;
}

.app-card-media {
    width: 100%;
    aspect-ratio: 16 / 10;
    border-radius: 16px;
    overflow: hidden;
    background: #eef7fb;
}

.app-card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.app-card-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: "Open Sans", "Segoe UI", sans-serif;
    font-size: 2.4rem;
    font-weight: 600;
    color: var(--blue);
    background: linear-gradient(160deg, #e8f7fc, #f7f7fc);
}

.app-card-desc {
    margin: 0;
    color: var(--muted);
    text-align: center;
    flex: 1 1 auto;
}

.app-card-action {
    text-align: center;
}

.app-card-action .button {
    margin-top: 0;
}

.app-card-status {
    margin: 0;
    text-align: center;
    font-size: 0.78rem;
    line-height: 1.3;
    font-weight: 500;
}

.app-card-status.is-open {
    color: #7dcea0;
}

.app-card-status.is-closed {
    color: #e7a0a0;
}

.app-thumb {
    width: 36px;
    height: 36px;
    object-fit: cover;
    border-radius: 8px;
    vertical-align: middle;
    margin-right: 8px;
}

.app-row-actions {
    display: flex;
    flex-direction: row;
    gap: 8px;
    align-items: center;
    justify-content: center;
}

.app-edit-preview {
    width: min(100%, 280px);
    aspect-ratio: 16 / 10;
    border-radius: 16px;
    overflow: hidden;
    background: #eef7fb;
    margin-bottom: 8px;
}

.app-edit-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.badge {
    display: inline-block;
    border-radius: 25px;
    padding: 3px 10px;
    background: rgba(0, 152, 215, 0.12);
    color: var(--blue);
    font-size: 0.82rem;
}

table { width: 100%; border-collapse: collapse; }

th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid #eef3f7; vertical-align: top; }

th {
    color: var(--muted);
    font-size: 0.75rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-weight: 500;
}

.inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.inline input, .inline select { width: auto; }

.narrow { max-width: 480px; margin-left: auto; margin-right: auto; }

.login-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 18px;
}

.login-actions button { margin-top: 0; }

.forgot-link {
    color: var(--blue);
    white-space: nowrap;
    margin-left: auto;
}

.forgot-link:hover { color: var(--blue-deep); }

.account-switch {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1fr;
    margin: 8px 0 16px;
    padding: 4px;
    border-radius: 25px;
    background: #e7f5fb;
}

.account-switch input { position: absolute; opacity: 0; pointer-events: none; }

.account-knob {
    position: absolute;
    top: 4px;
    bottom: 4px;
    left: 4px;
    width: calc(50% - 4px);
    border-radius: 22px;
    background: var(--blue);
    transition: transform .18s ease;
}

#type-company:checked ~ .account-knob { transform: translateX(100%); }

.account-switch label {
    position: relative;
    z-index: 1;
    margin: 0;
    padding: 10px 8px;
    text-align: center;
    color: var(--muted);
    cursor: pointer;
}

#type-person:checked ~ label[for="type-person"],
#type-company:checked ~ label[for="type-company"] { color: #fff; }

[data-account-form]:not(.is-company) .company-only { display: none; }

[data-register] label:has(+ input[required])::after,
[data-register] label:has(+ .password-tools input[required])::after {
    content: " *";
    color: var(--danger);
}

.req-note { margin-top: 14px; }

code, pre { font-family: Consolas, monospace; font-size: 0.92em; }

pre {
    white-space: pre-wrap;
    background: #fff;
    border-radius: 12px;
    padding: 12px;
}

.modal-back {
    position: fixed;
    inset: 0;
    background: rgba(33, 33, 33, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.modal-back[hidden] {
    display: none;
}

.modal { max-width: 520px; margin: 0; }

@media (max-width: 860px) {
    body.has-sidebar {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        flex: none;
        min-height: 0;
        position: static;
        border-right: 0;
        border-bottom: 1px solid #eef3f7;
    }

    .side-nav {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .sidebar-foot {
        margin-top: 0;
    }
}

.plan-form h2 { margin: 8px 0 12px; font-size: 1.15rem; }

.plan-prices,
.plan-conditions {
    border: 1px solid #e5edf3;
    border-radius: 12px;
    padding: 12px 16px 16px;
    margin: 16px 0;
    display: grid;
    gap: 8px;
}

.plan-prices[hidden],
.plan-conditions[hidden],
#app-prices-year[hidden],
#plan-prices-year[hidden],
#app-prices-split[hidden],
#plan-prices-split[hidden] {
    display: none !important;
}

.plan-prices legend,
.plan-conditions legend {
    padding: 0 6px;
    color: #4b5560;
}

.trial-settings {
    margin: 8px 0 18px;
    padding: 16px 18px;
    border: 1px solid #e5edf3;
    border-radius: 14px;
    background: #f8fbfe;
}

.trial-settings h2 {
    margin: 0 0 4px;
    font-size: 1.05rem;
}

.trial-settings .muted {
    margin: 0;
}

.trial-settings-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 16px;
    align-items: end;
}

.trial-settings-row > div {
    flex: 1 1 220px;
}

.trial-months-label {
    margin: 0;
}

.trial-settings input[type="number"] {
    width: 100px;
    margin: 0;
}

.trial-settings button {
    margin: 0;
}

.tariff-admin-tabs {
    display: flex;
    gap: 8px;
    margin: 12px 0 18px;
}

.tariff-admin-tab {
    display: inline-flex;
    align-items: center;
    padding: 10px 16px;
    border: 1px solid #d7e2ea;
    border-radius: 999px;
    color: #334155;
    text-decoration: none;
    background: #fff;
}

.tariff-admin-tab.is-on {
    background: var(--blue);
    border-color: var(--blue);
    color: #fff;
}

.plan-radio-row {
    display: flex;
    flex-wrap: wrap;
    gap: 14px 20px;
    margin: 4px 0 12px;
}

.app-prices-table input[type="text"],
.app-prices-table input[inputmode="decimal"],
.app-prices-table input:not([type="checkbox"]) {
    width: 110px;
    margin: 0;
}

.app-prices-table input:disabled {
    opacity: 0.45;
    background: #f3f6f9;
}

.app-prices-table .app-status-select {
    width: auto;
    min-width: 120px;
    margin: 0;
}

.app-prices-table .check {
    margin: 0;
    white-space: nowrap;
}

.subscribe-fixed-terms {
    display: grid;
    gap: 10px;
    margin: 12px 0 18px;
    padding: 14px 16px;
    border: 1px solid #e8eaed;
    border-radius: 14px;
    background: #f8f9fa;
}

.subscribe-fixed-terms > div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: baseline;
}

.subscribe-fixed-terms .muted {
    margin: 0;
}

.tariff-tabs {
    display: flex;
    gap: 18px;
    margin: 12px 0 18px;
}

.tariff-apps {
    display: grid;
    gap: 8px;
    margin: 8px 0 16px;
}

.tariffs-page {
    background: #f8f9fa;
    box-shadow: none;
}

.play-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
}

.play-card {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 16px;
    border-radius: 16px;
    background: #fff;
    border: 1px solid #e8eaed;
    box-shadow: 0 1px 2px rgba(60, 64, 67, 0.08), 0 1px 3px 1px rgba(60, 64, 67, 0.06);
    transition: box-shadow 0.18s ease, transform 0.18s ease;
}

.play-card:hover {
    box-shadow: 0 1px 3px rgba(60, 64, 67, 0.12), 0 4px 8px 3px rgba(60, 64, 67, 0.08);
    transform: translateY(-1px);
}

.play-card-top {
    display: grid;
    grid-template-columns: 72px 1fr;
    gap: 14px;
    align-items: start;
}

.play-icon {
    width: 72px;
    height: 72px;
    border-radius: 18px;
    overflow: hidden;
    background: #e8f0fe;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
}

.play-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.play-icon span {
    font-family: "Ubuntu", "Open Sans", sans-serif;
    font-size: 1.7rem;
    font-weight: 500;
    color: #1a73e8;
    line-height: 1;
}

.play-icon-sm {
    width: 52px;
    height: 52px;
    border-radius: 14px;
}

.play-icon-sm span {
    font-size: 1.25rem;
}

.play-icon-plan.tone-1 { background: linear-gradient(145deg, #e8f0fe, #d2e3fc); }
.play-icon-plan.tone-2 { background: linear-gradient(145deg, #e6f4ea, #ceead6); }
.play-icon-plan.tone-2 span { color: #137333; }
.play-icon-plan.tone-3 { background: linear-gradient(145deg, #fef7e0, #feefc3); }
.play-icon-plan.tone-3 span { color: #b06000; }
.play-icon-plan.tone-4 { background: linear-gradient(145deg, #fce8e6, #fad2cf); }
.play-icon-plan.tone-4 span { color: #c5221f; }

.play-card-meta {
    min-width: 0;
    display: grid;
    gap: 4px;
}

.play-card-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 500;
    color: #202124;
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.play-card-sub {
    margin: 0;
    color: #5f6368;
    font-size: 0.86rem;
    line-height: 1.3;
}

.play-card-price {
    margin: 2px 0 0;
    color: #202124;
    font-size: 0.92rem;
    font-weight: 500;
}

.play-card-actions {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 10px;
    margin-top: auto;
}

.play-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    min-height: 40px;
    padding: 8px 18px;
    border-radius: 25px;
    text-decoration: none;
    font-family: "Open Sans", "Segoe UI", sans-serif;
    font-size: 0.92rem;
    font-weight: 500;
    line-height: 1.2;
    cursor: pointer;
    white-space: nowrap;
    box-sizing: border-box;
}

.play-btn-solid {
    background: var(--orange);
    color: var(--accent-ink);
    border: 1px solid var(--orange);
}

.play-btn-solid:hover {
    background: #e86e00;
    border-color: #e86e00;
    color: #fff;
}

.play-btn-ghost {
    background: #fff;
    color: #222;
    border: 2px solid var(--blue-bright);
}

.play-btn-ghost:hover {
    background: #f4fcff;
    color: var(--blue);
}

.play-paid {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    color: #5f6368;
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1.3;
}

.play-dialog-head {
    display: grid;
    grid-template-columns: 52px 1fr;
    gap: 12px;
    align-items: center;
}

.play-dialog-head h2 {
    margin: 0;
    font-size: 1.15rem;
}

.play-dialog-head .muted {
    margin: 4px 0 0;
}

.tariff-price-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0;
}

.tariff-price-list li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
    border-top: 1px solid #e8eaed;
    color: #202124;
}

.tariff-dialog {
    border: 0;
    border-radius: 20px;
    padding: 0;
    max-width: min(440px, calc(100vw - 32px));
    box-shadow: 0 8px 28px rgba(60, 64, 67, 0.28);
}

.tariff-dialog::backdrop {
    background: rgba(32, 33, 36, 0.48);
}

.tariff-dialog-card {
    margin: 0;
    padding: 22px 24px;
    display: grid;
    gap: 14px;
    background: #fff;
}

.tariff-dialog-card h2 {
    margin: 0;
    font-size: 1.2rem;
}

@media (max-width: 720px) {
    .play-grid {
        grid-template-columns: 1fr;
    }

    .play-card-top {
        grid-template-columns: 64px 1fr;
    }

    .play-icon {
        width: 64px;
        height: 64px;
        border-radius: 16px;
    }
}

@media (max-width: 720px) {
    nav { width: 100%; }
    h1 { font-size: 1.6rem; }
    .app { align-items: flex-start; flex-direction: column; }
}

.kpp-select-dialog {
    border: 0;
    border-radius: 20px;
    padding: 0;
    width: min(480px, calc(100% - 32px));
    max-width: calc(100% - 32px);
    box-shadow: 0 18px 48px rgba(33, 33, 33, 0.18);
}

.kpp-select-dialog::backdrop {
    background: rgba(33, 45, 58, 0.35);
}

.kpp-select-card {
    margin: 0;
    padding: 28px;
    box-shadow: none;
}

.kpp-select-card h2 {
    margin: 0 0 8px;
    font-size: 1.25rem;
}

.kpp-select-list {
    display: grid;
    gap: 10px;
    margin: 16px 0 8px;
    max-height: min(360px, 50vh);
    overflow: auto;
}

.kpp-select-option {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 12px;
    align-items: start;
    margin: 0;
    padding: 12px 14px;
    border: 1px solid var(--line, #d7dde5);
    border-radius: 14px;
    cursor: pointer;
}

.kpp-select-option:has(input:checked) {
    border-color: var(--accent, #2f6fed);
    background: rgba(47, 111, 237, 0.06);
}

.kpp-select-option input {
    margin-top: 4px;
}

.kpp-select-option span {
    display: grid;
    gap: 4px;
}

.kpp-select-option strong {
    font-size: 1rem;
}

.kpp-select-option small {
    color: var(--muted, #667587);
}
