@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Cormorant+Garamond:wght@600;700&display=swap');

:root {
    --bg: #08151a;
    --panel: rgba(7, 24, 32, 0.68);
    --panel-strong: #0f2b36;
    --text: #eef8fb;
    --muted: #95b5bf;
    --accent: #f6b53f;
    --accent-2: #66e0b7;
    --border: rgba(153, 197, 210, 0.28);
    --shadow: 0 22px 42px rgba(0, 0, 0, 0.38);
}

* {
    box-sizing: border-box;
}

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

body {
    font-family: 'Space Grotesk', sans-serif;
    color: var(--text);
    background:
        radial-gradient(1400px 600px at -10% -10%, rgba(102, 224, 183, 0.16), transparent 40%),
        radial-gradient(1000px 500px at 110% 0%, rgba(246, 181, 63, 0.16), transparent 40%),
        linear-gradient(155deg, #041016 0%, #0b1f28 50%, #08151a 100%);
    line-height: 1.5;
    overflow-x: hidden;
}

.bg-orb {
    position: fixed;
    width: 36vw;
    height: 36vw;
    border-radius: 50%;
    filter: blur(55px);
    z-index: -1;
    opacity: 0.32;
}

.orb-a {
    top: -10vw;
    left: -8vw;
    background: #66e0b7;
    animation: driftA 14s ease-in-out infinite alternate;
}

.orb-b {
    right: -8vw;
    bottom: -12vw;
    background: #f6b53f;
    animation: driftB 16s ease-in-out infinite alternate;
}

@keyframes driftA {
    from {
        transform: translate(0, 0);
    }
    to {
        transform: translate(5vw, 6vw);
    }
}

@keyframes driftB {
    from {
        transform: translate(0, 0);
    }
    to {
        transform: translate(-5vw, -4vw);
    }
}

.container {
    width: min(1120px, 92vw);
    margin: 0 auto;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 22px 0;
}

.brand {
    color: var(--text);
    text-decoration: none;
    font-size: 1.35rem;
    letter-spacing: 0.02em;
    font-weight: 700;
}

nav {
    display: flex;
    gap: 12px;
    align-items: center;
}

.nav-link {
    color: var(--muted);
    text-decoration: none;
    padding: 8px 14px;
    border: 1px solid transparent;
    border-radius: 999px;
    transition: 180ms ease;
}

.user-settings-nav-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.user-settings-nav-link svg {
    flex: 0 0 auto;
}

.nav-link:hover,
.nav-link.active {
    color: var(--text);
    border-color: var(--border);
    background: rgba(11, 38, 46, 0.5);
}

.theme-toggle {
    background: transparent;
}

.inline-auth-form {
    margin: 0;
}

.inline-auth-form .nav-link {
    background: transparent;
    cursor: pointer;
}

.auth-form {
    max-width: 420px;
    margin-top: 12px;
}

.hero {
    display: grid;
    place-items: center;
    text-align: center;
    min-height: 72vh;
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--accent-2);
    font-size: 0.79rem;
}

.hero-title {
    margin: 8px 0 12px;
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(2.8rem, 8vw, 6rem);
    line-height: 0.95;
    text-wrap: balance;
}

.hero-subtitle {
    max-width: 620px;
    color: var(--muted);
    font-size: 1.05rem;
}

.hero-actions {
    margin-top: 18px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
}

.btn {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 11px 18px;
    text-decoration: none;
    color: var(--text);
    font-weight: 600;
    cursor: pointer;
    transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.27);
}

.btn-primary {
    background: linear-gradient(120deg, #f6b53f, #f3cc7d);
    color: #102027;
    border-color: transparent;
}

.btn-ghost {
    background: rgba(11, 38, 46, 0.46);
}

.btn-danger {
    background: linear-gradient(120deg, #d94a3a, #f07a45);
    color: #ffffff;
    border-color: transparent;
}

.btn-danger:hover {
    background: linear-gradient(120deg, #c93d2f, #df6a39);
}

.btn-danger-soft {
    background: rgba(217, 74, 58, 0.2);
    color: #ffd8d3;
    border-color: rgba(240, 122, 69, 0.6);
}

.btn-danger-soft:hover {
    background: rgba(217, 74, 58, 0.3);
}

.stats {
    margin-top: 34px;
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.stat-card,
.panel,
.info-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 18px;
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow);
}

.stat-card {
    padding: 20px;
}

.stat-label {
    margin: 0;
    color: var(--muted);
    font-size: 0.88rem;
}

.stat-value {
    margin: 8px 0 0;
    font-size: clamp(1.35rem, 2.2vw, 2rem);
    font-weight: 700;
}

.section {
    padding-bottom: 42px;
}

.section-head h2 {
    margin-bottom: 6px;
}

.section-head p,
.muted {
    color: var(--muted);
}

.empty-state {
    border: 1px dashed var(--border);
    border-radius: 16px;
    padding: 26px;
    color: var(--muted);
    text-align: center;
}

.grid-cards {
    margin-top: 14px;
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.info-card {
    padding: 18px;
}

.info-card h3 {
    margin: 9px 0;
}

.info-card p {
    margin: 0;
    color: #d6ecf2;
}

.info-card small {
    display: inline-block;
    margin-top: 11px;
    color: var(--muted);
}

.badge {
    display: inline-block;
    margin: 0;
    color: #09303d;
    background: var(--accent-2);
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 700;
}

.admin-layout {
    display: grid;
    gap: 14px;
}

.panel {
    padding: 20px;
}

.panel h1,
.panel h2 {
    margin-top: 0;
}

.calendar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-top: 12px;
}

.inline-date-import {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(7, 24, 32, 0.45);
}

.inline-date-import label {
    margin: 0;
    color: var(--muted);
}

.inline-date-import input[type='date'] {
    width: auto;
    min-width: 145px;
    padding: 8px 10px;
}

.btn-date-import {
    background: linear-gradient(120deg, #14c7a4, #7fe5c2);
    color: #052a22;
    border-color: transparent;
}

.btn-date-import:hover {
    background: linear-gradient(120deg, #11b293, #72d9b8);
}

.calendar-source-config {
    margin-top: 12px;
    display: grid;
    gap: 10px;
}

.source-row {
    display: grid;
    grid-template-columns: 22px 140px 1fr;
    align-items: center;
    gap: 10px;
}

.source-row input[type='radio'] {
    width: 16px;
    height: 16px;
}

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

.stack-form {
    display: grid;
    gap: 8px;
}

label {
    font-size: 0.84rem;
    color: var(--muted);
}

input,
textarea,
select,
button {
    font: inherit;
}

input,
textarea,
.search {
    width: 100%;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: rgba(4, 20, 26, 0.66);
    color: var(--text);
    padding: 10px 12px;
}

input:focus,
textarea:focus,
.search:focus {
    outline: 2px solid rgba(102, 224, 183, 0.34);
    border-color: rgba(102, 224, 183, 0.8);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.password-field {
    position: relative;
}

.password-field input {
    min-width: 0;
    padding-right: 50px;
}

.password-toggle {
    position: absolute;
    top: 50%;
    right: 8px;
    width: 34px;
    height: 34px;
    border: 1px solid rgba(255, 255, 255, 0.36);
    border-radius: 999px;
    padding: 0;
    color: #ffffff;
    background: rgba(4, 20, 26, 0.9);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35);
    cursor: pointer;
    display: inline-grid;
    place-items: center;
    transform: translateY(-50%);
}

.password-toggle::after {
    content: attr(data-tooltip);
    position: absolute;
    right: 0;
    bottom: calc(100% + 8px);
    min-width: 210px;
    max-width: 250px;
    padding: 8px 10px;
    border-radius: 10px;
    color: #06271f;
    background: #66e0b7;
    border: 1px solid rgba(255, 255, 255, 0.45);
    box-shadow: 0 14px 26px rgba(0, 0, 0, 0.3);
    font-size: 0.76rem;
    font-weight: 800;
    line-height: 1.25;
    text-align: center;
    opacity: 0;
    pointer-events: none;
    transform: translateY(6px);
    transition: opacity 150ms ease, transform 150ms ease;
    z-index: 20;
}

.password-toggle:hover::after,
.password-toggle:focus-visible::after {
    opacity: 1;
    transform: translateY(0);
}

.password-toggle:hover,
.password-toggle:focus-visible,
.password-toggle.is-visible {
    color: var(--text);
    background: rgba(102, 224, 183, 0.12);
    border-color: rgba(102, 224, 183, 0.4);
}

.password-toggle-icon {
    position: relative;
    width: 18px;
    height: 11px;
    border: 2px solid currentColor;
    border-radius: 999px / 70%;
    font-size: 0;
}

.password-toggle-icon::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 5px;
    height: 5px;
    border-radius: 999px;
    background: currentColor;
    transform: translate(-50%, -50%);
}

.password-toggle.is-visible .password-toggle-icon::before {
    content: '';
    position: absolute;
    left: 50%;
    top: -5px;
    width: 2px;
    height: 22px;
    border-radius: 999px;
    background: currentColor;
    transform: translateX(-50%) rotate(45deg);
}

.checkbox-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    color: var(--muted);
    line-height: 1.45;
}

.checkbox-row a {
    color: #f6d27d;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.checkbox-row input[type='checkbox'] {
    width: 18px;
    min-width: 18px;
    height: 18px;
    margin-top: 0.2em;
}

.user-auth-grid {
    margin-top: 14px;
}

.user-auth-status {
    margin-top: 14px;
}

.user-auth-actions {
    justify-content: flex-start;
}

.settings-form {
    display: grid;
    gap: 14px;
}

.settings-choice-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 10px;
    margin-top: 12px;
}

.setting-check-card {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-height: 52px;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    color: var(--text);
    background: rgba(7, 24, 32, 0.45);
    cursor: pointer;
}

.setting-check-card input[type='checkbox'] {
    width: 18px;
    min-width: 18px;
    height: 18px;
    margin-top: 0.12em;
}

.user-settings-page .checkbox-row,
.user-settings-page .setting-check-card {
    display: grid !important;
    grid-template-columns: 18px minmax(0, 1fr) !important;
    align-items: start !important;
    justify-content: start !important;
    justify-items: start !important;
    text-align: left !important;
}

.user-settings-page .checkbox-row input[type='checkbox'],
.user-settings-page .setting-check-card input[type='checkbox'] {
    width: 18px !important;
    min-width: 18px !important;
    max-width: 18px !important;
    height: 18px !important;
    min-height: 18px !important;
    padding: 0 !important;
    margin: 2px 0 0 0 !important;
    justify-self: start !important;
}

.user-settings-page .checkbox-row span,
.user-settings-page .setting-check-card span {
    display: block !important;
    width: auto !important;
    text-align: left !important;
    justify-self: start !important;
}

.user-settings-page .settings-choice-grid {
    grid-template-columns: 1fr !important;
}

.settings-row {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    align-items: center;
    margin-top: 10px;
}

.settings-inline-input {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.settings-inline-input input,
.settings-inline-input select {
    width: 110px;
}

.settings-inline-input select {
    min-width: 170px;
}

.settings-duration-note {
    margin: 8px 0 0;
}

.email-settings-form {
    margin-top: 14px;
}

.email-settings-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    align-items: stretch;
}

.email-settings-grid label {
    color: var(--muted);
    margin-top: 8px;
}

.email-test-form {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px 12px;
    align-items: stretch;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.email-auto-note {
    margin-top: 10px;
}

.head-settings-form {
    margin-top: 14px;
}

.footer-settings-form {
    margin-top: 14px;
}

.footer-editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 10px 0;
}

.footer-editor-toolbar button {
    min-width: 38px;
    min-height: 36px;
    cursor: pointer;
}

.footer-editor {
    min-height: 170px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: rgba(5, 18, 24, 0.72);
    line-height: 1.65;
    outline: none;
}

.footer-editor:focus {
    border-color: rgba(102, 224, 183, 0.72);
    box-shadow: 0 0 0 3px rgba(102, 224, 183, 0.12);
}

.footer-editor p {
    margin: 0 0 10px;
}

.footer-link-popup {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 80;
    place-items: center;
    padding: 18px;
    background: rgba(3, 10, 14, 0.72);
}

.footer-link-popup.is-open {
    display: grid;
}

.footer-link-dialog {
    width: min(520px, 100%);
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #07151b;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
}

.footer-link-dialog h3 {
    margin: 0 0 12px;
}

.footer-link-grid {
    display: grid;
    gap: 10px;
}

.site-footer {
    margin-top: 36px;
    border-top: 1px solid var(--border);
    background: rgba(3, 13, 17, 0.76);
}

.site-footer-inner {
    padding: 22px 0 28px;
    color: #c6dce2;
    font-size: 0.86rem;
    line-height: 1.55;
}

.site-footer-inner p {
    margin: 0 0 8px;
}

.site-footer-inner .site-footer-main {
    text-align: center;
    color: #eef8fb;
    font-weight: 700;
}

.site-footer-inner a {
    color: var(--accent);
    font-weight: 800;
}

.footer-editor.site-footer-inner {
    padding: 16px;
}

.cookie-editor {
    min-height: 150px;
}

.cookie-buttons-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin: 18px 0 12px;
}

.cookie-buttons-head h3 {
    margin: 0 0 4px;
}

.cookie-buttons-list {
    display: grid;
    gap: 12px;
}

.cookie-button-row {
    display: grid;
    grid-template-columns: minmax(150px, 1.1fr) minmax(130px, 0.8fr) minmax(170px, 1.2fr) minmax(140px, 1fr) minmax(120px, 0.75fr) minmax(120px, 0.75fr) auto;
    gap: 10px;
    align-items: end;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: rgba(5, 18, 24, 0.52);
}

.cookie-button-field {
    display: grid;
    gap: 6px;
    margin: 0;
}

.cookie-button-field span {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
}

.cookie-button-remove {
    min-height: 42px;
    white-space: nowrap;
}

.cookie-consent-banner[hidden],
.cookie-required-alert[hidden] {
    display: none !important;
}

.cookie-consent-banner {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 95;
    padding: 18px;
    background: linear-gradient(180deg, rgba(3, 10, 14, 0), rgba(3, 10, 14, 0.72));
}

.cookie-consent-card {
    position: relative;
    width: min(1120px, 100%);
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    padding: 18px 52px 18px 18px;
    border: 1px solid rgba(102, 224, 183, 0.24);
    border-radius: 10px;
    background: rgba(5, 18, 24, 0.96);
    box-shadow: 0 18px 55px rgba(0, 0, 0, 0.42);
}

.cookie-consent-copy {
    color: #d4e8ed;
    font-size: 0.92rem;
    line-height: 1.5;
}

.cookie-consent-copy p {
    margin: 0;
}

.cookie-consent-copy a {
    color: #8ff1d1;
    font-weight: 800;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.cookie-consent-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
}

.cookie-consent-actions .btn {
    min-height: 40px;
    white-space: nowrap;
}

.cookie-consent-danger {
    border-color: rgba(255, 195, 104, 0.45);
    color: #ffd99b;
}

.cookie-consent-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 34px;
    height: 34px;
    display: inline-grid;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 999px;
    background: rgba(4, 20, 26, 0.82);
    color: #e8f7fa;
    cursor: pointer;
}

.cookie-consent-close:hover {
    border-color: rgba(102, 224, 183, 0.6);
    color: #8ff1d1;
}

.cookie-required-alert {
    position: fixed;
    right: 18px;
    top: 18px;
    z-index: 110;
    width: min(420px, calc(100vw - 36px));
    padding: 14px 16px;
    border: 1px solid rgba(255, 195, 104, 0.45);
    border-radius: 10px;
    background: rgba(24, 17, 7, 0.96);
    color: #ffe8bc;
    box-shadow: 0 18px 55px rgba(0, 0, 0, 0.42);
    font-weight: 700;
    line-height: 1.45;
}

.head-code-textarea {
    min-height: 320px;
    resize: vertical;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    font-size: 0.88rem;
    line-height: 1.45;
    white-space: pre;
    overflow: auto;
}

.settings-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    border-radius: 999px;
    padding: 4px 10px;
    font-weight: 800;
    font-size: 0.78rem;
}

.status-badge-on {
    color: #06271f;
    background: #66e0b7;
}

.status-badge-off {
    color: #dfe9ec;
    background: rgba(138, 151, 160, 0.34);
}

.status-badge-admin {
    color: #ffffff;
    background: rgba(4, 20, 26, 0.9);
    border: 1px solid rgba(102, 224, 183, 0.55);
}

.alert {
    border-radius: 12px;
    padding: 10px 12px;
    margin-top: 10px;
}

.alert p {
    margin: 0;
}

.alert-error {
    border: 1px solid rgba(255, 144, 144, 0.55);
    background: rgba(107, 28, 28, 0.4);
}

.alert-success {
    border: 1px solid rgba(102, 224, 183, 0.5);
    background: rgba(17, 98, 74, 0.33);
}

.section-head.compact {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
}

.search {
    max-width: 360px;
}

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

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

th,
td {
    text-align: left;
    padding: 12px 10px;
    border-bottom: 1px solid rgba(153, 197, 210, 0.22);
    vertical-align: top;
}

td a {
    color: var(--accent);
}

.calendar-summary {
    color: var(--muted);
    margin-bottom: 10px;
}

.panel-toggle {
    width: 100%;
    border: 0;
    border-radius: 12px;
    background: rgba(9, 35, 45, 0.55);
    color: var(--text);
    padding: 16px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 1.08rem;
    font-weight: 850;
    cursor: pointer;
    margin-bottom: 12px;
}

.panel-toggle > span:first-child,
.sentiment-toggle-title span:first-child {
    font-size: 1.12rem;
}

.panel-toggle-chevron {
    width: 30px;
    height: 30px;
    display: inline-grid;
    place-items: center;
    border-radius: 999px;
    border: 1px solid var(--border);
    font-size: 1.25rem;
    font-weight: 900;
}

.sentiment-toggle-title {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 999px;
    display: inline-block;
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.04);
}

.status-dot-idle {
    background: #8a97a0;
}

.status-dot-active {
    background: #d94a3a;
}

.panel-collapsible.is-collapsed {
    display: none;
}

.db-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.db-controls select {
    width: auto;
    min-width: 100px;
}

.calendar-results {
    display: grid;
    gap: 14px;
}

.calendar-pagination {
    display: grid;
    gap: 10px;
    margin-top: 14px;
}

.calendar-pagination-summary {
    color: var(--muted);
    font-size: 0.88rem;
}

.calendar-pagination-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.calendar-page-btn {
    width: auto;
    min-width: 38px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: rgba(9, 35, 45, 0.7);
    color: var(--text);
    padding: 8px 11px;
    cursor: pointer;
}

.calendar-page-btn:hover,
.calendar-page-btn:focus-visible {
    border-color: rgba(102, 224, 183, 0.78);
    background: rgba(18, 65, 78, 0.9);
}

.calendar-page-btn.is-active,
.calendar-page-btn:disabled {
    color: #06271f;
    background: #66e0b7;
    border-color: #66e0b7;
    cursor: default;
}

.calendar-page-last {
    min-width: 74px;
}

.calendar-page-ellipsis {
    display: inline-flex;
    align-items: center;
    color: var(--muted);
    padding: 0 4px;
}

.calendar-group {
    background: rgba(7, 24, 32, 0.64);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
}

.calendar-group h3 {
    margin: 0 0 8px;
}

.calendar-group-toggle {
    width: 100%;
    border: 0;
    border-radius: 10px;
    background: rgba(9, 35, 45, 0.55);
    color: var(--text);
    padding: 10px 12px;
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    margin-bottom: 10px;
}

.calendar-group-date {
    font-weight: 700;
}

.calendar-group-meta {
    color: var(--muted);
    font-size: 0.86rem;
}

.calendar-group-chevron {
    width: 24px;
    height: 24px;
    display: inline-grid;
    place-items: center;
    border-radius: 999px;
    border: 1px solid var(--border);
}

.calendar-group-body.is-collapsed {
    display: none;
}

.sentiment-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-top: 10px;
}

.sentiment-source-config {
    display: grid;
    gap: 8px;
    margin-top: 10px;
}

.sentiment-source-row {
    display: grid;
    grid-template-columns: 28px 1fr;
    gap: 10px;
    align-items: center;
}

.sentiment-source-index {
    color: var(--muted);
    font-weight: 700;
}

.sentiment-results {
    margin-top: 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(7, 24, 32, 0.45);
    padding: 10px;
}

.db-cleanup-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-top: 12px;
}

.db-backup-controls {
    display: grid;
    gap: 10px;
    margin-top: 12px;
}

.db-backup-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.db-backup-actions {
    justify-content: flex-start;
}

.db-backup-controls select {
    min-width: 260px;
    width: auto;
}

.db-history-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-top: 12px;
    margin-bottom: 8px;
}

.auto-parse-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-top: 12px;
}

#autoParseDetails {
    margin-top: 10px;
    line-height: 1.6;
}

.auto-parse-label {
    margin: 0;
}

#autoParseValue {
    width: 56px;
    min-width: 56px;
    text-align: center;
    padding: 10px 8px;
}

#autoParseUnit {
    width: auto;
    min-width: 110px;
}

#dbCleanupDate {
    width: auto;
    min-width: 145px;
}

.calendar-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.calendar-table th,
.calendar-table td {
    border-bottom: 1px solid rgba(153, 197, 210, 0.2);
    text-align: left;
    padding: 8px;
}

.stars {
    letter-spacing: 0.1em;
    color: #f1be59;
}

.is-hidden {
    display: none !important;
}

.calendar-page {
    padding-top: 18px;
}

.calendar-page .section-head {
    margin-bottom: 14px;
}

.calendar-page h1 {
    margin: 4px 0 6px;
}

.calendar-count-pill {
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 8px 12px;
    color: var(--text);
    background: rgba(9, 35, 45, 0.55);
    font-weight: 700;
    white-space: nowrap;
}

.calendar-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 16px 0;
    overflow: visible;
}

.star-filter-btn {
    position: relative;
    border: 1px solid rgba(153, 197, 210, 0.42);
    border-radius: 12px;
    padding: 10px 12px 10px 10px;
    color: #c8d9de;
    background: rgba(4, 20, 26, 0.84);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    box-shadow: inset 0 0 0 1px rgba(4, 20, 26, 0.35);
    transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease, color 160ms ease;
}

.star-filter-btn::before {
    content: 'SPENTO';
    border-radius: 999px;
    padding: 3px 7px;
    color: #dfe9ec;
    background: rgba(138, 151, 160, 0.34);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.04em;
}

.star-filter-btn::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 50%;
    bottom: calc(100% + 10px);
    min-width: 210px;
    max-width: 260px;
    padding: 9px 11px;
    border-radius: 10px;
    color: #06271f;
    background: #66e0b7;
    border: 1px solid rgba(255, 255, 255, 0.35);
    box-shadow: 0 16px 30px rgba(0, 0, 0, 0.28);
    font-size: 0.78rem;
    font-weight: 800;
    line-height: 1.25;
    text-align: center;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 8px);
    transition: opacity 150ms ease, transform 150ms ease;
    z-index: 30;
}

.star-filter-btn:hover,
.star-filter-btn:focus-visible {
    transform: translateY(-2px);
    box-shadow: 0 12px 26px rgba(0, 0, 0, 0.32);
}

.star-filter-btn:hover::after,
.star-filter-btn:focus-visible::after {
    opacity: 1;
    transform: translate(-50%, 0);
}

.star-filter-btn.is-active {
    color: #102027;
    border-color: rgba(246, 181, 63, 0.95);
    background: linear-gradient(120deg, #f6b53f, #f3cc7d);
    box-shadow: 0 12px 26px rgba(246, 181, 63, 0.22);
}

.star-filter-btn.is-active::before {
    content: 'ATTIVO';
    color: #06271f;
    background: #66e0b7;
}

.star-filter-btn.is-active::after {
    color: #102027;
    background: #f6b53f;
}

.star-filter-count {
    min-width: 26px;
    height: 24px;
    border-radius: 999px;
    display: inline-grid;
    place-items: center;
    padding: 0 7px;
    background: rgba(255, 255, 255, 0.13);
    font-size: 0.82rem;
    font-weight: 700;
}

.star-filter-btn.is-active .star-filter-count {
    background: rgba(16, 32, 39, 0.13);
}

.economic-stars {
    white-space: nowrap;
}

.economic-event-title-wrap {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.economic-event-link {
    color: inherit;
    font-weight: 700;
    text-decoration: underline;
    text-decoration-color: rgba(102, 224, 183, 0.42);
    text-underline-offset: 3px;
}

.economic-event-link:hover,
.economic-event-link:focus-visible {
    color: #66e0b7;
    text-decoration-color: currentColor;
}

.economic-event-row[data-detail-url] {
    cursor: pointer;
}

.economic-event-row[data-detail-url]:not(.is-past):not(.is-next-event):hover td {
    background: rgba(102, 224, 183, 0.08);
}

.economic-value-tone {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    border-radius: 999px;
    padding: 3px 8px;
    font-weight: 800;
    line-height: 1.15;
    color: inherit;
}

.economic-value-tone-positive {
    color: #063f2e !important;
    background: #6ee7b7;
    box-shadow: 0 0 0 1px rgba(110, 231, 183, 0.45);
}

.economic-value-tone-negative {
    color: #ffffff !important;
    background: #dc3f4d;
    box-shadow: 0 0 0 1px rgba(255, 128, 142, 0.42);
}

.economic-value-tone-neutral {
    color: #111827 !important;
    background: #e8eef0;
    box-shadow: 0 0 0 1px rgba(232, 238, 240, 0.45);
}

.economic-notification-bell-btn {
    position: relative;
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    width: 25px;
    height: 25px;
    border-radius: 999px;
    padding: 0;
    color: #9fb2ba;
    background: rgba(4, 20, 26, 0.72);
    border: 1px solid rgba(153, 197, 210, 0.38);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transform-origin: 50% 12%;
    transition: color 160ms ease, background 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.economic-notification-bell-btn::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 50%;
    top: calc(100% + 10px);
    min-width: 230px;
    max-width: min(300px, 80vw);
    padding: 10px 12px;
    border-radius: 10px;
    color: #06271f;
    background: #66e0b7;
    border: 1px solid rgba(255, 255, 255, 0.48);
    box-shadow: 0 16px 30px rgba(0, 0, 0, 0.3);
    font-size: 0.78rem;
    font-weight: 800;
    line-height: 1.25;
    text-align: center;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 8px);
    transition: opacity 150ms ease, transform 150ms ease;
    z-index: 60;
}

.economic-notification-bell-btn:hover,
.economic-notification-bell-btn:focus-visible {
    color: #ffffff;
    background: rgba(9, 35, 45, 0.94);
    transform: translateY(-1px);
}

.economic-notification-bell-btn:hover::after,
.economic-notification-bell-btn:focus-visible::after {
    opacity: 1;
    transform: translate(-50%, 0);
}

.economic-event-row.has-active-notification .economic-notification-bell-btn.is-active {
    color: #06271f;
    background: #66e0b7;
    border-color: rgba(255, 255, 255, 0.62);
    box-shadow: 0 0 0 3px rgba(102, 224, 183, 0.16), 0 0 18px rgba(102, 224, 183, 0.32);
}

.economic-event-row.has-sent-notification .economic-notification-bell-btn.is-sent,
.economic-notification-bell-btn.is-sent {
    color: #fff5cf;
    background: #8a5a10;
    border-color: rgba(255, 219, 127, 0.72);
    box-shadow: 0 0 0 2px rgba(138, 90, 16, 0.18), inset 0 0 0 1px rgba(255, 245, 207, 0.16);
}

.economic-notification-bell-btn.is-sent::after {
    color: #fff5cf;
    background: #8a5a10;
}

.economic-notification-bell-btn.is-loading {
    opacity: 0.62;
    pointer-events: none;
}

.economic-notification-bell-btn:disabled {
    cursor: not-allowed;
    opacity: 0.42;
}

.economic-event-row.has-active-notification .economic-notification-bell-btn.is-active {
    animation: notificationBellWobble 3.2s ease-in-out infinite;
}

@keyframes notificationBellWobble {
    0%,
    72%,
    100% {
        transform: rotate(0deg);
    }
    76% {
        transform: rotate(-13deg);
    }
    80% {
        transform: rotate(12deg);
    }
    84% {
        transform: rotate(-9deg);
    }
    88% {
        transform: rotate(7deg);
    }
    92% {
        transform: rotate(0deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    .economic-event-row.has-active-notification .economic-notification-bell-btn.is-active {
        animation: none;
    }
}

.calendar-notification-toast {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 130;
    max-width: min(420px, calc(100vw - 32px));
    padding: 13px 15px;
    border-radius: 10px;
    color: #06271f;
    background: #66e0b7;
    border: 1px solid rgba(255, 255, 255, 0.56);
    box-shadow: 0 18px 38px rgba(0, 0, 0, 0.36);
    font-weight: 800;
    line-height: 1.35;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 180ms ease, transform 180ms ease;
}

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

.calendar-notification-toast.is-error {
    color: #ffffff;
    background: #bd3d3d;
}

.calendar-signup-modal[hidden],
.calendar-notification-toast[hidden] {
    display: none;
}

.calendar-modal-open {
    overflow: hidden;
}

.calendar-signup-modal {
    position: fixed;
    inset: 0;
    z-index: 120;
    display: grid;
    place-items: center;
    padding: 18px;
}

.calendar-signup-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(2, 12, 16, 0.72);
    backdrop-filter: blur(4px);
}

.calendar-signup-modal-panel {
    position: relative;
    width: min(520px, 100%);
    border-radius: 10px;
    padding: 26px;
    color: var(--text);
    background: rgba(9, 35, 45, 0.98);
    border: 1px solid rgba(153, 197, 210, 0.36);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.46);
}

.calendar-signup-modal-panel h2 {
    margin: 0 38px 10px 0;
    font-size: 1.35rem;
}

.calendar-signup-modal-panel p {
    margin: 0;
    color: var(--muted);
    line-height: 1.55;
}

.calendar-signup-modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 34px;
    height: 34px;
    border-radius: 999px;
    border: 1px solid rgba(153, 197, 210, 0.36);
    color: #ffffff;
    background: rgba(4, 20, 26, 0.82);
    display: inline-grid;
    place-items: center;
    cursor: pointer;
}

.calendar-signup-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
}

.calendar-report-open-btn {
    min-height: 38px;
    white-space: nowrap;
    cursor: pointer;
}

.calendar-report-modal-panel {
    width: min(620px, 100%);
}

.calendar-report-form {
    display: grid;
    gap: 14px;
    margin-top: 18px;
}

.calendar-report-field {
    display: grid;
    gap: 7px;
}

.calendar-report-field span,
.calendar-report-stars legend {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
}

.calendar-report-field select {
    width: 100%;
    min-height: 42px;
}

.calendar-report-stars {
    display: grid;
    gap: 9px;
    margin: 0;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: rgba(4, 20, 26, 0.46);
}

.calendar-report-stars .checkbox-row {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr);
    align-items: start;
    gap: 10px;
}

.economic-event-row {
    transition: background 160ms ease, opacity 160ms ease;
}

.economic-event-row.is-past {
    opacity: 1;
    background: rgba(74, 83, 92, 0.34);
}

.economic-event-row.is-past td {
    color: #a8bac0;
}

.economic-event-row.is-past .economic-stars {
    color: #8a97a0;
}

.economic-event-row.is-next-event {
    background: linear-gradient(90deg, rgba(102, 224, 183, 0.34), rgba(246, 181, 63, 0.16));
    box-shadow: inset 0 0 0 1px rgba(102, 224, 183, 0.55);
}

.economic-event-row.is-next-event td:first-child {
    border-left: 5px solid var(--accent-2);
    font-weight: 700;
}

.economic-event-row.is-next-event td {
    border-top: 1px solid rgba(102, 224, 183, 0.5);
    border-bottom: 1px solid rgba(102, 224, 183, 0.5);
}

.economic-now-marker td {
    padding: 14px 8px;
    border-bottom: 0;
}

.economic-now-bookmark {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text);
    font-size: 0.86rem;
    font-weight: 700;
}

.economic-now-bookmark::before,
.economic-now-bookmark::after {
    content: '';
    height: 1px;
    flex: 1;
    background: linear-gradient(90deg, transparent, var(--accent-2), transparent);
}

.economic-now-bookmark span:first-child {
    border: 1px solid rgba(102, 224, 183, 0.65);
    border-radius: 999px;
    padding: 5px 10px;
    color: #06271f;
    background: var(--accent-2);
    white-space: nowrap;
}

.economic-now-bookmark span:first-child span,
.economic-now-bookmark [data-current-time-label] {
    color: #06271f;
}

.economic-now-bookmark span:last-child {
    color: var(--muted);
    white-space: nowrap;
}

.economic-calendar-table {
    margin-top: 8px;
    overflow: visible;
}

.economic-calendar-table .calendar-table {
    border-collapse: separate;
    border-spacing: 0;
}

.economic-calendar-table .calendar-table thead {
    position: sticky;
    top: 0;
    z-index: 45;
}

.economic-calendar-table .calendar-table thead th {
    position: sticky;
    top: 0;
    z-index: 45;
    color: #e8f6f2;
    background: #09232d;
    box-shadow: 0 1px 0 rgba(153, 197, 210, 0.26), 0 10px 18px rgba(0, 0, 0, 0.24);
}

.economic-calendar-table .calendar-table thead th:first-child {
    border-top-left-radius: 8px;
}

.economic-calendar-table .calendar-table thead th:last-child {
    border-top-right-radius: 8px;
}

@media (max-width: 760px) {
    .economic-calendar-table {
        overflow-x: auto;
    }

    .economic-calendar-table .calendar-table {
        min-width: 760px;
    }
}

.event-detail-page {
    padding-top: 18px;
}

.event-detail-back {
    margin-bottom: 16px;
}

.event-detail-hero h1 {
    margin: 4px 0 12px;
    max-width: 920px;
}

.event-detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 0 0 18px;
}

.event-detail-meta span {
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 7px 10px;
    color: var(--text);
    background: rgba(9, 35, 45, 0.54);
    font-weight: 700;
}

.event-detail-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 0 0 18px;
}

.event-detail-notification-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #06271f;
    background: linear-gradient(120deg, #f6b53f, #ffe09a);
    border-color: rgba(255, 255, 255, 0.62);
    cursor: pointer;
}

.event-detail-notification-btn.is-active {
    color: #06271f;
    background: #66e0b7;
    box-shadow: 0 0 0 3px rgba(102, 224, 183, 0.16), 0 0 18px rgba(102, 224, 183, 0.3);
}

.event-detail-notification-btn.is-sent {
    color: #fff5cf;
    background: #8a5a10;
    border-color: rgba(255, 219, 127, 0.72);
}

.event-detail-notification-btn.is-loading {
    opacity: 0.65;
    pointer-events: none;
}

.event-detail-notification-btn:disabled {
    color: #9fb2ba;
    background: rgba(4, 20, 26, 0.72);
    border-color: rgba(153, 197, 210, 0.38);
    cursor: not-allowed;
}

.event-detail-alert {
    margin: 12px 0;
}

.event-detail-summary {
    max-width: 900px;
    color: var(--text);
    line-height: 1.65;
}

.event-detail-section {
    margin-top: 18px;
}

.event-detail-section h2 {
    margin-top: 0;
}

.event-detail-copy {
    color: var(--text);
    line-height: 1.72;
    max-width: 980px;
}

.event-detail-history-table {
    margin-top: 12px;
}

.calendar-empty-state {
    margin-top: 12px;
}

[data-reveal] {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 500ms ease, transform 500ms ease;
}

[data-reveal].is-visible {
    opacity: 1;
    transform: translateY(0);
}

@media (max-width: 920px) {
    .split {
        grid-template-columns: 1fr;
    }

    .stats {
        grid-template-columns: 1fr;
    }

    .section-head.compact {
        flex-direction: column;
        align-items: flex-start;
    }

    .search {
        max-width: 100%;
    }

    .calendar-count-pill {
        width: 100%;
        text-align: center;
    }

    .star-filter-btn {
        flex: 1 1 150px;
        justify-content: center;
    }

    .email-settings-grid,
    .email-test-form {
        grid-template-columns: 1fr;
    }

    .cookie-button-row,
    .cookie-consent-card {
        grid-template-columns: 1fr;
    }

    .cookie-consent-card {
        align-items: stretch;
        padding: 18px 46px 18px 18px;
    }

    .cookie-consent-actions {
        justify-content: flex-start;
    }

    .cookie-consent-actions .btn {
        width: 100%;
        justify-content: center;
    }

    .economic-now-bookmark {
        flex-wrap: wrap;
        justify-content: center;
        text-align: center;
    }

    .economic-now-bookmark::before,
    .economic-now-bookmark::after {
        flex-basis: 100%;
    }

    .inline-date-import {
        width: 100%;
        display: grid;
        grid-template-columns: auto 1fr;
        gap: 8px;
    }

    .inline-date-import input[type='date'] {
        width: 100%;
        min-width: 0;
    }

    .inline-date-import .btn {
        grid-column: 1 / -1;
        width: 100%;
    }
}
