:root {
    --bg: #050511;
    --panel: rgba(11, 15, 31, 0.82);
    --panel-border: rgba(255, 255, 255, 0.1);
    --text: #f5f7ff;
    --muted: #9aa4c7;
    --primary: #8b5cf6;
    --secondary: #06b6d4;
    --accent: #ec4899;
    --shadow: 0 24px 80px rgba(2, 6, 23, 0.35);
    --radius: 24px;
    --font-heading: "Outfit", sans-serif;
    --font-body: "Plus Jakarta Sans", sans-serif;
    --shell-bg:
        radial-gradient(circle at top left, rgba(139, 92, 246, 0.28), transparent 32%),
        radial-gradient(circle at bottom right, rgba(6, 182, 212, 0.22), transparent 28%),
        linear-gradient(180deg, #050511 0%, #090d1d 100%);
    --sidebar-bg: rgba(5, 5, 17, 0.75);
    --nav-hover-bg: rgba(255, 255, 255, 0.05);
    --nav-hover-border: rgba(255, 255, 255, 0.08);
    --field-bg: rgba(255, 255, 255, 0.04);
    --soft-bg: rgba(255, 255, 255, 0.03);
    --soft-border: rgba(255, 255, 255, 0.06);
    --table-border: rgba(255, 255, 255, 0.08);
    --chart-grid: rgba(255, 255, 255, 0.08);
    --chart-area: rgba(96, 165, 250, 0.12);
    --chart-line: rgba(96, 165, 250, 0.9);
    --chart-point: rgba(96, 165, 250, 0.95);
    --chart-point-today: rgba(236, 72, 153, 0.9);
    --table-link: #a5f3fc;
    --table-link-hover: #ecfeff;
    --sidebar-width: 290px;
    --sidebar-collapsed-width: 110px;
}

:root[data-theme="light"] {
    --bg: #f4f7fb;
    --panel: rgba(255, 255, 255, 0.92);
    --panel-border: rgba(15, 23, 42, 0.08);
    --text: #111827;
    --muted: #64748b;
    --primary: #2563eb;
    --secondary: #0891b2;
    --accent: #db2777;
    --shadow: 0 22px 48px rgba(15, 23, 42, 0.08);
    --shell-bg:
        radial-gradient(circle at top left, rgba(37, 99, 235, 0.1), transparent 30%),
        radial-gradient(circle at bottom right, rgba(8, 145, 178, 0.1), transparent 25%),
        linear-gradient(180deg, #f7fafc 0%, #eef4fb 100%);
    --sidebar-bg: rgba(248, 250, 252, 0.86);
    --nav-hover-bg: rgba(37, 99, 235, 0.06);
    --nav-hover-border: rgba(37, 99, 235, 0.12);
    --field-bg: rgba(15, 23, 42, 0.03);
    --soft-bg: rgba(15, 23, 42, 0.025);
    --soft-border: rgba(15, 23, 42, 0.08);
    --table-border: rgba(15, 23, 42, 0.08);
    --chart-grid: rgba(15, 23, 42, 0.08);
    --chart-area: rgba(37, 99, 235, 0.12);
    --chart-line: rgba(37, 99, 235, 0.8);
    --chart-point: rgba(37, 99, 235, 0.9);
    --chart-point-today: rgba(219, 39, 119, 0.86);
    --table-link: #1d4ed8;
    --table-link-hover: #1e3a8a;
    --sidebar-width: 290px;
    --sidebar-collapsed-width: 110px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    background: var(--shell-bg);
    color: var(--text);
    font-family: var(--font-body);
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input {
    font: inherit;
}

textarea,
select {
    font: inherit;
}

h1,
h2,
h3 {
    margin: 0;
    font-family: var(--font-heading);
    letter-spacing: -0.04em;
}

p {
    margin: 0;
    color: var(--muted);
}

.admin-shell {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    min-height: 100vh;
    transition: grid-template-columns 0.25s ease;
}

.admin-shell.sidebar-collapsed {
    grid-template-columns: var(--sidebar-collapsed-width) 1fr;
}

.admin-sidebar {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    height: 100vh;
    padding: 2rem 1.5rem;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--panel-border);
    backdrop-filter: blur(18px);
    transition: padding 0.25s ease;
}

.brand-block,
.sidebar-footer,
.topbar,
.panel,
.metric-card,
.login-panel,
.login-copy {
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.brand-block {
    padding: 1.5rem;
}

.brand-header,
.user-badge {
    display: flex;
    align-items: center;
    gap: 0.9rem;
}

.brand-header {
    justify-content: space-between;
    margin-bottom: 1rem;
}

.brand-mark,
.user-badge-icon,
.nav-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.brand-mark,
.user-badge-icon {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.22), rgba(6, 182, 212, 0.2));
    color: var(--text);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.sidebar-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border: 1px solid var(--panel-border);
    border-radius: 14px;
    background: var(--soft-bg);
    color: var(--text);
    cursor: pointer;
    transition: 0.2s ease;
}

.sidebar-toggle:hover {
    background: var(--nav-hover-bg);
}

.brand-kicker,
.eyebrow,
.topbar-kicker {
    color: var(--secondary);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.brand-title {
    display: inline-block;
    margin-top: 0.75rem;
    font-size: 2rem;
    font-family: var(--font-heading);
    font-weight: 700;
}

.brand-copy {
    margin-top: 0.75rem;
    line-height: 1.7;
}

.sidebar-nav {
    display: grid;
    gap: 0.75rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 1rem 1.1rem;
    border-radius: 18px;
    color: var(--muted);
    transition: 0.25s ease;
    border: 1px solid transparent;
    font-weight: 600;
}

.nav-icon {
    width: 1.25rem;
    color: var(--secondary);
    flex: 0 0 1.25rem;
}

.nav-label {
    white-space: nowrap;
}

.nav-item:hover,
.nav-item.active {
    color: var(--text);
    background: var(--nav-hover-bg);
    border-color: var(--nav-hover-border);
}

.nav-item:hover .nav-icon,
.nav-item.active .nav-icon {
    color: var(--text);
}

.sidebar-footer {
    margin-top: auto;
    padding: 1rem;
}

.sidebar-footer form {
    width: 100%;
}

.user-badge {
    margin-bottom: 1rem;
}

.user-badge-text {
    display: grid;
    gap: 0.3rem;
    min-width: 0;
}

.user-badge-label,
.metric-label,
.metric-foot,
.table-secondary,
small,
.pager-summary,
.pager-current {
    color: var(--muted);
}

.admin-main {
    padding: 1.5rem;
}

.topbar {
    margin-bottom: 1.5rem;
    padding: 1.25rem 1.5rem;
}

.topbar-title {
    margin-top: 0.5rem;
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
}

.topbar-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.logout-button {
    width: 100%;
    gap: 0.7rem;
}

.page-shell {
    display: grid;
    gap: 1.5rem;
}

.page-toast {
    position: fixed;
    top: 1.25rem;
    right: 1.25rem;
    z-index: 30;
    max-width: min(420px, calc(100vw - 2rem));
    padding: 0.85rem 1rem;
    border-radius: 14px;
    border: 1px solid rgba(34, 197, 94, 0.2);
    background: rgba(15, 23, 42, 0.9);
    color: #dcfce7;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.18);
    backdrop-filter: blur(12px);
}

:root[data-theme="light"] .page-toast {
    background: rgba(255, 255, 255, 0.96);
    color: #166534;
}

.tab-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.filter-panel {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.85rem 1rem;
    padding: 1rem 1.1rem;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.filter-label {
    color: var(--muted);
    font-size: 0.84rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.filter-check {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    color: var(--text);
}

.filter-check input {
    width: 18px;
    height: 18px;
}

.filter-toggles {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
}

.filter-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    min-height: 42px;
    padding: 0.45rem 0.7rem;
    border: 1px solid var(--soft-border);
    border-radius: 14px;
    background: var(--soft-bg);
    color: var(--text);
    cursor: pointer;
    transition: 0.18s ease;
}

.filter-toggle:hover {
    border-color: var(--panel-border);
    background: var(--field-bg);
}

.filter-toggle input {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--secondary);
}

.filter-toggle-body {
    display: grid;
    gap: 0.05rem;
}

.filter-toggle-body strong {
    font-size: 0.83rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.filter-toggle-body small {
    color: var(--muted);
    font-size: 0.72rem;
    line-height: 1.25;
}

.search-field {
    display: grid;
    gap: 0.45rem;
    min-width: min(100%, 420px);
}

.search-field input {
    width: 100%;
    min-height: 52px;
    padding: 0.9rem 1rem;
    border-radius: 16px;
    border: 1px solid var(--panel-border);
    background: var(--field-bg);
    color: var(--text);
}

.lookup-list {
    display: grid;
    gap: 0.65rem;
    margin-top: 1rem;
}

.d-none {
    display: none !important;
}

.lookup-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    width: 100%;
    padding: 0.9rem 1rem;
    border-radius: 18px;
    border: 1px solid var(--panel-border);
    background: var(--soft-bg);
    color: var(--text);
    text-align: left;
    cursor: pointer;
    transition: 0.2s ease;
}

.lookup-item:hover {
    background: var(--nav-hover-bg);
}

.lookup-item span {
    display: grid;
    gap: 0.2rem;
}

.compact-grid {
    margin-top: 1rem;
}

.inline-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1rem;
}

.inline-actions-tight {
    justify-content: end;
    gap: 0.5rem;
    margin-top: 0;
}

.affiliate-flag {
    padding-top: 1.8rem;
}

.tab-button {
    min-height: 46px;
    padding: 0.8rem 1rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
    color: var(--muted);
    cursor: pointer;
    transition: 0.25s ease;
}

.tab-button.active {
    color: var(--text);
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.24), rgba(236, 72, 153, 0.24));
    border-color: rgba(139, 92, 246, 0.35);
}

.page-header {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 1rem;
}

.page-header h1 {
    margin-top: 0.4rem;
    font-size: clamp(2rem, 3vw, 3rem);
}

.stats-grid,
.content-grid {
    display: grid;
    gap: 1.5rem;
}

.stats-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.content-grid {
    grid-template-columns: 1.3fr 1fr;
}

.content-grid-balanced {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: start;
}

.metric-card,
.panel {
    padding: 1.5rem;
}

.metric-card {
    display: grid;
    gap: 0.65rem;
}

.metric-card-hero {
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(circle at top right, rgba(6, 182, 212, 0.22), transparent 38%),
        linear-gradient(135deg, rgba(139, 92, 246, 0.16), rgba(236, 72, 153, 0.12)),
        var(--panel);
}

.metric-card strong {
    font-size: 2rem;
    font-family: var(--font-heading);
}

.metric-card-hero strong {
    font-size: clamp(3rem, 8vw, 4.75rem);
    line-height: 0.95;
}

.metric-foot-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1rem;
}

.panel-header {
    margin-bottom: 1.25rem;
}

.panel-header h2 {
    margin-top: 0.35rem;
    font-size: 1.35rem;
}

.panel-half {
    width: 100%;
}

.chart-panel {
    overflow-x: auto;
    padding-bottom: 0.25rem;
}

.chart-frame {
    display: grid;
    gap: 0.9rem;
    min-width: 420px;
}

.chart-summary {
    display: grid;
    gap: 0.2rem;
}

.chart-summary strong {
    font-size: 1rem;
    font-family: var(--font-heading);
    font-weight: 600;
}

.chart-summary span {
    color: var(--muted);
    font-size: 0.82rem;
}

.chart-layout {
    display: grid;
    grid-template-columns: 78px minmax(0, 1fr);
    gap: 0.9rem;
    align-items: start;
}

.chart-y-axis {
    display: grid;
    align-content: stretch;
    height: 220px;
}

.chart-axis-title {
    color: var(--muted);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 0.55rem;
}

.chart-y-label {
    color: var(--muted);
    font-size: 0.74rem;
    font-weight: 600;
    line-height: 1;
}

.chart-main {
    display: grid;
    gap: 0.65rem;
}

.activity-chart {
    width: 100%;
    height: 220px;
    overflow: visible;
}

.chart-grid-line {
    stroke: rgba(255, 255, 255, 0.08);
    stroke-width: 1;
}

.chart-area {
    fill: rgba(96, 165, 250, 0.12);
}

.chart-line {
    fill: none;
    stroke: rgba(96, 165, 250, 0.9);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.chart-point {
    fill: rgba(96, 165, 250, 0.95);
}

.chart-point.today {
    fill: rgba(236, 72, 153, 0.9);
}

.chart-axis {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
}

.chart-axis-label {
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 600;
    opacity: 0.72;
}

.chart-axis-label.today {
    color: #f9a8d4;
    opacity: 1;
}

.chart-x-axis-title {
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    text-align: center;
}

.table-wrap {
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table th,
.admin-table td {
    padding: 0.78rem 0.7rem;
    text-align: left;
    border-bottom: 1px solid var(--table-border);
}

.table-link {
    color: var(--table-link);
    text-decoration: underline;
    text-decoration-color: rgba(165, 243, 252, 0.35);
}

.table-link:hover {
    color: var(--table-link-hover);
}

.admin-table th {
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.table-sort {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    letter-spacing: inherit;
    text-transform: inherit;
    cursor: pointer;
}

.table-sort:hover {
    color: var(--text);
}

.admin-table td {
    font-size: 0.94rem;
    line-height: 1.35;
}

.date-edit {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 300px;
}

.date-edit input {
    min-height: 42px;
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    background: var(--field-bg);
    color: var(--text);
}

.date-edit .ghost-button {
    min-height: 42px;
    padding: 0.65rem 0.9rem;
    border-radius: 12px;
    white-space: nowrap;
}

.inline-feedback {
    margin-bottom: 1rem;
    padding: 0.8rem 1rem;
    border: 1px solid rgba(6, 182, 212, 0.25);
    border-radius: 14px;
    background: rgba(6, 182, 212, 0.08);
    color: var(--text);
    font-size: 0.92rem;
}

.admin-table-compact th,
.admin-table-compact td {
    padding: 0.62rem 0.58rem;
}

.admin-table-compact td {
    font-size: 0.88rem;
    line-height: 1.25;
}

.table-bio-compact {
    max-width: 340px;
    margin-top: 0.15rem;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: 0.78rem;
}

.user-name-row {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    max-width: 100%;
}

.recipient-verified-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--success, #22c55e);
    font-size: 0.88rem;
    line-height: 1;
    opacity: 0.9;
}

.user-row-cell {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    min-width: 0;
}

.user-row-main {
    min-width: 0;
}

.user-list-avatar-wrap {
    flex: 0 0 auto;
}

.user-list-avatar {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    object-fit: cover;
    border: 1px solid var(--panel-border);
}

.user-list-avatar-fallback {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.25), rgba(6, 182, 212, 0.2));
    color: var(--text);
    font-size: 0.82rem;
    font-family: var(--font-heading);
    font-weight: 700;
}

.whatsapp-inline-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.45rem;
    height: 1.45rem;
    border-radius: 999px;
    color: #22c55e;
    background: rgba(34, 197, 94, 0.12);
    font-size: 0.86rem;
    transition: 0.2s ease;
}

.whatsapp-inline-link:hover {
    background: rgba(34, 197, 94, 0.2);
    color: #16a34a;
}

.admin-table-compact .ghost-button,
.admin-table-compact .primary-button,
.admin-table-compact .danger-button {
    min-height: 36px;
    padding: 0.55rem 0.8rem;
    border-radius: 12px;
    font-size: 0.82rem;
}

.align-right {
    text-align: right !important;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.45rem 0.8rem;
    border-radius: 999px;
    background: rgba(139, 92, 246, 0.14);
    color: #ddd6fe;
    border: 1px solid rgba(139, 92, 246, 0.28);
    font-size: 0.84rem;
    font-weight: 600;
}

.platform-pill {
    background: rgba(6, 182, 212, 0.12);
    color: #a5f3fc;
    border-color: rgba(6, 182, 212, 0.24);
}

.os-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    font-size: 0.95rem;
}

.os-icon i {
    line-height: 1;
}

.os-icon.android {
    background: rgba(16, 185, 129, 0.14);
    color: #a7f3d0;
    border-color: rgba(16, 185, 129, 0.3);
}

.os-icon.ios {
    background: rgba(139, 92, 246, 0.14);
    color: #ddd6fe;
    border-color: rgba(139, 92, 246, 0.3);
}

.os-icon.unknown {
    background: rgba(148, 163, 184, 0.14);
    color: #e2e8f0;
    border-color: rgba(148, 163, 184, 0.24);
}

.stack-list {
    display: grid;
    gap: 0.85rem;
}

.stack-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem;
    border-radius: 18px;
    background: var(--soft-bg);
    border: 1px solid var(--soft-border);
}

.stack-meta {
    display: grid;
    justify-items: end;
    gap: 0.5rem;
}

.profile-hero {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 1.5rem;
    align-items: center;
}

.profile-avatar-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-avatar {
    width: 112px;
    height: 112px;
    border-radius: 28px;
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.profile-avatar-fallback {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.25), rgba(6, 182, 212, 0.2));
    color: var(--text);
    font-size: 2rem;
    font-family: var(--font-heading);
    font-weight: 700;
}

.profile-hero-content {
    display: grid;
    gap: 1rem;
}

.profile-pill-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.detail-item {
    display: grid;
    gap: 0.35rem;
    padding: 0.95rem 1rem;
    border-radius: 18px;
    background: var(--soft-bg);
    border: 1px solid var(--soft-border);
}

.detail-item-full {
    grid-column: 1 / -1;
}

.detail-item-logo {
    align-items: start;
}

.detail-item span {
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.external-link {
    color: #a5f3fc;
    text-decoration: underline;
    text-decoration-color: rgba(165, 243, 252, 0.35);
    font-weight: 600;
    word-break: break-word;
}

.external-link:hover {
    color: #ecfeff;
}

.logo-link {
    display: inline-flex;
    width: 120px;
    height: 120px;
    border-radius: 18px;
    overflow: hidden;
    border: 1px solid var(--panel-border);
    background: var(--soft-bg);
}

.profile-logo-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    aspect-ratio: 1 / 1;
}

.loading-state,
.empty-state {
    display: grid;
    place-items: center;
    gap: 1rem;
    min-height: 240px;
    text-align: center;
}

.empty-state.compact {
    min-height: 140px;
}

.inline-loading-state {
    min-height: 180px;
}

.inline-loading-state h3 {
    font-size: 1.1rem;
}

.spinner {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.15);
    border-top-color: var(--secondary);
    animation: spin 0.9s linear infinite;
}

.pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1.25rem;
    padding-top: 1rem;
}

.pager-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.ghost-button,
.primary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 0.85rem 1.25rem;
    border-radius: 16px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: 0.25s ease;
}

.theme-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    min-height: 46px;
    padding: 0.8rem 1rem;
    border-radius: 999px;
    border: 1px solid var(--panel-border);
    background: var(--soft-bg);
    color: var(--text);
    cursor: pointer;
    transition: 0.2s ease;
}

.form-select {
    width: 100%;
    min-height: 54px;
    padding: 0.9rem 1rem;
    border-radius: 16px;
    border: 1px solid var(--panel-border);
    background: var(--field-bg);
    color: var(--text);
}

.theme-toggle:hover {
    background: var(--nav-hover-bg);
}

.danger-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0.7rem 1rem;
    border-radius: 14px;
    border: 1px solid rgba(251, 113, 133, 0.28);
    background: rgba(251, 113, 133, 0.12);
    color: #ffe4e6;
    cursor: pointer;
    transition: 0.25s ease;
}

.danger-button:hover:not(:disabled) {
    background: rgba(251, 113, 133, 0.18);
}

.danger-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.ghost-button {
    background: var(--soft-bg);
    color: var(--text);
    border-color: var(--panel-border);
}

.ghost-button:hover:not(:disabled) {
    background: var(--nav-hover-bg);
}

.ghost-button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

@media (min-width: 1101px) {
    .admin-shell.sidebar-collapsed .admin-sidebar {
        padding-inline: 1rem;
    }

    .admin-shell.sidebar-collapsed .brand-block,
    .admin-shell.sidebar-collapsed .sidebar-footer {
        padding-inline: 0.9rem;
    }

    .admin-shell.sidebar-collapsed .brand-header {
        justify-content: center;
        flex-direction: column;
        margin-bottom: 0;
    }

    .admin-shell.sidebar-collapsed .brand-kicker,
    .admin-shell.sidebar-collapsed .brand-copy,
    .admin-shell.sidebar-collapsed .nav-label,
    .admin-shell.sidebar-collapsed .user-badge-text,
    .admin-shell.sidebar-collapsed .logout-button span {
        display: none;
    }

    .admin-shell.sidebar-collapsed .brand-title {
        display: block;
        margin-top: 1rem;
        text-align: center;
        font-size: 1rem;
    }

    .admin-shell.sidebar-collapsed .sidebar-nav {
        justify-items: center;
    }

    .admin-shell.sidebar-collapsed .nav-item {
        justify-content: center;
        padding-inline: 0.85rem;
    }

    .admin-shell.sidebar-collapsed .sidebar-footer {
        display: grid;
        justify-items: center;
        gap: 1rem;
    }

    .admin-shell.sidebar-collapsed .sidebar-footer form {
        display: flex;
        justify-content: center;
    }

    .admin-shell.sidebar-collapsed .user-badge {
        margin-bottom: 0;
    }

    .admin-shell.sidebar-collapsed .logout-button {
        width: 3rem;
        padding-inline: 0;
    }
}

.primary-button {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    color: #fff;
    font-weight: 700;
}

.auth-shell {
    position: relative;
    display: grid;
    min-height: 100vh;
    overflow: hidden;
}

.auth-main {
    display: grid;
    place-items: center;
    padding: 2rem;
}

.auth-ambient {
    position: absolute;
    border-radius: 999px;
    filter: blur(110px);
    opacity: 0.5;
}

.auth-ambient-primary {
    top: -10rem;
    left: -6rem;
    width: 26rem;
    height: 26rem;
    background: rgba(139, 92, 246, 0.5);
}

.auth-ambient-secondary {
    right: -4rem;
    bottom: -8rem;
    width: 24rem;
    height: 24rem;
    background: rgba(6, 182, 212, 0.32);
}

.login-card {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 1.2fr 0.9fr;
    gap: 1.5rem;
    width: min(1100px, 100%);
}

.login-copy,
.login-panel {
    padding: 2rem;
}

.login-copy h1 {
    margin: 0.75rem 0 1rem;
    font-size: clamp(2.4rem, 5vw, 4.2rem);
    line-height: 1;
}

.login-panel h2 {
    margin-bottom: 1rem;
}

.login-form {
    display: grid;
    gap: 1rem;
}

.form-field {
    display: grid;
    gap: 0.5rem;
}

.form-field-full {
    grid-column: 1 / -1;
}

.form-field span,
.checkbox-field {
    color: var(--muted);
}

.form-field input,
.form-field textarea,
.form-field select {
    width: 100%;
    min-height: 54px;
    padding: 0.9rem 1rem;
    border-radius: 16px;
    border: 1px solid var(--panel-border);
    background: var(--field-bg);
    color: var(--text);
}

.form-field textarea {
    min-height: 132px;
    resize: vertical;
}

.crm-status-select {
    width: 100%;
    min-height: 40px;
    padding: 0.5rem 0.75rem;
    border-radius: 12px;
    border: 1px solid var(--panel-border);
    background: var(--field-bg);
    color: var(--text);
}

.crm-notes-textarea {
    width: 100%;
    min-height: 180px;
    padding: 0.9rem 1rem;
    border-radius: 16px;
    border: 1px solid var(--panel-border);
    background: var(--field-bg);
    color: var(--text);
    resize: vertical;
}

.template-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.template-tag-button,
.template-import-button {
    min-height: 38px;
    padding: 0.55rem 0.8rem;
    border-radius: 999px;
}

.email-editor-grid {
    display: grid;
    gap: 1rem;
}

.email-editor-code {
    width: 100%;
    min-height: 520px;
    padding: 1rem;
    border-radius: 18px;
    border: 1px solid var(--panel-border);
    background: var(--field-bg);
    color: var(--text);
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.9rem;
    white-space: pre;
}

.email-preview-frame {
    width: 100%;
    border: 0;
    border-radius: 0;
    background: #fff;
    display: block;
    min-height: 100%;
    height: auto;
}

.email-preview-empty {
    min-height: 320px;
    border: 0;
    border-radius: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    background: var(--soft-bg);
    text-align: center;
    padding: 2rem;
}

.email-preview-shell {
    display: grid;
    gap: 0.85rem;
}

.email-preview-shell__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.email-preview-scroll {
    max-height: 720px;
    overflow: auto;
    border-radius: 0.85rem;
    background: #fff;
    padding: 0;
    scrollbar-gutter: stable both-edges;
}

.email-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    z-index: 10990;
}

.email-modal {
    position: fixed;
    inset: 0;
    z-index: 11000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 1rem 1rem 2rem;
    overflow-y: auto;
}

.email-modal__dialog {
    width: min(1140px, 100%);
    margin-top: 0.75rem;
}

.procedure-cell {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.info-icon-button {
    width: 1.35rem;
    height: 1.35rem;
    border-radius: 999px;
    border: 1px solid var(--panel-border);
    background: var(--soft-bg);
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.info-icon-button:hover {
    color: var(--text);
    background: var(--nav-hover-bg);
}

.procedure-modal {
    width: min(720px, 100%);
}

.procedure-modal__body {
    margin-top: 1rem;
}

.checkbox-field {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.alert {
    margin-bottom: 1rem;
    padding: 0.9rem 1rem;
    border-radius: 16px;
}

.alert.error {
    color: #ffe4e6;
    background: rgba(251, 113, 133, 0.12);
    border: 1px solid rgba(251, 113, 133, 0.2);
}

.alert.success {
    color: #d1fae5;
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

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

@media (max-width: 1100px) {
    .admin-shell,
    .content-grid,
    .login-card,
    .stats-grid,
    .profile-hero,
    .detail-grid {
        grid-template-columns: 1fr;
    }

    .panel-half {
        width: 100%;
    }

    .admin-sidebar {
        position: static;
        height: auto;
    }

    .sidebar-toggle {
        display: none;
    }
}

@media (max-width: 720px) {
    .admin-main,
    .auth-main {
        padding: 1rem;
    }

    .topbar-row {
        display: grid;
    }

    .panel,
    .metric-card,
    .topbar,
    .brand-block,
    .sidebar-footer,
    .login-panel,
    .login-copy {
        padding: 1.25rem;
    }

    .pager,
    .stack-item,
    .page-header {
        display: grid;
    }

    .chart-frame {
        min-width: 520px;
    }
}
