/* ==========================================================================
   Parnosoft Web App — design system
   ========================================================================== */

@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/Vazirmatn-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/Vazirmatn-Medium.woff2') format('woff2');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/Vazirmatn-Bold.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Material Icons Outlined';
    src: url('../fonts/MaterialIconsOutlined.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: block;
}

@font-face {
    font-family: 'Material Icons';
    src: url('../fonts/MaterialIconsOutlined.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: block;
}

:root,
:root[data-theme="light"] {
    --bg: #FAF6F0;
    --bg-soft: #F3EBE1;
    --surface: #FFFFFF;
    --surface-2: #FBF7F2;
    --text: #241A10;
    --text-2: #6F6152;
    --text-3: #A0917F;
    --primary: #B45309;
    --primary-strong: #8F3F05;
    --primary-soft: rgba(180, 83, 9, .10);
    --primary-contrast: #FFFFFF;
    --secondary: #0F766E;
    --amber: #D97706;
    --green: #10B981;
    --red: #EF4444;
    --border: rgba(63, 42, 20, .10);
    --border-strong: rgba(63, 42, 20, .18);
    --glass: rgba(255, 251, 246, .82);
    --shadow-sm: 0 1px 2px rgba(63, 42, 20, .04), 0 4px 16px rgba(63, 42, 20, .05);
    --shadow-md: 0 12px 32px rgba(63, 42, 20, .10);
    --shadow-lg: 0 24px 64px rgba(63, 42, 20, .16);
    --hero-gradient: linear-gradient(135deg, #7C2D12 0%, #C2410C 46%, #F59E0B 132%);
    --hero-shadow: 0 18px 44px rgba(180, 83, 9, .30);
    color-scheme: light;
}

:root[data-theme="dark"] {
    --bg: #120E0A;
    --bg-soft: #19130E;
    --surface: #1E1712;
    --surface-2: #261D16;
    --text: #F6EFE7;
    --text-2: #B7A897;
    --text-3: #8A7B6B;
    --primary: #F5A45B;
    --primary-strong: #FFC48C;
    --primary-soft: rgba(245, 164, 91, .15);
    --primary-contrast: #241205;
    --secondary: #2DD4BF;
    --amber: #FBBF24;
    --green: #34D399;
    --red: #F87171;
    --border: rgba(255, 236, 218, .09);
    --border-strong: rgba(255, 236, 218, .17);
    --glass: rgba(30, 23, 18, .84);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .20), 0 6px 20px rgba(0, 0, 0, .18);
    --shadow-md: 0 14px 36px rgba(0, 0, 0, .40);
    --shadow-lg: 0 28px 70px rgba(0, 0, 0, .55);
    --hero-gradient: linear-gradient(135deg, #3D1F0E 0%, #9A3D0C 52%, #D97706 135%);
    --hero-shadow: 0 18px 44px rgba(0, 0, 0, .45);
    color-scheme: dark;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    height: 100%;
    -webkit-text-size-adjust: 100%;
}

html.app-scroll-locked,
html.app-scroll-locked body {
    overflow: hidden;
}

body {
    margin: 0;
    min-height: 100%;
    font-family: 'Vazirmatn', 'Segoe UI', Tahoma, sans-serif;
    font-size: 15px;
    line-height: 1.75;
    color: var(--text);
    background-color: var(--bg);
    background-image:
        radial-gradient(1100px 520px at 100% -8%, rgba(180, 83, 9, .055), transparent 60%),
        radial-gradient(900px 480px at 0% 0%, rgba(15, 118, 110, .05), transparent 55%);
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

[data-theme="dark"] body {
    background-image:
        radial-gradient(1100px 520px at 100% -8%, rgba(245, 164, 91, .10), transparent 60%),
        radial-gradient(900px 480px at 0% 0%, rgba(45, 212, 191, .07), transparent 55%);
}

button,
input,
textarea,
select {
    font-family: inherit;
    color: inherit;
}

button {
    -webkit-tap-highlight-color: transparent;
}

a {
    -webkit-tap-highlight-color: transparent;
    color: inherit;
}

img {
    max-width: 100%;
}

.material-icons,
.material-icons-outlined,
.mud-icon-root {
    font-feature-settings: 'liga';
    -webkit-font-feature-settings: 'liga';
}

::selection {
    background: var(--primary);
    color: var(--primary-contrast);
}

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 999px;
    border: 3px solid transparent;
    background-clip: content-box;
}

:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* ==========================================================================
   Shell, header, drawer
   ========================================================================== */

.app-shell {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

.float-header {
    position: fixed;
    top: max(12px, env(safe-area-inset-top));
    left: 16px;
    right: 16px;
    height: 64px;
    z-index: 90;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 0 12px;
    border-radius: 22px;
    background: var(--glass);
    -webkit-backdrop-filter: blur(20px) saturate(1.5);
    backdrop-filter: blur(20px) saturate(1.5);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
}

.fh-start,
.fh-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.header-icon-btn {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border: 1px solid transparent;
    border-radius: 14px;
    background: transparent;
    color: var(--text-2);
    cursor: pointer;
    transition: background .18s ease, color .18s ease, border-color .18s ease;
}

.header-icon-btn:hover {
    background: var(--surface-2);
    color: var(--text);
    border-color: var(--border);
}

.header-icon-btn:active {
    transform: scale(.96);
}

.app-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    color: inherit;
    text-decoration: none;
    padding: 4px 2px;
}

.brand-logo {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    object-fit: cover;
    box-shadow: 0 6px 14px rgba(63, 42, 20, .14);
    flex-shrink: 0;
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.35;
    min-width: 0;
}

.brand-text strong {
    font-size: .95rem;
    font-weight: 700;
    white-space: nowrap;
}

.brand-text small {
    font-size: .68rem;
    color: var(--text-3);
    white-space: nowrap;
}

.notification-btn {
    position: relative;
}

.header-badge {
    position: absolute;
    top: 2px;
    inset-inline-end: 2px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--red);
    color: #fff;
    font-size: .6rem;
    font-weight: 700;
    display: grid;
    place-items: center;
    border: 2px solid var(--surface);
    line-height: 1;
}

.header-avatar {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    border: 0;
    background: linear-gradient(135deg, #B45309, #7C2D12);
    color: #fff;
    font-family: inherit;
    font-size: .78rem;
    font-weight: 700;
    display: grid;
    place-items: center;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(180, 83, 9, .28);
    transition: transform .18s ease;
}

.header-avatar:hover {
    transform: translateY(-1px) scale(1.02);
}

.app-main {
    flex: 1;
    padding-top: calc(64px + max(12px, env(safe-area-inset-top)) + 22px);
}

.page-wrap {
    width: min(1120px, 100% - 32px);
    margin: 0 auto;
    padding-bottom: calc(48px + env(safe-area-inset-bottom));
}

.route-loading {
    min-height: 55vh;
    display: grid;
    place-items: center;
}

/* Drawer */

.drawer-layer {
    position: fixed;
    inset: 0;
    z-index: 120;
    display: flex;
    justify-content: flex-start;
    padding: max(12px, env(safe-area-inset-top)) 12px calc(12px + env(safe-area-inset-bottom));
    background: transparent;
    opacity: 0;
    visibility: hidden;
    transition: background .28s ease, opacity .28s ease, visibility .28s;
}

.drawer-layer.open {
    opacity: 1;
    visibility: visible;
    background: rgba(8, 10, 20, .46);
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
}

.float-drawer {
    width: min(344px, calc(100vw - 28px));
    height: calc(100dvh - max(24px, env(safe-area-inset-top)) - 24px);
    display: flex;
    flex-direction: column;
    padding: 16px;
    border-radius: 28px;
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    overflow-y: auto;
    overscroll-behavior: contain;
    transform: translateX(112%);
    transition: transform .34s cubic-bezier(.22, .82, .26, 1);
}

.drawer-layer.open .float-drawer {
    transform: none;
}

.drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 2px 2px 14px;
}

.drawer-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.drawer-logo {
    width: 42px;
    height: 42px;
    border-radius: 13px;
    object-fit: cover;
}

.drawer-brand div {
    display: flex;
    flex-direction: column;
    line-height: 1.35;
}

.drawer-brand strong {
    font-size: .95rem;
}

.drawer-brand span {
    font-size: .68rem;
    color: var(--text-3);
}

.drawer-close {
    width: 38px;
    height: 38px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-2);
    color: var(--text-2);
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: background .18s ease, color .18s ease;
}

.drawer-close:hover {
    background: var(--bg-soft);
    color: var(--text);
}

.drawer-user {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 11px 12px;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: inherit;
    font-family: inherit;
    text-align: start;
    cursor: pointer;
    transition: border-color .18s ease, background .18s ease;
}

.drawer-user:hover {
    border-color: rgba(180, 83, 9, .35);
    background: var(--primary-soft);
}

.drawer-avatar {
    width: 46px;
    height: 46px;
    flex-shrink: 0;
    border-radius: 15px;
    background: linear-gradient(135deg, #B45309, #7C2D12);
    color: #fff;
    font-size: .85rem;
    font-weight: 700;
    display: grid;
    place-items: center;
}

.drawer-user-text {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    line-height: 1.45;
}

.drawer-user-text strong {
    font-size: .86rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.drawer-user-text small {
    font-size: .72rem;
    color: var(--text-3);
    letter-spacing: .03em;
}

.drawer-user-arrow {
    color: var(--text-3);
    font-size: 18px;
}

.drawer-nav {
    margin-top: 16px;
}

.drawer-account {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed var(--border);
}

.drawer-label {
    display: block;
    margin: 4px 8px 7px;
    font-size: .68rem;
    font-weight: 600;
    color: var(--text-3);
}

.drawer-link {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 11px;
    margin-bottom: 2px;
    border: 1px solid transparent;
    border-radius: 14px;
    color: var(--text);
    text-decoration: none;
    font-size: .88rem;
    font-weight: 500;
    transition: background .18s ease, color .18s ease, border-color .18s ease;
}

.drawer-link:hover {
    background: var(--surface-2);
}

.drawer-link.active {
    background: var(--primary-soft);
    border-color: rgba(180, 83, 9, .16);
    color: var(--primary);
    font-weight: 700;
}

.drawer-link-icon {
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    border-radius: 11px;
    background: var(--surface-2);
    color: var(--text-2);
    display: grid;
    place-items: center;
    font-size: 19px;
    transition: background .18s ease, color .18s ease;
}

.drawer-link.active .drawer-link-icon {
    background: var(--primary);
    color: var(--primary-contrast);
}

.drawer-link-text {
    flex: 1;
}

.drawer-count {
    min-width: 22px;
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--primary);
    color: var(--primary-contrast);
    font-size: .64rem;
    font-weight: 700;
    text-align: center;
}

.drawer-foot {
    margin-top: auto;
    padding-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.drawer-connection {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 12px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: inherit;
    font-family: inherit;
    text-align: start;
    cursor: pointer;
}

.status-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
    background: var(--amber);
    box-shadow: 0 0 0 4px rgba(245, 158, 11, .16);
}

.drawer-connection.connected .status-dot,
.setting-connection.connected .status-dot {
    background: var(--green);
    box-shadow: 0 0 0 4px rgba(16, 185, 129, .16);
}

.drawer-connection-text {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    line-height: 1.4;
}

.drawer-connection-text strong {
    font-size: .78rem;
}

.drawer-connection-text small {
    font-size: .68rem;
    color: var(--text-3);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.drawer-connection > .mud-icon-root {
    color: var(--text-3);
    font-size: 18px;
}

.drawer-version {
    text-align: center;
    font-size: .66rem;
    color: var(--text-3);
}

/* ==========================================================================
   Shared primitives
   ========================================================================== */

.page-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.page-heading-main {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.page-heading-text {
    min-width: 0;
}

.page-title {
    margin: 0;
    font-size: clamp(1.3rem, 2.6vw, 1.65rem);
    font-weight: 700;
    line-height: 1.4;
    letter-spacing: -.01em;
}

.page-subtitle {
    margin: 5px 0 0;
    font-size: .82rem;
    color: var(--text-2);
    line-height: 1.75;
}

.page-heading-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.back-btn {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-2);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: color .18s ease, border-color .18s ease, transform .18s ease;
}

.back-btn:hover {
    color: var(--primary);
    border-color: rgba(180, 83, 9, .35);
    transform: translateX(2px);
}

.section-title {
    margin: 4px 0 -2px;
    font-size: 1rem;
    font-weight: 700;
}

.section-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.section-head h2 {
    margin: 0;
    font-size: .98rem;
    font-weight: 700;
}

.count-pill {
    padding: 1px 8px;
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--text-2);
    font-size: .68rem;
    font-weight: 600;
}

.soft-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    font-family: inherit;
    font-size: .78rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
    transition: color .18s ease, border-color .18s ease, background .18s ease, transform .18s ease;
}

.soft-btn:hover {
    color: var(--primary);
    border-color: rgba(180, 83, 9, .32);
    background: var(--primary-soft);
}

.soft-btn .mud-icon-root {
    font-size: 17px;
}

.soft-btn:disabled {
    opacity: .5;
    cursor: not-allowed;
}

.primary-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 18px;
    border: 0;
    border-radius: 14px;
    background: linear-gradient(135deg, #B45309, #7C2D12);
    color: #fff;
    font-family: inherit;
    font-size: .82rem;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 10px 22px rgba(180, 83, 9, .28);
    transition: transform .18s ease, box-shadow .18s ease, filter .18s ease;
}

.primary-btn:hover {
    transform: translateY(-1px);
    filter: brightness(1.04);
    box-shadow: 0 14px 28px rgba(180, 83, 9, .34);
}

.primary-btn:disabled {
    opacity: .45;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.primary-btn .mud-icon-root {
    font-size: 18px;
}

.ghost-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 13px;
    border-radius: 12px;
    border: 1px solid var(--border-strong);
    background: transparent;
    color: var(--text-2);
    font-family: inherit;
    font-size: .76rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: color .18s ease, border-color .18s ease, background .18s ease;
}

.ghost-pill:hover {
    color: var(--primary);
    border-color: rgba(180, 83, 9, .4);
    background: var(--primary-soft);
}

.ghost-pill.danger {
    color: var(--red);
    border-color: rgba(239, 68, 68, .28);
}

.ghost-pill.danger:hover {
    background: rgba(239, 68, 68, .08);
    border-color: var(--red);
    color: var(--red);
}

.ghost-pill .mud-icon-root {
    font-size: 17px;
}

.icon-soft-btn {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-2);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: color .18s ease, border-color .18s ease;
}

.icon-soft-btn:hover {
    color: var(--primary);
    border-color: rgba(180, 83, 9, .32);
}

.field {
    margin-bottom: 16px;
}

.field > label {
    display: block;
    margin-bottom: 7px;
    font-size: .78rem;
    font-weight: 600;
    color: var(--text-2);
}

.input-shell {
    display: flex;
    align-items: center;
    height: 52px;
    padding: 0 4px;
    border-radius: 15px;
    border: 1.5px solid var(--border);
    background: var(--surface-2);
    transition: border-color .18s ease, background .18s ease, box-shadow .18s ease;
}

.input-shell:focus-within {
    border-color: var(--primary);
    background: var(--surface);
    box-shadow: 0 0 0 4px var(--primary-soft);
}

.input-shell.has-error {
    border-color: var(--red);
}

.input-icon {
    width: 42px;
    height: 100%;
    display: grid;
    place-items: center;
    color: var(--text-3);
    font-size: 19px;
    flex-shrink: 0;
}

.text-input {
    flex: 1;
    min-width: 0;
    height: 100%;
    border: 0;
    background: transparent;
    color: var(--text);
    font-family: inherit;
    font-size: .94rem;
    padding: 0 8px;
    outline: none;
}

.text-input.ltr {
    direction: ltr;
    text-align: left;
    letter-spacing: .05em;
    font-variant-numeric: tabular-nums;
}

.text-input::placeholder {
    color: var(--text-3);
    letter-spacing: normal;
    font-size: .86rem;
}

.field-error {
    display: block;
    margin-top: 6px;
    font-size: .73rem;
    color: var(--red);
    font-weight: 500;
}

.field-error.center {
    text-align: center;
}

.btn-spinner {
    width: 15px;
    height: 15px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, .4);
    border-top-color: #fff;
    animation: ps-spin .7s linear infinite;
    flex-shrink: 0;
}

.btn-spinner.dark {
    border-color: rgba(22, 26, 43, .18);
    border-top-color: currentColor;
}

[data-theme="dark"] .btn-spinner {
    border-color: rgba(255, 255, 255, .3);
    border-top-color: #fff;
}

@keyframes ps-spin {
    to { transform: rotate(360deg); }
}

.link-btn {
    border: 0;
    background: none;
    padding: 4px;
    color: var(--primary);
    font-family: inherit;
    font-size: .75rem;
    font-weight: 600;
    cursor: pointer;
}

.link-btn:disabled {
    color: var(--text-3);
    cursor: default;
}

.inline-alert {
    display: flex;
    align-items: center;
    gap: 9px;
    flex-wrap: wrap;
    padding: 12px 14px;
    margin-bottom: 14px;
    border-radius: 15px;
    border: 1px solid var(--border);
    font-size: .76rem;
    line-height: 1.8;
}

.inline-alert .mud-icon-root {
    font-size: 20px;
    flex-shrink: 0;
}

.inline-alert.warning {
    background: rgba(245, 158, 11, .10);
    border-color: rgba(245, 158, 11, .30);
    color: #92400E;
}

.inline-alert.error {
    background: rgba(239, 68, 68, .09);
    border-color: rgba(239, 68, 68, .28);
    color: #B91C1C;
}

.inline-alert.info {
    background: var(--primary-soft);
    border-color: rgba(180, 83, 9, .22);
    color: var(--primary);
}

[data-theme="dark"] .inline-alert.warning { color: #FCD34D; }
[data-theme="dark"] .inline-alert.error { color: #FCA5A5; }

.inline-alert .banner-btn {
    margin-inline-start: auto;
}

.banner-btn {
    border: 0;
    border-radius: 11px;
    background: var(--primary);
    color: var(--primary-contrast);
    padding: 8px 14px;
    font-family: inherit;
    font-size: .74rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: filter .18s ease;
}

.banner-btn:hover {
    filter: brightness(1.06);
}

.banner-btn:disabled {
    opacity: .55;
    cursor: not-allowed;
}

/* Empty / error / skeletons */

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 6px;
    padding: 44px 20px;
}

.empty-state-icon {
    width: 74px;
    height: 74px;
    border-radius: 24px;
    background: var(--primary-soft);
    color: var(--primary);
    display: grid;
    place-items: center;
    font-size: 34px;
    margin-bottom: 6px;
}

.empty-state h3 {
    margin: 0;
    font-size: 1rem;
}

.empty-state p {
    margin: 0;
    max-width: 430px;
    font-size: .8rem;
    color: var(--text-2);
    line-height: 1.9;
}

.empty-state-action {
    margin-top: 12px;
}

.state-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
    padding: 36px 22px;
    margin-top: 6px;
    border: 1px dashed var(--border-strong);
    border-radius: 22px;
    background: var(--surface);
}

.state-icon {
    width: 56px;
    height: 56px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    font-size: 27px;
    background: var(--surface-2);
    color: var(--text-2);
}

.state-icon.error {
    background: rgba(239, 68, 68, .10);
    color: var(--red);
}

.state-card h3 {
    margin: 0;
    font-size: .98rem;
}

.state-card p {
    margin: 0;
    max-width: 430px;
    font-size: .79rem;
    color: var(--text-2);
    line-height: 1.9;
}

.state-card .soft-btn {
    margin-top: 8px;
}

.skeleton-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.skeleton-card {
    display: flex;
    flex-direction: column;
    gap: 11px;
    padding: 18px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--surface);
}

.skeleton-card.tall {
    padding: 24px;
    gap: 13px;
}

.skeleton-line {
    display: block;
    height: 12px;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--surface-2) 25%, var(--bg-soft) 50%, var(--surface-2) 75%);
    background-size: 200% 100%;
    animation: ps-shimmer 1.4s ease infinite;
}

.skeleton-line.w40 { width: 40%; }
.skeleton-line.w60 { width: 60%; }
.skeleton-line.w80 { width: 80%; }

@keyframes ps-shimmer {
    to { background-position: -200% 0; }
}

/* ==========================================================================
   MudBlazor refinements
   ========================================================================== */

.mud-button-root {
    font-family: inherit !important;
    border-radius: 14px !important;
    letter-spacing: 0 !important;
}

.mud-button-filled.mud-button-filled-primary {
    box-shadow: 0 8px 20px rgba(180, 83, 9, .26);
}

.mud-button-root.page-action {
    padding-inline: 18px;
    height: 44px;
}

.mud-popover {
    border-radius: 16px !important;
}

.mud-list-item {
    font-family: inherit !important;
}

.mud-select .mud-input-outlined-border {
    border-radius: 14px !important;
}

.mud-input.mud-input-outlined .mud-input-outlined-border {
    border-color: var(--border-strong);
    border-radius: 14px;
}

.mud-input.mud-input-outlined:hover .mud-input-outlined-border {
    border-color: var(--text-3);
}

.mud-input.mud-input-outlined.mud-input-focused .mud-input-outlined-border {
    border-color: var(--primary);
    border-width: 1.5px;
}

.mud-input-label {
    font-family: inherit !important;
    font-size: .78rem !important;
    color: var(--text-2) !important;
}

.mud-input {
    font-family: inherit !important;
    font-size: .85rem !important;
    color: var(--text) !important;
}

.mud-input-root::placeholder {
    color: var(--text-3) !important;
}

.mud-dialog {
    border-radius: 24px !important;
    background: var(--surface) !important;
    color: var(--text) !important;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg) !important;
}

.mud-dialog .mud-dialog-title {
    padding: 22px 24px 4px;
}

.mud-dialog .mud-dialog-content {
    padding: 10px 24px;
}

.mud-dialog .mud-dialog-actions {
    padding: 12px 24px 20px;
    gap: 8px;
}

.mud-overlay .mud-overlay-scrim {
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

.mud-snackbar {
    border-radius: 14px !important;
    font-family: inherit !important;
    box-shadow: var(--shadow-md) !important;
}

.mud-snackbar .mud-snackbar-content-message {
    font-family: inherit !important;
    font-size: .8rem !important;
    line-height: 1.7;
}

/* Dialogs */

.dialog-heading {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.dialog-heading-icon {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border-radius: 14px;
    background: var(--primary-soft);
    color: var(--primary);
    display: grid;
    place-items: center;
    font-size: 22px;
}

.dialog-heading h3 {
    margin: 0 0 3px;
    font-size: 1rem;
    font-weight: 700;
}

.dialog-heading p {
    margin: 0;
    font-size: .73rem;
    color: var(--text-2);
    line-height: 1.75;
}

.dialog-tabs {
    display: flex;
    gap: 4px;
    padding: 4px;
    margin-bottom: 16px;
    border-radius: 13px;
    border: 1px solid var(--border);
    background: var(--surface-2);
}

.dialog-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--text-2);
    font-family: inherit;
    font-size: .78rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .18s ease, color .18s ease, box-shadow .18s ease;
}

.dialog-tab .mud-icon-root {
    font-size: 18px;
}

.dialog-tab.active {
    background: var(--surface);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.dialog-alert {
    margin-top: 12px;
    border-radius: 12px !important;
}

.qr-frame {
    position: relative;
    min-height: 258px;
    display: grid;
    place-items: center;
    border-radius: 20px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: #0D0A07;
}

.qr-reader {
    width: 100%;
    min-height: 258px;
    border: 0 !important;
}

.qr-reader video {
    border-radius: 0 !important;
    object-fit: cover;
}

.qr-reader img[alt="Info icon"] {
    display: none;
}

#qr-reader__status_span,
#qr-reader__header_message {
    display: none !important;
}

.qr-overlay {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 20px;
    text-align: center;
    background: rgba(11, 13, 22, .76);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
    color: #fff;
    font-size: .76rem;
    line-height: 1.8;
}

.qr-overlay > .mud-icon-root {
    font-size: 34px;
    opacity: .85;
}

.qr-overlay .soft-btn {
    margin-top: 4px;
    background: rgba(255, 255, 255, .14);
    border-color: rgba(255, 255, 255, .26);
    color: #fff;
}

.qr-hint {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-top: 12px;
    font-size: .71rem;
    color: var(--text-2);
    line-height: 1.8;
}

.qr-hint .mud-icon-root {
    font-size: 17px;
    flex-shrink: 0;
    margin-top: 2px;
}

.manual-note,
.local-mode-note {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 14px;
    padding: 10px 12px;
    border-radius: 12px;
    background: var(--surface-2);
    color: var(--text-2);
    font-size: .71rem;
    line-height: 1.7;
}

.local-mode-note .mud-icon-root {
    color: var(--amber);
    font-size: 18px;
    flex-shrink: 0;
}

.manual-note .mud-icon-root {
    color: var(--green);
    font-size: 18px;
    flex-shrink: 0;
}

.inline-loading {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    font-size: .74rem;
    color: var(--text-2);
}

.confirm-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.confirm-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    font-size: 21px;
    flex-shrink: 0;
}

.confirm-title h3 {
    margin: 0;
    font-size: .95rem;
}

.confirm-message {
    margin: 0;
    font-size: .81rem;
    color: var(--text-2);
    line-height: 1.9;
}

.row-gap {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.composer-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
    font-size: .69rem;
    color: var(--text-3);
}

.composer-meta span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.composer-meta .mud-icon-root {
    font-size: 15px;
}

/* ==========================================================================
   Auth
   ========================================================================== */

.auth-shell {
    position: relative;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: max(24px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom));
    overflow: hidden;
    background:
        linear-gradient(160deg, #FFF1E2 0%, #FBF7F2 48%, #EDF8F4 100%);
}

[data-theme="dark"] .auth-shell {
    background:
        radial-gradient(900px 520px at 90% -10%, rgba(234, 88, 12, .22), transparent 60%),
        radial-gradient(760px 480px at 0% 100%, rgba(45, 212, 191, .12), transparent 60%),
        #120E0A;
}

.auth-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(64px);
    pointer-events: none;
}

.orb-one {
    width: 380px;
    height: 380px;
    top: -130px;
    inset-inline-start: -80px;
    background: rgba(234, 88, 12, .30);
}

.orb-two {
    width: 330px;
    height: 330px;
    bottom: -120px;
    inset-inline-end: -70px;
    background: rgba(15, 118, 110, .20);
}

.orb-three {
    width: 180px;
    height: 180px;
    bottom: 18%;
    inset-inline-start: 14%;
    background: rgba(245, 158, 11, .18);
}

[data-theme="dark"] .orb-one { background: rgba(234, 88, 12, .22); }
[data-theme="dark"] .orb-two { background: rgba(45, 212, 191, .14); }
[data-theme="dark"] .orb-three { background: rgba(245, 158, 11, .10); }

.auth-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(var(--border) 1px, transparent 1px),
        linear-gradient(90deg, var(--border) 1px, transparent 1px);
    background-size: 56px 56px;
    -webkit-mask-image: radial-gradient(circle at 50% 42%, #000 0%, transparent 72%);
    mask-image: radial-gradient(circle at 50% 42%, #000 0%, transparent 72%);
    opacity: .55;
    pointer-events: none;
}

.auth-panel {
    position: relative;
    z-index: 2;
    width: min(440px, 100%);
}

.auth-card {
    padding: 28px;
    border-radius: 28px;
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow-lg);
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}

.auth-logo {
    width: 52px;
    height: 52px;
    border-radius: 17px;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 0 10px 22px rgba(180, 83, 9, .22);
}

.auth-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.auth-brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.4;
}

.auth-brand-text strong {
    font-size: 1.05rem;
    font-weight: 700;
}

.auth-brand-text span {
    font-size: .72rem;
    color: var(--text-3);
}

.auth-step-head h1 {
    margin: 0 0 8px;
    font-size: 1.32rem;
    font-weight: 800;
    line-height: 1.5;
}

.auth-step-head p {
    margin: 0 0 20px;
    font-size: .82rem;
    color: var(--text-2);
    line-height: 1.9;
}

.auth-submit {
    height: 52px !important;
    border-radius: 15px !important;
    font-size: .94rem !important;
    font-weight: 700 !important;
    margin-top: 2px;
    box-shadow: 0 10px 24px rgba(180, 83, 9, .26);
}

.auth-submit .mud-button-label {
    display: flex;
    align-items: center;
    gap: 8px;
}

.auth-trust {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 18px;
    font-size: .68rem;
    color: var(--text-3);
}

.auth-trust span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.auth-trust .mud-icon-root {
    font-size: 16px;
}

.auth-back {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 14px;
    padding: 5px 0;
    border: 0;
    background: none;
    color: var(--text-2);
    font-family: inherit;
    font-size: .76rem;
    cursor: pointer;
    transition: color .18s ease;
}

.auth-back:hover {
    color: var(--primary);
}

.auth-back .mud-icon-root {
    font-size: 17px;
}

.demo-code {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    padding: 11px 13px;
    margin-bottom: 16px;
    border-radius: 15px;
    border: 1px dashed rgba(180, 83, 9, .5);
    background: var(--primary-soft);
}

.demo-code-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.demo-code-label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: .68rem;
    color: var(--text-2);
}

.demo-code-label .mud-icon-root {
    font-size: 15px;
    color: var(--primary);
}

.demo-code-text strong {
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: .26em;
    color: var(--primary);
    line-height: 1.4;
}

.inline-phone {
    color: var(--text);
    font-weight: 700;
    letter-spacing: .03em;
}

.otp-wrap {
    position: relative;
    margin: 6px 0 8px;
    cursor: text;
}

.otp-input {
    position: absolute;
    inset: 0;
    z-index: 2;
    width: 100%;
    height: 100%;
    border: 0;
    opacity: 0;
    background: transparent;
    cursor: text;
}

.otp-boxes {
    display: flex;
    direction: ltr;
    justify-content: space-between;
    gap: 7px;
    pointer-events: none;
}

.otp-box {
    flex: 1;
    height: 56px;
    display: grid;
    place-items: center;
    border-radius: 15px;
    border: 1.5px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    font-size: 1.3rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    transition: border-color .18s ease, background .18s ease, box-shadow .18s ease;
}

.otp-box.filled {
    border-color: rgba(180, 83, 9, .55);
    background: var(--primary-soft);
    color: var(--primary);
}

.otp-box.active {
    border-color: var(--primary);
    background: var(--surface);
    box-shadow: 0 0 0 4px var(--primary-soft);
}

.otp-box.active::after {
    content: '';
    width: 2px;
    height: 22px;
    border-radius: 2px;
    background: var(--primary);
    animation: ps-blink 1s step-end infinite;
}

.otp-wrap.has-error .otp-box {
    border-color: var(--red);
    box-shadow: none;
}

@keyframes ps-blink {
    50% { opacity: 0; }
}

.otp-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
    margin: 8px 0 18px;
    font-size: .72rem;
    color: var(--text-2);
}

.otp-expiry {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.otp-expiry .mud-icon-root {
    font-size: 16px;
}

.auth-hint {
    margin: 16px 0 0;
    font-size: .72rem;
    color: var(--text-3);
    line-height: 1.9;
    text-align: center;
}

.auth-footer {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 20px;
    font-size: .69rem;
    color: var(--text-3);
    text-align: center;
}

.dot-sep {
    opacity: .6;
}

.notfound-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
    padding: 36px 28px;
}

.notfound-code {
    font-size: 3.6rem;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: .04em;
    background: linear-gradient(135deg, var(--primary), #D97706);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.notfound-card h1 {
    margin: 0;
    font-size: 1.2rem;
}

.notfound-card p {
    margin: 0;
    max-width: 320px;
    font-size: .8rem;
    color: var(--text-2);
    line-height: 1.9;
}

.notfound-card .primary-btn {
    margin-top: 10px;
}

/* ==========================================================================
   Dashboard
   ========================================================================== */

.dashboard {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.hero-card {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 28px;
    border-radius: 28px;
    background: var(--hero-gradient);
    color: #fff;
    box-shadow: var(--hero-shadow);
    overflow: hidden;
    isolation: isolate;
}

.hero-glow {
    position: absolute;
    width: 300px;
    height: 300px;
    top: -120px;
    inset-inline-end: -70px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, .30), transparent 68%);
    pointer-events: none;
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 660px;
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.hero-eyebrow {
    font-size: .72rem;
    font-weight: 600;
    opacity: .85;
}

.hero-content h1 {
    margin: 0;
    font-size: clamp(1.3rem, 3vw, 1.85rem);
    font-weight: 800;
    line-height: 1.5;
}

.hero-content p {
    margin: 0;
    font-size: .82rem;
    line-height: 1.95;
    opacity: .85;
}

.hero-chips {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 6px;
}

.hero-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 11px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, .22);
    background: rgba(255, 255, 255, .14);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    color: #fff;
    font-size: .7rem;
    font-weight: 500;
    text-decoration: none;
    transition: background .18s ease;
}

.hero-chip:hover {
    background: rgba(255, 255, 255, .22);
}

.hero-chip .mud-icon-root {
    font-size: 15px;
}

.hero-chip .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #FBBF24;
    box-shadow: 0 0 0 3px rgba(251, 191, 36, .22);
}

.hero-chip.ok .dot {
    background: #34D399;
    box-shadow: 0 0 0 3px rgba(52, 211, 153, .22);
}

.hero-art {
    position: relative;
    z-index: 0;
    flex-shrink: 0;
}

.hero-art img {
    width: 126px;
    height: 126px;
    border-radius: 34px;
    object-fit: cover;
    box-shadow: 0 18px 44px rgba(0, 0, 0, .28);
    transform: rotate(-4deg);
    opacity: .96;
}

.install-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 13px 16px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.install-icon {
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    border-radius: 13px;
    background: var(--primary-soft);
    color: var(--primary);
    display: grid;
    place-items: center;
    font-size: 21px;
}

.install-text {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 150px;
    line-height: 1.5;
}

.install-text strong {
    font-size: .84rem;
}

.install-text span {
    font-size: .72rem;
    color: var(--text-2);
}

.tile-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.image-tile {
    position: relative;
    display: block;
    min-height: 214px;
    border-radius: 26px;
    overflow: hidden;
    text-decoration: none;
    color: #fff;
    box-shadow: var(--shadow-md);
    isolation: isolate;
    transition: transform .25s ease, box-shadow .25s ease;
}

.image-tile:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.tile-image {
    position: absolute;
    inset: 0;
    z-index: -2;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .5s ease;
}

.image-tile:hover .tile-image {
    transform: scale(1.05);
}

.tile-shade {
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(to top, rgba(32, 15, 4, .90), rgba(45, 21, 6, .30) 58%, rgba(60, 28, 8, .06));
}

.tile-body {
    position: absolute;
    inset-inline: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px;
}

.tile-icon {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, .22);
    background: rgba(255, 255, 255, .16);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    display: grid;
    place-items: center;
    font-size: 24px;
}

.tile-text {
    flex: 1;
    min-width: 0;
}

.tile-text h3 {
    margin: 0 0 3px;
    font-size: 1.08rem;
    font-weight: 700;
}

.tile-text p {
    margin: 0;
    font-size: .74rem;
    opacity: .82;
}

.tile-arrow {
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .16);
    display: grid;
    place-items: center;
    font-size: 18px;
}

.tile-badge {
    position: absolute;
    top: 14px;
    inset-inline-end: 14px;
    padding: 5px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .94);
    color: #161A2B;
    font-size: .66rem;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .16);
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 15px;
    border-radius: 19px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: inherit;
    text-decoration: none;
    box-shadow: var(--shadow-sm);
    transition: transform .2s ease, border-color .2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: var(--border-strong);
}

.stat-icon {
    width: 43px;
    height: 43px;
    flex-shrink: 0;
    border-radius: 14px;
    display: grid;
    place-items: center;
    font-size: 21px;
}

.stat-icon.primary {
    background: rgba(180, 83, 9, .11);
    color: var(--primary);
}

.stat-icon.amber {
    background: rgba(245, 158, 11, .13);
    color: #D97706;
}

[data-theme="dark"] .stat-icon.amber { color: #FBBF24; }

.stat-icon.success {
    background: rgba(16, 185, 129, .13);
    color: #059669;
}

[data-theme="dark"] .stat-icon.success { color: #34D399; }

.stat-icon.muted {
    background: var(--surface-2);
    color: var(--text-2);
}

.stat-text {
    display: flex;
    flex-direction: column;
    line-height: 1.4;
    min-width: 0;
}

.stat-text strong {
    font-size: 1.22rem;
    font-weight: 700;
}

.stat-text .stat-word {
    font-size: .95rem;
}

.stat-text span {
    font-size: .69rem;
    color: var(--text-2);
}

.tip-card {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    padding: 15px 17px;
    border-radius: 20px;
    border: 1px dashed var(--border-strong);
    background: linear-gradient(120deg, var(--surface), var(--surface-2));
    color: var(--text-2);
}

.tip-card > .mud-icon-root {
    color: var(--amber);
    font-size: 21px;
    flex-shrink: 0;
    margin-top: 2px;
}

.tip-card strong {
    display: block;
    font-size: .8rem;
    color: var(--text);
}

.tip-card p {
    margin: 3px 0 0;
    font-size: .76rem;
    line-height: 1.9;
}

/* ==========================================================================
   Support
   ========================================================================== */

.connection-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 13px 16px;
    margin-bottom: 14px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.connection-banner.local {
    background: linear-gradient(120deg, rgba(245, 158, 11, .10), var(--surface) 62%);
    border-color: rgba(245, 158, 11, .32);
}

.connection-banner.connected {
    background: linear-gradient(120deg, rgba(16, 185, 129, .09), var(--surface) 62%);
    border-color: rgba(16, 185, 129, .28);
}

.conn-icon {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border-radius: 14px;
    background: var(--surface-2);
    color: var(--text-2);
    display: grid;
    place-items: center;
    font-size: 22px;
}

.connection-banner.local .conn-icon {
    background: rgba(245, 158, 11, .14);
    color: #B45309;
}

.connection-banner.connected .conn-icon {
    background: rgba(16, 185, 129, .13);
    color: #047857;
}

[data-theme="dark"] .connection-banner.local .conn-icon { color: #FBBF24; }
[data-theme="dark"] .connection-banner.connected .conn-icon { color: #34D399; }

.conn-text {
    flex: 1;
    min-width: 160px;
    display: flex;
    flex-direction: column;
    gap: 1px;
    line-height: 1.55;
}

.conn-text strong {
    font-size: .84rem;
}

.conn-text span {
    font-size: .72rem;
    color: var(--text-2);
}

.conn-text span[dir="ltr"] {
    text-align: start;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.connection-banner .banner-btn {
    margin-inline-start: auto;
}

.support-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.support-stat,
.profile-stat {
    display: flex;
    align-items: center;
    gap: 11px;
}

.support-stat {
    padding: 13px 15px;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.support-stat-icon {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 13px;
    display: grid;
    place-items: center;
    font-size: 20px;
    background: var(--surface-2);
    color: var(--text-2);
}

.support-stat-icon.primary {
    background: rgba(180, 83, 9, .11);
    color: var(--primary);
}

.support-stat-icon.amber {
    background: rgba(245, 158, 11, .13);
    color: #D97706;
}

[data-theme="dark"] .support-stat-icon.amber { color: #FBBF24; }

.support-stat-icon.muted {
    background: var(--surface-2);
    color: var(--text-2);
}

.support-stat div {
    display: flex;
    flex-direction: column;
    line-height: 1.4;
}

.support-stat strong,
.profile-stat strong {
    font-size: 1.08rem;
    font-weight: 700;
}

.support-stat span,
.profile-stat span {
    font-size: .69rem;
    color: var(--text-2);
}

.support-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 16px 0 12px;
}

.filter-row {
    display: flex;
    align-items: center;
    gap: 7px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
}

.filter-row::-webkit-scrollbar {
    display: none;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-2);
    font-family: inherit;
    font-size: .75rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: background .18s ease, color .18s ease, border-color .18s ease;
}

.filter-chip span {
    padding: 0 6px;
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--text-3);
    font-size: .64rem;
    line-height: 1.3rem;
}

.filter-chip:hover {
    border-color: var(--border-strong);
    color: var(--text);
}

.filter-chip.active {
    background: var(--primary);
    border-color: transparent;
    color: var(--primary-contrast);
}

.filter-chip.active span {
    background: rgba(255, 255, 255, .22);
    color: inherit;
}

.ticket-list {
    display: flex;
    flex-direction: column;
    gap: 11px;
}

.ticket-card {
    display: block;
    padding: 15px 17px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: inherit;
    text-decoration: none;
    box-shadow: var(--shadow-sm);
    transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}

.ticket-card:hover {
    transform: translateY(-2px);
    border-color: rgba(180, 83, 9, .4);
    box-shadow: var(--shadow-md);
}

.ticket-card.unread {
    border-inline-start: 3px solid var(--primary);
}

.ticket-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 7px;
}

.ticket-code {
    padding: 2px 8px;
    border-radius: 8px;
    background: var(--surface-2);
    color: var(--text-3);
    font-size: .67rem;
    font-weight: 600;
    letter-spacing: .07em;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: .67rem;
    font-weight: 600;
    white-space: nowrap;
}

.status-pill .mud-icon-root {
    font-size: 14px;
}

.status-pill.open {
    background: rgba(180, 83, 9, .11);
    color: #9A3412;
}

.status-pill.progress {
    background: rgba(245, 158, 11, .13);
    color: #B45309;
}

.status-pill.answered {
    background: rgba(16, 185, 129, .13);
    color: #047857;
}

.status-pill.closed {
    background: var(--surface-2);
    color: var(--text-2);
}

[data-theme="dark"] .status-pill.open { color: #FDBA74; }
[data-theme="dark"] .status-pill.progress { color: #FBBF24; }
[data-theme="dark"] .status-pill.answered { color: #34D399; }

.ticket-subject {
    margin: 0 0 5px;
    font-size: .95rem;
    font-weight: 700;
    line-height: 1.65;
}

.ticket-preview {
    margin: 0 0 10px;
    color: var(--text-2);
    font-size: .78rem;
    line-height: 1.85;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ticket-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px 13px;
    font-size: .68rem;
    color: var(--text-3);
}

.ticket-meta > span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.ticket-meta .mud-icon-root {
    font-size: 14px;
}

.priority {
    padding: 1px 8px;
    border-radius: 999px;
    font-size: .65rem;
    font-weight: 600;
    background: var(--surface-2);
    color: var(--text-2);
}

.priority.normal {
    background: rgba(15, 118, 110, .12);
    color: #0F766E;
}

.priority.high {
    background: rgba(245, 158, 11, .14);
    color: #B45309;
}

.priority.urgent {
    background: rgba(239, 68, 68, .12);
    color: #B91C1C;
}

[data-theme="dark"] .priority.normal { color: #2DD4BF; }
[data-theme="dark"] .priority.high { color: #FBBF24; }
[data-theme="dark"] .priority.urgent { color: #FCA5A5; }

.unread-pill {
    padding: 1px 8px;
    border-radius: 999px;
    background: var(--primary);
    color: var(--primary-contrast);
    font-size: .64rem;
    font-weight: 700;
}

.fab {
    position: fixed;
    bottom: calc(22px + env(safe-area-inset-bottom));
    inset-inline-start: 22px;
    z-index: 60;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 13px 18px;
    border: 0;
    border-radius: 999px;
    background: linear-gradient(135deg, #B45309, #7C2D12);
    color: #fff;
    font-family: inherit;
    font-size: .82rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 14px 32px rgba(180, 83, 9, .38);
    transition: transform .2s ease, box-shadow .2s ease;
}

.fab:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 38px rgba(180, 83, 9, .44);
}

.fab .mud-icon-root {
    font-size: 20px;
}

/* Ticket details */

.ticket-summary {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
    padding: 15px;
    margin-bottom: 14px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.summary-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    min-width: 0;
    padding-inline: 5px;
}

.summary-item > span:first-child {
    font-size: .66rem;
    color: var(--text-3);
}

.summary-item strong {
    font-size: .79rem;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.thread-card {
    margin-bottom: 14px;
    border-radius: 22px;
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.thread-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 14px 17px;
    border-bottom: 1px solid var(--border);
}

.thread-title {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: .88rem;
    font-weight: 700;
}

.thread-title .mud-icon-root {
    color: var(--primary);
    font-size: 19px;
}

.thread-count {
    font-size: .69rem;
    color: var(--text-3);
}

.thread {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 17px;
    background: linear-gradient(180deg, var(--surface-2), var(--surface));
}

.bubble-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    max-width: 100%;
}

.bubble-row.user {
    flex-direction: row-reverse;
}

.bubble-avatar {
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    border-radius: 11px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-2);
    display: grid;
    place-items: center;
    font-size: .66rem;
    font-weight: 700;
}

.bubble-row.agent .bubble-avatar {
    background: var(--primary-soft);
    border-color: rgba(180, 83, 9, .18);
    color: var(--primary);
}

.bubble-avatar .mud-icon-root {
    font-size: 19px;
}

.bubble-main {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: min(78%, 560px);
    min-width: 0;
}

.bubble-row.user .bubble-main {
    align-items: flex-end;
}

.bubble-meta {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: .64rem;
    color: var(--text-3);
}

.bubble-meta span {
    font-weight: 600;
    color: var(--text-2);
}

.bubble-row.user .bubble-meta {
    justify-content: flex-end;
}

.bubble {
    padding: 10px 13px;
    border-radius: 16px;
    border-start-start-radius: 5px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: .82rem;
    line-height: 1.95;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    box-shadow: 0 2px 8px rgba(63, 42, 20, .03);
}

.bubble-row.user .bubble {
    border: 0;
    border-start-start-radius: 16px;
    border-start-end-radius: 5px;
    background: linear-gradient(135deg, #B45309, #7C2D12);
    color: #fff;
    box-shadow: 0 8px 18px rgba(180, 83, 9, .22);
}

.thread-note {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 11px 17px;
    border-top: 1px dashed var(--border);
    background: var(--surface);
    color: var(--text-2);
    font-size: .69rem;
    line-height: 1.8;
}

.thread-note .mud-icon-root {
    color: var(--amber);
    font-size: 17px;
    flex-shrink: 0;
    margin-top: 1px;
}

.reply-section {
    margin-bottom: 16px;
}

.composer {
    padding: 13px;
    border-radius: 22px;
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    transition: border-color .18s ease, box-shadow .18s ease;
}

.composer:focus-within {
    border-color: rgba(180, 83, 9, .55);
    box-shadow: 0 0 0 4px var(--primary-soft);
}

.composer-input {
    width: 100%;
    min-height: 84px;
    max-height: 260px;
    padding: 5px 6px;
    border: 0;
    outline: none;
    resize: vertical;
    background: transparent;
    color: var(--text);
    font-family: inherit;
    font-size: .85rem;
    line-height: 1.95;
}

.composer-input::placeholder {
    color: var(--text-3);
    font-size: .8rem;
}

.composer-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 8px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.composer-hint {
    font-size: .67rem;
    color: var(--text-3);
}

.send-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 15px;
    border: 0;
    border-radius: 12px;
    background: var(--primary);
    color: var(--primary-contrast);
    font-family: inherit;
    font-size: .77rem;
    font-weight: 700;
    cursor: pointer;
    transition: filter .18s ease;
}

.send-btn:hover {
    filter: brightness(1.06);
}

.send-btn:disabled {
    opacity: .45;
    cursor: not-allowed;
}

.send-btn .mud-icon-root {
    font-size: 17px;
}

.closed-notice {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 15px;
    border-radius: 20px;
    border: 1px dashed var(--border-strong);
    background: var(--surface);
}

.closed-icon {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border-radius: 14px;
    background: var(--surface-2);
    color: var(--text-2);
    display: grid;
    place-items: center;
    font-size: 21px;
}

.closed-notice div {
    flex: 1;
    min-width: 170px;
}

.closed-notice strong {
    font-size: .84rem;
}

.closed-notice p {
    margin: 2px 0 0;
    font-size: .73rem;
    color: var(--text-2);
}

.closed-notice .soft-btn {
    margin-inline-start: auto;
}

/* ==========================================================================
   Map
   ========================================================================== */

.map-card {
    position: relative;
    margin-bottom: 14px;
    border-radius: 26px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--surface-2);
    box-shadow: var(--shadow-md);
    isolation: isolate;
}

.leaflet-map {
    width: 100%;
    height: clamp(320px, 52vh, 540px);
    background: var(--bg-soft);
    z-index: 1;
}

.leaflet-container {
    font-family: inherit;
    background: var(--bg-soft);
}

.leaflet-control-attribution {
    background: var(--glass) !important;
    color: var(--text-3) !important;
    font-family: inherit !important;
    font-size: 10px !important;
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}

.leaflet-control-attribution a {
    color: var(--text-2) !important;
}

.leaflet-bar {
    border: 1px solid var(--border) !important;
    box-shadow: var(--shadow-sm) !important;
    border-radius: 12px !important;
    overflow: hidden;
}

.leaflet-bar a {
    background: var(--surface) !important;
    color: var(--text-2) !important;
    border-color: var(--border) !important;
}

.leaflet-bar a:hover {
    background: var(--surface-2) !important;
    color: var(--primary) !important;
}

.map-overlay {
    position: absolute;
    inset: 0;
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 20px;
    text-align: center;
    background: rgba(245, 246, 250, .86);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    color: var(--text-2);
    font-size: .76rem;
}

[data-theme="dark"] .map-overlay {
    background: rgba(11, 13, 22, .84);
}

.map-overlay > .mud-icon-root {
    font-size: 36px;
    opacity: .6;
}

.map-actions {
    position: absolute;
    top: 14px;
    inset-inline-end: 14px;
    z-index: 4;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.map-action {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 14px;
    background: var(--surface);
    color: var(--text-2);
    box-shadow: var(--shadow-md);
    cursor: pointer;
    font-size: 22px;
    transition: color .18s ease, transform .18s ease;
}

.map-action:hover {
    color: var(--primary);
    transform: translateY(-1px);
}

.map-action:disabled {
    opacity: .5;
    cursor: not-allowed;
}

.map-hint {
    position: absolute;
    bottom: 14px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 4;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: calc(100% - 28px);
    padding: 7px 13px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--glass);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    box-shadow: var(--shadow-sm);
    color: var(--text-2);
    font-size: .68rem;
    white-space: nowrap;
    pointer-events: none;
}

.map-hint .mud-icon-root {
    font-size: 16px;
}

.ps-map-pin-wrap {
    background: transparent;
    border: 0;
}

.ps-map-pin {
    position: relative;
    width: 34px;
    height: 34px;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    background: linear-gradient(135deg, #B45309, #F59E0B);
    border: 3px solid #fff;
    box-shadow: 0 8px 20px rgba(36, 18, 5, .35);
    display: grid;
    place-items: center;
}

.ps-map-pin span {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #fff;
    transform: rotate(45deg);
}

.coords-card {
    padding: 17px;
    margin-bottom: 16px;
    border-radius: 22px;
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.coords-head {
    display: flex;
    align-items: center;
    gap: 11px;
    margin-bottom: 13px;
}

.coords-icon {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border-radius: 14px;
    background: var(--primary-soft);
    color: var(--primary);
    display: grid;
    place-items: center;
    font-size: 22px;
}

.coords-title {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    line-height: 1.5;
}

.coords-title strong {
    font-size: .87rem;
}

.coords-title span {
    font-size: .7rem;
    color: var(--text-2);
}

.coords-badge {
    padding: 4px 9px;
    border-radius: 999px;
    font-size: .64rem;
    font-weight: 700;
}

.coords-badge.gps {
    background: rgba(16, 185, 129, .13);
    color: #047857;
}

.coords-badge.manual {
    background: var(--primary-soft);
    color: var(--primary);
}

.coords-badge.saved {
    background: rgba(15, 118, 110, .13);
    color: #0F766E;
}

[data-theme="dark"] .coords-badge.gps { color: #34D399; }
[data-theme="dark"] .coords-badge.saved { color: #2DD4BF; }

.coords-empty {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px;
    border-radius: 14px;
    background: var(--surface-2);
    color: var(--text-3);
}

.coords-empty .mud-icon-root {
    font-size: 22px;
    flex-shrink: 0;
}

.coords-empty p {
    margin: 0;
    font-size: .75rem;
    line-height: 1.85;
}

.coords-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.coord {
    padding: 10px 12px;
    border-radius: 14px;
    background: var(--surface-2);
    min-width: 0;
}

.coord span {
    display: block;
    margin-bottom: 3px;
    font-size: .66rem;
    color: var(--text-3);
}

.coord strong {
    display: block;
    font-size: .85rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: .02em;
    overflow-wrap: anywhere;
}

.save-row {
    display: flex;
    align-items: center;
    gap: 9px;
    flex-wrap: wrap;
    margin-top: 13px;
}

.save-row .text-input {
    flex: 1;
    min-width: 190px;
    height: 46px;
    padding: 0 13px;
    border-radius: 13px;
    border: 1.5px solid var(--border);
    background: var(--surface-2);
}

.save-row .text-input:focus {
    border-color: var(--primary);
    background: var(--surface);
    box-shadow: 0 0 0 4px var(--primary-soft);
}

.saved-section {
    padding: 17px;
    border-radius: 22px;
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.saved-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 26px;
    color: var(--text-3);
    text-align: center;
}

.saved-empty .mud-icon-root {
    font-size: 32px;
    opacity: .6;
}

.saved-empty p {
    margin: 0;
    font-size: .75rem;
    line-height: 1.8;
}

.saved-list {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.saved-item {
    display: flex;
    align-items: stretch;
    border-radius: 14px;
    background: var(--surface-2);
    overflow: hidden;
    transition: background .18s ease;
}

.saved-item:hover {
    background: var(--bg-soft);
}

.saved-main {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 11px;
    border: 0;
    background: transparent;
    color: inherit;
    font-family: inherit;
    text-align: start;
    cursor: pointer;
}

.saved-icon {
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    border-radius: 10px;
    background: var(--surface);
    color: var(--primary);
    display: grid;
    place-items: center;
    font-size: 18px;
}

.saved-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    line-height: 1.45;
}

.saved-text strong {
    font-size: .78rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.saved-text small {
    font-size: .67rem;
    color: var(--text-3);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.saved-time {
    font-size: .65rem;
    color: var(--text-3);
    white-space: nowrap;
}

.saved-delete {
    width: 42px;
    flex-shrink: 0;
    border: 0;
    background: transparent;
    color: var(--text-3);
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: background .18s ease, color .18s ease;
}

.saved-delete:hover {
    background: rgba(239, 68, 68, .08);
    color: var(--red);
}

.saved-delete .mud-icon-root {
    font-size: 19px;
}

/* ==========================================================================
   Notifications
   ========================================================================== */

.notification-list {
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.notification-row {
    display: flex;
    align-items: stretch;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: border-color .18s ease;
}

.notification-row:hover {
    border-color: var(--border-strong);
}

.notification-row.unread {
    border-inline-start: 3px solid var(--primary);
}

.notification-row.read {
    background: var(--surface-2);
}

.notification-main {
    flex: 1;
    min-width: 0;
    display: flex;
    gap: 11px;
    padding: 12px 15px;
    color: inherit;
    text-decoration: none;
}

.notification-icon {
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    border-radius: 13px;
    display: grid;
    place-items: center;
    font-size: 21px;
    background: var(--surface-2);
    color: var(--text-2);
}

.notification-icon.ticket {
    background: rgba(180, 83, 9, .11);
    color: var(--primary);
}

.notification-icon.connection {
    background: rgba(16, 185, 129, .13);
    color: #047857;
}

.notification-icon.system {
    background: rgba(15, 118, 110, .13);
    color: #0F766E;
}

[data-theme="dark"] .notification-icon.connection { color: #34D399; }
[data-theme="dark"] .notification-icon.system { color: #2DD4BF; }

.notification-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.notification-head {
    display: flex;
    align-items: center;
    gap: 7px;
}

.notification-head strong {
    font-size: .82rem;
    font-weight: 700;
}

.unread-badge {
    width: 7px;
    height: 7px;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--primary);
}

.notification-text {
    font-size: .75rem;
    color: var(--text-2);
    line-height: 1.8;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.notification-meta {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-top: 3px;
    font-size: .66rem;
    color: var(--text-3);
}

.kind-pill {
    padding: 0 7px;
    border-radius: 999px;
    font-size: .62rem;
    font-weight: 600;
    background: var(--surface-2);
    color: var(--text-2);
}

.kind-pill.ticket {
    background: var(--primary-soft);
    color: var(--primary);
}

.kind-pill.connection {
    background: rgba(16, 185, 129, .12);
    color: #047857;
}

.kind-pill.system {
    background: rgba(15, 118, 110, .12);
    color: #0F766E;
}

[data-theme="dark"] .kind-pill.connection { color: #34D399; }
[data-theme="dark"] .kind-pill.system { color: #2DD4BF; }

.notification-delete {
    width: 44px;
    flex-shrink: 0;
    border: 0;
    background: transparent;
    color: var(--text-3);
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: background .18s ease, color .18s ease;
}

.notification-delete:hover {
    background: rgba(239, 68, 68, .08);
    color: var(--red);
}

.notification-delete .mud-icon-root {
    font-size: 18px;
}

/* ==========================================================================
   Profile & settings
   ========================================================================== */

.profile-hero {
    position: relative;
    display: flex;
    align-items: center;
    gap: 17px;
    flex-wrap: wrap;
    padding: 22px;
    margin-bottom: 16px;
    border-radius: 26px;
    border: 1px solid var(--border);
    background:
        linear-gradient(130deg, rgba(180, 83, 9, .13), rgba(15, 118, 110, .09) 62%, transparent 90%),
        var(--surface);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.profile-avatar {
    width: 82px;
    height: 82px;
    flex-shrink: 0;
    border-radius: 25px;
    background: linear-gradient(135deg, #B45309, #7C2D12);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 1.75rem;
    font-weight: 800;
    box-shadow: 0 12px 26px rgba(180, 83, 9, .28);
}

.profile-identity {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.profile-identity h2 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
}

.profile-phone {
    font-size: .79rem;
    color: var(--text-2);
    letter-spacing: .04em;
}

.verified-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 2px;
    font-size: .68rem;
    font-weight: 600;
    color: #047857;
}

[data-theme="dark"] .verified-badge { color: #34D399; }

.verified-badge .mud-icon-root {
    font-size: 15px;
}

.member-since {
    margin-inline-start: auto;
    align-self: flex-start;
    padding: 5px 10px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    font-size: .68rem;
    color: var(--text-3);
}

.profile-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

.profile-side {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.settings-card {
    padding: 19px;
    border-radius: 22px;
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.settings-card.compact {
    padding: 17px;
}

.card-head {
    margin-bottom: 14px;
}

.card-head h3 {
    margin: 0 0 5px;
    font-size: .92rem;
    font-weight: 700;
}

.card-head p {
    margin: 0;
    font-size: .73rem;
    color: var(--text-2);
    line-height: 1.8;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 4px;
}

.profile-stat {
    padding: 9px 0;
    border-bottom: 1px dashed var(--border);
}

.profile-stat:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.profile-stat div {
    display: flex;
    flex-direction: column;
    line-height: 1.4;
}

.info-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px dashed var(--border);
    font-size: .75rem;
    color: var(--text-2);
}

.info-row:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.info-row strong {
    font-size: .77rem;
    font-weight: 600;
    color: var(--text);
}

.ok-text { color: #059669 !important; }
.muted-text { color: var(--text-3) !important; }

[data-theme="dark"] .ok-text { color: #34D399 !important; }

.account-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 16px;
}

.logout-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 10px 15px;
    border-radius: 13px;
    border: 1px solid rgba(239, 68, 68, .26);
    background: rgba(239, 68, 68, .07);
    color: #DC2626;
    font-family: inherit;
    font-size: .77rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .18s ease, border-color .18s ease;
}

.logout-btn:hover {
    background: rgba(239, 68, 68, .13);
    border-color: rgba(239, 68, 68, .45);
}

.logout-btn .mud-icon-root {
    font-size: 18px;
}

[data-theme="dark"] .logout-btn { color: #F87171; }

/* Settings */

.settings-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    align-items: start;
}

.about-card {
    grid-column: 1 / -1;
}

.segmented {
    display: flex;
    gap: 4px;
    padding: 4px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--surface-2);
}

.segmented-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 6px;
    border: 0;
    border-radius: 11px;
    background: transparent;
    color: var(--text-2);
    font-family: inherit;
    font-size: .76rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .18s ease, color .18s ease, box-shadow .18s ease;
}

.segmented-btn .mud-icon-root {
    font-size: 18px;
}

.segmented-btn.active {
    background: var(--surface);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 0;
    border-bottom: 1px dashed var(--border);
}

.setting-row:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.setting-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.setting-info strong {
    font-size: .8rem;
    font-weight: 600;
}

.setting-info span {
    font-size: .7rem;
    color: var(--text-2);
    line-height: 1.7;
}

.switch {
    position: relative;
    display: inline-flex;
    flex-shrink: 0;
    cursor: pointer;
}

.switch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-track {
    position: relative;
    display: block;
    width: 46px;
    height: 27px;
    border-radius: 999px;
    background: var(--border-strong);
    transition: background .2s ease;
}

.switch-thumb {
    position: absolute;
    top: 3px;
    inset-inline-start: 3px;
    width: 21px;
    height: 21px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .22);
    transition: transform .2s ease;
}

.switch input:checked + .switch-track {
    background: var(--primary);
}

.switch input:checked + .switch-track .switch-thumb {
    transform: translateX(-19px);
}

.switch input:focus-visible + .switch-track {
    box-shadow: 0 0 0 4px var(--primary-soft);
}

.settings-status {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
    margin: 11px 0 4px;
}

.status-chip {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--text-2);
    font-size: .66rem;
    font-weight: 600;
}

.status-chip.ok {
    background: rgba(16, 185, 129, .12);
    color: #047857;
}

.status-chip.warn {
    background: rgba(245, 158, 11, .14);
    color: #B45309;
}

[data-theme="dark"] .status-chip.ok { color: #34D399; }
[data-theme="dark"] .status-chip.warn { color: #FBBF24; }

.settings-note {
    margin: 8px 0 4px;
    padding: 10px 12px;
    border-radius: 12px;
    background: var(--surface-2);
    color: var(--text-2);
    font-size: .7rem;
    line-height: 1.9;
}

.inline-code {
    display: inline-block;
    padding: 0 5px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--bg-soft);
    color: var(--primary);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .9em;
    direction: ltr;
}

.install-status {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 12px;
    border-radius: 14px;
    background: var(--surface-2);
}

.install-status-icon {
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    border-radius: 13px;
    background: var(--surface);
    color: var(--primary);
    display: grid;
    place-items: center;
    font-size: 21px;
}

.install-status strong {
    display: block;
    font-size: .81rem;
}

.install-status span {
    font-size: .7rem;
    color: var(--text-2);
    line-height: 1.7;
}

.setting-connection {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 13px;
    margin-bottom: 4px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--surface-2);
}

.setting-connection.local {
    background: rgba(245, 158, 11, .08);
    border-color: rgba(245, 158, 11, .28);
}

.setting-connection.connected {
    background: rgba(16, 185, 129, .08);
    border-color: rgba(16, 185, 129, .26);
}

.setting-connection-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.5;
}

.setting-connection-text strong {
    font-size: .8rem;
}

.setting-connection-text span {
    font-size: .69rem;
    color: var(--text-2);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.row-actions {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.about-row {
    display: flex;
    align-items: center;
    gap: 11px;
}

.about-logo {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    object-fit: cover;
}

.about-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    line-height: 1.5;
}

.about-text strong {
    font-size: .88rem;
}

.about-text span {
    font-size: .7rem;
    color: var(--text-2);
}

.about-tags {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 11px;
}

.about-tags span {
    padding: 3px 9px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text-2);
    font-size: .65rem;
}

/* ==========================================================================
   Boot screen & Blazor error UI
   ========================================================================== */

.boot-screen {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 24px;
    background: var(--bg);
    color: var(--text);
}

.boot-logo {
    width: 92px;
    height: 92px;
    margin-bottom: 10px;
    border-radius: 28px;
    object-fit: cover;
    box-shadow: var(--shadow-md);
}

.boot-title {
    font-size: 1.2rem;
    font-weight: 700;
}

.boot-sub {
    font-size: .78rem;
    color: var(--text-2);
}

.boot-spinner {
    width: 34px;
    height: 34px;
    margin-top: 16px;
    border-radius: 50%;
    border: 3px solid var(--primary-soft);
    border-top-color: var(--primary);
    animation: ps-spin .8s linear infinite;
}

#blazor-error-ui {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 2000;
    display: none;
    padding: 12px 18px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
    background: #B42318;
    color: #fff;
    font-family: 'Vazirmatn', sans-serif;
    font-size: .8rem;
    box-shadow: 0 -8px 24px rgba(0, 0, 0, .2);
}

#blazor-error-ui .reload {
    margin-inline-start: 8px;
    color: #fff;
    font-weight: 700;
}

#blazor-error-ui .dismiss {
    position: absolute;
    top: 8px;
    inset-inline-end: 12px;
    cursor: pointer;
    font-size: 1rem;
}

.blazor-error-boundary {
    padding: 16px 18px;
    border-radius: 16px;
    background: #B42318;
    color: #fff;
    font-size: .82rem;
}

.blazor-error-boundary::after {
    content: "خطایی رخ داده است.";
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid var(--green);
}

.invalid {
    outline: 1px solid var(--red);
}

.validation-message {
    color: var(--red);
    font-size: .73rem;
}

code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    color: var(--primary);
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (min-width: 1440px) {
    .page-wrap {
        width: min(1180px, 100% - 64px);
    }
}

@media (max-width: 980px) {
    .settings-grid,
    .profile-grid {
        grid-template-columns: 1fr;
    }

    .ticket-summary {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 820px) {
    .hero-art {
        display: none;
    }

    .profile-side {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .stat-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .coords-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 700px) {
    .float-header {
        left: 10px;
        right: 10px;
        height: 60px;
        border-radius: 20px;
        padding: 0 10px;
    }

    .app-main {
        padding-top: calc(60px + max(10px, env(safe-area-inset-top)) + 18px);
    }

    .page-wrap {
        width: calc(100% - 24px);
    }

    .brand-text small {
        display: none;
    }

    .hero-card {
        padding: 22px;
        border-radius: 24px;
    }

    .tile-grid {
        grid-template-columns: 1fr;
    }

    .image-tile {
        min-height: 176px;
        border-radius: 22px;
    }

    .stat-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .stat-card {
        padding: 12px 14px;
    }

    .support-stats {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
    }

    .support-stat {
        flex-direction: column;
        align-items: flex-start;
        gap: 7px;
        padding: 11px;
    }

    .support-stat-icon {
        width: 34px;
        height: 34px;
        border-radius: 11px;
        font-size: 18px;
    }

    .support-stat strong {
        font-size: .98rem;
    }

    .ticket-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 9px;
        padding: 13px;
    }

    .profile-hero {
        padding: 18px;
        gap: 13px;
        border-radius: 22px;
    }

    .profile-avatar {
        width: 66px;
        height: 66px;
        border-radius: 20px;
        font-size: 1.4rem;
    }

    .profile-identity h2 {
        font-size: 1.1rem;
    }

    .member-since {
        margin-inline-start: 0;
        align-self: center;
        margin-top: 2px;
    }

    .profile-side {
        display: flex;
        flex-direction: column;
    }

    .settings-grid {
        gap: 12px;
    }

    .settings-card {
        padding: 16px;
        border-radius: 20px;
    }

    .map-hint {
        font-size: .64rem;
    }

    .coords-grid {
        grid-template-columns: 1fr;
    }

    .bubble-main {
        max-width: 84%;
    }

    .ticket-meta {
        gap: 4px 10px;
    }

    .page-heading-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .fab {
        bottom: calc(18px + env(safe-area-inset-bottom));
        inset-inline-start: 16px;
    }
}

@media (max-width: 520px) {
    .auth-shell {
        padding: max(16px, env(safe-area-inset-top)) 12px max(16px, env(safe-area-inset-bottom));
    }

    .auth-card {
        padding: 22px 18px;
        border-radius: 24px;
    }

    .auth-logo {
        width: 46px;
        height: 46px;
        border-radius: 15px;
    }

    .auth-brand-text strong {
        font-size: .98rem;
    }

    .auth-step-head h1 {
        font-size: 1.18rem;
    }

    .otp-box {
        height: 50px;
        border-radius: 13px;
        font-size: 1.15rem;
    }

    .otp-boxes {
        gap: 5px;
    }

    .hero-content p {
        font-size: .78rem;
    }

    .hero-chip {
        font-size: .66rem;
        padding: 5px 10px;
    }

    .connection-banner {
        align-items: flex-start;
    }

    .connection-banner .banner-btn {
        width: 100%;
        margin-inline-start: 0;
    }

    .save-row .primary-btn {
        width: 100%;
    }

    .save-row .text-input {
        min-width: 0;
        width: 100%;
    }

    .reply-section .send-btn {
        flex: 1;
        justify-content: center;
    }

    .composer-hint {
        display: none;
    }

    .page-title {
        font-size: 1.18rem;
    }

    .drawer-layer {
        padding: 8px;
    }

    .float-drawer {
        width: calc(100vw - 16px);
        height: calc(100dvh - 16px);
        border-radius: 24px;
    }

    .settings-card,
    .saved-section,
    .coords-card {
        border-radius: 18px;
    }

    .notification-main {
        padding: 11px 12px;
    }

    .notification-icon {
        width: 38px;
        height: 38px;
        border-radius: 12px;
        font-size: 19px;
    }

    .member-since {
        font-size: .64rem;
    }

    .map-card {
        border-radius: 22px;
    }

    .map-action {
        width: 42px;
        height: 42px;
    }

    .fab span {
        display: none;
    }

    .fab {
        padding: 14px;
        border-radius: 50%;
    }

    .row-gap {
        grid-template-columns: 1fr;
    }

    .closed-notice .soft-btn {
        width: 100%;
    }

    .auth-trust {
        justify-content: center;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
        scroll-behavior: auto !important;
    }
}
