/* /dashboard/assets/css/styles.css */

/* -------------------------------------------------------------------------- */
/*                                Base Styles                                 */
/* -------------------------------------------------------------------------- */

*, *::before, *::after {
    box-sizing: border-box;
}

:root {
    --brand: #51007F;
    --primary-color: #51007F;
    --primary-hover: #6a00ab;
    --green-color: #22c55e;
    --green-hover: #16a34a;
    --red-color: #ef4444;
    --red-hover: #dc2626;
    --gray-color: #6b7280;
    --gray-hover: #4b5563;
    --error-color: #ef4444;
    --font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
    --font-size: 16px;
    --header-height: 100px;
    --orb-opacity: 0.30;

    /* Light defaults; explicit theme selectors below define runtime values. */
    --bg: #f6f7fb;
    --text: #1b1c20;
    --muted: #5c5f66;
    --card: rgba(255,255,255,0.72);
    --stroke: rgba(10,12,16,0.08);

    --surface: rgba(255,255,255,0.72);
    --surface-strong: rgba(255,255,255,0.92);
    --surface-solid: #ffffff;
    --surface-border: rgba(10,12,16,0.08);
    --surface-shadow: 0 18px 40px rgba(10,12,16,0.10);
    --auth-surface: #ffffff;
    --auth-surface-border: rgba(10,12,16,0.10);
    --auth-surface-shadow: 0 18px 40px rgba(10,12,16,0.12);

    --sidebar-bg: rgba(255,255,255,0.7);
    --sidebar-hover: rgba(81,0,127,0.08);
    --sidebar-active: rgba(81,0,127,0.16);
    --submenu-bg: rgba(81,0,127,0.04);
    --menu-divider: rgba(10,12,16,0.08);

    --content-bg: rgba(255,255,255,0.8);
    --input-bg: #ffffff;
    --input-border: rgba(10,12,16,0.12);
    --input-focus: rgba(81,0,127,0.25);
    --loading-surface-bg: transparent;
    --loading-spinner-track: rgba(27,28,32,0.16);
    --overlay-bg: rgba(0,0,0,0.35);
    --brand-accent: #6a00ab;
    --brand-accent-bg: rgba(81,0,127,0.12);
    --brand-accent-text: #51007F;
    --input-disabled-bg: #f3f4f7;
    --footer-bg: rgba(0,0,0,0.03);

    --btn-primary-from: #6a00ab;
    --btn-primary-to: var(--primary-color);
    --btn-green-from: #16a34a;
    --btn-green-to: var(--green-color);
    --btn-red-from: #dc2626;
    --btn-red-to: var(--red-color);
    --btn-gray-from: #4b5563;
    --btn-gray-to: var(--gray-color);
    --btn-shadow: 0 10px 20px rgba(81,0,127,0.35);
    --btn-green-shadow: 0 10px 20px rgba(34,197,94,0.25);
    --btn-red-shadow: 0 10px 20px rgba(239,68,68,0.25);
    --btn-gray-shadow: 0 10px 20px rgba(107,114,128,0.25);
    --toggle-on: var(--green-color);
    --toggle-off: var(--red-color);

    --table-head-bg: rgba(81,0,127,0.08);
    --table-row-alt: rgba(0,0,0,0.02);
    --table-row-hover: rgba(81,0,127,0.06);
}

:root:not([data-theme]) {
    color-scheme: light;
    --auth-orb-core: rgba(214, 181, 247, 0.46);
    --auth-orb-mid: rgba(181, 139, 231, 0.18);
    --auth-backdrop-1: rgba(186, 150, 236, 0.12);
    --auth-backdrop-2: rgba(168, 128, 225, 0.10);
    --auth-backdrop-3: rgba(145, 112, 206, 0.09);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) {
        color-scheme: dark;
        --bg: #1b1b24;
        --text: #e9e9ee;
        --muted: #b9bbbf;
        --card: rgba(255,255,255,0.08);
        --stroke: rgba(255,255,255,0.16);

        --surface: rgba(255,255,255,0.08);
        --surface-strong: rgba(255,255,255,0.16);
        --surface-solid: rgba(24,24,32,0.98);
        --surface-border: rgba(255,255,255,0.16);
        --surface-shadow: 0 18px 40px rgba(0,0,0,0.35);
        --auth-surface: #181820;
        --auth-surface-border: rgba(255,255,255,0.18);
        --auth-surface-shadow: 0 18px 40px rgba(0,0,0,0.42);

        --sidebar-bg: rgba(255,255,255,0.08);
        --sidebar-hover: rgba(255,255,255,0.08);
        --sidebar-active: rgba(81,0,127,0.25);
        --submenu-bg: rgba(255,255,255,0.04);
        --menu-divider: rgba(255,255,255,0.15);

        --content-bg: rgba(255,255,255,0.08);
        --input-bg: rgba(0,0,0,0.2);
        --input-border: rgba(255,255,255,0.16);
        --input-focus: rgba(81,0,127,0.35);
        --loading-surface-bg: transparent;
        --loading-spinner-track: rgba(233,233,238,0.20);
        --overlay-bg: rgba(0,0,0,0.45);
        --brand-accent: #d8b4fe;
        --brand-accent-bg: rgba(216,180,254,0.28);
        --brand-accent-text: #f5e9ff;
        --input-disabled-bg: rgba(255,255,255,0.14);
        --footer-bg: rgba(0,0,0,0.15);

        --btn-primary-from: #5b0f7a;
        --btn-primary-to: #7a2f9e;
        --btn-green-from: #157a49;
        --btn-green-to: #2a9f5e;
        --btn-red-from: #a84444;
        --btn-red-to: #d16565;
        --btn-gray-from: #4b5563;
        --btn-gray-to: #6b7280;
        --btn-shadow: 0 8px 16px rgba(0,0,0,0.35);
        --btn-green-shadow: 0 8px 16px rgba(22,163,74,0.18);
        --btn-red-shadow: 0 8px 16px rgba(220,38,38,0.18);
        --btn-gray-shadow: 0 8px 16px rgba(107,114,128,0.20);
        --toggle-on: rgba(42,159,94,0.7);
        --toggle-off: rgba(209,101,101,0.7);

        --table-head-bg: rgba(255,255,255,0.08);
        --table-row-alt: rgba(255,255,255,0.04);
        --table-row-hover: rgba(255,255,255,0.08);
        --auth-orb-core: rgba(96, 58, 142, 0.32);
        --auth-orb-mid: rgba(56, 28, 94, 0.34);
        --auth-backdrop-1: rgba(22, 12, 38, 0.70);
        --auth-backdrop-2: rgba(30, 15, 52, 0.62);
        --auth-backdrop-3: rgba(18, 10, 34, 0.66);
    }
}

:root[data-theme="light"] {
    color-scheme: light;
    --bg: #f6f7fb;
    --text: #1b1c20;
    --muted: #5c5f66;
    --card: rgba(255,255,255,0.72);
    --stroke: rgba(10,12,16,0.08);

    --surface: rgba(255,255,255,0.72);
    --surface-strong: rgba(255,255,255,0.92);
    --surface-solid: #ffffff;
    --surface-border: rgba(10,12,16,0.08);
    --surface-shadow: 0 18px 40px rgba(10,12,16,0.10);
    --auth-surface: #ffffff;
    --auth-surface-border: rgba(10,12,16,0.10);
    --auth-surface-shadow: 0 18px 40px rgba(10,12,16,0.12);

    --sidebar-bg: rgba(255,255,255,0.7);
    --sidebar-hover: rgba(81,0,127,0.08);
    --sidebar-active: rgba(81,0,127,0.16);
    --submenu-bg: rgba(81,0,127,0.04);
    --menu-divider: rgba(10,12,16,0.08);

    --content-bg: rgba(255,255,255,0.8);
    --input-bg: #ffffff;
    --input-border: rgba(10,12,16,0.12);
    --input-focus: rgba(81,0,127,0.25);
    --loading-surface-bg: transparent;
    --loading-spinner-track: rgba(27,28,32,0.16);
    --overlay-bg: rgba(0,0,0,0.35);
    --brand-accent: #6a00ab;
    --brand-accent-bg: rgba(81,0,127,0.12);
    --brand-accent-text: #51007F;
    --input-disabled-bg: #f3f4f7;
    --footer-bg: rgba(0,0,0,0.03);

    --btn-primary-from: #6a00ab;
    --btn-primary-to: var(--primary-color);
    --btn-green-from: #16a34a;
    --btn-green-to: var(--green-color);
    --btn-red-from: #dc2626;
    --btn-red-to: var(--red-color);
    --btn-gray-from: #4b5563;
    --btn-gray-to: var(--gray-color);
    --btn-shadow: 0 10px 20px rgba(81,0,127,0.35);
    --btn-green-shadow: 0 10px 20px rgba(34,197,94,0.25);
    --btn-red-shadow: 0 10px 20px rgba(239,68,68,0.25);
    --btn-gray-shadow: 0 10px 20px rgba(107,114,128,0.25);
    --toggle-on: var(--green-color);
    --toggle-off: var(--red-color);

    --table-head-bg: rgba(81,0,127,0.08);
    --table-row-alt: rgba(0,0,0,0.02);
    --table-row-hover: rgba(81,0,127,0.06);
    --auth-orb-core: rgba(214, 181, 247, 0.46);
    --auth-orb-mid: rgba(181, 139, 231, 0.18);
    --auth-backdrop-1: rgba(186, 150, 236, 0.12);
    --auth-backdrop-2: rgba(168, 128, 225, 0.10);
    --auth-backdrop-3: rgba(145, 112, 206, 0.09);
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #1b1b24;
    --text: #e9e9ee;
    --muted: #b9bbbf;
    --card: rgba(255,255,255,0.08);
    --stroke: rgba(255,255,255,0.16);

    --surface: rgba(255,255,255,0.08);
    --surface-strong: rgba(255,255,255,0.16);
    --surface-solid: rgba(24,24,32,0.98);
    --surface-border: rgba(255,255,255,0.16);
    --surface-shadow: 0 18px 40px rgba(0,0,0,0.35);
    --auth-surface: #181820;
    --auth-surface-border: rgba(255,255,255,0.18);
    --auth-surface-shadow: 0 18px 40px rgba(0,0,0,0.42);

    --sidebar-bg: rgba(255,255,255,0.08);
    --sidebar-hover: rgba(255,255,255,0.08);
    --sidebar-active: rgba(81,0,127,0.25);
    --submenu-bg: rgba(255,255,255,0.04);
    --menu-divider: rgba(255,255,255,0.15);

    --content-bg: rgba(255,255,255,0.08);
    --input-bg: rgba(0,0,0,0.20);
    --input-border: rgba(255,255,255,0.16);
    --input-focus: rgba(81,0,127,0.35);
    --loading-surface-bg: transparent;
    --loading-spinner-track: rgba(233,233,238,0.20);
    --overlay-bg: rgba(0,0,0,0.45);
    --brand-accent: #d8b4fe;
    --brand-accent-bg: rgba(216,180,254,0.28);
    --brand-accent-text: #f5e9ff;
    --input-disabled-bg: rgba(255,255,255,0.14);
    --footer-bg: rgba(0,0,0,0.15);

    --btn-primary-from: #5b0f7a;
    --btn-primary-to: #7a2f9e;
    --btn-green-from: #157a49;
    --btn-green-to: #2a9f5e;
    --btn-red-from: #a84444;
    --btn-red-to: #d16565;
    --btn-gray-from: #4b5563;
    --btn-gray-to: #6b7280;
    --btn-shadow: 0 8px 16px rgba(0,0,0,0.35);
    --btn-green-shadow: 0 8px 16px rgba(22,163,74,0.18);
    --btn-red-shadow: 0 8px 16px rgba(220,38,38,0.18);
    --btn-gray-shadow: 0 8px 16px rgba(107,114,128,0.20);
    --toggle-on: rgba(42,159,94,0.7);
    --toggle-off: rgba(209,101,101,0.7);

    --table-head-bg: rgba(255,255,255,0.08);
    --table-row-alt: rgba(255,255,255,0.04);
    --table-row-hover: rgba(255,255,255,0.08);
    --auth-orb-core: rgba(96, 58, 142, 0.32);
    --auth-orb-mid: rgba(56, 28, 94, 0.34);
    --auth-backdrop-1: rgba(22, 12, 38, 0.70);
    --auth-backdrop-2: rgba(30, 15, 52, 0.62);
    --auth-backdrop-3: rgba(18, 10, 34, 0.66);
}

body,
h1, h2, h3, h4, h5, h6,
p,
label,
input, textarea, select,
button,
.error-message {
    font-family: var(--font-family);
}

#installationCode {
    font-size: 14px;
}

body {
    margin: 0;
    padding: 0;
    font-size: var(--font-size);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background-color: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h2.section-content {
    margin-top: 0;
    text-align: center;
}

/* -------------------------------------------------------------------------- */
/*                        Background Orbs (Match /main)                       */
/* -------------------------------------------------------------------------- */

.bg-orbs {
    position: fixed;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

.bg-orb {
    position: absolute;
    border-radius: 9999px;
    opacity: calc(var(--orb-opacity, 0.3) * var(--oAlpha, 1));
    filter: blur(var(--oBlur, 28px));
    transform: translate3d(0,0,0);
    background: radial-gradient(
        circle at 30% 30%,
        rgba(198, 98, 255, 0.95) 0%,
        rgba(81, 0, 127, 0.35) 35%,
        rgba(81, 0, 127, 0.00) 65%,
        transparent 72%
    );
    animation: orbFloat var(--oSpeed, 14s) ease-in-out infinite alternate;
    will-change: transform;
}

.bg-orb.orb-1 {
    width: clamp(360px, 44vw, 620px);
    height: clamp(360px, 44vw, 620px);
    left: -14vw;
    top: -18vh;
    --oAlpha: 1.00;
    --oBlur: 42px;
    --oDx: 18px;
    --oDy: -12px;
    --oSpeed: 18s;
}

.bg-orb.orb-2 {
    width: clamp(260px, 30vw, 440px);
    height: clamp(260px, 30vw, 440px);
    right: -10vw;
    top: 6vh;
    --oAlpha: 0.85;
    --oBlur: 36px;
    --oDx: -14px;
    --oDy: 10px;
    --oSpeed: 20s;
}

.bg-orb.orb-3 {
    width: clamp(320px, 36vw, 520px);
    height: clamp(320px, 36vw, 520px);
    left: 8vw;
    bottom: -22vh;
    --oAlpha: 0.80;
    --oBlur: 40px;
    --oDx: 14px;
    --oDy: -10px;
    --oSpeed: 22s;
}

.bg-orb.orb-4 {
    width: clamp(220px, 22vw, 340px);
    height: clamp(220px, 22vw, 340px);
    right: -16vw;
    top: 58vh;
    --oAlpha: 0.70;
    --oBlur: 34px;
    --oDx: -12px;
    --oDy: -12px;
    --oSpeed: 24s;
}

@media (max-width: 800px) {
    .bg-orb.orb-4 { display: none; }
    .bg-orb.orb-1 { left: -28vw; top: -22vh; }
    .bg-orb.orb-2 { right: -22vw; top: 14vh; }
    .bg-orb.orb-3 { left: -6vw; bottom: -26vh; }
}

:root[data-theme="dark"] .bg-orb { mix-blend-mode: screen; }
:root[data-theme="light"] .bg-orb { mix-blend-mode: normal; }

/* Logged-out route: use direct body backgrounds to avoid mobile compositor inversion. */
body.logged-out {
    --orb-opacity: 0;
}

body.logged-out .bg-orbs {
    display: none;
}

body.logged-out::before {
    content: none !important;
}

:root:not([data-theme]) body.logged-out,
:root[data-theme="light"] body.logged-out {
    background:
        radial-gradient(980px 680px at 10% 0%, rgba(186, 150, 236, 0.12), transparent 62%),
        radial-gradient(760px 560px at 86% 10%, rgba(168, 128, 225, 0.10), transparent 62%),
        radial-gradient(860px 660px at 50% 100%, rgba(145, 112, 206, 0.09), transparent 64%),
        linear-gradient(180deg, #fbfcff 0%, #eef1f8 100%);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) body.logged-out {
        background:
            radial-gradient(980px 680px at 10% 0%, rgba(22, 12, 38, 0.70), transparent 62%),
            radial-gradient(760px 560px at 86% 10%, rgba(30, 15, 52, 0.62), transparent 62%),
            radial-gradient(860px 660px at 50% 100%, rgba(18, 10, 34, 0.66), transparent 64%),
            linear-gradient(180deg, #232332 0%, #181823 100%);
    }
}

:root[data-theme="dark"] body.logged-out {
    background:
        radial-gradient(980px 680px at 10% 0%, rgba(22, 12, 38, 0.70), transparent 62%),
        radial-gradient(760px 560px at 86% 10%, rgba(30, 15, 52, 0.62), transparent 62%),
        radial-gradient(860px 660px at 50% 100%, rgba(18, 10, 34, 0.66), transparent 64%),
        linear-gradient(180deg, #232332 0%, #181823 100%);
}

/* Logged-in routes: same direct-background strategy for stable theme switching on mobile. */
body.logged-in {
    --orb-opacity: 0;
}

body.logged-in .bg-orbs {
    display: none;
}

body.logged-in::before {
    content: none !important;
}

:root:not([data-theme]) body.logged-in,
:root[data-theme="light"] body.logged-in {
    background:
        radial-gradient(980px 680px at 10% 0%, rgba(186, 150, 236, 0.12), transparent 62%),
        radial-gradient(760px 560px at 86% 10%, rgba(168, 128, 225, 0.10), transparent 62%),
        radial-gradient(860px 660px at 50% 100%, rgba(145, 112, 206, 0.09), transparent 64%),
        linear-gradient(180deg, #f8f9fd 0%, #eef1f8 100%);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) body.logged-in {
        background:
            radial-gradient(980px 680px at 10% 0%, rgba(22, 12, 38, 0.70), transparent 62%),
            radial-gradient(760px 560px at 86% 10%, rgba(30, 15, 52, 0.62), transparent 62%),
            radial-gradient(860px 660px at 50% 100%, rgba(18, 10, 34, 0.66), transparent 64%),
            linear-gradient(180deg, #232332 0%, #181823 100%);
    }
}

:root[data-theme="dark"] body.logged-in {
    background:
        radial-gradient(980px 680px at 10% 0%, rgba(22, 12, 38, 0.70), transparent 62%),
        radial-gradient(760px 560px at 86% 10%, rgba(30, 15, 52, 0.62), transparent 62%),
        radial-gradient(860px 660px at 50% 100%, rgba(18, 10, 34, 0.66), transparent 64%),
        linear-gradient(180deg, #232332 0%, #181823 100%);
}

:root:not([data-theme]) body.logged-out,
:root[data-theme="light"] body.logged-out,
:root[data-theme="dark"] body.logged-out,
:root:not([data-theme]) body.logged-in,
:root[data-theme="light"] body.logged-in,
:root[data-theme="dark"] body.logged-in {
    background-repeat: no-repeat;
    background-attachment: fixed;
}

@keyframes orbFloat {
    from { transform: translate3d(0,0,0) scale(1); }
    to   { transform: translate3d(var(--oDx, 18px), var(--oDy, -14px), 0) scale(1.03); }
}

@media (prefers-reduced-motion: reduce) {
    .bg-orb { animation: none !important; }
}

/* -------------------------------------------------------------------------- */
/*                                Header Styles                               */
/* -------------------------------------------------------------------------- */

header {
    background: var(--surface-solid);
    border-bottom: 1px solid var(--surface-border);
    padding: 0 1.25rem;
    width: 100%;
    position: relative;
    z-index: 5;
    height: var(--header-height);
    min-height: var(--header-height);
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0,0,0,0.35);
}

nav {
    display: flex;
    justify-content: center;
    align-items: center;
    max-width: 80em;
    margin: 0 auto;
    height: 100%;
    gap: 1rem;
    position: relative;
    z-index: 1;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    position: absolute;
    right: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
}

.dashboard-burger {
    display: none;
    background: var(--surface);
    border: 1px solid var(--surface-border);
    color: var(--text);
    width: 40px;
    height: 40px;
    border-radius: 999px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: 0.2s ease;
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.dashboard-burger svg {
    width: 20px;
    height: 20px;
}

.dashboard-burger:hover {
    background: var(--surface-strong);
}

.theme-toggle {
    background: transparent;
    border: 1px solid var(--surface-border);
    color: var(--text);
    padding: 8px;
    border-radius: 50%;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s ease;
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

button,
.button,
[role="button"],
.menu li,
.submenu li {
    touch-action: manipulation;
}

.sidebar-overlay {
    display: none;
}

.theme-toggle:hover {
    background: var(--surface);
    color: var(--brand);
}

:root[data-theme="dark"] .theme-toggle:hover {
    background: rgba(216,180,254,0.20);
    border-color: rgba(216,180,254,0.45);
    color: #e9d5ff;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) .theme-toggle:hover {
        background: rgba(216,180,254,0.20);
        border-color: rgba(216,180,254,0.45);
        color: #e9d5ff;
    }
}

.theme-toggle svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.icon-moon { display: none; }
.icon-sun { display: block; }
:root[data-theme="light"] .icon-sun { display: none; }
:root[data-theme="light"] .icon-moon { display: block; }

accountStatus {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .5rem;
    padding: 1rem;
}
accountStatus .notification {
    background-color: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 12px;
    padding: .5em 1em;
    color: var(--text);
    font-size: .9em;
    max-width: 90%;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
    text-align: center;
}
accountStatus .notification a {
    color: var(--text);
    text-decoration: underline;
}

accountStatus .notification-impersonating {
    background-color: rgba(245, 158, 11, 0.14);
    border-color: rgba(245, 158, 11, 0.4);
    color: #7c4a03;
}
accountStatus .notification-impersonating a {
    color: inherit;
}

:root[data-theme="dark"] accountStatus .notification-impersonating {
    background-color: rgba(245, 158, 11, 0.22);
    border-color: rgba(252, 211, 77, 0.48);
    color: #fef3c7;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) accountStatus .notification-impersonating {
        background-color: rgba(245, 158, 11, 0.22);
        border-color: rgba(252, 211, 77, 0.48);
        color: #fef3c7;
    }
}

accountStatus .notification-red {
    background-color: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 12px;
    padding: .5em 1em;
    color: var(--text);
    font-size: .9em;
    max-width: 90%;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
    text-align: center;
}

accountStatus .notification-red a {
    color: var(--text);
    text-decoration: underline;
}



/* -------------------------------------------------------------------------- */
/*                               Footer Styles                                */
/* -------------------------------------------------------------------------- */

footer {
    background: var(--footer-bg);
    color: var(--muted);
    text-align: center;
    padding: 1rem;
    width: 100%;
    position: relative;
    border-top: 1px solid var(--surface-border);
}

/* -------------------------------------------------------------------------- */
/*                             Main Content Styles                            */
/* -------------------------------------------------------------------------- */

main {
    flex: 1;
    display: flex;
    justify-content: center;
    padding: 1rem;
    position: relative;
    z-index: auto;
}

body.logged-in main {
    flex: 1;
    display: flex;
}

h2.section-content {
    margin-top: 0;
}

/* -------------------------------------------------------------------------- */
/*                             Login Page Styles                              */
/* -------------------------------------------------------------------------- */

.login-container {
    max-width: 400px;
    width: 100%;
    height: fit-content;
    padding: 2rem;
    margin: 0 auto;
    background: var(--surface);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius);
    box-shadow: var(--surface-shadow);
}

.create-account-container {
    max-width: 400px;
    width: 100%;
    height: fit-content;
    padding: 2rem;
    margin: 20px auto;
    background: var(--surface);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius);
    box-shadow: var(--surface-shadow);
}

body.logged-out .login-container,
body.logged-out .create-account-container,
body.logged-out .modal-content {
    background: var(--auth-surface);
    border-color: var(--auth-surface-border);
    box-shadow: var(--auth-surface-shadow);
}

.container-wrapper {
    width: 100%;
    display: block;
}


.h1-title {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    margin-top: 0;
    font-size: 1.5rem;
    color: var(--text);
    font-weight: 600;
}

.h1-title-tight {
    margin-bottom: 0;
}

.logo-img {
    padding: 0;
    height: 100%;
    width: auto;
    max-width: 220px;
    object-fit: contain;
}

/* Override shared branding rule `.logo img { width: 60px; }` */
header .logo img.logo-img {
    width: auto;
    height: 100%;
    max-height: 100%;
    max-width: 220px;
}

header .logo,
header .logo a {
    height: 100%;
    display: flex;
    align-items: center;
    padding: 5px;
}

:root:not([data-theme]) body.logged-in header,
:root[data-theme="light"] body.logged-in header {
    background: rgba(255,255,255,0.92);
    border-bottom-color: rgba(10,12,16,0.10);
    box-shadow: 0 8px 24px rgba(10,12,16,0.12);
}

:root:not([data-theme]) body.logged-in header::before,
:root[data-theme="light"] body.logged-in header::before {
    content: none;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) body.logged-in header {
        background: rgba(28,28,40,0.94);
        border-bottom-color: rgba(255,255,255,0.14);
        box-shadow: 0 8px 24px rgba(0,0,0,0.45);
    }

    :root:not([data-theme]) body.logged-in header::before {
        content: "";
        position: absolute;
        inset: 0;
        background: radial-gradient(
            circle at 50% 40%,
            rgba(231,208,255,0.38) 0%,
            rgba(184,128,230,0.14) 34%,
            rgba(120,64,180,0.04) 60%,
            rgba(255,255,255,0) 72%
        );
        pointer-events: none;
        z-index: 0;
        opacity: 0.8;
    }
}

:root[data-theme="dark"] body.logged-in header {
    background: rgba(28,28,40,0.94);
    border-bottom-color: rgba(255,255,255,0.14);
    box-shadow: 0 8px 24px rgba(0,0,0,0.45);
}

:root[data-theme="dark"] body.logged-in header::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(
        circle at 50% 40%,
        rgba(231,208,255,0.38) 0%,
        rgba(184,128,230,0.14) 34%,
        rgba(120,64,180,0.04) 60%,
        rgba(255,255,255,0) 72%
    );
    pointer-events: none;
    z-index: 0;
    opacity: 0.8;
}

body.logged-out header::before {
    content: none !important;
}

:root:not([data-theme]) body.logged-out header,
:root[data-theme="light"] body.logged-out header {
    background: rgba(255,255,255,0.92);
    border-bottom-color: rgba(10,12,16,0.10);
    box-shadow: 0 8px 24px rgba(10,12,16,0.12);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) body.logged-out header {
        background:
            radial-gradient(
                circle at 50% 40%,
                rgba(231,208,255,0.38) 0%,
                rgba(184,128,230,0.14) 34%,
                rgba(120,64,180,0.04) 60%,
                rgba(255,255,255,0) 72%
            ),
            rgba(28,28,40,0.94);
        border-bottom-color: rgba(255,255,255,0.14);
        box-shadow: 0 8px 24px rgba(0,0,0,0.45);
    }
}

:root[data-theme="dark"] body.logged-out header {
    background:
        radial-gradient(
            circle at 50% 40%,
            rgba(231,208,255,0.38) 0%,
            rgba(184,128,230,0.14) 34%,
            rgba(120,64,180,0.04) 60%,
            rgba(255,255,255,0) 72%
        ),
        rgba(28,28,40,0.94);
    border-bottom-color: rgba(255,255,255,0.14);
    box-shadow: 0 8px 24px rgba(0,0,0,0.45);
}

.login-logo {
    width: 40px;
    height: auto;
    margin-right: 0.5rem;
}

.password-field {
    position: relative;
}

.password-field input {
    padding-right: 72px;
}

.pw-toggle {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    padding: 0.3rem 0.55rem;
    border: 1px solid var(--surface-border);
    border-radius: 8px;
    background: var(--surface-strong);
    color: var(--text);
    cursor: pointer;
    font-size: 0.85em;
}

.pw-toggle:hover {
    background: var(--surface);
    color: var(--brand);
}

.caps-lock {
    display: none;
    font-size: 0.85em;
    color: #f59e0b;
    margin-top: 0.35rem;
}

.login-footer {
    margin-top: 1rem;
    text-align: right;
    font-size: 0.9em;
}

.cta-subtext {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--muted);
    font-size: 0.95rem;
    text-align: center;
}

.cta-subtext-icon {
    font-size: 1rem;
}

.helper-tip {
    background: rgba(81, 0, 127, 0.12);
    border: 1px solid rgba(81, 0, 127, 0.25);
    color: var(--text);
    border-radius: 10px;
    padding: 0.6rem 0.8rem;
    font-size: 0.9rem;
}

.helper-tip--spaced {
    margin-top: 1em;
    margin-bottom: 1rem;
}

.form-spaced {
    margin-top: 1em;
}

.success-banner {
    margin-bottom: 1rem;
    color: var(--green-color);
    font-weight: 700;
}

.text-muted {
    color: var(--muted);
}

/* -------------------------------------------------------------------------- */
/*                               Form Styles                                  */
/* -------------------------------------------------------------------------- */

.form-group {
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
}

.form-group label {
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--muted);
    font-weight: 600;
}

.form-group input,
.form-group textarea,
.input-field,
.alias-input {
    width: 100%;
    padding: 0.8rem;
    font-size: 0.9rem;
    border: 1px solid var(--input-border);
    border-radius: 10px;
    background: var(--input-bg);
    color: var(--text);
    font-weight: 400;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus,
input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--input-focus);
}

/* Prevent iOS Safari auto-zoom on login/create-account fields */
@supports (-webkit-touch-callout: none) {
    @media (max-width: 900px) {
        body.logged-out .form-group input:not([type="checkbox"]):not([type="radio"]),
        body.logged-out .form-group select,
        body.logged-out .form-group textarea,
        body.logged-out .input-field,
        body.logged-out .styled-input,
        body.logged-out .styled-select {
            font-size: 16px;
        }
    }
}

.form-row {
    display: flex;
    flex-wrap: wrap;
}

.form-row .form-group {
    flex: 1;
    min-width: 200px;
    margin-right: 1rem;
}

.form-row .form-group:last-child {
    margin-right: 0;
}

.section-content {
    position: relative;
}

/* Fieldset and Legend Styles */
.widget-settings-section {
    border: 1px solid var(--surface-border);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 1.5rem;
    background: var(--surface);
    box-shadow: 0 12px 26px rgba(0,0,0,0.06);
}

.widget-settings-section legend {
    font-weight: 600;
    font-size: 1rem;
    padding: 0 0.5rem;
}

.domain-settings-section {
    border: 1px solid var(--surface-border);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 1.5rem;
    background: var(--surface);
    box-shadow: 0 12px 26px rgba(0,0,0,0.06);
}

.domain-settings-section legend {
    font-weight: 600;
    font-size: 1rem;
    padding: 0 0.5rem;
}

/* Sub-fieldsets inside section cards: subtle but clearly separated */
.widget-settings-section fieldset:not(.widget-settings-section):not(.domain-settings-section),
.domain-settings-section fieldset:not(.widget-settings-section):not(.domain-settings-section) {
    border: 1px solid rgba(15, 23, 42, 0.12);
    border-radius: 12px;
    padding: 1rem;
    margin-top: 1rem;
    background: transparent;
}

.widget-settings-section fieldset:not(.widget-settings-section):not(.domain-settings-section) > legend,
.domain-settings-section fieldset:not(.widget-settings-section):not(.domain-settings-section) > legend {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    padding: 0 0.45rem;
}

:root[data-theme="dark"] .widget-settings-section fieldset:not(.widget-settings-section):not(.domain-settings-section),
:root[data-theme="dark"] .domain-settings-section fieldset:not(.widget-settings-section):not(.domain-settings-section) {
    border-color: rgba(226, 232, 240, 0.22);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) .widget-settings-section fieldset:not(.widget-settings-section):not(.domain-settings-section),
    :root:not([data-theme]) .domain-settings-section fieldset:not(.widget-settings-section):not(.domain-settings-section) {
        border-color: rgba(226, 232, 240, 0.22);
    }
}

/* -------------------------------------------------------------------------- */
/*                             Button Styles                                  */
/* -------------------------------------------------------------------------- */

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0.6rem 1rem;
    font-size: 0.95rem;
    color: #fff;
    border: none;
    border-radius: 999px;
    cursor: pointer;
    transition: transform 0.1s ease, filter 0.2s ease;
    font-weight: 700;
    text-align: center;
    width: fit-content;
    background: linear-gradient(135deg, var(--btn-primary-from), var(--btn-primary-to));
    box-shadow: var(--btn-shadow);
}

.button:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
}

.button-primary {
    background: linear-gradient(135deg, var(--btn-primary-from), var(--btn-primary-to));
}

.button-primary:hover {
    filter: brightness(1.1);
}

.button-green {
    background: linear-gradient(135deg, var(--btn-green-from), var(--btn-green-to));
    box-shadow: var(--btn-green-shadow);
}

.button-green:hover {
    filter: brightness(1.06);
}

.reviews-trial-usage {
    margin-top: 10px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    background: var(--sidebar-hover);
    color: var(--text);
    border: 1px solid var(--menu-divider);
    font-size: 0.88rem;
    font-weight: 600;
}

.reviews-trial-usage.is-limit-reached {
    background: rgba(231, 76, 60, 0.12);
    border-color: rgba(231, 76, 60, 0.35);
}

.button-red {
    background: linear-gradient(135deg, var(--btn-red-from), var(--btn-red-to));
    box-shadow: var(--btn-red-shadow);
}

.button-red:hover {
    filter: brightness(1.06);
}

.button-gray {
    background: linear-gradient(135deg, var(--btn-gray-from), var(--btn-gray-to));
    box-shadow: var(--btn-gray-shadow);
}

.button-gray:hover {
    filter: brightness(1.06);
}

.button-small {
    padding: 0.4rem 0.8rem;
    font-size: 0.9rem;
}

.button-large {
    padding: 0.6rem 1.2rem;
    font-size: 1.1rem;
}

/* -------------------------------------------------------------------------- */
/*                           Error and Success Messages                       */
/* -------------------------------------------------------------------------- */

.success-message,
.error-message {
    margin-top: 1rem;
    font-size: 0.9rem;
    text-align: center;
    font-weight: 600;
}

.success-message {
    color: var(--green-color);
}

.error-message {
    display: none;
    color: var(--error-color);
    text-align: center;
    font-weight: 400;
    font-size: 0.85rem;
}

/* -------------------------------------------------------------------------- */
/*                            Dashboard Layout                                */
/* -------------------------------------------------------------------------- */

.dashboard-container {
    display: flex;
    flex: 1;
    min-height: calc(50vh - 60px);
    max-width: 80em;
    margin: 1.5rem auto 2.5rem;
    width: min(100%, 80em);
    position: relative;
    z-index: auto;
    gap: 0;
}

.sidebar {
    width: 250px;
    background: var(--sidebar-bg);
    color: var(--text);
    flex-shrink: 0;
    transition: width 0.3s;
    border-top-left-radius: 1em;
    border-bottom-left-radius: 1em;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border: 1px solid var(--surface-border);
    border-right: none;
}

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

.menu li {
    padding: 15px 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--menu-divider);
    color: var(--text);
    position: relative;
}

.menu li.active,
.menu li:hover {
    background-color: var(--sidebar-hover);
}

.menu li.active {
    background-color: var(--sidebar-active);
}

.menu > li:first-child:hover,
.menu > li:first-child.active {
    background-color: var(--sidebar-hover);
    border-top-left-radius: 1em;
}


.menu li svg {
    margin-right: 10px;
    width: 15px;
    height: 15px;
    stroke: currentColor;
}

.menu li span {
    /*flex: 1;*/
}

.menu li .menu-label {
    flex: 1;
}

.content-area {
    flex: 1;
    padding: 20px;
    background: var(--content-bg);
    overflow-y: auto;
    border-top-right-radius: 1em;
    border-bottom-right-radius: 1em;
    border: 1px solid var(--surface-border);
    border-left: none;
}

.loading-message {
    text-align: center;
    color: var(--muted);
}

/* Divider style */
.menu li.divider {
height: 3px;
background: var(--menu-divider);
padding: 0;
border-bottom: none;
}

.menu li.divider:hover {
    background-color: transparent;
}

@media (min-width: 769px) {
    .menu li {
        border-bottom: none;
    }

    .menu li::after {
        content: "";
        position: absolute;
        left: 0;
        right: 0;
        bottom: 0;
        height: 1px;
        background: linear-gradient(90deg, var(--menu-divider) 0%, var(--menu-divider) 60%, rgba(0,0,0,0) 100%);
        pointer-events: none;
    }

    .menu li.divider {
        background: linear-gradient(90deg, var(--menu-divider) 0%, var(--menu-divider) 60%, rgba(0,0,0,0) 100%);
    }

    .menu li.divider::after {
        content: none;
    }
}

.menu-home-link {
    background: rgba(81,0,127,0.18);
    border-bottom-left-radius: 1em;
    border-bottom-right-radius: 1em;
}

.menu-home-link:hover {
    background: rgba(81,0,127,0.24);
}

.has-submenu {
    display: flex;
    align-items: center;
    position: relative;

}

.has-submenu > .arrow {
    margin-left: auto;
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    line-height: 1;
    transition: transform 0.3s ease-in-out;
    cursor: pointer;
    user-select: none;
    border-radius: 999px;
    border: 1px solid var(--surface-border);
    background: var(--surface);
    color: var(--text);
    box-shadow: 0 6px 14px rgba(0,0,0,0.2);
    padding: 0;
}

.has-submenu > span:not(.arrow) {
    flex: 1 1 auto;
    min-width: 0;
}



.has-submenu.open > .arrow {
    transform: rotate(180deg);
}

/* Initially hide submenu */
.submenu {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 0;
    overflow: hidden;
    background: var(--submenu-bg);
    transition: max-height 0.3s ease;
    border-bottom: none;
}

/* When open, show submenu */
.submenu.open {
    max-height: 500px;
}

.submenu li {
    display: flex;
    padding: 15px 20px;
    border-bottom: 1px solid var(--menu-divider);
    color: var(--text);
    cursor: pointer;
    font-size: 14px;
    padding-left: 35px;
}

.submenu li:hover {
    background-color: var(--sidebar-hover);
}

/* -------------------------------------------------------------------------- */
/*                             Spinner Styles                                 */
/* -------------------------------------------------------------------------- */

.spinner {
    width: 40px;
    height: 40px;
    margin: 50px auto;
    border: 5px solid var(--loading-spinner-track);
    border-top: 5px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.section-swap-loader {
    width: 100%;
    min-height: clamp(180px, 28vh, 280px);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--loading-surface-bg);
    border-radius: 12px;
}

.section-swap-loader .spinner {
    margin: 0;
}

button .spinner,
.button .spinner {
    width: 16px;
    height: 16px;
    margin: 0;
    border-width: 2px;
    border-color: rgba(255,255,255,0.4);
    border-top-color: #fff;
}

.form-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--loading-surface-bg);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1;
}

.form-loading-overlay .spinner {
    width: 50px;
    height: 50px;
    margin: 0;
    border-width: 5px;
}

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

/* -------------------------------------------------------------------------- */
/*                             Toggle Switch Styles                           */
/* -------------------------------------------------------------------------- */

.switch {
    position: relative;
    display: inline-block;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch .slider {
    position: absolute;
    cursor: pointer;
    transition: .4s;
    border-radius: 34px;
}

.switch .slider:before {
    position: absolute;
    content: "";
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

.switch input:checked + .slider {
    background-color: var(--toggle-on);
}

.switch input:not(:checked) + .slider {
    background-color: var(--toggle-off);
}

.switch input:checked + .slider:before {
    transform: translateX(calc(100% + 4px));
}

.switch input:not(:checked) + .slider:before {
    transform: translateX(0);
}

.switch-small {
    width: 40px;
    height: 20px;
}

.switch-small .slider {
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

.switch-small .slider:before {
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
}

.switch-large {
    width: 60px;
    height: 30px;
}

.switch-large .slider {
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

.switch-large .slider:before {
    height: 26px;
    width: 26px;
    left: 2px;
    bottom: 2px;
}

/* -------------------------------------------------------------------------- */
/*                             Color Picker Styles                            */
/* -------------------------------------------------------------------------- */

input[type="color"] {
    padding: 0;
    border: none;
    background: none;
    height: 34px;
    width: 60px;
    cursor: pointer;
}

.pickr .pcr-button {
    margin-right: .5em;
    height: 2.5em !important;
    width: 2.5em !important;
    border: 1px solid var(--surface-border);
}

/* -------------------------------------------------------------------------- */
/*                              Select Styles                                 */
/* -------------------------------------------------------------------------- */

/*.styled-select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 16px;
}*/

.styled-select {
    border: 1.5px solid var(--input-border);
    border-radius: 16px;
    padding: 7px 46px 7px 13px;
    padding-right: 46px !important;
    min-width: 95px;
    background-color: var(--input-bg);
    background-image:
        linear-gradient(45deg, transparent 50%, #334155 50%),
        linear-gradient(135deg, #334155 50%, transparent 50%) !important;
    background-position:
        calc(100% - 21px) 50%,
        calc(100% - 15px) 50% !important;
    background-size: 7px 7px, 7px 7px !important;
    background-repeat: no-repeat !important;
    color: var(--text);
    font-size: 15px;
    transition: border-color 0.18s, box-shadow 0.18s;
    appearance: none !important;
    -webkit-appearance: none !important;
    outline: none;
    margin: 2px 0;
    width: 100%;
    display: block;
    overflow: hidden;
}

/* Remove native browser arrows so only the custom chevron is rendered. */
select:not([multiple]):not([size]),
.styled-select {
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
}

select:not([multiple]):not([size])::-ms-expand,
.styled-select::-ms-expand {
    display: none;
}

.styled-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--input-focus);
}

/* Ensure native option lists remain readable in dark mode */
:root[data-theme="dark"] select,
:root[data-theme="dark"] .styled-select {
    background-color: var(--input-bg);
    background-image:
        linear-gradient(45deg, transparent 50%, #cbd5e1 50%),
        linear-gradient(135deg, #cbd5e1 50%, transparent 50%) !important;
    background-position:
        calc(100% - 21px) 50%,
        calc(100% - 15px) 50% !important;
    background-size: 7px 7px, 7px 7px !important;
    background-repeat: no-repeat !important;
    color: var(--text);
    border-color: var(--input-border);
}

:root[data-theme="light"] select,
:root[data-theme="light"] .styled-select {
    background-color: var(--input-bg);
    background-image:
        linear-gradient(45deg, transparent 50%, #334155 50%),
        linear-gradient(135deg, #334155 50%, transparent 50%) !important;
    background-position:
        calc(100% - 21px) 50%,
        calc(100% - 15px) 50% !important;
    background-size: 7px 7px, 7px 7px !important;
    background-repeat: no-repeat !important;
    color: var(--text);
    border-color: var(--input-border);
}

:root:not([data-theme]) select,
:root:not([data-theme]) .styled-select {
    background-color: var(--input-bg);
    background-image:
        linear-gradient(45deg, transparent 50%, #334155 50%),
        linear-gradient(135deg, #334155 50%, transparent 50%) !important;
    background-position:
        calc(100% - 21px) 50%,
        calc(100% - 15px) 50% !important;
    background-size: 7px 7px, 7px 7px !important;
    background-repeat: no-repeat !important;
    color: var(--text);
    border-color: var(--input-border);
}

:root[data-theme="dark"] select option,
:root[data-theme="dark"] select optgroup,
:root[data-theme="dark"] .styled-select option,
:root[data-theme="dark"] .styled-select optgroup {
    background: var(--surface-solid);
    color: var(--text);
}

/* Global intl-tel-input dropdown styling for dark mode */
:root[data-theme="dark"] .iti__dropdown-content,
:root[data-theme="dark"] .iti__country-list {
    background: var(--surface-solid);
    color: var(--text);
    border-color: var(--surface-border);
}

:root[data-theme="dark"] .iti__country {
    color: var(--text);
}

:root[data-theme="dark"] .iti__country.iti__highlight,
:root[data-theme="dark"] .iti__country:hover {
    background: var(--table-row-hover);
}

:root[data-theme="dark"] .iti__dial-code {
    color: var(--muted);
}

:root[data-theme="dark"] .iti__search-input {
    background: var(--input-bg);
    color: var(--text);
    border: 1px solid var(--input-border);
}

:root[data-theme="dark"] .iti__search-input::placeholder {
    color: var(--muted);
}

:root[data-theme="dark"] .iti__search-input:focus {
    border-color: rgba(216,180,254,0.64);
    box-shadow: 0 0 0 3px rgba(216,180,254,0.26);
}

/* Keep focus borders consistent across all dashboard inputs/dropdowns in dark mode */
:root[data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="file"]):not([type="hidden"]):focus,
:root[data-theme="dark"] textarea:focus,
:root[data-theme="dark"] select:focus,
:root[data-theme="dark"] .styled-input:focus,
:root[data-theme="dark"] .styled-select:focus {
    border-color: rgba(216,180,254,0.64) !important;
    box-shadow: 0 0 0 3px rgba(216,180,254,0.26) !important;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="file"]):not([type="hidden"]):focus,
    :root:not([data-theme]) textarea:focus,
    :root:not([data-theme]) select:focus,
    :root:not([data-theme]) .styled-input:focus,
    :root:not([data-theme]) .styled-select:focus {
        border-color: rgba(216,180,254,0.64) !important;
        box-shadow: 0 0 0 3px rgba(216,180,254,0.26) !important;
    }

    :root:not([data-theme]) select,
    :root:not([data-theme]) .styled-select {
        background-color: var(--input-bg);
        background-image:
            linear-gradient(45deg, transparent 50%, #cbd5e1 50%),
            linear-gradient(135deg, #cbd5e1 50%, transparent 50%) !important;
        background-position:
            calc(100% - 21px) 50%,
            calc(100% - 15px) 50% !important;
        background-size: 7px 7px, 7px 7px !important;
        background-repeat: no-repeat !important;
        color: var(--text);
        border-color: var(--input-border);
    }

    :root:not([data-theme]) select option,
    :root:not([data-theme]) select optgroup,
    :root:not([data-theme]) .styled-select option,
    :root:not([data-theme]) .styled-select optgroup {
        background: var(--surface-solid);
        color: var(--text);
    }

    :root:not([data-theme]) .iti__dropdown-content,
    :root:not([data-theme]) .iti__country-list {
        background: var(--surface-solid);
        color: var(--text);
        border-color: var(--surface-border);
    }

    :root:not([data-theme]) .iti__country {
        color: var(--text);
    }

    :root:not([data-theme]) .iti__country.iti__highlight,
    :root:not([data-theme]) .iti__country:hover {
        background: var(--table-row-hover);
    }

    :root:not([data-theme]) .iti__dial-code {
        color: var(--muted);
    }

    :root:not([data-theme]) .iti__search-input {
        background: var(--input-bg);
        color: var(--text);
        border: 1px solid var(--input-border);
    }

    :root:not([data-theme]) .iti__search-input::placeholder {
        color: var(--muted);
    }

    :root:not([data-theme]) .iti__search-input:focus {
        border-color: rgba(216,180,254,0.64);
        box-shadow: 0 0 0 3px rgba(216,180,254,0.26);
    }
}

/* -------------------------------------------------------------------------- */
/*                              Table Styles                                  */
/* -------------------------------------------------------------------------- */

.styled-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border: 1px solid var(--surface-border);
    border-radius: 12px;
    background: var(--surface);
    box-shadow: 0 1px 8px rgba(0,0,0,0.04);
    overflow: hidden;
    margin-top: 1rem;
}

.styled-table th, .styled-table td {
    border-bottom: 1px solid var(--surface-border);
    padding: 0.85rem 0.8rem;
    text-align: left;
    vertical-align: top;
}

.styled-table th {
    background: var(--table-head-bg);
    font-weight: 600;
    letter-spacing: 0.01em;
    border-bottom: 2px solid var(--surface-border);
}

.styled-table tbody tr:nth-child(even) {
    background-color: var(--table-row-alt);
}

.styled-table tbody tr:hover {
    background-color: var(--table-row-hover);
}

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

/* -------------------------------------------------------------------------- */
/*                              Reviews Styles                                */
/* -------------------------------------------------------------------------- */

.reviews-template-help {
    display: block;
}

.reviews-template-toolbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.7rem;
}

.reviews-template-token-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.reviews-template-token-buttons .reviews-token-button {
    font-weight: 600;
    padding: 0.38rem 0.72rem;
    min-height: 30px;
}

.reviews-template-counter {
    min-width: 110px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    font-size: 0.84rem;
    color: var(--muted);
}

.reviews-template-counter-track {
    display: block;
    width: 110px;
    height: 6px;
    border-radius: 999px;
    background: var(--surface-border);
    overflow: hidden;
}

.reviews-template-counter-fill {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(135deg, var(--btn-primary-from), var(--btn-primary-to));
    transition: width 0.16s ease;
}

.reviews-template-counter.is-near-limit {
    color: #d97706;
}

.reviews-template-counter.is-near-limit .reviews-template-counter-fill {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.reviews-template-counter.is-at-limit {
    color: #dc2626;
}

.reviews-template-counter.is-at-limit .reviews-template-counter-fill {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.reviews-template-editor {
    position: relative;
}

.reviews-template-suggestions {
    position: static;
    margin-top: 8px;
    width: 100%;
    border: 1px solid var(--surface-border);
    border-radius: 12px;
    background: var(--surface);
    box-shadow: 0 10px 30px rgba(0,0,0,0.12);
    overflow: hidden;
}

.reviews-template-suggestion-item {
    display: block;
    width: 100%;
    text-align: left;
    border: 0;
    background: transparent;
    color: var(--text);
    font-size: 0.9rem;
    padding: 0.6rem 0.8rem;
    cursor: pointer;
}

.reviews-template-suggestion-item:hover {
    background: var(--table-row-hover);
}

.reviews-template-note {
    display: block;
    margin-top: 0.45rem;
    color: var(--muted);
    font-size: 0.83rem;
}

.reviews-followup-sequence {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.8rem;
    margin-top: 0.9rem;
}

.reviews-followup-picker,
.reviews-template-picker {
    margin-top: 0.9rem;
    max-width: 420px;
}

.reviews-followup-picker label,
.reviews-template-picker label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 600;
    color: var(--text);
}

.reviews-followup-dropdown-panels {
    margin-top: 0.75rem;
}

.reviews-followup-panel {
    display: none;
}

.reviews-followup-panel.is-active {
    display: block;
}

.reviews-followup-card {
    border: 1px solid var(--surface-border);
    border-radius: 12px;
    background: var(--surface-alt);
    padding: 0.85rem;
}

.reviews-followup-card h4 {
    margin: 0;
    font-size: 0.97rem;
    color: var(--text);
}

.reviews-followup-trigger {
    margin: 0.28rem 0 0.7rem;
    color: var(--muted);
    font-size: 0.84rem;
}

.reviews-followup-advanced {
    margin-top: 0.9rem;
    border: 1px solid var(--surface-border);
    border-radius: 12px;
    background: var(--surface);
    padding: 0.6rem 0.75rem 0.75rem;
}

.reviews-followup-advanced > summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--text);
    list-style: none;
}

.reviews-followup-advanced > summary::-webkit-details-marker {
    display: none;
}

.reviews-followup-advanced > summary::after {
    content: '+';
    float: right;
    color: var(--muted);
}

.reviews-followup-advanced[open] > summary::after {
    content: '-';
}

.reviews-followup-overrides {
    margin-top: 0.75rem;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.reviews-followup-advanced .reviews-template-toolbar {
    margin-top: 0.55rem;
}

.reviews-sources-help {
    display: block;
}

.reviews-sources-list {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

.reviews-source-row {
    display: grid;
    grid-template-columns: minmax(180px, 240px) minmax(220px, 1fr) auto;
    gap: 0.7rem;
    align-items: end;
    border: 1px solid var(--surface-border);
    border-radius: 12px;
    background: var(--surface-alt);
    padding: 0.75rem;
}

.reviews-source-row .form-group {
    margin: 0;
}

.reviews-source-url {
    width: 100%;
}

.reviews-source-actions {
    display: flex;
    align-items: flex-end;
}

.reviews-source-remove {
    white-space: nowrap;
}

.reviews-sources-limit {
    color: var(--muted);
}

.reviews-sources-limit.is-maxed {
    color: #b45309;
    font-weight: 600;
}

.reviews-sync-status-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: 0.9rem;
}

.reviews-sync-connection-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.7rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
    border: 1px solid transparent;
}

.reviews-sync-connected {
    background: rgba(22, 163, 74, 0.12);
    color: #166534;
    border-color: rgba(22, 163, 74, 0.3);
}

.reviews-sync-disconnected {
    background: rgba(148, 163, 184, 0.2);
    color: var(--text);
    border-color: var(--surface-border);
}

.reviews-sync-account-email {
    font-size: 0.85rem;
    color: var(--muted);
}

.reviews-sync-connect-row {
    margin-top: 0.55rem;
}

.reviews-sync-connected-panel {
    margin-top: 0.55rem;
    border: 1px solid var(--surface-border);
    border-radius: 14px;
    background: var(--surface);
    padding: 0.85rem;
}

.reviews-sync-onboarding-note {
    margin-top: 0.55rem;
    padding: 0.55rem 0.75rem;
    border-radius: 11px;
    border: 1px solid rgba(14, 116, 144, 0.22);
    background: linear-gradient(180deg, rgba(14, 116, 144, 0.08), rgba(14, 116, 144, 0.04));
    color: var(--text);
    font-size: 0.84rem;
    line-height: 1.45;
}

.reviews-sync-onboarding-note strong {
    font-weight: 700;
}

.reviews-sync-actions-row {
    gap: 0.55rem;
    margin-top: 0.45rem;
    flex-wrap: wrap;
}

.reviews-sync-actions-row-bottom {
    margin-top: 1rem;
    justify-content: flex-end;
}

.reviews-sync-actions-row-bottom .button {
    min-width: 160px;
}

.reviews-sync-post-sheet-panel {
    margin-top: 0.7rem;
    padding-top: 0.7rem;
    border-top: 1px dashed var(--surface-border);
}

.reviews-sync-grid {
    margin-top: 0.5rem;
    display: grid;
    grid-template-columns: repeat(2, minmax(260px, 1fr));
    gap: 0.75rem;
}

.reviews-sync-grid .form-group {
    margin: 0;
}

.reviews-sync-field-hint {
    display: block;
    margin-top: 0.3rem;
    color: var(--muted);
    font-size: 0.78rem;
    line-height: 1.35;
}

.reviews-sync-label-help {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    margin-bottom: 0.35rem;
}

.reviews-sync-label-help label {
    margin: 0;
}

.reviews-sync-help-trigger {
    width: 1.15rem;
    height: 1.15rem;
    border: 1px solid rgba(81, 0, 127, 0.32);
    border-radius: 50%;
    background: rgba(81, 0, 127, 0.10);
    color: var(--brand-accent-text);
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
    padding: 0;
}

.reviews-sync-help-trigger:hover {
    background: rgba(81, 0, 127, 0.16);
    border-color: rgba(81, 0, 127, 0.45);
    transform: translateY(-1px);
}

.reviews-sync-help-trigger:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(81, 0, 127, 0.24);
}

.reviews-sync-footer-row {
    margin-top: 0.8rem;
}

.reviews-sync-preview-summary {
    margin-top: 0.65rem;
    padding: 0.55rem 0.7rem;
    border-radius: 10px;
    font-size: 0.85rem;
    background: rgba(81, 0, 127, 0.08);
    color: var(--text);
    border: 1px solid rgba(81, 0, 127, 0.18);
}

.reviews-sync-phone-guide {
    margin-top: 0.65rem;
    padding: 0.55rem 0.75rem 0.4rem;
    border-radius: 11px;
    border: 1px solid rgba(3, 105, 161, 0.18);
    background: rgba(3, 105, 161, 0.06);
    color: var(--text);
    font-size: 0.83rem;
    line-height: 1.45;
}

.reviews-sync-phone-guide strong {
    display: block;
    margin-bottom: 0.25rem;
    font-size: 0.84rem;
}

.reviews-sync-phone-guide ul {
    margin: 0.15rem 0 0.2rem 1rem;
    padding: 0;
}

.reviews-sync-phone-guide li {
    margin-bottom: 0.28rem;
}

.reviews-sync-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.92rem;
    color: var(--text);
    cursor: pointer;
    user-select: none;
}

.reviews-sync-toggle input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    pointer-events: none;
}

.reviews-sync-toggle-slider {
    position: relative;
    width: 46px;
    height: 26px;
    border-radius: 999px;
    background: rgba(100, 116, 139, 0.42);
    border: 1px solid rgba(100, 116, 139, 0.28);
    transition: background 0.2s ease, border-color 0.2s ease;
    flex-shrink: 0;
}

.reviews-sync-toggle-slider::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.25);
    transition: transform 0.2s ease;
}

.reviews-sync-toggle input:checked + .reviews-sync-toggle-slider {
    background: rgba(22, 163, 74, 0.58);
    border-color: rgba(22, 163, 74, 0.45);
}

.reviews-sync-toggle input:checked + .reviews-sync-toggle-slider::after {
    transform: translateX(20px);
}

.reviews-sync-toggle input:focus-visible + .reviews-sync-toggle-slider {
    box-shadow: 0 0 0 3px rgba(81, 0, 127, 0.22);
}

.reviews-sync-toggle-copy {
    display: inline-flex;
    flex-direction: column;
    line-height: 1.2;
    gap: 0.12rem;
}

.reviews-sync-toggle-copy strong {
    font-size: 0.92rem;
    font-weight: 600;
}

.reviews-sync-toggle-copy small {
    color: var(--muted);
    font-size: 0.8rem;
}

.reviews-sync-meta {
    margin-top: 0.6rem;
    color: var(--muted);
    font-size: 0.85rem;
}

.reviews-sync-error {
    margin-top: 0.45rem;
    color: #b91c1c;
    font-size: 0.85rem;
    display: none;
}

.reviews-sync-help-modal-content {
    width: min(560px, calc(100% - 24px));
    margin: 6vh auto;
    border-radius: 16px;
    border: 1px solid var(--surface-border);
    box-shadow: var(--surface-shadow);
    padding: 1rem 1rem 0.9rem;
}

.reviews-sync-help-close {
    position: absolute;
    top: 10px;
    right: 12px;
    width: 2rem;
    height: 2rem;
    border: 0;
    border-radius: 50%;
    background: rgba(81, 0, 127, 0.08);
    color: var(--text);
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
}

.reviews-sync-help-close:hover {
    background: rgba(81, 0, 127, 0.16);
}

.reviews-sync-help-close:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(81, 0, 127, 0.25);
}

.reviews-sync-help-body {
    margin-top: 0.4rem;
    color: var(--muted);
    font-size: 0.94rem;
    line-height: 1.55;
}

.reviews-sync-help-body p {
    margin: 0 0 0.65rem 0;
}

.reviews-sync-help-body ul {
    margin: 0.2rem 0 0.75rem 1.15rem;
    padding: 0;
}

.reviews-sync-help-body li {
    margin-bottom: 0.45rem;
}

.reviews-sync-help-actions {
    margin-top: 0.85rem;
    display: flex;
    justify-content: flex-end;
}

body.reviews-sync-help-modal-open {
    overflow: hidden;
}

.reviews-history-wrap {
    margin-top: 0.55rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.reviews-history-table {
    min-width: 540px;
    margin-top: 0;
}

.reviews-history-table .reviews-history-cell-value {
    display: block;
    overflow-wrap: anywhere;
}

.reviews-rating-status {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.12rem;
}

.reviews-rating-stars {
    color: #f59e0b;
    letter-spacing: 0.8px;
    white-space: nowrap;
}

.reviews-rating-status-meta {
    color: var(--text);
}

.reviews-history-action-cell {
    text-align: center;
    white-space: nowrap;
}

.reviews-history-action-wrap {
    display: flex;
    justify-content: center;
}

.reviews-history-view-btn {
    min-width: 72px;
}

.reviews-history-row-clickable {
    cursor: pointer;
}

.reviews-history-row-clickable:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.reviews-summary-modal-content {
    max-width: 640px;
    width: min(92vw, 640px);
    margin: 7vh auto;
    padding: 18px 18px 16px;
}

.reviews-summary-close {
    position: absolute;
    top: 10px;
    right: 12px;
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 1.8rem;
    line-height: 1;
    cursor: pointer;
}

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

.reviews-summary-meta {
    margin: 0.2rem 0 0.7rem;
    color: var(--muted);
    font-size: 0.9rem;
}

.reviews-summary-table-wrap {
    border: 1px solid var(--surface-border);
    border-radius: 10px;
    overflow: hidden;
    background: var(--surface);
    margin-bottom: 0.75rem;
}

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

.reviews-summary-table th,
.reviews-summary-table td {
    border-bottom: 1px solid var(--surface-border);
    padding: 0.56rem 0.72rem;
    line-height: 1.4;
    text-align: left;
    vertical-align: top;
    font-size: 0.9rem;
}

.reviews-summary-table tr:last-child th,
.reviews-summary-table tr:last-child td {
    border-bottom: 0;
}

.reviews-summary-table th {
    width: 38%;
    color: var(--muted);
    font-weight: 600;
    background: var(--surface-alt);
}

.reviews-summary-section-title {
    margin: 0.2rem 0 0.55rem;
    color: var(--muted);
    font-size: 0.82rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-weight: 700;
}

.reviews-summary-voice-wrap {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.reviews-summary-audio {
    width: 100%;
}

.reviews-summary-voice-link {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    width: fit-content;
    font-weight: 600;
}

.reviews-click-analytics {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
}

.reviews-click-details summary {
    cursor: pointer;
    color: var(--primary-color);
    font-weight: 600;
}

.reviews-click-details-list {
    margin: 0.45rem 0 0;
    padding-left: 1.05rem;
}

.reviews-click-details-list li {
    margin: 0.2rem 0;
}

.reviews-summary-body {
    border: 1px solid var(--surface-border);
    border-radius: 10px;
    background: var(--surface);
    padding: 0.85rem;
    white-space: pre-wrap;
    line-height: 1.45;
    color: var(--text);
    max-height: 50vh;
    overflow: auto;
}

body.reviews-summary-modal-open {
    overflow: hidden;
}

@media (max-width: 760px) {
    .reviews-template-toolbar {
        flex-direction: column;
        gap: 0.7rem;
    }

    .reviews-template-counter {
        width: 100%;
        align-items: flex-start;
    }

    .reviews-template-counter-track {
        width: 100%;
        max-width: 220px;
    }

    .reviews-source-row {
        grid-template-columns: 1fr;
    }

    .reviews-source-actions {
        justify-content: flex-end;
    }

    .reviews-followup-overrides {
        grid-template-columns: 1fr;
    }

    .reviews-sync-grid {
        grid-template-columns: 1fr;
    }

    .reviews-sync-actions-row .button {
        width: 100%;
    }

    .reviews-sync-toggle {
        align-items: flex-start;
    }

    .reviews-history-wrap {
        overflow: visible;
    }

    .reviews-history-table {
        min-width: 0;
        border: 0;
        background: transparent;
        box-shadow: none;
    }

    .reviews-history-table thead {
        display: none;
    }

    .reviews-history-table tbody {
        display: block;
    }

    .reviews-history-table tbody tr {
        display: block;
        margin-bottom: 0.75rem;
        border: 1px solid var(--surface-border);
        border-radius: 12px;
        background: var(--surface);
        box-shadow: 0 1px 8px rgba(0,0,0,0.06);
        overflow: hidden;
    }

    .reviews-history-table tbody tr:nth-child(even) {
        background: var(--surface);
    }

    .reviews-history-table tbody tr td {
        display: flex;
        width: 100%;
        box-sizing: border-box;
        align-items: flex-start;
        justify-content: space-between;
        gap: 10px;
        border: 0;
        border-bottom: 1px solid var(--surface-border);
        padding: 10px 12px;
        background: transparent;
    }

    .reviews-history-table tbody tr td:last-child {
        border-bottom: 0;
    }

    .reviews-history-table tbody tr td::before {
        content: attr(data-label);
        flex: 0 0 42%;
        max-width: 140px;
        color: var(--muted);
        font-size: 12px;
        font-weight: 600;
        line-height: 1.35;
        text-align: left;
        padding-right: 8px;
    }

    .reviews-history-table .reviews-history-cell-value {
        flex: 1 1 auto;
        min-width: 0;
        text-align: right;
    }

    .reviews-history-table tbody tr td[colspan] {
        display: block;
        text-align: left;
    }

    .reviews-history-table tbody tr td[colspan]::before {
        content: none;
    }

    .reviews-history-table tbody tr td[colspan] .reviews-history-cell-value {
        text-align: left;
    }

    .reviews-history-action-cell {
        justify-content: flex-end;
    }

    .reviews-history-action-wrap {
        width: 100%;
        justify-content: flex-end;
    }

    .reviews-summary-modal-content {
        width: min(94vw, 640px);
        margin: 5vh auto;
        padding: 15px 14px 13px;
    }

    .reviews-summary-table th,
    .reviews-summary-table td {
        padding: 0.5rem 0.62rem;
    }

    .reviews-summary-table th {
        width: 44%;
    }

    .reviews-summary-voice-link {
        width: 100%;
        justify-content: center;
    }

    .reviews-summary-body {
        max-height: 58vh;
    }
}

/* -------------------------------------------------------------------------- */
/*                        Scheduled Calls Styles                              */
/* -------------------------------------------------------------------------- */

.scheduled-calls-block {
    margin-top: 1.5rem;
}

.scheduled-calls-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin: 0.5rem 0 0.75rem 0;
}

.scheduled-calls-header h3 {
    margin: 0;
    font-size: 1.05rem;
}

.scheduled-calls-meta,
.scheduled-calls-subtext {
    color: var(--muted);
    font-size: 0.9rem;
}

.scheduled-calls-subtext {
    display: block;
    margin: 0.4rem 0 0.2rem 0;
}

.scheduled-calls-load-more {
    display: flex;
    justify-content: center;
    margin-top: 0.5rem;
}

.scheduled-calls-table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 0.75rem;
}

.scheduled-calls-table {
    min-width: 760px;
}

.scheduled-calls-table .scheduled-cell-value {
    display: block;
    overflow-wrap: anywhere;
}

.scheduled-calls-modal-actions {
    justify-content: flex-end;
    gap: 0.6rem;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    border: 1px solid var(--surface-border);
    background: var(--table-head-bg);
    color: var(--text);
    text-transform: capitalize;
}

.status-pill--success {
    background: rgba(34, 197, 94, 0.18);
    color: #4ade80;
    border-color: rgba(34, 197, 94, 0.35);
}

.status-pill--warning {
    background: rgba(245, 158, 11, 0.18);
    color: #fbbf24;
    border-color: rgba(245, 158, 11, 0.35);
}

.status-pill--danger {
    background: rgba(239, 68, 68, 0.18);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.35);
}

.status-pill--info {
    background: var(--brand-accent-bg);
    color: var(--brand-accent-text);
    border-color: rgba(81, 0, 127, 0.2);
}

.status-pill--muted {
    background: rgba(107, 114, 128, 0.2);
    color: #d1d5db;
    border-color: rgba(107, 114, 128, 0.4);
}

@media (max-width: 760px) {
    .scheduled-calls-header {
        flex-wrap: wrap;
        align-items: flex-start;
    }

    .scheduled-calls-table-wrap {
        overflow: visible;
    }

    .scheduled-calls-table {
        min-width: 0;
        border: 0;
        background: transparent;
        box-shadow: none;
    }

    .scheduled-calls-table thead .scheduled-calls-columns-row {
        display: none;
    }

    .scheduled-calls-table thead .scheduled-calls-date-row th {
        border: 0;
        background: transparent;
        color: var(--muted);
        font-size: 0.86rem;
        font-weight: 700;
        letter-spacing: 0.02em;
        padding: 0.15rem 0.2rem 0.55rem;
        text-transform: uppercase;
    }

    .scheduled-calls-table tbody {
        display: block;
    }

    .scheduled-calls-table tbody .scheduled-calls-call-row {
        display: block;
        margin-bottom: 0.75rem;
        border: 1px solid var(--surface-border);
        border-radius: 12px;
        background: var(--surface);
        box-shadow: 0 1px 8px rgba(0,0,0,0.06);
        overflow: hidden;
    }

    .scheduled-calls-table tbody .scheduled-calls-call-row:nth-child(even) {
        background: var(--surface);
    }

    .scheduled-calls-table tbody .scheduled-calls-call-row td {
        display: flex;
        width: 100%;
        box-sizing: border-box;
        align-items: flex-start;
        justify-content: space-between;
        gap: 10px;
        border: 0;
        border-bottom: 1px solid var(--surface-border);
        padding: 10px 12px;
        background: transparent;
    }

    .scheduled-calls-table tbody .scheduled-calls-call-row td:last-child {
        border-bottom: 0;
    }

    .scheduled-calls-table tbody .scheduled-calls-call-row td::before {
        content: attr(data-label);
        flex: 0 0 42%;
        max-width: 140px;
        color: var(--muted);
        font-size: 12px;
        font-weight: 600;
        line-height: 1.35;
        text-align: left;
        padding-right: 8px;
    }

    .scheduled-calls-table .scheduled-cell-value {
        flex: 1 1 auto;
        min-width: 0;
        text-align: right;
    }

    .scheduled-calls-table .scheduled-status-cell .status-pill,
    .scheduled-calls-table .scheduled-actions-cell .button {
        margin-left: auto;
    }

    .scheduled-calls-table .scheduled-actions-cell .button {
        min-width: 88px;
    }
}

/* -------------------------------------------------------------------------- */
/*                           Domain Settings Styles                           */
/* -------------------------------------------------------------------------- */

.domain-row {
    border: 1px solid var(--surface-border);
    border-radius: 12px;
    padding: 1rem;
    padding-bottom: .5em;
    background: var(--surface);
    margin-bottom: 1rem;
}

.domain-header {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.domain-info {
    flex: 1;
}

.domain-name {
    font-weight: bold;
}

.domain-alias {
    margin-top: 5px;
    color: var(--muted);
}

.arrow-icon {
    width: 24px;
    height: 24px;
    margin-left: auto;
    transition: transform 0.3s ease;
}

.arrow-icon.rotated {
    transform: rotate(180deg);
}

.action-panel {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    margin-top: 10px;
}

.action-panel.open {
    max-height: 1000px;
    opacity: 1;
}

.action-panel div {
    justify-content: flex-start;
    gap: 10px;
}


.action-panel .save-button {
    margin-top: 1rem;
}

/* -------------------------------------------------------------------------- */
/*                             Agents Settings Styles                         */
/* -------------------------------------------------------------------------- */

.salesperson-row {
    border: 1px solid var(--surface-border);
    border-radius: 12px;
    padding: 1rem;
    padding-bottom: .5em;
    background: var(--surface);
    margin-bottom: 1rem;
}

.salesperson-header {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.salesperson-info {
    flex: 1;
}

.salesperson-name {
    font-weight: bold;
    font-size: 1.1rem;
}

.salesperson-email {
    margin-top: 5px;
    color: var(--muted);
    font-size: 0.9rem;
}

.domains-list {
    display: flex;
    flex-direction: column;
}

.domains-list .option {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
}

.domains-list .option input[type="checkbox"] {
    display: none;
}

.domains-list .custom-checkbox {
    position: relative;
    width: 40px;
    height: 20px;
    background-color: var(--toggle-off);
    border-radius: 10px;
    margin-right: 10px;
    cursor: pointer;
    border: 1px solid var(--surface-border);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.06);
}

.domains-list .custom-checkbox:before {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background-color: white;
    border-radius: 50%;
    transition: 0.3s;
}

.domains-list .option input[type="checkbox"]:checked + .custom-checkbox {
    background-color: var(--toggle-on);
}

.domains-list .option input[type="checkbox"]:checked + .custom-checkbox:before {
    transform: translateX(20px);
}

.domains-list .option span:last-child {
    font-size: 0.9rem;
    color: var(--text);
}

.action-panel .switch {
    margin-left: 0;
}

.action-panel .save-button {
    margin-top: 1rem;
}

.section-content {
    position: relative;
    overflow: visible;
}

.content-area {
    overflow: visible;
}

/* -------------------------------------------------------------------------- */
/*                                 Modal Styles                               */
/* -------------------------------------------------------------------------- */

.modal {
    display: none;
    position: fixed;
    z-index: 20000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: var(--overlay-bg);
}

.rr-confirm-overlay {
    position: fixed;
    inset: 0;
    z-index: 21000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: var(--overlay-bg);
}

.rr-confirm-overlay.is-open {
    display: flex;
}

.rr-confirm-card {
    width: min(520px, 100%);
    border-radius: 14px;
    border: 1px solid var(--surface-border);
    background: var(--surface-solid);
    box-shadow: var(--surface-shadow);
    padding: 18px 18px 14px;
}

.rr-confirm-title {
    margin: 0 0 8px 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
}

.rr-confirm-message {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--muted);
    white-space: pre-line;
}

.rr-confirm-actions {
    margin-top: 14px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

body.rr-confirm-open {
    overflow: hidden;
}

@media (max-width: 520px) {
    .rr-confirm-card {
        padding: 14px 14px 12px;
    }
    .rr-confirm-actions {
        justify-content: stretch;
        gap: 8px;
    }
    .rr-confirm-actions .button {
        flex: 1 1 0;
    }
}

.zapier-modal-overlay,
.check-modal-overlay,
.delete-modal-overlay {
    z-index: 20000;
}

.modal-content {
    background: var(--surface-solid);
    margin: 5% auto;
    padding: 20px;
    border: 1px solid var(--surface-border);
    width: 80%;
    max-width: 700px;
    border-radius: var(--radius);
    position: relative;
    box-shadow: var(--surface-shadow);
}

.cancel-button {
    margin: 20px auto 0 auto;
    display: block;
}

.close {
    color: var(--muted);
    float: right;
    font-size: 28px;
    font-weight: bold;
    position: absolute;
    top: 10px;
    right: 15px;
}

.close:hover,
.close:focus {
    color: var(--text);
    text-decoration: none;
    cursor: pointer;
}

.modal h3 {
    margin-top: 0;
}

.modal .styled-table {
    width: 100%;
    margin-top: 1rem;
}

.modal .form-group {
    margin-bottom: 1rem;
}

.edit-salesperson-form .form-row {
    justify-content: center;
}

/* -------------------------------------------------------------------------- */
/*                             Widget Settings                                */
/* -------------------------------------------------------------------------- */

.input-container {
    display: flex;
    align-items: center;
}

.color-picker-button {
    width: 34px;
    height: 34px;
    border: 1px solid var(--surface-border);
    border-radius: 8px;
    margin-right: 10px;
    background-color: var(--surface);
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.input-container input[type="text"] {
    flex: 1;
    padding: 0.8rem;
    font-size: 0.9rem;
    border: 1px solid var(--input-border);
    border-radius: 10px;
    background: var(--input-bg);
    color: var(--text);
    font-weight: 400;
}

.disabled-input {
    background: var(--input-disabled-bg);
    color: var(--text);
    border: 1px solid var(--surface-border);
}

.styled-input {
    width: 100%;
    padding: 0.6rem 0.7rem;
    font-size: 0.95rem;
    border-radius: 10px;
    border: 1px solid var(--input-border);
    background: var(--input-bg);
    color: var(--text);
}

.group-cap-info {
    width: 60px;
    padding: 6px 10px;
    border-radius: 10px;
    border: 1px solid var(--input-border);
    background: var(--input-disabled-bg);
    color: var(--text);
}

/* New styles for widget logo section */
.widget-logo-row {
    align-items: center;
}

.file-input-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.widget-logo-preview img {
    display: block;
    border: 1px solid var(--surface-border);
    border-radius: 8px;
    background: var(--surface-strong);
    padding: 5px;
}

/* -------------------------------------------------------------------------- */
/*                             Responsive Styles                              */
/* -------------------------------------------------------------------------- */

@media (max-width: 768px) {
    .dashboard-container {
        flex-direction: column;
        max-width: 100%;
        width: 100%;
    }

    body.menu-open {
        overflow: hidden;
    }

    .sidebar {
        position: fixed;
        top: var(--header-height);
        left: 0;
        height: calc(100vh - var(--header-height));
        width: min(82vw, 300px);
        max-width: 300px;
        min-width: 0;
        background: var(--surface-solid);
        transform: translateX(-110%);
        transition: transform 0.25s ease;
        border-radius: 0 1em 1em 0;
        border-right: 1px solid var(--surface-border);
        border-left: none;
        z-index: 15010;
        overflow-y: auto;
        box-shadow: 12px 0 30px rgba(0,0,0,0.35);
    }

    body.menu-open .sidebar {
        transform: translateX(0);
    }

    .sidebar-overlay {
        display: block;
        position: fixed;
        top: var(--header-height);
        left: 0;
        right: 0;
        bottom: 0;
        background: var(--overlay-bg);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s ease;
        z-index: 15000;
    }

    body.menu-open .sidebar-overlay {
        opacity: 1;
        pointer-events: auto;
    }

    body.logged-in .dashboard-burger {
        display: inline-flex;
    }

    .menu {
        display: block;
        padding: 0;
    }

    .menu li {
        width: 100%;
        box-sizing: border-box;
        display: flex;
        align-items: center;
        padding: 10px 15px;
        height: 3em;
    }

    .menu li:last-child {
        border-bottom: none;
    }

    .menu li svg {
        margin-right: 10px;
    }

    .content-area {
        padding: 10px;
        border-left: 1px solid var(--surface-border);
        border-radius: 1em;
    }

    .form-row {
        flex-direction: column;
    }

    .form-row .form-group {
        margin-right: 0;
    }

    h2.section-content {
        margin-top: 1em;
    }

    .domain-row {
        padding: 0.5rem;
    }

    .domain-name {
        margin-bottom: 0.5rem;
    }

    .domain-alias {
        text-align: left;
    }

    .button {
        font-size: 0.9rem;
    }

    .button-small {
        padding: 8px 12px;
        font-size: 14px;
    }

    .salesperson-row {
        padding: 0.5rem;
    }

    .salesperson-name {
        font-size: 1rem;
    }

    .salesperson-email {
        font-size: 0.85rem;
    }

    .action-panel .form-row {
        flex-direction: column;
    }

    .action-panel .form-group {
        margin-right: 0;
    }

    .file-input-container {
        flex-direction: column;
        align-items: flex-start;
    }

    .widget-logo-preview img {
        max-width: 100%;
        height: auto;
    }

    .menu > li:first-child,
    .menu > li:first-child:hover,
    .menu > li:first-child.active {
        border-top-left-radius: 1em;
        border-top-right-radius: 1em;
    }
}

@media (max-width: 480px) {

    .dashboard-container {
        max-width: 100vw;
    }
    .nav-links {
        display: none;
    }

    .menu li {
        font-size: 14px;
        padding: 8px 10px;
    }

    .menu li svg {
        width: 20px;
        height: 20px;
    }

    .content-area {
        padding: 5px;
    }
}

#toastContainer {
    position: fixed;
    left: 50%;
    bottom: max(14px, env(safe-area-inset-bottom, 0px));
    transform: translateX(-50%);
    z-index: 100010;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: min(92vw, 560px);
    pointer-events: none;
}

.toast {
    width: fit-content;
    max-width: min(92vw, 560px);
    padding: 10px 18px;
    border-radius: 999px;
    color: #fff;
    font-weight: 600;
    line-height: 1.35;
    text-align: center;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: auto;
}

.toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.toast.is-hiding {
    opacity: 0;
    transform: translateY(10px);
}

.toast.toast-success {
    background: linear-gradient(135deg, rgba(22, 163, 74, 0.96), rgba(5, 150, 105, 0.96));
}

.toast.toast-error {
    background: linear-gradient(135deg, rgba(220, 38, 38, 0.96), rgba(185, 28, 28, 0.96));
}

.toast.toast-info {
    background: linear-gradient(135deg, rgba(71, 85, 105, 0.96), rgba(51, 65, 85, 0.96));
}

/* ------------------------------ */
/* Centre the header logo on mobile */
/* ------------------------------ */
@media (max-width: 768px) {
  nav {
    justify-content: center;
  }

  .logo {
    width: auto;
    text-align: center;
    margin: 0 auto;
  }

  .nav-actions {
    margin-left: auto;
  }
}

@media (max-width: 480px) {
  .logo-img {
    height: 100%;
    width: auto;
  }
  header .logo img.logo-img {
    height: 100%;
    max-height: 100%;
  }
}


/* -------------------------------------------------------------------------- */
/*                         Fieldset Help Enhancer (NEW)                       */
/* -------------------------------------------------------------------------- */

/* Legend: text on the left, icon button on the right */
fieldset[data-help="true"] > legend {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
}

/* Icon-only button */
.rr-fs-help__btn {
  border: none;
  background: transparent;
  padding: 2px;
  margin: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  line-height: 1;
}

/* Feather icon size/colour (reuses your palette) */
.rr-fs-help__btn .feather,
.rr-fs-help__btn i.icon-extra-small {
  width: 20px;
  height: 20px;
  stroke: var(--brand-accent);
}

/* Sliding help panel – collapsed state has NO visuals */
.rr-fs-help-panel {
  overflow: hidden;
  max-height: 0;
  margin: 0;
  border: 0;
  background: transparent;
  transition:
    max-height .25s ease,
    margin .2s ease,
    border-color .2s ease,
    background-color .2s ease;
}

/* Open state visuals */
.rr-fs-help-panel.is-open {
  margin: 0 0 .8rem;
  border: 1px solid var(--surface-border);
  background: rgba(81,0,127,0.08);
  border-radius: 8px;
}

/* IMPORTANT: if an "open" panel still has max-height:0 (e.g. parent hidden),
   remove visuals to avoid the thin line */
.rr-fs-help-panel.is-open[style*="max-height: 0"] {
  margin: 0;
  border: 0;
  background: transparent;
}

.rr-fs-help-panel-inner {
  padding: 10px 12px;
  color: var(--text);
  font-size: 1rem;
}

.rr-fs-help-panel-inner small {
  display: block;
  margin: 0;
}
