/* ==========================================================================
   Yuoopi Cabinet — Light Theme (self-contained, no dependencies)
   ========================================================================== */

/* --- Reset / Base --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --color-bg: #f8f9fa;
    --color-surface: #ffffff;
    --color-border: #e2e8f0;
    --color-border-light: #f1f5f9;
    --color-text: #1e293b;
    --color-text-secondary: #64748b;
    --color-text-muted: #94a3b8;
    --color-primary: #3b82f6;
    --color-primary-hover: #2563eb;
    --color-primary-light: #eff6ff;
    --color-success: #22c55e;
    --color-success-light: #f0fdf4;
    --color-warning: #f59e0b;
    --color-warning-light: #fffbeb;
    --color-danger: #ef4444;
    --color-danger-light: #fef2f2;
    --color-info: #06b6d4;
    --color-info-light: #ecfeff;

    --sidebar-width: 240px;
    --topbar-height: 56px;
    --radius: 8px;
    --radius-sm: 4px;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --transition: 0.2s ease;
}

html {
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--color-text);
    background: var(--color-bg);
    line-height: 1.5;
}

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

/* --- Layout: Topbar + Sidebar + Content --- */
.cabinet {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.cabinet__body {
    display: flex;
    flex: 1;
}

/* --- Topbar --- */
.cabinet-topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--topbar-height);
    padding: 0 24px;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    box-shadow: var(--shadow);
}

.cabinet-topbar__logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-text);
    text-decoration: none;
}
.cabinet-topbar__logo:hover {
    text-decoration: none;
    color: var(--color-text);
}

.cabinet-topbar__logo-icon {
    width: 32px;
    height: 32px;
    background: var(--color-primary);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 1rem;
}

.cabinet-topbar__right {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* User menu */
.user-menu {
    position: relative;
}

.user-menu__toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface);
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--color-text);
    transition: border-color var(--transition);
}
.user-menu__toggle:hover {
    border-color: var(--color-primary);
}

.user-menu__toggle-icon {
    width: 28px;
    height: 28px;
    background: var(--color-primary-light);
    color: var(--color-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
}

.user-menu__dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    min-width: 180px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    z-index: 200;
    overflow: hidden;
}
.user-menu.is-open .user-menu__dropdown {
    display: block;
}

.user-menu__item {
    display: block;
    width: 100%;
    padding: 10px 16px;
    font-size: 0.875rem;
    color: var(--color-text);
    text-decoration: none;
    border: none;
    background: none;
    cursor: pointer;
    text-align: left;
    transition: background var(--transition);
}
.user-menu__item:hover {
    background: var(--color-bg);
    text-decoration: none;
    color: var(--color-text);
}
.user-menu__item--danger {
    color: var(--color-danger);
}
.user-menu__item--danger:hover {
    background: var(--color-danger-light);
    color: var(--color-danger);
}

.user-menu__divider {
    height: 1px;
    background: var(--color-border-light);
    margin: 4px 0;
}

/* --- Sidebar --- */
.cabinet-sidebar {
    width: var(--sidebar-width);
    min-height: calc(100vh - var(--topbar-height));
    background: var(--color-surface);
    border-right: 1px solid var(--color-border);
    padding: 16px 0;
    flex-shrink: 0;
}

.cabinet-sidebar__nav {
    list-style: none;
    padding: 0;
    margin: 0;
}

.cabinet-sidebar__item {
    margin: 2px 8px;
}

.cabinet-sidebar__link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-radius: var(--radius);
    color: var(--color-text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: all var(--transition);
}
.cabinet-sidebar__link:hover {
    background: var(--color-bg);
    color: var(--color-text);
    text-decoration: none;
}

.cabinet-sidebar__link.is-active {
    background: var(--color-primary-light);
    color: var(--color-primary);
    font-weight: 600;
}

.cabinet-sidebar__icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

/* --- Main Content --- */
.cabinet__content {
    flex: 1;
    padding: 24px;
    min-width: 0;
}

.cabinet__content-header {
    margin-bottom: 24px;
}

.cabinet__content-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-text);
    margin: 0;
}

.cabinet__content-subtitle {
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    margin-top: 4px;
}

/* --- Cards / Panels --- */
.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 20px;
}

.card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--color-border-light);
}

.card__title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text);
    margin: 0;
}

/* --- Tables --- */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

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

.table th {
    font-weight: 600;
    color: var(--color-text-secondary);
    background: var(--color-bg);
    white-space: nowrap;
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.table tbody tr:hover {
    background: var(--color-primary-light);
}

.table td.text-center,
.table th.text-center {
    text-align: center;
}

.table td.text-right,
.table th.text-right {
    text-align: right;
}

/* --- Badges (subscription statuses) --- */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.4;
    text-transform: capitalize;
    white-space: nowrap;
}

.badge--none {
    background: var(--color-bg);
    color: var(--color-text-muted);
    border: 1px solid var(--color-border);
}

.badge--trial {
    background: var(--color-info-light);
    color: #0e7490;
}

.badge--active {
    background: var(--color-success-light);
    color: #15803d;
}

/* Блок L: ручная подписка (активна, подключена админом) — фиолетовый, отличим от active */
.badge--active_manual {
    background: #ede9fe;
    color: #6d28d9;
}

.badge--cancelled {
    background: var(--color-warning-light);
    color: #b45309;
}

.badge--expired {
    background: var(--color-danger-light);
    color: #dc2626;
}

.badge--received {
    background: #dbeafe;
    color: #1d4ed8;
}

.badge--processed {
    background: #dcfce7;
    color: #15803d;
}

.badge--failed {
    background: var(--color-danger-light);
    color: #dc2626;
}

/* --- Forms --- */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--color-text-secondary);
}

.form-control {
    display: block;
    width: 100%;
    padding: 8px 12px;
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--color-text);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.form-control--password-wrap {
    position: relative;
}
.form-control--password-wrap .form-control {
    padding-right: 40px;
}
.form-control--password-toggle {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-text-muted);
    font-size: 1rem;
    padding: 4px;
}
.form-control--password-toggle:hover {
    color: var(--color-text-secondary);
}

select.form-control {
    appearance: auto;
	height: 36px;
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

.form-hint {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    margin-top: 4px;
}

.form-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}
.form-row > .form-group {
    flex: 1;
    min-width: 200px;
}

/* Input + button row (inside .form-group, e.g. webhook button) */
.form-group > .form-row {
    display: flex;
    gap: 8px;
    align-items: stretch;
}
.form-group > .form-row > .form-control {
    flex: 1;
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 18px;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.5;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
}
.btn:hover {
    text-decoration: none;
}
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn--primary {
    background: var(--color-primary);
    color: #fff;
}
.btn--primary:hover {
    background: var(--color-primary-hover);
    color: #fff;
}

.btn--secondary {
    background: var(--color-surface);
    color: var(--color-text);
    border-color: var(--color-border);
}
.btn--secondary:hover {
    background: var(--color-bg);
}

.btn--danger {
    background: var(--color-danger);
    color: #fff;
}
.btn--danger:hover {
    background: #dc2626;
    color: #fff;
}

.btn--sm {
    padding: 4px 10px;
    font-size: 0.8125rem;
}

.btn--outline {
    background: transparent;
    border-color: var(--color-border);
    color: var(--color-text-secondary);
    white-space: nowrap;
    flex-shrink: 0;
}
.btn--outline:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
    background: var(--color-primary-light);
}

.btn--icon {
    padding: 6px;
    line-height: 1;
}

/* --- Filter bar --- */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
    margin-bottom: 20px;
    padding: 16px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
}

.filter-bar .form-group {
    margin-bottom: 0;
}
.filter-bar .form-group .btn {
    height: 36px;
}

/* --- Pagination (pdoPage) --- */
.pagination {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 16px 0 0;
    gap: 4px;
    justify-content: center;
}

.pagination .page-item .page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    color: var(--color-text-secondary);
    font-size: 0.875rem;
    text-decoration: none;
    background: var(--color-surface);
    transition: all var(--transition);
}
.pagination .page-item .page-link:hover {
    background: var(--color-bg);
    color: var(--color-text);
    text-decoration: none;
    border-color: var(--color-primary);
}

.pagination .page-item.active .page-link {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}

/* --- Toasts / Notifications --- */
.toast-container {
    position: fixed;
    top: calc(var(--topbar-height) + 12px);
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: var(--shadow-md);
    pointer-events: auto;
    animation: toast-in 0.3s ease forwards;
    max-width: 400px;
}

.toast--success {
    background: var(--color-success-light);
    color: #15803d;
    border: 1px solid #bbf7d0;
}

.toast--error {
    background: var(--color-danger-light);
    color: #dc2626;
    border: 1px solid #fecaca;
}

.toast--info {
    background: var(--color-info-light);
    color: #0e7490;
    border: 1px solid #a5f3fc;
}

.toast--warning {
    background: var(--color-warning-light);
    color: #b45309;
    border: 1px solid #fde68a;
}

.toast.is-hiding {
    animation: toast-out 0.3s ease forwards;
}

@keyframes toast-in {
    from { opacity: 0; transform: translateX(40px); }
    to   { opacity: 1; transform: translateX(0); }
}
@keyframes toast-out {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(40px); }
}

/* --- Login page (centered) --- */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--color-bg);
    padding: 24px;
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 32px;
}

.login-card__header {
    text-align: center;
    margin-bottom: 24px;
}

.login-card__logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 8px;
}

.login-card__subtitle {
    font-size: 0.875rem;
    color: var(--color-text-secondary);
}

.login-card .form-group {
    margin-bottom: 20px;
}

.login-card .btn {
    width: 100%;
}

.login-error {
    padding: 10px 14px;
    margin-bottom: 16px;
    background: var(--color-danger-light);
    color: var(--color-danger);
    border: 1px solid #fecaca;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
}

/* --- Settings form --- */
.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-text);
    margin: 0 0 24px;
}

.settings-form, .profile-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.settings-section {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px 24px;
}

.settings-section__title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-text);
    margin: 0 0 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--color-border-light);
    cursor: pointer;
    user-select: none;
    transition: color var(--transition);
}
.settings-section__title:hover {
    color: var(--color-primary);
}

.settings-section__chevron {
    font-size: 0.875rem;
    color: var(--color-text-muted);
    transition: transform 0.25s ease;
    flex-shrink: 0;
}
.settings-section__title:hover .settings-section__chevron {
    color: var(--color-primary);
}

/* Collapsed state */
.settings-section.is-collapsed .settings-section__fields {
    display: none;
}
.settings-section.is-collapsed .settings-section__title {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}
.settings-section.is-collapsed .settings-section__chevron {
    transform: rotate(-90deg);
}

.settings-section__fields {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.settings-section__fields .form-group:last-child {
    margin-bottom: 0;
}

.form-control--textarea {
    min-height: 100px;
    resize: vertical;
}

.form-actions {
    margin-top: 8px;
    display: flex;
    justify-content: flex-end;
}

/* --- Empty / No results --- */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--color-text-muted);
}

.empty-state__icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
    opacity: 0.5;
}

.empty-state__text {
    font-size: 0.9375rem;
}

/* --- Footer --- */
.cabinet-footer {
    padding: 16px 24px;
    text-align: center;
    font-size: 0.75rem;
    color: var(--color-text-muted);
    border-top: 1px solid var(--color-border-light);
    background: var(--color-surface);
}

/* --- Utilities --- */
.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mt-0 { margin-top: 0; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.text-right { text-align: right; }
.text-center { text-align: center; }

/* --- FontAwesome icon alignment --- */
.cat-editor__btn i,
.sub-editor__btn i,
.modal__close i,
.form-control--password-toggle i {
    pointer-events: none; /* click goes to parent button */
}

.cabinet-sidebar__icon i {
    font-size: 1rem;
    width: 20px;
    text-align: center;
}

.user-menu__toggle-icon i {
    font-size: 0.75rem;
}

.empty-state__icon i {
    font-size: 2.5rem;
    opacity: 0.5;
    color: var(--color-text-muted);
}

/* --- Subscriptions Editor (C-23) --- */
.sub-editor {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sub-editor__header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.sub-editor__th {
    display: inline-block;
}

.sub-editor__th--handle { width: 18px; flex-shrink: 0; }
.sub-editor__th--key { min-width: 120px; flex: 0 0 120px; }
.sub-editor__th--label { flex: 1; min-width: 120px; }
.sub-editor__th--link { flex: 1.5; min-width: 160px; }
.sub-editor__th--price { width: 100px; flex: 0 0 100px; text-align: right; }
.sub-editor__th--default { width: 60px; flex: 0 0 60px; text-align: center; }
.sub-editor__th--btns { width: 70px; flex: 0 0 70px; }

.sub-editor__list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sub-editor__empty {
    padding: 24px;
    text-align: center;
    color: var(--color-text-muted);
    font-size: 0.875rem;
    background: var(--color-bg);
    border: 1px dashed var(--color-border);
    border-radius: var(--radius-sm);
}

.sub-editor__row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    transition: background var(--transition), border-color var(--transition);
}

.sub-editor__row:hover {
    border-color: var(--color-primary);
}

.sub-editor__row.is-editing {
    background: var(--color-primary-light);
    border-color: var(--color-primary);
}

.sub-editor__row.has-error {
    border-color: var(--color-danger);
    background: var(--color-danger-light);
}

.sub-editor__handle {
    cursor: default;
    color: var(--color-text-muted);
    font-size: 1rem;
    flex-shrink: 0;
    user-select: none;
    width: 18px;
    text-align: center;
}

.sub-editor__key {
    display: inline-block;
    min-width: 120px;
    flex: 0 0 120px;
    font-family: 'SF Mono', SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 0.8125rem;
    color: var(--color-text-secondary);
    background: var(--color-surface);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sub-editor__key--dup {
    color: var(--color-danger);
    background: var(--color-danger-light);
    border-color: var(--color-danger);
}

.sub-editor__label {
    flex: 1;
    min-width: 120px;
    font-size: 0.875rem;
    color: var(--color-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sub-editor__link-wrap {
    flex: 1.5;
    min-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sub-editor__link {
    font-size: 0.8125rem;
    color: var(--color-primary);
    text-decoration: none;
}

.sub-editor__link:hover {
    text-decoration: underline;
}

.sub-editor__no-value {
    color: var(--color-text-muted);
    font-size: 0.8125rem;
}

.sub-editor__price {
    width: 100px;
    flex: 0 0 100px;
    text-align: right;
    font-family: 'SF Mono', SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 0.8125rem;
    color: var(--color-text-secondary);
}

.sub-editor__default {
    width: 60px;
    flex: 0 0 60px;
    text-align: center;
}

.sub-editor__radio {
    cursor: pointer;
    width: 16px;
    height: 16px;
    accent-color: var(--color-primary);
}

.sub-editor__star {
    font-size: 1rem;
    color: var(--color-text-muted);
}

.sub-editor__star--active {
    color: var(--color-warning);
}

.sub-editor__input {
    padding: 4px 8px;
    font-size: 0.875rem;
    min-width: 0;
}

.sub-editor__input-key {
    flex: 0 0 120px;
    max-width: 120px;
    font-family: 'SF Mono', SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 0.8125rem;
}

.sub-editor__input-label {
    flex: 1;
    min-width: 120px;
}

.sub-editor__input-link {
    flex: 1.5;
    min-width: 160px;
    font-size: 0.8125rem;
}

.sub-editor__input-price {
    flex: 0 0 100px;
    max-width: 100px;
    text-align: right;
    font-family: 'SF Mono', SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 0.8125rem;
}

.sub-editor__btns {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
    width: 70px;
    flex: 0 0 70px;
}

.sub-editor__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: none;
    color: var(--color-text-secondary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all var(--transition);
    padding: 0;
    line-height: 1;
}

.sub-editor__btn:hover:not(:disabled) {
    background: var(--color-surface);
    border-color: var(--color-border);
    color: var(--color-text);
}

.sub-editor__btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.sub-editor__btn--save {
    color: var(--color-success);
}
.sub-editor__btn--save:hover:not(:disabled) {
    background: var(--color-success-light);
    border-color: var(--color-success);
    color: #15803d;
}

.sub-editor__btn--delete {
    color: var(--color-text-muted);
}
.sub-editor__btn--delete:hover:not(:disabled) {
    background: var(--color-danger-light);
    border-color: var(--color-danger);
    color: var(--color-danger);
}

.sub-editor__actions {
    padding-top: 4px;
}

.sub-editor__actions .form-hint {
    margin-bottom: 8px;
}

/* --- Categories Editor --- */
.cat-editor {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cat-editor__list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cat-editor__empty {
    padding: 16px;
    text-align: center;
    color: var(--color-text-muted);
    font-size: 0.875rem;
    background: var(--color-bg);
    border: 1px dashed var(--color-border);
    border-radius: var(--radius-sm);
}

.cat-editor__row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    transition: background var(--transition), border-color var(--transition);
}

.cat-editor__row:hover {
    border-color: var(--color-primary);
}

.cat-editor__row.is-editing {
    background: var(--color-primary-light);
    border-color: var(--color-primary);
}

.cat-editor__row.has-error {
    border-color: var(--color-danger);
    background: var(--color-danger-light);
}

.cat-editor__handle {
    cursor: default;
    color: var(--color-text-muted);
    font-size: 1rem;
    flex-shrink: 0;
    user-select: none;
    width: 18px;
    text-align: center;
}

.cat-editor__key {
    display: inline-block;
    min-width: 100px;
    font-family: 'SF Mono', SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 0.8125rem;
    color: var(--color-text-secondary);
    background: var(--color-surface);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
}

.cat-editor__key--dup {
    color: var(--color-danger);
    background: var(--color-danger-light);
    border-color: var(--color-danger);
}

.cat-editor__label {
    flex: 1;
    font-size: 0.875rem;
    color: var(--color-text);
}

.cat-editor__input {
    flex: 1;
    padding: 4px 8px;
    font-size: 0.875rem;
    min-width: 0;
}

.cat-editor__input-key {
    max-width: 180px;
    flex: 0 0 180px;
    font-family: 'SF Mono', SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 0.8125rem;
}

.cat-editor__input-label {
    flex: 1;
}

.cat-editor__btns {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}

.cat-editor__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: none;
    color: var(--color-text-secondary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all var(--transition);
    padding: 0;
    line-height: 1;
}

.cat-editor__btn:hover:not(:disabled) {
    background: var(--color-surface);
    border-color: var(--color-border);
    color: var(--color-text);
}

.cat-editor__btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.cat-editor__btn--save {
    color: var(--color-success);
}
.cat-editor__btn--save:hover:not(:disabled) {
    background: var(--color-success-light);
    border-color: var(--color-success);
    color: #15803d;
}

.cat-editor__btn--delete {
    color: var(--color-text-muted);
}
.cat-editor__btn--delete:hover:not(:disabled) {
    background: var(--color-danger-light);
    border-color: var(--color-danger);
    color: var(--color-danger);
}

.cat-editor__actions {
    padding-top: 4px;
}

/* --- Modal --- */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(2px);
    align-items: center;
    justify-content: center;
}
.modal-overlay.is-visible {
    display: flex;
}

body.modal-open {
    overflow: hidden;
}

.modal {
    background: var(--color-surface);
    border-radius: var(--radius);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
    width: 100%;
    max-width: 440px;
    margin: 24px;
    animation: modal-in 0.2s ease;
}

@keyframes modal-in {
    from { opacity: 0; transform: translateY(12px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-border-light);
}

.modal__title {
    font-size: 1.0625rem;
    font-weight: 700;
    color: var(--color-text);
    margin: 0;
}

.modal__close {
    background: none;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}
.modal__close:hover {
    color: var(--color-text);
    background: var(--color-bg);
}

.modal__body {
    padding: 20px;
}

.modal__body .form-group:last-child {
    margin-bottom: 0;
}

.modal__footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 20px;
    border-top: 1px solid var(--color-border-light);
}

/* --- Flatpickr theme overrides (light) --- */
.flatpickr-calendar {
    border: 1px solid var(--color-border) !important;
    border-radius: var(--radius) !important;
    box-shadow: var(--shadow-md) !important;
    font-family: inherit !important;
}

.flatpickr-day:hover,
.flatpickr-day:focus {
    background: var(--color-primary-light) !important;
    border-color: var(--color-primary-light) !important;
}

.flatpickr-day.selected,
.flatpickr-day.selected:hover {
    background: var(--color-primary) !important;
    border-color: var(--color-primary) !important;
}

.flatpickr-months .flatpickr-month {
    background: transparent !important;
}

.flatpickr-current-month .flatpickr-monthDropdown-months {
    background: transparent !important;
}

.flatpickr-time {
    border-top: 1px solid var(--color-border-light) !important;
}

.numInputWrapper:hover {
    background: var(--color-primary-light) !important;
}

.flatpickr-day.today {
    border-color: var(--color-primary) !important;
}

.flatpickr-day.today:hover {
    background: var(--color-primary) !important;
    border-color: var(--color-primary) !important;
    color: #fff !important;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .cabinet__body {
        flex-direction: column;
    }
    .cabinet-sidebar {
        width: 100%;
        min-height: auto;
        border-right: none;
        border-bottom: 1px solid var(--color-border);
        padding: 8px 0;
    }
    .cabinet-sidebar__nav {
        display: flex;
        overflow-x: auto;
        padding: 0 8px;
    }
    .cabinet-sidebar__item {
        margin: 0 2px;
    }
    .cabinet-sidebar__link {
        white-space: nowrap;
        padding: 8px 14px;
        font-size: 0.8125rem;
    }
    .cabinet__content {
        padding: 16px;
    }
    .filter-bar {
        flex-direction: column;
    }
    .filter-bar .form-group {
        width: 100%;
    }
}
