/**
 * Подписки на автоматические уведомления
 * Premium Corporate Theme — Taurus
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    --blue-900:  #062B5E;
    --blue-800:  #0B3D82;
    --blue-700:  #0E4FA6;
    --blue-600:  #1265C9;
    --blue-500:  #1A7AEF;
    --blue-400:  #4A9AF5;
    --blue-300:  #7CB8F8;
    --blue-200:  #B3D7FB;
    --blue-100:  #DCEEFB;
    --blue-50:   #F0F7FF;

    --gradient-primary: linear-gradient(135deg, #1265C9 0%, #0E4FA6 50%, #062B5E 100%);
    --gradient-shine:   linear-gradient(135deg, #1A7AEF 0%, #1265C9 100%);
    --gradient-bg:      linear-gradient(160deg, #F4F8FF 0%, #E8F0FE 50%, #F0F4FA 100%);
    --gradient-card:    linear-gradient(180deg, #FFFFFF 0%, #FAFCFF 100%);

    --white:       #FFFFFF;
    --gray-50:     #F8FAFC;
    --gray-100:    #F1F5F9;
    --gray-200:    #E2E8F0;
    --gray-300:    #CBD5E1;
    --gray-400:    #94A3B8;
    --gray-500:    #64748B;
    --gray-600:    #475569;
    --gray-700:    #334155;
    --gray-800:    #1E293B;
    --gray-900:    #0F172A;

    --text:        #0F172A;
    --text-secondary: #475569;
    --text-muted:  #64748B;
    --text-light:  #94A3B8;

    --success:     #059669;
    --success-bg:  #ECFDF5;
    --warning:     #DC2626;
    --warning-bg:  #FEF2F2;

    --border:      #E2E8F0;
    --border-blue: #B3D7FB;

    --shadow-xs:  0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-sm:  0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-md:  0 4px 6px -1px rgba(15, 23, 42, 0.06), 0 2px 4px -2px rgba(15, 23, 42, 0.04);
    --shadow-lg:  0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.04);
    --shadow-xl:  0 20px 25px -5px rgba(15, 23, 42, 0.08), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
    --shadow-blue: 0 4px 14px rgba(18, 101, 201, 0.25);
    --shadow-glow: 0 0 20px rgba(26, 122, 239, 0.15);

    --radius:    16px;
    --radius-sm: 10px;
    --radius-xs: 8px;
    --radius-full: 9999px;

    --ease:    cubic-bezier(0.4, 0, 0.2, 1);
    --ease-out: cubic-bezier(0, 0, 0.2, 1);
    --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
    --duration: 0.2s;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text);
    background: var(--gradient-bg);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ── App wrapper ─────────────────────────────────────────────────────────────── */

.app {
    padding: 28px;
    max-width: 1100px;
    margin: 0 auto;
    position: relative;
}

.app::before {
    content: '';
    position: fixed;
    top: -20%; right: -10%;
    width: 500px; height: 500px;
    background: radial-gradient(circle, rgba(26, 122, 239, 0.06) 0%, transparent 70%);
    pointer-events: none;
    z-index: -1;
}

.app::after {
    content: '';
    position: fixed;
    bottom: -10%; left: -10%;
    width: 400px; height: 400px;
    background: radial-gradient(circle, rgba(14, 79, 166, 0.05) 0%, transparent 70%);
    pointer-events: none;
    z-index: -1;
}

/* ── Header ──────────────────────────────────────────────────────────────────── */

.header {
    margin-bottom: 28px;
}

.header-brand {
    display: flex;
    align-items: center;
    padding-bottom: 16px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.header-logo {
    height: 30px;
    width: auto;
    object-fit: contain;
}

.header-left {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.header-title {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 22px;
    font-weight: 800;
    color: var(--blue-800);
    letter-spacing: -0.4px;
}

.header-icon {
    flex-shrink: 0;
    width: 40px; height: 40px;
    padding: 9px;
    background: var(--gradient-primary);
    border-radius: var(--radius-sm);
    color: white;
    box-shadow: var(--shadow-blue);
}

.header-sub {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    padding-left: 54px;
}

/* ── Loading ─────────────────────────────────────────────────────────────────── */

.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    color: var(--text-muted);
    gap: 18px;
}

.loading-spinner {
    width: 40px; height: 40px;
    border: 3px solid var(--blue-100);
    border-top-color: var(--blue-500);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading p { font-size: 14px; font-weight: 500; }

/* ── Error state ─────────────────────────────────────────────────────────────── */

.error-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 60px 20px;
    color: var(--text-muted);
    text-align: center;
}

.error-state svg { width: 48px; height: 48px; opacity: .5; color: var(--warning); }
.error-state p   { font-size: 14px; max-width: 400px; }

/* ── User card ───────────────────────────────────────────────────────────────── */

.user-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 22px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
    animation: slideUp .4s var(--ease-out);
}

.user-card-avatar {
    flex-shrink: 0;
    width: 52px; height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--blue-100) 0%, var(--blue-50) 100%);
    border: 2px solid var(--blue-200);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    color: var(--blue-400);
}

.user-card-avatar svg {
    width: 26px; height: 26px;
}

.user-card-avatar img {
    width: 100%; height: 100%;
    object-fit: cover;
}

.user-card-info {
    flex: 1;
    min-width: 0;
}

.user-card-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.3;
}

.user-card-position {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    margin-top: 2px;
}

.user-card-stats {
    flex-shrink: 0;
    text-align: center;
    padding: 10px 16px;
    background: linear-gradient(135deg, var(--blue-50) 0%, rgba(179, 215, 251, 0.3) 100%);
    border-radius: var(--radius-xs);
    border: 1px solid var(--blue-100);
}

.user-card-stats-value {
    font-size: 26px;
    font-weight: 800;
    color: var(--blue-600);
    line-height: 1;
    letter-spacing: -1px;
}

.user-card-stats-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-top: 4px;
    white-space: nowrap;
}

/* ── Section label ───────────────────────────────────────────────────────────── */

.section-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-light);
    margin-bottom: 14px;
    padding-left: 2px;
}

/* ── Subscription card ───────────────────────────────────────────────────────── */

.sub-card {
    background: var(--gradient-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: all var(--duration) var(--ease);
    animation: slideUp .4s var(--ease-out);
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.sub-card:hover {
    box-shadow: var(--shadow-md);
}

.sub-card.is-active {
    border-color: var(--blue-400);
    box-shadow: var(--shadow-lg), 0 0 0 1px rgba(26, 122, 239, 0.08);
}

/* ── Card header ─────────────────────────────────────────────────────────────── */

.sub-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 24px;
    flex-wrap: wrap;
    transition: all var(--duration) var(--ease);
}

.sub-card.is-active .sub-header {
    background: linear-gradient(135deg, var(--blue-50) 0%, rgba(179, 215, 251, 0.2) 100%);
}

.sub-meta {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    flex: 1;
    min-width: 0;
}

.sub-icon {
    flex-shrink: 0;
    width: 44px; height: 44px;
    background: var(--blue-50);
    border: 1px solid var(--blue-100);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--blue-500);
    transition: all 0.3s var(--ease);
}

.sub-card.is-active .sub-icon {
    background: var(--gradient-shine);
    border-color: transparent;
    color: white;
    box-shadow: var(--shadow-blue);
    transform: scale(1.05);
}

.sub-icon svg { width: 20px; height: 20px; }

.sub-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 2px;
    letter-spacing: -0.1px;
}

.sub-desc {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
}

/* ── Toggle ──────────────────────────────────────────────────────────────────── */

.toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    flex-shrink: 0;
    user-select: none;
}

.toggle input { display: none; }

.toggle-track {
    position: relative;
    width: 46px; height: 26px;
    background: var(--gray-300);
    border-radius: 13px;
    transition: all 0.3s var(--ease);
    flex-shrink: 0;
}

.toggle-thumb {
    position: absolute;
    top: 3px; left: 3px;
    width: 20px; height: 20px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,.15), 0 1px 2px rgba(0,0,0,.1);
    transition: all 0.3s var(--ease-bounce);
}

.toggle input:checked ~ .toggle-track {
    background: var(--gradient-shine);
    box-shadow: 0 0 12px rgba(26, 122, 239, 0.3);
}

.toggle input:checked ~ .toggle-track .toggle-thumb {
    left: 23px;
}

.toggle-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-light);
    min-width: 76px;
    letter-spacing: 0.2px;
    transition: all var(--duration) var(--ease);
}

.toggle input:checked ~ .toggle-label {
    color: var(--blue-600);
}

/* ── Card header right (toggle + chevron) ───────────────────────────────────── */

.sub-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.sub-chevron {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px; height: 32px;
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    background: var(--white);
    color: var(--text-light);
    cursor: pointer;
    transition: all var(--duration) var(--ease);
    padding: 0;
}

.sub-chevron svg {
    width: 16px; height: 16px;
    transition: transform 0.25s var(--ease);
}

.sub-chevron:hover {
    color: var(--blue-600);
    border-color: var(--blue-300);
    background: var(--blue-50);
}

.sub-card.is-expanded .sub-chevron svg {
    transform: rotate(180deg);
}

.sub-card.is-expanded .sub-chevron {
    color: var(--blue-600);
    border-color: var(--blue-300);
    background: var(--blue-50);
}

.sub-chevron-hidden {
    visibility: hidden;
    pointer-events: none;
}

/* ── Settings panel ──────────────────────────────────────────────────────────── */

.sub-settings {
    padding: 20px 24px 24px;
    border-top: 1px solid var(--border);
}

.sub-settings.animate-in {
    animation: expandDown .3s var(--ease-out);
}

@keyframes expandDown {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.settings-divider { display: none; }

/* ── Form ────────────────────────────────────────────────────────────────────── */

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 14px;
}

.form-group {
    margin-bottom: 0;
}

.form-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .8px;
    margin-bottom: 6px;
}

.form-label svg { width: 12px; height: 12px; opacity: 0.7; }

.form-hint {
    display: block;
    font-size: 11px;
    color: var(--text-light);
    margin-top: 4px;
    font-weight: 500;
}

.form-control-mono {
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 13px;
    letter-spacing: 0.5px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    background: var(--white);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-xs);
    outline: none;
    transition: all var(--duration) var(--ease);
    appearance: none;
    font-family: inherit;
}

.form-control:hover {
    border-color: var(--gray-300);
}

.form-control:focus {
    border-color: var(--blue-500);
    box-shadow: 0 0 0 3px rgba(26, 122, 239, 0.1);
}

/* ── Frequency row ───────────────────────────────────────────────────────────── */

.frequency-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}

.form-select {
    flex: 1;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
    cursor: pointer;
}

.freq-value-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.freq-input {
    width: 70px;
    text-align: center;
}

.freq-unit {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
}

/* ── Info rows ───────────────────────────────────────────────────────────────── */

.info-rows {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 4px;
    padding: 12px 14px;
    background: linear-gradient(135deg, var(--blue-50) 0%, rgba(220, 238, 251, 0.5) 100%);
    border-radius: var(--radius-xs);
    border: 1px solid var(--blue-100);
}

.info-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.info-row-label {
    color: var(--text-muted);
    flex-shrink: 0;
    font-weight: 500;
}

.info-row-value {
    font-weight: 700;
    color: var(--text);
}

.info-next {
    color: var(--blue-600);
}

/* ── Actions ─────────────────────────────────────────────────────────────────── */

.actions {
    display: flex;
    justify-content: flex-start;
    margin-top: 20px;
}

/* ── Buttons ─────────────────────────────────────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 24px;
    font-size: 13px;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-xs);
    cursor: pointer;
    transition: all var(--duration) var(--ease);
    position: relative;
    overflow: hidden;
    font-family: inherit;
    letter-spacing: 0.2px;
}

.btn svg { width: 16px; height: 16px; }

.btn-primary {
    background: var(--gradient-shine);
    color: white;
    box-shadow: var(--shadow-md), var(--shadow-blue);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg), 0 6px 20px rgba(18, 101, 201, 0.35);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

.btn-primary:disabled {
    opacity: .6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: var(--shadow-sm) !important;
}

.btn-secondary {
    background: var(--white);
    color: var(--blue-600);
    border: 1.5px solid var(--border);
    box-shadow: var(--shadow-xs);
}

.btn-secondary:hover {
    border-color: var(--blue-400);
    background: var(--blue-50);
    box-shadow: var(--shadow-sm);
}

/* Loading state */
.btn.loading .btn-text { opacity: 0; }
.btn.loading .btn-spinner { display: block; }

.btn-spinner {
    display: none;
    position: absolute;
    width: 18px; height: 18px;
    border: 2.5px solid rgba(255,255,255,.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin .7s linear infinite;
}

/* ── Toast ───────────────────────────────────────────────────────────────────── */

.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    max-width: 380px;
    padding: 14px 18px;
    background: var(--white);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-xl);
    display: flex;
    align-items: center;
    gap: 12px;
    border-left: 4px solid var(--blue-500);
    transform: translateY(120px);
    opacity: 0;
    transition: all 0.35s var(--ease-bounce);
    z-index: 1000;
}

.toast.show { transform: translateY(0); opacity: 1; }

.toast.success { border-left-color: var(--success); }
.toast.success::before { content: '✓'; font-size: 16px; font-weight: 800; color: var(--success); }

.toast.error { border-left-color: var(--warning); }
.toast.error::before { content: '!'; font-size: 16px; font-weight: 800; color: var(--warning); }

.toast-text {
    flex: 1;
    font-weight: 600;
    font-size: 13px;
    color: var(--text);
}

.toast-close {
    background: none;
    border: none;
    font-size: 18px;
    color: var(--text-light);
    cursor: pointer;
    padding: 0 0 0 4px;
    line-height: 1;
    transition: all var(--duration) var(--ease);
}

.toast-close:hover { color: var(--text); }

/* ═══════════════════════════════════════════════════════════════════════════ */
/* ── Tabs ───────────────────────────────────────────────────────────────── */
/* ═══════════════════════════════════════════════════════════════════════════ */

.tabs {
    display: flex;
    gap: 2px;
    margin-bottom: 24px;
    background: var(--gray-100);
    border-radius: var(--radius-sm);
    padding: 3px;
}

.tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    background: transparent;
    border: none;
    border-radius: var(--radius-xs);
    cursor: pointer;
    transition: all var(--duration) var(--ease);
    font-family: inherit;
    white-space: nowrap;
}

.tab svg { width: 15px; height: 15px; flex-shrink: 0; opacity: 0.7; }

.tab:hover {
    color: var(--blue-600);
    background: rgba(255,255,255,0.6);
}
.tab:hover svg { opacity: 1; }

.tab.active {
    color: var(--blue-700);
    background: var(--white);
    box-shadow: var(--shadow-sm);
}
.tab.active svg { opacity: 1; color: var(--blue-500); }

/* ── Admin: Toolbar ─────────────────────────────────────────────────────── */

.admin-toolbar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 16px;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 12px;
}

.btn-sm svg { width: 14px; height: 14px; }

/* ── Admin: Type form ───────────────────────────────────────────────────── */

.type-form-card {
    background: var(--white);
    border: 1.5px solid var(--blue-300);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    animation: slideUp .3s var(--ease-out);
}

.type-form-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--blue-800);
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.type-form-title::before {
    content: '';
    width: 4px; height: 20px;
    background: var(--gradient-shine);
    border-radius: 2px;
}

.type-form-card .form-group {
    margin-bottom: 14px;
}

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

.type-form-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

/* ── Admin: Types filter ───────────────────────────────────────────────── */

.types-filter-bar {
    display: flex;
    gap: 6px;
    margin-bottom: 14px;
    background: var(--gray-100);
    border-radius: var(--radius-xs);
    padding: 3px;
}

.types-filter-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 14px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    background: transparent;
    border: none;
    border-radius: 7px;
    cursor: pointer;
    transition: all var(--duration) var(--ease);
    font-family: inherit;
    white-space: nowrap;
}

.types-filter-btn:hover {
    color: var(--blue-600);
    background: rgba(255,255,255,0.5);
}

.types-filter-btn.active {
    color: var(--blue-700);
    background: var(--white);
    box-shadow: var(--shadow-sm);
}

.types-filter-count {
    font-size: 10px;
    font-weight: 700;
    background: var(--gray-200);
    color: var(--text-muted);
    padding: 1px 7px;
    border-radius: var(--radius-full);
    line-height: 1.5;
}

.types-filter-btn.active .types-filter-count {
    background: var(--blue-100);
    color: var(--blue-600);
}

/* ── Admin: Type cards ──────────────────────────────────────────────────── */

.type-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    overflow: hidden;
    transition: all var(--duration) var(--ease);
    animation: slideUp .3s var(--ease-out);
}

.type-card:hover {
    border-color: var(--gray-300);
    box-shadow: var(--shadow-md);
}

.type-card.type-disabled {
    opacity: 0.55;
}

.type-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 16px 20px;
}

.type-card-info { flex: 1; min-width: 0; }

.type-card-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    margin: 5px 0 3px;
}

.type-card-desc {
    font-size: 12px;
    color: var(--text-muted);
}

.type-card-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px; height: 34px;
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    background: var(--white);
    color: var(--text-light);
    cursor: pointer;
    transition: all var(--duration) var(--ease);
}

.btn-icon svg { width: 15px; height: 15px; }

.btn-icon:hover {
    color: var(--blue-600);
    border-color: var(--blue-300);
    background: var(--blue-50);
    box-shadow: var(--shadow-sm);
}

.btn-icon-danger:hover {
    color: var(--warning);
    border-color: #FECACA;
    background: var(--warning-bg);
}

.type-badge, .stats-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 3px 10px;
    border-radius: var(--radius-full);
}

.badge-active {
    background: var(--success-bg);
    color: var(--success);
}

.badge-active::before {
    content: '';
    width: 6px; height: 6px;
    background: var(--success);
    border-radius: 50%;
}

.badge-inactive {
    background: var(--gray-100);
    color: var(--text-light);
}

.badge-external {
    background: #FEF3C7;
    color: #B45309;
}

.badge-external::before {
    content: '';
    width: 6px; height: 6px;
    background: #F59E0B;
    border-radius: 50%;
}

.type-card-badges {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.type-key-badge {
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 10px;
    font-weight: 600;
    color: var(--blue-600);
    background: var(--blue-50);
    border: 1px solid var(--blue-100);
    padding: 2px 8px;
    border-radius: var(--radius-full);
    letter-spacing: 0.3px;
}

.type-card-message {
    padding: 0 20px 16px;
    border-top: 1px solid var(--gray-100);
    padding-top: 14px;
}

.type-message-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: .8px;
}

.type-message-text {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-top: 8px;
    padding: 12px 14px;
    background: var(--gray-50);
    border-radius: var(--radius-xs);
    border: 1px solid var(--gray-200);
}

/* ── Admin: Statistics ──────────────────────────────────────────────────── */

/* Dashboard metrics */
.stats-dashboard {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}

.stats-metric {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 18px 16px;
    text-align: center;
    box-shadow: var(--shadow-xs);
    transition: all var(--duration) var(--ease);
}

.stats-metric:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--blue-200);
}

.stats-metric-value {
    font-size: 32px;
    font-weight: 800;
    color: var(--blue-600);
    line-height: 1;
    letter-spacing: -1px;
    margin-bottom: 6px;
}

.stats-metric-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stats-metric-icon {
    width: 22px;
    height: 22px;
    margin-bottom: 8px;
    color: var(--blue-400);
}

.stats-metric-accent {
    background: linear-gradient(135deg, var(--blue-50), var(--white));
    border-color: var(--blue-200);
}

.stats-metric-accent .stats-metric-icon { color: var(--blue-600); }

.stats-metric-sub {
    font-size: 18px;
    font-weight: 500;
    color: var(--text-muted);
}

/* Tag bar chart */
.stats-tags-section {
    margin-bottom: 20px;
}

.stats-section-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.stats-tags-bars {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.stats-tag-bar-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

.stats-tag-bar-count {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

.stats-tag-bar-track {
    height: 8px;
    background: var(--gray-100);
    border-radius: 4px;
    overflow: hidden;
}

.stats-tag-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.6s ease;
    min-width: 4px;
}

/* Card enhancements */
.stats-card-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.stats-type-icon {
    width: 18px;
    height: 18px;
    color: var(--blue-400);
    flex-shrink: 0;
}

.stats-card-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
}

.badge-external {
    background: #f0fdf4;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

.badge-links {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.stats-bar-mini {
    height: 4px;
    background: var(--gray-100);
    border-radius: 2px;
    margin-top: 8px;
    overflow: hidden;
}

.stats-bar-mini-fill {
    height: 100%;
    background: var(--blue-400);
    border-radius: 2px;
    transition: width 0.6s ease;
    min-width: 2px;
}

/* Search */
.stats-search-wrap {
    position: relative;
    margin-bottom: 16px;
}

.stats-search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px; height: 16px;
    color: var(--text-light);
    pointer-events: none;
}

.stats-search {
    padding-left: 40px !important;
}

/* Cards */
.stats-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    overflow: hidden;
    transition: all var(--duration) var(--ease);
}

.stats-card:hover { box-shadow: var(--shadow-md); }

.stats-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 16px 20px;
    cursor: pointer;
    transition: all var(--duration) var(--ease);
}

.stats-card-header:hover { background: var(--blue-50); }

.stats-card-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
    flex-wrap: wrap;
}

.stats-card-info h4 {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
}

.stats-card-count {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.stats-number {
    font-size: 28px;
    font-weight: 800;
    color: var(--blue-600);
    line-height: 1;
    letter-spacing: -1px;
}

.stats-label {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.2;
    font-weight: 500;
}

.stats-chevron {
    width: 16px; height: 16px;
    color: var(--text-light);
    transition: transform 0.25s var(--ease);
    margin-left: 4px;
}

.stats-card.expanded .stats-chevron { transform: rotate(180deg); }

.stats-card-body {
    display: none;
    padding: 0 20px 16px;
    border-top: 1px solid var(--gray-100);
}

.stats-card.expanded .stats-card-body { display: block; }

.stats-empty {
    font-size: 13px;
    color: var(--text-muted);
    padding: 16px 0;
    text-align: center;
}

/* Show more */
.stats-show-more {
    text-align: center;
    padding: 12px 0 4px;
}

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

.stats-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 14px;
    font-size: 13px;
}

.stats-table-continuation {
    margin-top: 0;
}

.stats-table th {
    text-align: left;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .8px;
    color: var(--text-light);
    padding: 10px 12px;
    border-bottom: 2px solid var(--gray-200);
    white-space: nowrap;
}

.stats-table td {
    padding: 12px;
    border-bottom: 1px solid var(--gray-100);
    color: var(--text);
    vertical-align: top;
}

.stats-table tr:last-child td { border-bottom: none; }

.stats-table tr:hover td { background: var(--blue-50); }

.stats-table .text-muted {
    font-size: 11px;
    color: var(--text-light);
    font-weight: 500;
}

.stats-placeholder {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
    font-size: 14px;
}

/* ── Links editor ───────────────────────────────────────────────────────── */

.link-field-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
    animation: slideUp .2s var(--ease-out);
}

.link-field-row .link-title {
    flex: 1;
    min-width: 0;
}

.link-field-row .link-url {
    flex: 1.5;
    min-width: 0;
}

.link-field-row .btn-remove-link {
    flex-shrink: 0;
}

.btn-add-link {
    margin-top: 4px;
}

.type-links-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed var(--gray-200);
}

.type-link-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--blue-600);
    text-decoration: none;
    padding: 4px 0;
    transition: color var(--duration) var(--ease);
}

.type-link-item:hover {
    color: var(--blue-800);
}

.type-link-item svg {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
    opacity: 0.6;
}

/* ── Tags ───────────────────────────────────────────────────────────────── */

.tag-badges {
    display: inline-flex;
    gap: 4px;
    flex-wrap: wrap;
    margin: 2px 0;
}

.tag-badge {
    display: inline-flex;
    align-items: center;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    color: #fff;
    line-height: 1.5;
}

/* Tags filter bar (user subscriptions) */
.tags-filter-bar {
    display: flex;
    gap: 6px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.tag-filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--white);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all var(--duration) var(--ease);
    font-family: inherit;
}

.tag-filter-btn:hover {
    box-shadow: var(--shadow-sm);
}

.tag-filter-btn.active {
    box-shadow: var(--shadow-sm);
}

.tag-filter-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.tag-filter-btn.active .tag-filter-dot {
    background: #fff !important;
}

/* Tag checkboxes in type form */
.tag-checkboxes {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.tag-checkbox-label {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    transition: all var(--duration) var(--ease);
}

.tag-checkbox-label input[type="checkbox"] {
    display: none;
}

.tag-checkbox-badge {
    display: inline-flex;
    align-items: center;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    color: #fff;
    opacity: 0.4;
    transition: all var(--duration) var(--ease);
}

.tag-checkbox-label input[type="checkbox"]:checked + .tag-checkbox-badge {
    opacity: 1;
    box-shadow: var(--shadow-sm);
}

/* Tag color picker */
.tag-color-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.form-control-color {
    width: 44px;
    height: 36px;
    padding: 2px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-xs);
    cursor: pointer;
    background: var(--white);
}

.tag-preview {
    display: inline-flex;
    align-items: center;
    font-size: 12px;
    font-weight: 700;
    padding: 4px 14px;
    border-radius: var(--radius-full);
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ── Empty state ────────────────────────────────────────────────────────── */

.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
    font-size: 14px;
    background: var(--white);
    border-radius: var(--radius-sm);
    border: 1.5px dashed var(--gray-300);
}

/* ── Mini tag badge (универсальный) ─────────────────────────────────────── */

.tag-mini-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    line-height: 1.4;
    white-space: nowrap;
}

/* ── Stats: widgets row (donut + top-5) ─────────────────────────────────── */

.stats-widgets {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin: 16px 0;
}

.stats-widget {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 18px 20px;
    box-shadow: var(--shadow-sm);
}

.stats-widget-title {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 14px;
}

/* Donut */
.stats-donut-body {
    display: flex;
    align-items: center;
    gap: 22px;
}

.stats-donut-wrap {
    flex-shrink: 0;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stats-donut-wrap svg {
    overflow: visible;
    display: block;
}

.stats-donut-wrap circle {
    transition: stroke-width .2s ease, filter .2s ease;
}

.stats-donut-wrap circle:hover {
    stroke-width: 32 !important;
    filter: brightness(1.08) drop-shadow(0 2px 6px rgba(0,0,0,0.18));
}

.stats-donut-legend {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.stats-legend-item {
    display: grid;
    grid-template-columns: 12px 1fr auto auto;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: background .15s ease;
    font-size: 12px;
}

.stats-legend-item:hover { background: var(--gray-50, #f9fafb); }
.stats-legend-item.is-active { background: var(--blue-50); }

.stats-legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.stats-legend-title {
    color: var(--text);
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stats-legend-val {
    font-weight: 700;
    color: var(--text);
    font-size: 13px;
}

.stats-legend-pct {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    min-width: 32px;
    text-align: right;
}

/* Top-5 */
.stats-top5 {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.stats-top5-row {
    display: grid;
    grid-template-columns: 28px 32px 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: 10px;
    cursor: pointer;
    transition: background .15s ease;
}

.stats-top5-row:hover { background: var(--gray-50, #f9fafb); }

.stats-top5-rank {
    font-size: 13px;
    font-weight: 800;
    color: var(--text-muted);
    text-align: center;
}

.stats-top5-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--blue-500);
    background: var(--blue-50);
    flex-shrink: 0;
}

.stats-top5-icon svg { width: 16px; height: 16px; }

.stats-top5-info { min-width: 0; }

.stats-top5-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stats-top5-bar {
    height: 5px;
    background: var(--gray-100, #f3f4f6);
    border-radius: 999px;
    overflow: hidden;
}

.stats-top5-bar-fill {
    height: 100%;
    border-radius: 999px;
    transition: width .4s ease-out;
}

.stats-top5-num {
    font-size: 16px;
    font-weight: 800;
    color: var(--text);
}

@media (max-width: 768px) {
    .stats-widgets { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .stats-donut-body { flex-direction: column; align-items: stretch; }
    .stats-donut-wrap { align-self: center; }
}

/* ── Stats: global search + subtabs ─────────────────────────────────────── */

.stats-global-search {
    position: relative;
    margin: 8px 0 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.stats-global-search > svg {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    pointer-events: none;
}

.stats-global-search input {
    flex: 1;
    padding: 11px 14px 11px 40px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 13px;
    background: #fff;
    outline: none;
    transition: border-color .15s ease;
}

.stats-global-search input:focus {
    border-color: var(--blue-400);
    box-shadow: 0 0 0 3px rgba(26, 122, 239, 0.12);
}

.stats-clear-filter {
    padding: 8px 12px;
    background: var(--blue-50);
    border: 1px solid var(--blue-200, var(--blue-100));
    color: var(--blue-500);
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.stats-subtabs {
    display: flex;
    gap: 6px;
    margin-bottom: 14px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0;
    overflow-x: auto;
}

.stats-subtab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s ease;
    white-space: nowrap;
}

.stats-subtab svg { width: 15px; height: 15px; }

.stats-subtab:hover { color: var(--text); }

.stats-subtab.active {
    color: var(--blue-500);
    border-bottom-color: var(--blue-500);
}

/* ── Stats: users tab ───────────────────────────────────────────────────── */

.stats-users-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}

.stats-user-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px;
    box-shadow: var(--shadow-sm);
}

.stats-user-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.stats-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--blue-400), var(--blue-500));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
    overflow: hidden;
}
.stats-user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.stats-user-info { flex: 1; min-width: 0; }

.stats-user-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stats-user-id {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.stats-user-count {
    font-size: 18px;
    font-weight: 800;
    color: var(--blue-500);
}

.stats-user-types {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.stats-user-type {
    display: inline-block;
    padding: 3px 9px;
    border: 1px solid;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 600;
    line-height: 1.4;
}

/* ── Stats: alerts tab ──────────────────────────────────────────────────── */

.stats-alerts-grid {
    display: grid;
    gap: 12px;
}

.stats-alert-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 16px;
    box-shadow: var(--shadow-sm);
}

.stats-alert-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.stats-alert-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--blue-50);
    border: 1px solid var(--blue-100);
    color: var(--blue-500);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stats-alert-icon svg { width: 20px; height: 20px; }

.stats-alert-info { flex: 1; min-width: 0; }

.stats-alert-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}

.stats-alert-key code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, monospace;
    font-size: 11px;
    color: var(--text-muted);
}

.stats-alert-count {
    font-size: 18px;
    font-weight: 800;
    color: var(--text);
}

.stats-alert-url {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--gray-50, #f3f4f6);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 10px;
}

.stats-alert-url code {
    flex: 1;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, monospace;
    font-size: 11px;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stats-alert-url .btn-icon { flex-shrink: 0; }

/* ── Stats tiles grid ───────────────────────────────────────────────────── */

.stats-tiles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
    margin-top: 12px;
}

.stats-tile {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 18px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: all .2s var(--ease);
}

.stats-tile:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--blue-300, var(--blue-400));
}

.stats-tile-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.stats-tile-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--blue-50);
    border: 1px solid var(--blue-100);
    color: var(--blue-500);
    flex-shrink: 0;
}

.stats-tile-icon svg { width: 22px; height: 22px; }

.stats-tile-count {
    text-align: right;
}

.stats-tile-num {
    font-size: 28px;
    font-weight: 800;
    color: var(--text);
    line-height: 1;
    letter-spacing: -0.5px;
}

.stats-tile-num-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    font-weight: 600;
    margin-top: 4px;
}

.stats-tile-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    margin: 0;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: calc(14px * 1.35 * 2);
}

.stats-tile-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    min-height: 22px;
}

.stats-tile-bar {
    height: 6px;
    background: var(--gray-100, #f3f4f6);
    border-radius: 999px;
    overflow: hidden;
}

.stats-tile-bar-fill {
    height: 100%;
    border-radius: 999px;
    transition: width .4s var(--ease-out, ease-out);
}

.stats-tile-action {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11px;
    font-weight: 600;
    color: var(--blue-500);
    padding-top: 8px;
    border-top: 1px dashed var(--border);
}

.stats-tile-action svg { width: 14px; height: 14px; }

@media (max-width: 600px) {
    .stats-tiles-grid { grid-template-columns: 1fr; }
}

/* ── Stats modal ────────────────────────────────────────────────────────── */

.stats-modal {
    max-width: 800px !important;
}

.stats-modal-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
}

.stats-modal-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--blue-50);
    border: 1px solid var(--blue-100);
    color: var(--blue-500);
    flex-shrink: 0;
}

.stats-modal-icon svg { width: 26px; height: 26px; }

.stats-modal-info {
    flex: 1;
    min-width: 0;
}

.stats-modal-info h3 {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 8px;
    color: var(--text);
}

.stats-modal-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.stats-modal-num {
    text-align: right;
    flex-shrink: 0;
}

.stats-modal-num-val {
    font-size: 32px;
    font-weight: 800;
    color: var(--blue-500);
    line-height: 1;
}

.stats-modal-num-lbl {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    font-weight: 600;
    margin-top: 4px;
}

.stats-modal-search {
    position: relative;
    margin-bottom: 14px;
}

.stats-modal-search input {
    width: 100%;
    padding: 10px 14px 10px 38px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 13px;
    outline: none;
    background: #fff;
    transition: border-color .15s ease;
}

.stats-modal-search input:focus {
    border-color: var(--blue-400);
    box-shadow: 0 0 0 3px rgba(26, 122, 239, 0.12);
}

.stats-modal-search svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    pointer-events: none;
}

.stats-modal-body {
    max-height: 60vh;
    overflow-y: auto;
}

@media (max-width: 600px) {
    .stats-modal-header {
        flex-wrap: wrap;
        gap: 10px;
    }
    .stats-modal-num { width: 100%; text-align: left; }
    .stats-modal-num-val { font-size: 24px; }
}

/* ── Tags grid (admin) ──────────────────────────────────────────────────── */

#tagsList {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
}

.tag-card {
    position: relative;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: all .2s var(--ease);
}

.tag-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--tc);
}

.tag-card-stripe {
    height: 6px;
    background: var(--tc);
}

.tag-card-body {
    padding: 14px 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tag-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tag-card-swatch {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12), inset 0 0 0 1px rgba(255, 255, 255, 0.3);
}

.tag-card-actions {
    display: flex;
    gap: 4px;
}

.tag-card-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    margin: 0;
    line-height: 1.2;
}

.tag-card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.tag-card-key code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, monospace;
    font-size: 11px;
    background: var(--gray-50, #f3f4f6);
    color: var(--text);
    padding: 3px 8px;
    border-radius: 6px;
    border: 1px solid var(--border);
}

.tag-card-color {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, monospace;
    font-size: 10px;
    font-weight: 600;
    color: var(--tc);
    background: color-mix(in srgb, var(--tc) 10%, transparent);
    padding: 3px 8px;
    border-radius: 6px;
    letter-spacing: 0.5px;
}

.tag-card-usage {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
    padding-top: 8px;
    border-top: 1px dashed var(--border);
}

.tag-card-usage svg {
    width: 14px;
    height: 14px;
    color: var(--tc);
    flex-shrink: 0;
}

@media (max-width: 600px) {
    #tagsList { grid-template-columns: 1fr; }
}

/* ── Modal overlay ──────────────────────────────────────────────────────── */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 40px 16px;
    overflow-y: auto;
    opacity: 0;
    transition: opacity .2s ease-out;
}

.modal-overlay.is-open {
    opacity: 1;
}

.modal-overlay > .type-form-card {
    display: block !important;
    position: relative;
    width: 100%;
    max-width: 640px;
    margin: 0 auto;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 24px 64px rgba(15, 30, 60, 0.35);
    padding: 28px 32px;
    transform: translateY(20px) scale(0.98);
    transition: transform .25s var(--ease-out, ease-out);
}

.modal-overlay.is-open > .type-form-card {
    transform: translateY(0) scale(1);
}

.modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .15s var(--ease);
}

.modal-close:hover {
    background: var(--gray-100, #f3f4f6);
    color: var(--text);
}

.modal-close svg { width: 18px; height: 18px; }

@media (max-width: 600px) {
    .modal-overlay { padding: 16px 10px; }
    .modal-overlay > .type-form-card { padding: 22px 18px 18px; border-radius: 14px; }
}

/* ── Types grid (admin) ─────────────────────────────────────────────────── */

#typesList {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
    align-items: stretch;
}

#typesList .type-card {
    margin-bottom: 0;
    display: grid;
    grid-template-rows:
        48px       /* top: иконка + действия */
        42px       /* title (2 строки фикс) */
        36px       /* desc (2 строки фикс) */
        28px       /* badges */
        26px;      /* key pill */
    gap: 12px;
    padding: 18px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow-sm);
    transition: all .2s var(--ease);
}

#typesList .type-card > * {
    margin: 0;
    min-width: 0;
}

#typesList .type-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

#typesList .type-card.type-disabled {
    opacity: 0.6;
}

.type-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

#typesList .type-card-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--blue-50);
    border: 1px solid var(--blue-100);
    color: var(--blue-500);
    flex-shrink: 0;
}

#typesList .type-card-icon svg { width: 22px; height: 22px; }

#typesList .type-card-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

#typesList .type-card-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

#typesList .type-card-desc {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

#typesList .type-card-badges {
    display: flex;
    flex-wrap: nowrap;
    gap: 5px;
    align-items: center;
    overflow: hidden;
}

#typesList .type-card-badges .type-badge,
#typesList .type-card-badges .tag-mini-badge {
    flex-shrink: 0;
}

.type-card-key {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 9px;
    background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
    border: 1px solid #c7d2fe;
    color: #4338ca;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 600;
    align-self: flex-start;
    max-width: 100%;
    overflow: hidden;
}

.type-card-key svg { width: 11px; height: 11px; flex-shrink: 0; opacity: 0.7; }

.type-card-key code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, monospace;
    font-size: 10px;
    background: transparent;
    color: inherit;
    padding: 0;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
    max-width: 100%;
}

#typesList .type-card-message {
    padding: 10px 14px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
}

#typesList .type-message-label {
    display: block;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    color: var(--text-muted);
    font-weight: 700;
    flex-shrink: 0;
}

#typesList .type-message-text {
    font-size: 12px;
    line-height: 1.4;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* multiline-теги внутри превью схлопываем (br тоже не нужны) */
#typesList .type-message-text br {
    display: none;
}


@media (max-width: 600px) {
    #typesList { grid-template-columns: 1fr; gap: 12px; }
    #typesList .type-card { padding: 14px; }
}

/* ── Sticky save bar ────────────────────────────────────────────────────── */

.save-bar {
    margin: 0 0 16px;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transform: translateY(-8px);
    transition: opacity .25s ease-out, max-height .3s ease-out, transform .25s ease-out, margin .25s ease-out;
}

.save-bar.is-visible {
    opacity: 1;
    max-height: 200px;
    transform: translateY(0);
    margin: 0 0 16px;
}

.save-bar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: linear-gradient(135deg, #fff 0%, #fafbff 100%);
    border: 2px solid var(--blue-400, #1a7aef);
    border-radius: 14px;
    box-shadow: 0 8px 24px rgba(26, 122, 239, 0.18);
    padding: 14px 20px;
    animation: saveBarPulse 2s ease-in-out infinite;
}

@keyframes saveBarPulse {
    0%, 100% { box-shadow: 0 8px 24px rgba(26, 122, 239, 0.18); }
    50%      { box-shadow: 0 10px 30px rgba(26, 122, 239, 0.34); }
}

.save-bar-info {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    min-width: 0;
}

.save-bar-info svg {
    width: 18px;
    height: 18px;
    color: var(--blue-500);
    flex-shrink: 0;
}

.save-bar-info span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.save-bar-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

/* Сброс старой нижней подкладки — бар теперь сверху */
#tabSubscriptions {
    padding-bottom: 0;
}

@media (max-width: 600px) {
    .save-bar { margin: 0 0 14px; }
    .save-bar-inner {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 12px 14px;
        border-radius: 12px;
    }
    .save-bar-info {
        justify-content: flex-start;
        font-size: 13px;
    }
    .save-bar-info span {
        display: inline;
        white-space: normal;
    }
    .save-bar-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        width: 100%;
    }
    .save-bar-actions .btn {
        width: 100%;
        justify-content: center;
        padding: 10px 12px;
        font-size: 13px;
    }
}

/* ── Icon picker (admin form) ───────────────────────────────────────────── */

.icon-picker {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
    gap: 6px;
    max-height: 220px;
    overflow-y: auto;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--gray-50, #f9fafb);
}

.icon-picker-btn {
    width: 100%;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all .15s var(--ease);
    padding: 0;
}

.icon-picker-btn:hover {
    border-color: var(--blue-400);
    color: var(--blue-500);
    transform: translateY(-1px);
}

.icon-picker-btn.selected {
    background: var(--blue-500, #1a7aef);
    border-color: var(--blue-500, #1a7aef);
    color: #fff;
    box-shadow: 0 2px 8px rgba(26, 122, 239, 0.3);
}

.icon-picker-btn svg { width: 18px; height: 18px; }

/* Icon в карточке списка типов админки */
.type-card-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--blue-50);
    border: 1px solid var(--blue-100);
    color: var(--blue-500);
    margin-right: 12px;
}

.type-card-icon svg { width: 20px; height: 20px; }

/* ── Subscriptions search ───────────────────────────────────────────────── */

.subs-search {
    position: relative;
    margin: 12px 0 16px;
}

.subs-search input {
    width: 100%;
    padding: 11px 14px 11px 40px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #fff;
    font-size: 14px;
    color: var(--text);
    transition: all var(--duration) var(--ease);
    outline: none;
}

.subs-search input:focus {
    border-color: var(--blue-400);
    box-shadow: 0 0 0 3px rgba(26, 122, 239, 0.12);
}

.subs-search-icon {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    pointer-events: none;
}

/* ── Subscription tiles grid ────────────────────────────────────────────── */

#subscriptionCards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 14px;
    align-items: stretch;
}

#subscriptionCards .sub-card {
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Раскрытая карточка занимает всю ширину строки */
#subscriptionCards .sub-card.is-expanded {
    grid-column: 1 / -1;
}

/* Вертикальный layout плитки */
#subscriptionCards .sub-header {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 16px;
    flex: 1;
    flex-wrap: nowrap;
}

#subscriptionCards .sub-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    flex: 1;
}

#subscriptionCards .sub-icon {
    width: 40px;
    height: 40px;
}

#subscriptionCards .sub-title {
    font-size: 13px;
    line-height: 1.35;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.7em;
}

#subscriptionCards .sub-desc {
    font-size: 12px;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Нижний бар плитки: тумблер слева, шеврон справа */
#subscriptionCards .sub-header-right {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
    margin-top: auto;
}

#subscriptionCards .toggle-label {
    display: none;
}

#subscriptionCards .sub-chevron {
    width: 28px;
    height: 28px;
}

/* В раскрытом виде — header снова горизонтальный, как было */
#subscriptionCards .sub-card.is-expanded .sub-header {
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
}
#subscriptionCards .sub-card.is-expanded .sub-meta {
    flex-direction: row;
    align-items: flex-start;
}
#subscriptionCards .sub-card.is-expanded .sub-title {
    -webkit-line-clamp: unset;
    min-height: 0;
}
#subscriptionCards .sub-card.is-expanded .sub-desc {
    -webkit-line-clamp: unset;
}
#subscriptionCards .sub-card.is-expanded .sub-header-right {
    border-top: none;
    padding-top: 0;
    margin-top: 0;
    width: auto;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */

/* Large screens */
@media (min-width: 900px) {
    .app { max-width: 1100px; padding: 36px; }
}

/* Extra-wide screens */
@media (min-width: 1400px) {
    .app { max-width: 1320px; }
}

/* Tablet (601–768px) */
@media (max-width: 768px) {
    .app { padding: 20px; }

    .header-title { font-size: 20px; gap: 10px; }
    .header-icon { width: 36px; height: 36px; padding: 8px; }
    .header-logo { height: 26px; }
    .header-sub { padding-left: 46px; }

    .sub-header { padding: 16px 18px; }
    .sub-settings { padding: 16px 18px 20px; }

    .type-card-header { padding: 14px 16px; }
    .type-card-message { padding: 0 16px 14px; padding-top: 12px; }

    .stats-card-header { padding: 14px 16px; }
    .stats-card-body { padding: 0 16px 14px; }

    .type-form-card { padding: 20px; }
}

/* Mobile (≤600px) */
@media (max-width: 600px) {
    .app { padding: 14px; }

    .header { margin-bottom: 20px; }
    .header-brand { padding-bottom: 12px; margin-bottom: 12px; }
    .header-title { font-size: 18px; gap: 10px; }
    .header-icon { width: 34px; height: 34px; padding: 7px; }
    .header-logo { height: 24px; }
    .header-sub { padding-left: 44px; font-size: 12px; }

    /* User card */
    .user-card { flex-wrap: wrap; gap: 12px; padding: 14px 16px; }
    .user-card-avatar { width: 44px; height: 44px; }
    .user-card-avatar svg { width: 22px; height: 22px; }
    .user-card-info { min-width: calc(100% - 72px); }
    .user-card-name { font-size: 14px; }
    .user-card-stats {
        width: 100%;
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 8px 12px;
    }
    .user-card-stats-value { font-size: 20px; }
    .user-card-stats-label { margin-top: 0; }

    .section-label { font-size: 10px; margin-bottom: 10px; }

    /* Tabs — icon mode on mobile */
    .tabs { flex-direction: row; gap: 2px; }
    .tab {
        flex-direction: column;
        gap: 4px;
        padding: 10px 8px 8px;
        font-size: 10px;
        min-width: 0;
    }
    .tab svg { width: 20px; height: 20px; }
    .tab .tab-text {
        display: none;
    }
    .tab.active .tab-text {
        display: block;
        font-size: 10px;
        line-height: 1;
    }

    /* Subscription cards */
    .sub-header {
        flex-direction: column;
        align-items: flex-start;
        padding: 14px 16px;
        gap: 12px;
    }
    .sub-header-right { align-self: flex-end; margin-top: -4px; }
    .sub-icon { width: 38px; height: 38px; }
    .sub-icon svg { width: 18px; height: 18px; }
    .sub-title { font-size: 14px; }
    .sub-settings { padding: 14px 16px 18px; }

    .form-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .frequency-row { flex-wrap: wrap; }
    .form-select { min-width: 0; }

    .info-rows { padding: 10px 12px; }
    .info-row { flex-direction: column; align-items: flex-start; gap: 2px; font-size: 12px; }

    /* Admin: Types filter */
    .types-filter-btn { padding: 7px 10px; font-size: 11px; }
    .types-filter-count { font-size: 9px; padding: 1px 6px; }

    /* Admin: Type form */
    .type-form-card { padding: 16px; }
    .type-form-title { font-size: 15px; }

    /* Admin: Type cards */
    .type-card-header {
        flex-direction: column;
        align-items: flex-start;
        padding: 12px 14px;
    }
    .type-card-actions { align-self: flex-end; }
    .type-card-message { padding: 0 14px 12px; padding-top: 10px; }
    .type-message-text { font-size: 12px; padding: 10px 12px; }
    .type-card-badges { gap: 4px; }

    /* Stats: Dashboard */
    .stats-dashboard { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .stats-metric { padding: 14px 12px; }
    .stats-metric-value { font-size: 24px; }
    .stats-metric-label { font-size: 10px; }

    /* Stats: Cards */
    .stats-card-header {
        flex-direction: column;
        align-items: flex-start;
        padding: 12px 14px;
        gap: 8px;
    }
    .stats-card-info { gap: 6px; }
    .stats-card-info h4 { font-size: 13px; }
    .stats-card-count { align-self: flex-end; }
    .stats-number { font-size: 24px; }
    .stats-card-body { padding: 0 14px 12px; }

    /* Stats: Table → Cards on mobile */
    .stats-table thead { display: none; }
    .stats-table, .stats-table tbody, .stats-table tr, .stats-table td {
        display: block;
        width: 100%;
    }
    .stats-table tr {
        padding: 12px 0;
        border-bottom: 1px solid var(--gray-100);
    }
    .stats-table tr:last-child { border-bottom: none; }
    .stats-table td {
        padding: 2px 0;
        border-bottom: none;
        font-size: 13px;
    }
    .stats-table td::before {
        content: attr(data-label);
        display: block;
        font-size: 10px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        color: var(--text-light);
        margin-bottom: 1px;
    }
    .stats-table td:first-child::before { content: none; }
    .stats-table td:first-child { font-size: 14px; margin-bottom: 4px; }
    .stats-table tr:hover td { background: none; }

    /* Links editor */
    .link-field-row { flex-wrap: wrap; }
    .link-field-row .link-title,
    .link-field-row .link-url { flex: 1 1 100%; }
    .link-field-row .btn-remove-link { position: absolute; right: 4px; top: 4px; }
    .link-field-row { position: relative; padding-right: 40px; }

    /* Tags */
    .tags-filter-bar { gap: 4px; }
    .tag-filter-btn { padding: 5px 10px; font-size: 11px; }
    .tag-checkboxes { gap: 6px; }
    .tag-checkbox-badge { font-size: 10px; padding: 3px 10px; }

    /* Actions & Buttons */
    .actions { margin-top: 16px; }
    .btn { padding: 10px 18px; font-size: 12px; }
    .admin-toolbar { margin-bottom: 12px; }

    /* Toast */
    .toast { left: 12px; right: 12px; bottom: 12px; max-width: none; padding: 12px 14px; }
    .toast-text { font-size: 12px; }
}

/* Very small screens (≤380px) */
@media (max-width: 380px) {
    .app { padding: 10px; }

    .header-brand { padding-bottom: 10px; margin-bottom: 10px; }
    .header-title { font-size: 16px; }
    .header-icon { width: 30px; height: 30px; padding: 6px; }
    .header-logo { height: 20px; }
    .header-sub { padding-left: 40px; font-size: 11px; }

    .stats-dashboard { grid-template-columns: 1fr 1fr; gap: 6px; }
    .stats-metric { padding: 10px 8px; }
    .stats-metric-value { font-size: 20px; }
    .stats-metric-label { font-size: 9px; }

    .sub-header { padding: 12px; }
    .sub-settings { padding: 12px; }

    .toggle-label { display: none; }

    .type-key-badge { font-size: 9px; padding: 1px 6px; }

    .btn { padding: 8px 14px; font-size: 11px; gap: 6px; }
    .btn svg { width: 14px; height: 14px; }
}

/* ── Scrollbar ───────────────────────────────────────────────────────────── */

::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--blue-400); }

::selection { background: rgba(26, 122, 239, 0.15); }
