:root {
    --gray: #737174;
    --accent: #01754f;
    --accent-dark: #015a3f;
    --accent-light: rgba(1, 117, 79, 0.18);
    --accent-glow: rgba(1, 117, 79, 0.35);
    --primary: var(--accent);
    --primary-dark: var(--accent-dark);
    --primary-light: var(--accent-light);
    --warning: #c9a227;
    --warning-bg: rgba(201, 162, 39, 0.15);
    --danger: #e05252;
    --danger-bg: rgba(224, 82, 82, 0.12);
    --radius: 16px;
    --radius-sm: 10px;
    --app-width: 430px;
}

[data-theme="dark"] {
    --black: #000000;
    --bg: #000000;
    --body-bg: #000000;
    --surface: #111111;
    --surface-elevated: #1a1a1a;
    --header-bg: #000000;
    --text: #ffffff;
    --text-muted: #737174;
    --border: rgba(115, 113, 116, 0.25);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
    --shell-glow: rgba(1, 117, 79, 0.08);
    --desktop-bg: #0a0a0a;
    --success: #01754f;
    --success-bg: rgba(1, 117, 79, 0.15);
    --success-text: #4ade80;
    --error-text: #fca5a5;
    --info-text: #6ee7b7;
    --warning-text: #fcd34d;
    --danger-text: #fca5a5;
    --hero-end: #000000;
    --toggle-bg: var(--surface-elevated);
}

[data-theme="light"] {
    --black: #111111;
    --bg: #f5f5f6;
    --body-bg: #e8e8ea;
    --surface: #ffffff;
    --surface-elevated: #f0f0f2;
    --header-bg: #ffffff;
    --text: #111111;
    --text-muted: #737174;
    --border: rgba(115, 113, 116, 0.22);
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.07);
    --shell-glow: rgba(1, 117, 79, 0.06);
    --desktop-bg: #d8d8dc;
    --success: #01754f;
    --success-bg: rgba(1, 117, 79, 0.1);
    --success-text: #01754f;
    --error-text: #dc2626;
    --info-text: #01754f;
    --warning-text: #b45309;
    --danger-text: #dc2626;
    --hero-end: #f0f0f2;
    --toggle-bg: #f0f0f2;
    --accent-light: rgba(1, 117, 79, 0.12);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
}

body {
    font-family: 'Vazirmatn', Tahoma, sans-serif;
    background: var(--body-bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.25s ease, color 0.25s ease;
}

a {
    color: inherit;
    text-decoration: none;
}

.icon {
    flex-shrink: 0;
    display: inline-block;
    vertical-align: middle;
}

.icon-muted {
    color: var(--gray);
}

.app-shell {
    max-width: var(--app-width);
    margin: 0 auto;
    min-height: 100vh;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 80px var(--shell-glow);
    transition: background-color 0.25s ease;
}

.app-header {
    background: var(--header-bg);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 12px 16px;
    transition: background-color 0.25s ease;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text);
    min-width: 0;
}

.brand span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.brand-logo {
    width: 36px;
    height: 36px;
    object-fit: contain;
    border-radius: 8px;
    flex-shrink: 0;
}

.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--toggle-bg);
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s;
    padding: 0;
}

.theme-toggle:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.theme-icon {
    display: none;
    line-height: 0;
}

[data-theme="dark"] .theme-icon-moon,
[data-theme="light"] .theme-icon-sun {
    display: flex;
}

.header-user {
    font-size: 0.8rem;
    color: var(--accent);
    background: var(--accent-light);
    padding: 5px 12px;
    border-radius: 20px;
    border: 1px solid rgba(1, 117, 79, 0.3);
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-decoration: none;
}

.header-user:hover {
    opacity: 0.9;
}

.section-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 16px;
}

.app-main {
    flex: 1;
    padding: 16px;
    padding-bottom: 90px;
}

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: var(--app-width);
    background: var(--header-bg);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-around;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    z-index: 100;
    transition: background-color 0.25s ease;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    font-size: 0.68rem;
    color: var(--gray);
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
    min-width: 58px;
}

.nav-item .icon {
    transition: color 0.2s;
}

.nav-item.active {
    color: var(--accent);
    background: var(--accent-light);
}

.nav-item.active .icon {
    color: var(--accent);
}

.page-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 4px;
    color: var(--text);
}

.page-subtitle {
    color: var(--gray);
    font-size: 0.9rem;
    margin-bottom: 20px;
}

.page-title-sm {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
}

.alert {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 0.9rem;
    border: 1px solid transparent;
}

.alert-success {
    background: var(--success-bg);
    color: var(--success-text);
    border-color: rgba(1, 117, 79, 0.35);
}

.alert-error {
    background: var(--danger-bg);
    color: var(--error-text);
    border-color: rgba(224, 82, 82, 0.3);
}

.alert-info {
    background: var(--accent-light);
    color: var(--info-text);
    border-color: rgba(1, 117, 79, 0.3);
}

.alert-warning {
    background: var(--warning-bg);
    color: var(--warning-text);
    border-color: rgba(201, 162, 39, 0.3);
}

.payment-card-box .payment-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    gap: 12px;
    font-size: 0.9rem;
}

.payment-card-box .payment-info-row:last-of-type {
    border-bottom: none;
}

.payment-card-box .card-number {
    color: var(--accent);
    font-size: 1.05rem;
    letter-spacing: 1px;
}

.receipt-preview {
    width: 100%;
    max-height: 320px;
    object-fit: contain;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface-elevated);
}

.admin-payment-form {
    margin-top: 12px;
}

.otp-input {
    text-align: center;
    font-size: 1.4rem;
    letter-spacing: 0.4em;
    font-weight: 600;
}

.section-heading {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 12px;
}

.announcements-section {
    margin-bottom: 24px;
}

.announcement-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-right: 3px solid var(--accent);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    margin-bottom: 10px;
    box-shadow: var(--shadow);
}

.announcement-card h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text);
}

.announcement-card p {
    font-size: 0.88rem;
    line-height: 1.7;
    color: var(--text-muted);
}

.announcement-date {
    margin-top: 10px;
    font-size: 0.78rem;
}

.ticket-thread {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ticket-bubble {
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    border: 1px solid var(--border);
    max-width: 92%;
}

.ticket-bubble-user {
    align-self: flex-end;
    background: var(--accent-light);
    border-color: rgba(1, 117, 79, 0.25);
}

.ticket-bubble-admin {
    align-self: flex-start;
    background: var(--surface);
}

.ticket-bubble-header {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 0.75rem;
    color: var(--gray);
    margin-bottom: 6px;
}

.ticket-bubble-header strong {
    color: var(--text);
    font-size: 0.8rem;
}

.ticket-bubble p {
    font-size: 0.9rem;
    line-height: 1.7;
    white-space: pre-wrap;
}

.event-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    display: block;
    transition: transform 0.15s, border-color 0.2s, background-color 0.25s;
}

.event-card:hover {
    border-color: rgba(1, 117, 79, 0.4);
}

.event-card:active {
    transform: scale(0.98);
}

.event-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 10px;
}

.event-card h3 {
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.4;
    color: var(--text);
}

.event-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 0.82rem;
    color: var(--gray);
    margin-bottom: 10px;
}

.meta-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.event-price {
    font-weight: 700;
    color: var(--accent);
    font-size: 0.95rem;
}

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
}

.badge-success {
    background: var(--success-bg);
    color: var(--success-text);
    border: 1px solid rgba(1, 117, 79, 0.3);
}

.badge-warning {
    background: var(--warning-bg);
    color: var(--warning-text);
    border: 1px solid rgba(201, 162, 39, 0.3);
}

.badge-danger {
    background: var(--danger-bg);
    color: var(--danger-text);
    border: 1px solid rgba(224, 82, 82, 0.3);
}

.badge-muted {
    background: rgba(115, 113, 116, 0.15);
    color: var(--gray);
    border: 1px solid var(--border);
}

.badge-info {
    background: rgba(59, 130, 246, 0.12);
    color: #2563eb;
    border: 1px solid rgba(59, 130, 246, 0.25);
}

[data-theme="dark"] .badge-info {
    color: #93c5fd;
}

.online-link-section .online-link-url {
    margin-top: 10px;
    font-size: 0.78rem;
    color: var(--gray);
    word-break: break-all;
}

.event-type-fields.is-hidden {
    display: none;
}

.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--gray);
}

.empty-state .icon-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--surface);
    border: 1px solid var(--border);
    margin-bottom: 16px;
    color: var(--accent);
}

.landing-page {
    padding-bottom: 24px;
}

.landing-hero {
    padding-bottom: 24px;
}

.org-search-wrap {
    max-width: 100%;
    margin: 0 auto 20px;
}

.org-search-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text);
}

.org-search {
    position: relative;
}

.org-search-icon {
    position: absolute;
    top: 50%;
    right: 14px;
    transform: translateY(-50%);
    color: var(--gray);
    pointer-events: none;
}

.org-search-input {
    width: 100%;
    padding: 14px 44px 14px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.95rem;
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.org-search-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.org-search-results {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    left: 0;
    z-index: 30;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    max-height: 280px;
    overflow-y: auto;
}

.org-search-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    width: 100%;
    padding: 12px 14px;
    border: 0;
    border-bottom: 1px solid var(--border);
    background: transparent;
    color: var(--text);
    font-family: inherit;
    text-align: right;
    cursor: pointer;
    transition: background-color 0.15s;
}

.org-search-item:last-child {
    border-bottom: 0;
}

.org-search-item:hover,
.org-search-item.is-active {
    background: var(--accent-light);
}

.org-search-item-title {
    font-size: 0.92rem;
    font-weight: 600;
}

.org-search-item-meta {
    font-size: 0.78rem;
    color: var(--gray);
}

.org-search-empty {
    padding: 14px;
    text-align: center;
    font-size: 0.85rem;
    color: var(--gray);
}

.org-search-hint {
    margin-top: 8px;
    font-size: 0.78rem;
    color: var(--gray);
}

.landing-staff-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
    color: var(--gray);
}

.landing-staff-links a {
    color: var(--accent);
    font-weight: 600;
}

.form-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: background-color 0.25s ease;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.95rem;
    background: var(--surface-elevated);
    color: var(--text);
    transition: border-color 0.2s, background-color 0.25s;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--gray);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.form-group textarea {
    min-height: 100px;
    resize: vertical;
}

.form-group select option {
    background: var(--surface);
}

.form-hint {
    font-size: 0.78rem;
    color: var(--gray);
    margin-top: 4px;
}

.form-error {
    font-size: 0.82rem;
    color: var(--error-text);
    margin-bottom: 12px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
}

.btn-primary {
    background: var(--accent);
    color: #ffffff;
}

.btn-primary:hover {
    background: var(--accent-dark);
    box-shadow: 0 4px 20px var(--accent-glow);
}

.btn-primary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    box-shadow: none;
}

.btn-secondary {
    background: transparent;
    color: var(--accent);
    border: 1px solid var(--accent);
}

.btn-secondary:hover {
    background: var(--accent-light);
}

.btn-danger {
    background: var(--danger-bg);
    color: var(--danger-text);
    border: 1px solid rgba(224, 82, 82, 0.3);
}

.btn-sm {
    padding: 8px 14px;
    font-size: 0.85rem;
    width: auto;
}

.btn-group {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.btn-group .btn {
    flex: 1;
}

.detail-hero {
    background: linear-gradient(145deg, var(--surface-elevated) 0%, var(--hero-end) 100%);
    color: var(--text);
    border-radius: var(--radius);
    padding: 24px 20px;
    margin-bottom: 16px;
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
}

.detail-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), transparent);
}

.detail-hero h1 {
    font-size: 1.3rem;
    margin-bottom: 12px;
}

.detail-hero .event-meta {
    color: var(--gray);
}

.detail-section {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
    border: 1px solid var(--border);
    transition: background-color 0.25s ease;
}

.detail-section h2 {
    font-size: 0.85rem;
    color: var(--gray);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 16px;
}

.stat-card {
    background: var(--surface);
    border-radius: var(--radius-sm);
    padding: 14px;
    text-align: center;
    border: 1px solid var(--border);
    transition: background-color 0.25s ease;
}

.stat-card .value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent);
}

.stat-card .label {
    font-size: 0.78rem;
    color: var(--gray);
}

.admin-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.admin-actions .btn {
    width: auto;
    flex: 1;
    min-width: 100px;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    color: var(--accent);
    font-weight: 500;
}

.auth-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 0.9rem;
    color: var(--gray);
}

.auth-footer a {
    color: var(--accent);
    font-weight: 600;
}

.divider {
    height: 1px;
    background: var(--border);
    margin: 16px 0;
}

.link-accent {
    color: var(--accent);
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.auth-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    background: var(--surface);
    padding: 4px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.auth-tab {
    flex: 1;
    text-align: center;
    padding: 10px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--gray);
    transition: all 0.2s;
}

.auth-tab.active {
    background: var(--accent);
    color: #fff;
}

.admin-menu {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 16px;
}

.admin-menu-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    transition: border-color 0.2s, background-color 0.25s;
}

.admin-menu-item:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.admin-menu-item .icon {
    color: var(--accent);
}

.admin-bottom-nav .nav-item {
    min-width: 56px;
    font-size: 0.68rem;
    padding: 8px 6px;
}

.header-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--toggle-bg);
    color: var(--text-muted);
    transition: all 0.2s;
}

.header-logout:hover {
    color: var(--danger-text);
    border-color: rgba(224, 82, 82, 0.4);
}

.dashboard-block {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}

.dashboard-block-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.dashboard-alerts {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.dashboard-alert {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-weight: 600;
}

.dashboard-alert-warning {
    background: var(--warning-bg);
    color: var(--warning-text);
    border: 1px solid rgba(201, 162, 39, 0.3);
}

.dashboard-alert-info {
    background: var(--accent-light);
    color: var(--info-text);
    border: 1px solid rgba(1, 117, 79, 0.3);
}

.admin-menu-item-accent {
    border-color: var(--accent);
    background: var(--accent-light);
}

.admin-menu-item-accent .icon {
    color: var(--accent);
}

.sms-var-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 8px;
}

.sms-var-row input,
.sms-var-row select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.88rem;
    background: var(--surface-elevated);
    color: var(--text);
}

@media (min-width: 431px) {
    body {
        background: var(--desktop-bg);
    }

    .app-shell {
        border-left: 1px solid var(--border);
        border-right: 1px solid var(--border);
    }
}

.brand-preview-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    margin-bottom: 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface-elevated);
}

.brand-preview-logo {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    object-fit: cover;
    border: 1px solid var(--border);
    background: var(--surface);
}

.brand-preview-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
}

.brand-preview-chip {
    display: inline-block;
    margin-top: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    color: #fff;
    background: var(--preview-accent, var(--accent));
}

.brand-color-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-color-row input[type="color"] {
    width: 52px;
    height: 44px;
    padding: 4px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-elevated);
    cursor: pointer;
}

.brand-color-row input[type="text"] {
    flex: 1;
}

.brand-current-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
    padding: 10px;
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
}

.brand-current-logo img {
    width: 56px;
    height: 56px;
    border-radius: 10px;
    object-fit: cover;
}

.brand-remove-logo {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--gray);
}

/* ── Subscription / plan widgets ── */
.plan-widget {
    background: linear-gradient(135deg, var(--surface) 0%, color-mix(in srgb, var(--accent) 6%, var(--surface)) 100%);
    border: 1px solid color-mix(in srgb, var(--accent) 25%, var(--border));
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}

.plan-widget-warn {
    border-color: color-mix(in srgb, var(--warning-text) 35%, var(--border));
    background: linear-gradient(135deg, var(--surface) 0%, var(--warning-bg) 100%);
}

.plan-widget-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.plan-widget-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.plan-widget-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: color-mix(in srgb, var(--accent) 14%, transparent);
    color: var(--accent);
    flex-shrink: 0;
}

.plan-widget-label {
    display: block;
    font-size: 0.75rem;
    color: var(--gray);
    margin-bottom: 2px;
}

.plan-widget-name {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text);
    margin: 0;
    line-height: 1.3;
}

.plan-widget-price {
    text-align: left;
    flex-shrink: 0;
}

.plan-widget-price-value {
    display: block;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--accent);
    line-height: 1.2;
}

.plan-widget-price-unit {
    font-size: 0.72rem;
    color: var(--gray);
}

.plan-widget-desc {
    font-size: 0.85rem;
    color: var(--gray);
    margin: -4px 0 12px;
    line-height: 1.6;
}

.plan-widget-pending {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    margin-bottom: 12px;
    border-radius: var(--radius-sm);
    background: var(--warning-bg);
    color: var(--warning-text);
    font-size: 0.85rem;
}

.plan-metrics {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 14px;
}

.plan-metric-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
}

.plan-metric-title {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text);
}

.plan-metric-value {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--gray);
}

.plan-metric-value-warn {
    color: var(--warning-text);
}

.plan-metric-value-full {
    color: var(--danger-text);
}

.plan-progress {
    height: 8px;
    border-radius: 999px;
    background: var(--border);
    overflow: hidden;
}

.plan-progress-fill {
    height: 100%;
    border-radius: 999px;
    transition: width 0.35s ease;
}

.plan-progress-ok {
    background: var(--accent);
}

.plan-progress-warn {
    background: var(--warning-text);
}

.plan-progress-full {
    background: var(--danger-text);
}

.plan-widget-footer {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.plan-widget-hint {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--warning-text);
    margin: 0;
    line-height: 1.5;
}

.plan-widget-hint-muted {
    color: var(--gray);
}

.plan-widget-cta {
    align-self: stretch;
    justify-content: center;
}

.plan-cards-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.plan-card {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.plan-card-current {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent);
}

.plan-card-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
}

.plan-card-badge-muted {
    background: var(--border);
    color: var(--gray);
}

.plan-card-name {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0;
    padding-top: 4px;
}

.plan-card-price {
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.plan-card-price-value {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--accent);
}

.plan-card-price-unit {
    font-size: 0.8rem;
    color: var(--gray);
}

.plan-card-desc {
    font-size: 0.85rem;
    color: var(--gray);
    line-height: 1.6;
    margin: 0;
}

.plan-card-features {
    list-style: none;
    margin: 4px 0 8px;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.plan-card-features li {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.84rem;
    color: var(--text);
}

.plan-card-btn {
    width: 100%;
    margin-top: auto;
}

.plan-card-hint {
    font-size: 0.8rem;
    color: var(--gray);
    text-align: center;
    padding: 8px 0;
}

.plan-card-select {
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.plan-card-select input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.plan-card-selected,
.plan-card-select:has(input:checked) {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent);
}

.plan-card-hint-free {
    color: var(--accent);
    font-weight: 600;
}

.plan-select-section {
    margin: 20px 0 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.plan-select-title {
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.plan-select-subtitle {
    font-size: 0.82rem;
    color: var(--gray);
    margin: 0 0 14px;
    line-height: 1.5;
}

@media (min-width: 640px) {
    .plan-cards-grid {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    }

    .plan-widget-footer {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }

    .plan-widget-cta {
        align-self: auto;
        min-width: 180px;
    }
}

/* ── PWA install banner & toast ── */
.pwa-install-banner {
    position: fixed;
    inset-inline: 12px;
    bottom: calc(72px + env(safe-area-inset-bottom, 0px));
    z-index: 1200;
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.28s ease, transform 0.28s ease;
    pointer-events: none;
}

.pwa-install-banner.is-visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.pwa-install-card {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    gap: 10px 12px;
    align-items: center;
    padding: 14px 14px 14px 16px;
    border-radius: 18px;
    background: linear-gradient(135deg, var(--surface) 0%, color-mix(in srgb, var(--accent) 8%, var(--surface)) 100%);
    border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--border));
    box-shadow: 0 12px 40px rgba(1, 117, 79, 0.18), 0 4px 16px rgba(0, 0, 0, 0.08);
}

.pwa-install-close {
    position: absolute;
    top: 8px;
    left: 10px;
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: var(--gray);
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
    border-radius: 8px;
}

.pwa-install-card {
    position: relative;
}

.pwa-install-icon-wrap {
    grid-row: span 2;
}

.pwa-install-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    box-shadow: 0 4px 12px rgba(1, 117, 79, 0.25);
}

.pwa-install-title {
    display: block;
    font-size: 0.95rem;
    color: var(--text);
}

.pwa-install-text {
    margin: 4px 0 0;
    font-size: 0.78rem;
    line-height: 1.55;
    color: var(--gray);
}

.pwa-install-btn {
    grid-column: 1 / -1;
    width: 100%;
    margin: 0;
    box-shadow: 0 6px 18px rgba(1, 117, 79, 0.25);
}

.pwa-toast {
    position: fixed;
    top: calc(12px + env(safe-area-inset-top, 0px));
    inset-inline: 12px;
    z-index: 1300;
    padding: 12px 16px;
    border-radius: 14px;
    background: var(--accent);
    color: #fff;
    font-size: 0.88rem;
    font-weight: 600;
    text-align: center;
    box-shadow: 0 8px 28px rgba(1, 117, 79, 0.35);
    opacity: 0;
    transform: translateY(-12px);
    transition: opacity 0.28s ease, transform 0.28s ease;
}

.pwa-toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}

@media (min-width: 640px) {
    .pwa-install-banner {
        inset-inline: auto;
        left: 50%;
        right: auto;
        transform: translateX(-50%) translateY(16px);
        width: min(420px, calc(100vw - 24px));
    }

    .pwa-install-banner.is-visible {
        transform: translateX(-50%) translateY(0);
    }

    .pwa-toast {
        inset-inline: auto;
        left: 50%;
        right: auto;
        transform: translateX(-50%) translateY(-12px);
        width: min(360px, calc(100vw - 24px));
    }

    .pwa-toast.is-visible {
        transform: translateX(-50%) translateY(0);
    }
}
