:root {
    /* Color Tokens (HSL) */
    --bg-dark: hsl(248, 48%, 6%);
    --bg-space: hsl(248, 50%, 10%);
    --card-bg: hsla(248, 35%, 11%, 0.88);
    --card-border: hsla(248, 30%, 30%, 0.25);
    --card-border-focus: hsla(182, 100%, 50%, 0.4);
    
    --text-primary: hsl(220, 20%, 94%);
    --text-secondary: hsl(220, 15%, 70%);
    --text-muted: hsl(248, 10%, 50%);
    
    /* Neon & Accent Colors */
    --gold: hsl(45, 80%, 50%);
    --gold-glow: hsla(45, 80%, 50%, 0.3);
    --cyan: hsl(182, 100%, 50%);
    --cyan-glow: hsla(182, 100%, 50%, 0.25);
    --violet: hsl(276, 100%, 65%);
    --violet-glow: hsla(276, 100%, 65%, 0.25);
    --emerald: hsl(145, 80%, 45%);
    --emerald-glow: hsla(145, 80%, 45%, 0.25);
    
    /* UI Constants */
    --radius-lg: 16px;
    --radius-md: 10px;
    --radius-sm: 6px;
    --shadow-glow: 0 0 20px var(--violet-glow);
    --shadow-gold-glow: 0 0 25px var(--gold-glow);
    --transition-smooth: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    overflow-x: hidden;
    min-height: 100vh;
}

/* Space Background Effects */
.cosmos-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 30% 20%, hsl(265, 55%, 15%) 0%, transparent 40%),
                radial-gradient(circle at 80% 70%, hsl(235, 50%, 15%) 0%, transparent 40%);
    z-index: -2;
    pointer-events: none;
}

.stars {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(white, rgba(255,255,255,.2) 2px, transparent 40px),
        radial-gradient(white, rgba(255,255,255,.15) 1px, transparent 30px),
        radial-gradient(white, rgba(255,255,255,.1) 2px, transparent 40px);
    background-size: 550px 550px, 350px 350px, 250px 250px;
    background-position: 0 0, 40px 60px, 130px 270px;
    opacity: 0.18;
    z-index: -1;
    pointer-events: none;
    animation: starsRotate 240s linear infinite;
}

@keyframes starsRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Layout Container */
.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    min-height: 100vh;
}

/* Header Styling */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 16px;
}

.clavis-logo-svg {
    width: 54px;
    height: 54px;
    filter: drop-shadow(0 0 8px var(--gold-glow));
    animation: floatLogo 4s ease-in-out infinite;
}

@keyframes floatLogo {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); filter: drop-shadow(0 0 12px var(--gold)); }
}

.pupil {
    animation: pulsePupil 3s ease-in-out infinite;
}

@keyframes pulsePupil {
    0%, 100% { transform: scale(1) translate(0px, 0px); opacity: 0.8; }
    50% { transform: scale(1.1) translate(0px, 0px); opacity: 1; filter: drop-shadow(0 0 4px var(--cyan)); }
}

.logo-text h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 2px;
    background: linear-gradient(135deg, #fff 30%, var(--gold) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-text h1 span {
    font-weight: 300;
    color: var(--cyan);
    -webkit-text-fill-color: var(--cyan);
    text-shadow: 0 0 10px var(--cyan-glow);
}

.logo-text p {
    font-size: 11px;
    letter-spacing: 1px;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.header-actions {
    display: flex;
    gap: 12px;
}

/* Glassmorphism Cards */
.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
    transition: var(--transition-smooth);
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.card:hover {
    border-color: hsla(248, 30%, 40%, 0.4);
}

/* Grid Layout */
.app-main {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 24px;
    align-items: start;
}

.left-panel {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.right-panel {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Compact Header Stats */
.header-stats {
    display: flex;
    gap: 20px;
    align-items: center;
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    padding: 6px 16px;
}

.header-stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-stats .stat-value {
    font-family: 'Outfit', sans-serif;
    font-size: 16px;
    font-weight: 700;
    color: var(--cyan);
    text-shadow: 0 0 8px var(--cyan-glow);
}

.header-stats .stat-label {
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

/* Calendar Card Styling */
.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.calendar-header h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 18px;
    font-weight: 600;
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    text-align: center;
    font-weight: 600;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 8px;
}

.calendar-day {
    aspect-ratio: 1;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    border-radius: 50%;
    cursor: pointer;
    position: relative;
    border: 1px solid transparent;
    transition: var(--transition-smooth);
    color: var(--text-primary);
}

.calendar-day:hover:not(.empty) {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
}

.calendar-day.empty {
    cursor: default;
}

.calendar-day.today {
    background: rgba(255, 255, 255, 0.15);
    border: 1.5px solid var(--text-primary);
    font-weight: bold;
}

.calendar-day.active-day {
    border-color: var(--cyan) !important;
    background: rgba(0, 242, 254, 0.05);
    box-shadow: 0 0 10px var(--cyan-glow);
}

/* Sincronia no Calendário (O Portal) */
.calendar-day.has-portal {
    border-color: var(--gold);
    color: var(--gold);
    text-shadow: 0 0 5px var(--gold-glow);
}

.calendar-day.has-portal::after {
    content: '';
    position: absolute;
    bottom: 3px;
    width: 4px;
    height: 4px;
    background-color: var(--gold);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--gold);
}

.calendar-day.has-acted {
    border-color: var(--emerald);
    color: var(--emerald);
}

.calendar-day.has-acted::after {
    background-color: var(--emerald);
    box-shadow: 0 0 8px var(--emerald);
}

.calendar-day.has-open {
    border-color: var(--violet);
    color: var(--violet);
}

.calendar-day.has-open::after {
    background-color: var(--violet);
    box-shadow: 0 0 8px var(--violet);
}

/* Button & UI element styling */
.btn-icon, .btn-nav {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.btn-icon:hover, .btn-nav:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.25);
    color: var(--gold);
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.2);
}

.btn-pwa {
    background: linear-gradient(135deg, var(--cyan) 0%, var(--violet) 100%);
    border: none;
    color: white;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: none; /* Só mostra se a instalação for possível */
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-smooth);
    box-shadow: 0 0 15px var(--violet-glow);
}

.btn-pwa:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px var(--violet);
}

/* Forms Tabs */
.form-tabs {
    display: flex;
    gap: 4px;
    background: rgba(0, 0, 0, 0.2);
    padding: 4px;
    border-radius: var(--radius-md);
    margin-bottom: 24px;
    overflow-x: auto;
}

.tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 8px 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition-smooth);
    white-space: nowrap;
}

.tab-btn.active {
    background: var(--card-bg);
    color: var(--gold);
    border: 1px solid var(--card-border);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.tab-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

/* Form Styles */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.4s ease;
}

/* Cosmic Stepper (Redesigned Step Indicator) */
.cosmic-stepper {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 500px;
    margin: 0 auto 32px auto;
    padding: 0 10px;
}

/* Connecting Line */
.step-line {
    position: absolute;
    top: 50%;
    left: 20px;
    right: 20px;
    height: 2px;
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-50%);
    z-index: 1;
    border-radius: 2px;
}

.step-line-progress {
    height: 100%;
    width: 0%; /* Dynamic width based on current step: 0%, 33.3%, 66.6%, 100% */
    background: linear-gradient(90deg, var(--violet) 0%, var(--cyan) 100%);
    box-shadow: 0 0 10px var(--cyan-glow);
    transition: width 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    border-radius: 2px;
}

/* Stepper Nodes (Stars) */
.step-node {
    position: relative;
    z-index: 2;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-space);
    border: 2px solid rgba(255, 255, 255, 0.15);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-smooth);
    outline: none;
    padding: 0;
}

.step-node:disabled {
    cursor: not-allowed;
    opacity: 0.4;
}

.step-node.active {
    border-color: var(--violet);
    color: white;
    background: var(--bg-dark);
    box-shadow: 0 0 15px var(--violet-glow);
    animation: stepperActivePulse 2s infinite ease-in-out;
}

.step-node.completed {
    border-color: var(--cyan);
    color: var(--cyan);
    background: var(--bg-dark);
    box-shadow: 0 0 12px var(--cyan-glow);
}

.step-icon {
    font-size: 14px;
}

/* Tooltip Labels below the nodes */
.step-tooltip {
    position: absolute;
    top: 48px;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Outfit', sans-serif;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    white-space: nowrap;
    color: var(--text-muted);
    transition: var(--transition-smooth);
    pointer-events: none;
}

.step-node.active .step-tooltip {
    color: var(--violet);
    text-shadow: 0 0 8px var(--violet-glow);
}

.step-node.completed .step-tooltip {
    color: var(--cyan);
    text-shadow: 0 0 8px var(--cyan-glow);
}

@keyframes stepperActivePulse {
    0%, 100% {
        box-shadow: 0 0 12px var(--violet-glow);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 18px var(--violet);
        transform: scale(1.05);
    }
}

/* Space Slide Transition Container */
#entry-modal .form-card {
    overflow-x: hidden !important;
}

#entry-modal #clavis-form {
    overflow-x: hidden !important;
}

.wizard-slides-container {
    display: flex;
    width: 100%;
    height: 100%;
    transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Layout of slide contents inside .wizard-slides-container */
.wizard-slides-container .tab-content {
    width: 100%;
    flex-shrink: 0;
    display: flex !important; /* Force flex display so they sit side-by-side inside container */
    flex-direction: column;
    justify-content: flex-start;
    opacity: 0.15;
    transition: opacity 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-sizing: border-box;
}

.wizard-slides-container .tab-content.active {
    opacity: 1;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.form-group-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

.form-group label {
    font-family: 'Outfit', sans-serif;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.form-group input[type="text"],
.form-group input[type="date"],
.form-group input[type="time"],
.form-group textarea {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    outline: none;
    transition: var(--transition-smooth);
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: var(--cyan);
    box-shadow: 0 0 10px var(--cyan-glow);
    background: rgba(0, 0, 0, 0.4);
}

.form-group textarea {
    resize: vertical;
}

/* Slider Customization */
.slider-container {
    padding: 10px 0;
}

.slider-container input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--card-border);
    outline: none;
    margin-bottom: 12px;
}

.slider-container input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--gold);
    cursor: pointer;
    box-shadow: 0 0 10px var(--gold-glow);
    transition: var(--transition-smooth);
}

.slider-container input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 0 15px var(--gold);
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: var(--text-muted);
}

/* Checkbox Customization */
.checkbox-group {
    margin: 10px 0 20px 0;
}

.checkbox-container {
    display: block;
    position: relative;
    padding-left: 30px;
    cursor: pointer;
    font-size: 13px;
    user-select: none;
    color: var(--text-secondary);
}

.checkbox-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: absolute;
    top: 0;
    left: 0;
    height: 20px;
    width: 20px;
    background-color: rgba(0,0,0,0.25);
    border: 1px solid var(--card-border);
    border-radius: 4px;
    transition: var(--transition-smooth);
}

.checkbox-container:hover input ~ .checkmark {
    border-color: var(--gold);
}

.checkbox-container input:checked ~ .checkmark {
    background-color: var(--gold);
    border-color: var(--gold);
    box-shadow: 0 0 8px var(--gold-glow);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.checkbox-container input:checked ~ .checkmark:after {
    display: block;
}

.checkbox-container .checkmark:after {
    left: 7px;
    top: 3px;
    width: 4px;
    height: 9px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* Action Buttons */
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 10px;
}

.btn {
    padding: 12px 20px;
    font-size: 13px;
    font-weight: 600;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: 'Outfit', sans-serif;
}

.btn-primary {
    background: linear-gradient(135deg, var(--gold) 0%, #aa7c11 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px var(--gold-glow);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid var(--card-border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-success {
    background: linear-gradient(135deg, var(--emerald) 0%, hsl(145, 80%, 30%) 100%);
    color: white;
    box-shadow: 0 0 15px var(--emerald-glow);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px var(--emerald);
}

/* Timeline/List styling */
.timeline-container {
    margin-top: 12px;
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.timeline-header h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 18px;
}

.search-bar {
    position: relative;
    width: 250px;
}

.search-bar input {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--card-border);
    border-radius: 30px;
    padding: 8px 16px 8px 36px;
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
    transition: var(--transition-smooth);
}

.search-bar input:focus {
    border-color: var(--cyan);
    box-shadow: 0 0 10px var(--cyan-glow);
}

.search-bar i {
    position: absolute;
    left: 14px;
    top: 11px;
    color: var(--text-muted);
    font-size: 12px;
}

.timeline-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.timeline-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 20px;
    align-items: center;
    transition: var(--transition-smooth);
    cursor: pointer;
}

.timeline-card:hover {
    border-color: var(--cyan);
    transform: translateX(4px);
    box-shadow: 0 4px 20px var(--cyan-glow);
}

.timeline-card-icon {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    background: rgba(255, 255, 255, 0.03);
    border: 1.5px solid var(--text-muted);
    color: var(--text-muted);
    transition: var(--transition-smooth);
}

.timeline-card.portal .timeline-card-icon {
    border-color: var(--gold);
    color: var(--gold);
    box-shadow: 0 0 10px var(--gold-glow);
}

.timeline-card.acted .timeline-card-icon {
    border-color: var(--cyan);
    color: var(--cyan);
    box-shadow: 0 0 10px var(--cyan-glow);
}

.timeline-card.open .timeline-card-icon {
    border-color: var(--violet);
    color: var(--violet);
    box-shadow: 0 0 10px var(--violet-glow);
}

.timeline-card-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.timeline-card-date {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.timeline-card-title {
    font-family: 'Outfit', sans-serif;
    font-size: 15px;
    font-weight: 600;
}

.timeline-card-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 4px;
}

.tag {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
}

.timeline-card-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.status-badge {
    font-family: 'Outfit', sans-serif;
    font-size: 10px;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
    padding: 4px 10px;
    border-radius: 20px;
    border: 1px solid transparent;
}

.timeline-card.portal .status-badge {
    color: var(--gold);
    border-color: var(--gold-glow);
    background: rgba(212, 175, 55, 0.05);
}

.timeline-card.acted .status-badge {
    color: var(--cyan);
    border-color: var(--cyan-glow);
    background: rgba(0, 242, 254, 0.05);
}

.timeline-card.open .status-badge {
    color: var(--violet);
    border-color: var(--violet-glow);
    background: rgba(276, 100, 65, 0.05);
}

.btn-delete {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
    padding: 8px;
    transition: var(--transition-smooth);
}

.btn-delete:hover {
    color: hsl(0, 80%, 60%);
}

.modal {
    display: none;
    position: fixed;
    z-index: 100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(6, 5, 15, 0.85); /* Slightly darker for better overlay contrast without blur */
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.open {
    display: flex;
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: var(--bg-space);
    border: 1.5px solid var(--card-border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 600px;
    padding: 30px;
    position: relative;
    box-shadow: 0 10px 40px rgba(0,0,0,0.6);
    max-height: 90vh;
    overflow-y: auto;
}

.close-modal {
    position: absolute;
    right: 20px;
    top: 15px;
    color: var(--text-muted);
    font-size: 28px;
    font-weight: 300;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.close-modal:hover {
    color: var(--gold);
}

/* Modal Internal Layout */
.modal-title-area {
    margin-bottom: 20px;
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 15px;
}

.modal-title-area h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 20px;
    color: var(--gold);
    margin-bottom: 4px;
}

.modal-meta {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.modal-section {
    margin-bottom: 20px;
}

.modal-section h4 {
    font-family: 'Outfit', sans-serif;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: 6px;
    border-left: 2.5px solid var(--gold);
    padding-left: 6px;
}

.modal-section.acted h4 {
    border-left-color: var(--cyan);
}

.modal-section.open h4 {
    border-left-color: var(--violet);
}

.modal-section p {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.02);
    padding: 10px 14px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(255,255,255,0.03);
}

/* User Profile Header */
.user-profile-header {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.03);
    padding: 6px 14px;
    border-radius: 30px;
    border: 1px solid var(--card-border);
}

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1.5px solid var(--cyan);
    box-shadow: 0 0 6px var(--cyan-glow);
}

.user-name-text {
    font-size: 13px;
    font-weight: 500;
    font-family: 'Outfit', sans-serif;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-logout-icon {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
    padding: 2px 4px;
    transition: var(--transition-smooth);
}

.btn-logout-icon:hover {
    color: hsl(0, 80%, 65%);
}

/* Login Overlay */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-dark);
    background-image: 
        radial-gradient(circle at 30% 20%, hsl(265, 55%, 12%) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, hsl(235, 50%, 12%) 0%, transparent 50%);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-overlay.active {
    display: flex;
}

.login-card {
    width: 100%;
    max-width: 420px;
    padding: 40px 30px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 24px;
    background: var(--card-bg);
    border: 1.5px solid var(--card-border);
    border-radius: var(--radius-lg);
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.6);
}

.login-logo-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.login-logo {
    width: 70px;
    height: 70px;
    margin-bottom: 8px;
}

.login-logo-area h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 28px;
    letter-spacing: 2px;
    font-weight: 700;
    background: linear-gradient(135deg, #fff 30%, var(--gold) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.login-logo-area h2 span {
    font-weight: 300;
    color: var(--cyan);
    -webkit-text-fill-color: var(--cyan);
}

.login-logo-area p {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Google Login Button */
.btn-google {
    background: #ffffff;
    color: #1f1f1f;
    font-size: 14px;
    font-weight: 600;
    width: 100%;
    justify-content: center;
    padding: 14px 20px;
    border-radius: var(--radius-md);
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.1);
}

.btn-google:hover {
    background: #f1f1f1;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 255, 255, 0.2);
}

.btn-google i {
    font-size: 16px;
    color: #4285F4;
}

/* Separator */
.login-separator {
    display: flex;
    align-items: center;
    text-align: center;
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.login-separator::before,
.login-separator::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--card-border);
}

.login-separator:not(:empty)::before {
    margin-right: .5em;
}

.login-separator:not(:empty)::after {
    margin-left: .5em;
}

/* Email Sign-in Section */
.login-email-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.login-email-section .form-group {
    margin-bottom: 0;
}

.login-email-section input {
    width: 100%;
    text-align: center;
}

.login-email-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 6px;
}

.login-email-actions .btn {
    justify-content: center;
    padding: 10px;
}

.login-error-msg {
    font-size: 12px;
    color: hsl(0, 85%, 65%);
    margin-top: 4px;
    min-height: 18px;
}

/* Small Config Button inside Header */
.btn-icon-small {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-smooth);
    font-size: 11px;
}

.btn-icon-small:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.25);
    color: var(--gold);
    box-shadow: 0 0 8px var(--gold-glow);
}

/* Theme Select Dropdown */
.theme-select-dropdown {
    width: 100%;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    outline: none;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.theme-select-dropdown:focus {
    border-color: var(--cyan);
    box-shadow: 0 0 10px var(--cyan-glow);
}

.theme-select-dropdown option {
    background: var(--bg-space);
    color: var(--text-primary);
}

/* Settings Modal Row & Danger Button */
.settings-buttons-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.btn-danger {
    background: linear-gradient(135deg, hsl(0, 80%, 45%) 0%, hsl(0, 80%, 30%) 100%);
    color: white;
    box-shadow: 0 0 15px rgba(220, 50, 50, 0.25);
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px hsl(0, 80%, 45%);
}

/* Theme 2: Nebula Violet Class Override */
body.theme-nebula {
    --bg-dark: hsl(265, 55%, 5%);
    --bg-space: hsl(265, 50%, 8%);
    --card-bg: hsla(265, 40%, 10%, 0.88);
    --gold: hsl(190, 100%, 45%); /* Troca acentos dourados por ciano */
    --gold-glow: hsla(190, 100%, 45%, 0.3);
    --violet: hsl(280, 100%, 65%);
}

body.theme-nebula .cosmos-bg {
    background: radial-gradient(circle at 30% 20%, hsl(280, 55%, 15%) 0%, transparent 40%),
                radial-gradient(circle at 80% 70%, hsl(190, 50%, 12%) 0%, transparent 40%);
}

/* Theme 3: Zen Obsidian Class Override */
body.theme-obsidian {
    --bg-dark: hsl(0, 0%, 4%);
    --bg-space: hsl(0, 0%, 8%);
    --card-bg: hsla(0, 0%, 8%, 0.92);
    --gold: hsl(38, 90%, 50%); /* Acentos em âmbar/ouro envelhecido */
    --gold-glow: hsla(38, 90%, 50%, 0.3);
    --cyan: hsl(38, 90%, 50%);
    --cyan-glow: hsla(38, 90%, 50%, 0.25);
    --violet: hsl(38, 90%, 45%);
}

body.theme-obsidian .cosmos-bg {
    background: radial-gradient(circle at 30% 20%, hsl(0, 0%, 10%) 0%, transparent 40%),
                radial-gradient(circle at 80% 70%, hsl(0, 0%, 6%) 0%, transparent 40%);
}

/* Oracle Card Styling */
.oracle-card {
    border-color: hsla(276, 100%, 65%, 0.25);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3), 0 0 15px rgba(170, 0, 255, 0.05);
}

.oracle-card:hover {
    border-color: hsla(276, 100%, 65%, 0.4);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4), 0 0 20px rgba(170, 0, 255, 0.1);
}

.oracle-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.oracle-header h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-secondary);
    border-left: 3px solid var(--violet);
    padding-left: 8px;
    margin: 0;
}

.oracle-badge {
    font-family: 'Outfit', sans-serif;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    background: linear-gradient(135deg, var(--violet) 0%, var(--cyan) 100%);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    box-shadow: 0 0 10px var(--violet-glow);
}

.oracle-status-msg {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.6;
    text-align: center;
    padding: 20px 10px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: var(--radius-md);
    border: 1px dashed var(--card-border);
}

.oracle-output {
    font-size: 13px;
    line-height: 1.7;
    color: var(--text-primary);
    background: rgba(0, 0, 0, 0.2);
    padding: 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--card-border);
    max-height: 250px;
    overflow-y: auto;
}

.oracle-output::-webkit-scrollbar {
    width: 6px;
}

.oracle-output::-webkit-scrollbar-track {
    background: transparent;
}

.oracle-output::-webkit-scrollbar-thumb {
    background: var(--card-border);
    border-radius: 3px;
}

.oracle-output::-webkit-scrollbar-thumb:hover {
    background: var(--violet-glow);
}

/* AI theme-colored button with subtle animated texture */
.btn-ai-theme {
    background: 
        repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.03) 0px, rgba(255, 255, 255, 0.03) 2px, transparent 2px, transparent 8px),
        linear-gradient(270deg, var(--violet), var(--cyan), var(--violet));
    background-size: 40px 40px, 200% 200%;
    color: white !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    box-shadow: 0 4px 15px var(--violet-glow), 0 0 10px var(--cyan-glow);
    animation: aiButtonAnim 10s linear infinite;
    position: relative;
    overflow: hidden;
    transition: var(--transition-smooth) !important;
}

.btn-ai-theme:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--violet), 0 0 15px var(--cyan);
}

@keyframes aiButtonAnim {
    0% {
        background-position: 0px 0px, 0% 50%;
    }
    50% {
        background-position: 20px 0px, 100% 50%;
    }
    100% {
        background-position: 40px 0px, 0% 50%;
    }
}

/* Oracle output typography */
.oracle-output h3, .oracle-output h4 {
    font-family: 'Outfit', sans-serif;
    color: var(--gold);
    margin: 14px 0 8px 0;
    font-size: 14px;
}

.oracle-output h3:first-child, .oracle-output h4:first-child {
    margin-top: 0;
}

.oracle-output p {
    margin-bottom: 12px;
}

.oracle-output p:last-child {
    margin-bottom: 0;
}

.oracle-output ul {
    margin-left: 16px;
    margin-bottom: 12px;
}

.oracle-output li {
    margin-bottom: 6px;
}

/* Pulsing effect during loading */
.oracle-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 30px 10px;
}

.oracle-spinner {
    position: relative;
    width: 50px;
    height: 50px;
}

.oracle-spinner-inner {
    box-sizing: border-box;
    position: absolute;
    width: 100%;
    height: 100%;
    border: 3px solid transparent;
    border-top-color: var(--violet);
    border-radius: 50%;
    animation: oracleSpin 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}

.oracle-spinner-inner:nth-child(2) {
    border-top-color: var(--cyan);
    animation-delay: -0.4s;
}

.oracle-spinner-inner:nth-child(3) {
    border-top-color: var(--gold);
    animation-delay: -0.8s;
}

@keyframes oracleSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.oracle-loading-text {
    font-family: 'Outfit', sans-serif;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--violet);
    animation: oraclePulseText 1.5s ease-in-out infinite;
}

@keyframes oraclePulseText {
    0%, 100% { opacity: 0.5; text-shadow: 0 0 5px transparent; }
    50% { opacity: 1; text-shadow: 0 0 10px var(--violet-glow); }
}

/* Daily Wisdom Banner */
.wisdom-banner {
    padding: 16px 24px;
    margin-bottom: 8px;
    border-color: hsla(45, 80%, 50%, 0.15);
    background: linear-gradient(135deg, hsla(248, 35%, 13%, 0.45) 0%, hsla(45, 80%, 50%, 0.03) 100%);
    box-shadow: 0 4px 24px 0 rgba(0, 0, 0, 0.25), 0 0 15px hsla(45, 80%, 50%, 0.03);
    transition: var(--transition-smooth);
}

.wisdom-banner:hover {
    border-color: hsla(45, 80%, 50%, 0.3);
    box-shadow: 0 6px 32px 0 rgba(0, 0, 0, 0.3), var(--shadow-gold-glow);
}

.wisdom-content {
    display: flex;
    align-items: center;
    gap: 16px;
    width: 100%;
}

.wisdom-quote-icon {
    font-size: 20px;
    color: var(--gold);
    text-shadow: 0 0 8px var(--gold-glow);
    flex-shrink: 0;
}

.wisdom-text {
    font-style: italic;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    flex-grow: 1;
}

.wisdom-author {
    font-family: 'Outfit', sans-serif;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 1px;
    color: var(--cyan);
    text-transform: uppercase;
    text-shadow: 0 0 5px var(--cyan-glow);
    white-space: nowrap;
    flex-shrink: 0;
    border-left: 2px solid var(--cyan);
    padding-left: 12px;
}

/* Floating Action Button (FAB) Container & Expandable Menu */
.fab-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

/* Trigger Button */
.fab-main-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gold) 0%, var(--cyan) 100%);
    border: none;
    color: white;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px hsla(45, 80%, 50%, 0.4), 0 0 15px var(--cyan-glow);
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), box-shadow 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    animation: fabPulse 3s infinite;
    outline: none;
    /* GPU Acceleration layer promotion to prevent shadow clipping box during rotation */
    will-change: transform;
    transform: translateZ(0);
    backface-visibility: hidden;
}

.fab-container.active .fab-main-btn {
    transform: rotate(135deg) translateZ(0);
    background: linear-gradient(135deg, hsl(350, 80%, 50%) 0%, hsl(280, 80%, 50%) 100%);
    box-shadow: 0 4px 20px hsla(350, 80%, 50%, 0.4);
    animation: none;
}

.fab-main-btn:hover {
    transform: scale(1.08) translateZ(0);
}

.fab-container.active .fab-main-btn:hover {
    transform: rotate(135deg) scale(1.08) translateZ(0);
}

/* Sliding options */
.fab-options {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(15px);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.fab-container.active .fab-options {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

/* Option Buttons */
.fab-option-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--bg-space);
    border: 1px solid var(--card-border);
    color: var(--text-primary);
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    transition: var(--transition-smooth);
    position: relative;
}

.fab-option-btn i {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

#btn-add-sync {
    background: linear-gradient(135deg, hsla(45, 80%, 50%, 0.2) 0%, hsla(248, 35%, 13%, 0.8) 100%);
    border-color: var(--gold);
}

#btn-add-diary {
    background: linear-gradient(135deg, hsla(182, 100%, 50%, 0.15) 0%, hsla(248, 35%, 13%, 0.8) 100%);
    border-color: var(--cyan);
}

.fab-option-btn:hover {
    transform: scale(1.1);
    color: var(--gold);
}

#btn-add-diary:hover {
    color: var(--cyan);
    box-shadow: 0 4px 15px var(--cyan-glow);
}

#btn-add-sync:hover {
    color: var(--gold);
    box-shadow: 0 4px 15px var(--gold-glow);
}

/* Tooltip labels for options */
.fab-label {
    position: absolute;
    right: 60px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    padding: 6px 12px;
    border-radius: var(--radius-md);
    font-family: 'Outfit', sans-serif;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    opacity: 0;
    transform: translateX(10px);
    transition: var(--transition-smooth);
    pointer-events: none;
}

.fab-option-btn:hover .fab-label {
    opacity: 1;
    transform: translateX(0);
}

@keyframes fabPulse {
    0%, 100% {
        box-shadow: 0 4px 20px hsla(45, 80%, 50%, 0.4), 0 0 15px var(--cyan-glow);
    }
    50% {
        box-shadow: 0 4px 30px hsla(45, 80%, 50%, 0.7), 0 0 25px var(--cyan);
    }
}

/* Diary Mode specifics on Modal */
#entry-modal.diary-mode #cosmic-stepper {
    display: none !important;
}

#entry-modal.diary-mode .wizard-slides-container {
    transform: none !important;
}

#entry-modal.diary-mode .wizard-slides-container .tab-content:not(.active) {
    display: none !important;
}

#entry-modal.diary-mode .next-step {
    display: none !important;
}

/* Custom premium ambient styling for Diary Modal */
#entry-modal.diary-mode .form-card {
    background: 
        url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M160,40 C140,55 100,105 80,135 C74,144 60,152 50,147 C44,142 52,132 58,126 C88,90 125,58 160,40 Z' stroke='rgba(160, 32, 240, 0.05)' stroke-width='1' fill='none'/%3E%3Cpath d='M160,40 L145,46' stroke='rgba(160, 32, 240, 0.05)' stroke-width='1' fill='none'/%3E%3Ccircle cx='130' cy='75' r='2' fill='rgba(255,255,255,0.06)'/%3E%3Ccircle cx='70' cy='115' r='1.5' fill='rgba(255,255,255,0.04)'/%3E%3Cpath d='M30,70 Q70,45 110,70 T170,70' stroke='rgba(160,32,240,0.02)' stroke-width='0.6' fill='none'/%3E%3C/svg%3E") no-repeat right 10px bottom 10px / 240px 240px,
        linear-gradient(135deg, hsl(265, 45%, 6%) 0%, hsl(280, 50%, 3%) 100%) !important;
    border-color: hsla(276, 100%, 65%, 0.25) !important;
    box-shadow: 0 15px 50px rgba(0,0,0,0.9), 0 0 40px hsla(276, 100%, 65%, 0.2) !important;
    display: flex;
    flex-direction: column;
    overflow-y: hidden !important; /* NO scroll on the modal card itself */
    position: relative;
}

/* Astrolabe / constellation watermark for card.glass */
.card.glass {
    position: relative;
    overflow: hidden;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='100' cy='100' r='90' stroke='rgba(255,255,255,0.012)' stroke-width='0.5' fill='none'/%3E%3Ccircle cx='100' cy='100' r='60' stroke='rgba(255,255,255,0.008)' stroke-dasharray='3,3' stroke-width='0.5' fill='none'/%3E%3Cpath d='M100 10 L100 190 M10 L100 100 L190 100' stroke='rgba(255,255,255,0.006)' stroke-width='0.5' fill='none'/%3E%3Ccircle cx='100' cy='100' r='5' stroke='rgba(255,255,255,0.015)' stroke-width='0.5' fill='none'/%3E%3Ccircle cx='50' cy='50' r='1.5' fill='rgba(255,255,255,0.02)'/%3E%3Ccircle cx='150' cy='60' r='1' fill='rgba(255,255,255,0.015)'/%3E%3Ccircle cx='130' cy='140' r='2' fill='rgba(255,255,255,0.015)'/%3E%3Cpath d='M50 50 L100 100 L130 140' stroke='rgba(255,255,255,0.006)' stroke-width='0.5' fill='none'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right -30px bottom -30px !important;
    background-size: 180px 180px !important;
}

/* Metatron's Cube watermark for Oracle Card */
.oracle-card {
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cpolygon points='100,20 169,60 169,140 100,180 31,140 31,60' stroke='rgba(160, 32, 240, 0.03)' stroke-width='0.6' fill='none'/%3E%3Cpolygon points='100,180 31,60 169,60' stroke='rgba(0, 242, 254, 0.025)' stroke-width='0.5' fill='none'/%3E%3Cpolygon points='100,20 31,140 169,140' stroke='rgba(0, 242, 254, 0.025)' stroke-width='0.5' fill='none'/%3E%3Ccircle cx='100' cy='100' r='80' stroke='rgba(160,32,240,0.02)' stroke-width='0.5' fill='none'/%3E%3Ccircle cx='100' cy='100' r='50' stroke='rgba(0,242,254,0.015)' stroke-width='0.5' fill='none'/%3E%3Cpath d='M100 20 L100 180 M31 60 L169 140 M31 140 L169 60' stroke='rgba(160, 32, 240, 0.015)' stroke-width='0.5' fill='none'/%3E%3Ccircle cx='100' cy='20' r='4' fill='rgba(160, 32, 240, 0.02)'/%3E%3Ccircle cx='169' cy='60' r='4' fill='rgba(160, 32, 240, 0.02)'/%3E%3Ccircle cx='169' cy='140' r='4' fill='rgba(160, 32, 240, 0.02)'/%3E%3Ccircle cx='100' cy='180' r='4' fill='rgba(160, 32, 240, 0.02)'/%3E%3Ccircle cx='31' cy='140' r='4' fill='rgba(160, 32, 240, 0.02)'/%3E%3Ccircle cx='31' cy='60' r='4' fill='rgba(160, 32, 240, 0.02)'/%3E%3Ccircle cx='100' cy='100' r='10' stroke='rgba(255,255,255,0.02)' stroke-width='0.5' fill='none'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    background-size: 190px 190px !important;
}

/* Lunar orbits watermark for Calendar Card */
.calendar-card {
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='100' cy='100' r='75' stroke='rgba(255, 230, 153, 0.02)' stroke-dasharray='4,4' stroke-width='0.8' fill='none'/%3E%3Ccircle cx='100' cy='100' r='55' stroke='rgba(255,230,153,0.01)' stroke-width='0.5' fill='none'/%3E%3Cpath d='M100 25 A 75 75 0 0 1 100 175' stroke='rgba(255,230,153,0.015)' stroke-width='1.2' fill='none'/%3E%3Ccircle cx='100' cy='25' r='6' fill='rgba(255, 230, 153, 0.03)'/%3E%3Ccircle cx='100' cy='175' r='6' fill='rgba(255, 230, 153, 0.01)'/%3E%3Ccircle cx='175' cy='100' r='6' fill='rgba(255, 230, 153, 0.02)'/%3E%3Ccircle cx='25' cy='100' r='6' fill='rgba(255, 230, 153, 0.008)'/%3E%3Cpath d='M25 100 Q100 150 175 100' stroke='rgba(255,230,153,0.008)' stroke-width='0.5' fill='none'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    background-size: 180px 180px !important;
}

/* PC layout constraints */
@media (min-width: 901px) {
    #entry-modal.diary-mode .form-card {
        max-width: 850px;
        width: 85vw;
        height: 80vh;
        max-height: 850px;
        padding: 40px;
    }
}

/* Mobile layout constraints */
@media (max-width: 900px) {
    #entry-modal.diary-mode .form-card {
        width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
        padding: 30px 20px 20px 20px;
    }
}

#entry-modal.diary-mode #clavis-form {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: calc(100% - 70px);
}

#entry-modal.diary-mode #tab-portal {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    gap: 16px;
    height: 100%;
}

/* Make textarea form-group take remaining height */
#entry-modal.diary-mode #tab-portal .form-group:nth-child(3) {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    margin-bottom: 4px;
}

#entry-modal.diary-mode #entry-description {
    flex-grow: 1;
    resize: none !important;
    overflow-y: auto !important; /* Scroll inside the textarea! */
    min-height: 150px;
    background: rgba(255, 255, 255, 0.01) !important;
    border: 1px solid rgba(160, 32, 240, 0.15) !important;
    border-bottom: 2px solid rgba(160, 32, 240, 0.3) !important;
    border-radius: var(--radius-md) !important;
    padding: 16px !important;
    line-height: 1.7;
    font-size: 15px;
    color: var(--text-primary);
}

#entry-modal.diary-mode #entry-description:focus {
    border-color: var(--violet) !important;
    box-shadow: 0 0 15px var(--violet-glow) !important;
    background: rgba(160, 32, 240, 0.03) !important;
}

/* Beautiful scrollbar styling inside the textarea */
#entry-modal.diary-mode #entry-description::-webkit-scrollbar {
    width: 6px;
}
#entry-modal.diary-mode #entry-description::-webkit-scrollbar-track {
    background: transparent;
}
#entry-modal.diary-mode #entry-description::-webkit-scrollbar-thumb {
    background: rgba(160, 32, 240, 0.3);
    border-radius: 3px;
}
#entry-modal.diary-mode #entry-description::-webkit-scrollbar-thumb:hover {
    background: var(--violet);
}

/* Redesign Modal Title */
#entry-modal.diary-mode #form-modal-title {
    color: transparent;
    background: linear-gradient(135deg, #ffffff 40%, var(--violet) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    font-family: 'Outfit', sans-serif;
    font-size: 28px;
    font-weight: 300; /* Sophisticated thin font */
    letter-spacing: 2px;
    text-transform: uppercase;
    text-shadow: none;
    margin-bottom: 4px;
}

#entry-modal.diary-mode #form-modal-subtitle {
    color: var(--text-muted);
    font-size: 12px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

/* Compact Date and Time row */
#entry-modal.diary-mode .form-group-row {
    display: flex !important;
    flex-direction: row !important;
    justify-content: flex-start !important;
    gap: 16px !important;
    margin-bottom: 8px !important;
}

#entry-modal.diary-mode .form-group-row .form-group {
    flex: none !important;
    width: auto !important;
    margin-bottom: 0 !important;
}

#entry-modal.diary-mode .form-group-row label {
    font-size: 11px !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted) !important;
    margin-bottom: 4px !important;
}

#entry-modal.diary-mode .form-group-row input {
    font-size: 13px !important;
    padding: 6px 12px !important;
    height: auto !important;
    max-width: 140px !important;
    border-radius: 6px !important;
    background: rgba(0, 0, 0, 0.2) !important;
    border: 1px solid var(--card-border) !important;
}

#entry-modal.diary-mode .form-group-row input:focus {
    border-color: var(--violet) !important;
    box-shadow: 0 0 8px var(--violet-glow) !important;
}

/* Elegant single-line notebooks title input */
#entry-modal.diary-mode #entry-title {
    font-family: 'Outfit', sans-serif;
    font-size: 20px !important;
    font-weight: 500;
    color: var(--text-primary);
    background: transparent !important;
    border: none !important;
    border-bottom: 2px dashed rgba(160, 32, 240, 0.3) !important;
    border-radius: 0 !important;
    padding: 8px 0 !important;
    box-shadow: none !important;
    transition: var(--transition-smooth);
}

#entry-modal.diary-mode #entry-title:focus {
    border-bottom: 2px solid var(--violet) !important;
    background: transparent !important;
    box-shadow: none !important;
}

#entry-modal.diary-mode #entry-title::placeholder {
    color: var(--text-muted);
    font-weight: 300;
    font-style: italic;
    opacity: 0.6;
}

/* Gravar no Diário Button styling */
#entry-modal.diary-mode #btn-save-diary {
    background: linear-gradient(135deg, var(--violet) 0%, #7b1fa2 100%) !important;
    color: white !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    padding: 12px 30px !important;
    border-radius: 30px !important;
    box-shadow: 0 4px 15px rgba(160, 32, 240, 0.4) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    transition: var(--transition-smooth) !important;
    justify-content: center !important;
    width: 100% !important;
    margin-top: 8px;
}

#entry-modal.diary-mode #btn-save-diary:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 20px var(--violet) !important;
}

/* Timeline Diary Styles */
.timeline-card.diary {
    border-color: hsla(276, 100%, 65%, 0.15);
    background: linear-gradient(135deg, var(--card-bg) 0%, hsla(276, 100%, 65%, 0.02) 100%);
}

.timeline-card.diary:hover {
    border-color: var(--violet);
    box-shadow: 0 4px 20px var(--violet-glow);
}

.timeline-card.diary .timeline-card-icon {
    border-color: var(--violet);
    color: var(--violet);
    box-shadow: 0 0 10px var(--violet-glow);
}

.timeline-card.diary .status-badge {
    background: rgba(160, 32, 240, 0.1);
    color: var(--violet);
    border: 1px solid hsla(276, 100%, 65%, 0.2);
}

/* Modal de Novo Sinal (Especificidades) */
#entry-modal .form-card {
    width: 100%;
    max-width: 650px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 10px 40px rgba(0,0,0,0.6);
    background: var(--bg-space);
    border: 1.5px solid var(--card-border);
}

.close-entry-modal {
    position: absolute;
    right: 20px;
    top: 15px;
    color: var(--text-muted);
    font-size: 28px;
    font-weight: 300;
    cursor: pointer;
    z-index: 10;
    transition: var(--transition-smooth);
}

.close-entry-modal:hover {
    color: var(--gold);
}

/* Helper hints for inputs */
.field-hint {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
    font-style: italic;
    line-height: 1.4;
}

/* ==========================================================================
   MEDIA QUERIES (Sempre no final do arquivo para sobrescrever estilos globais)
   ========================================================================== */

/* Responsive adjustments */
@media (max-width: 900px) {
    .app-main {
        grid-template-columns: 1fr;
        gap: 16px;
        max-width: 100%;
        width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }
    
    .left-panel {
        order: 1;
        max-width: 100%;
        width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }
    
    .right-panel {
        order: 2;
        max-width: 100%;
        width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }
}

@media (max-width: 600px) {
    html, body {
        overflow-x: hidden;
        max-width: 100%;
    }

    body {
        overflow-x: hidden; /* Garante que nada causará scroll lateral no body */
    }

    .app-container {
        padding: 10px;
        gap: 16px;
        max-width: 100%;
        width: auto;
        min-width: 0;
        box-sizing: border-box;
        overflow-x: hidden;
    }
    
    .app-header {
        padding: 10px 12px;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        gap: 8px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .logo-area {
        gap: 8px;
    }
    
    .clavis-logo-svg {
        width: 32px;
        height: 32px;
    }
    
    .logo-text h1 {
        font-size: 16px;
        letter-spacing: 1px;
    }
    
    .logo-text p {
        display: none; /* Oculta legenda para manter header fino */
    }
    
    /* Oculta PWA e Ajustar Brilho no header do mobile para economizar espaço lateral */
    #theme-toggle, #install-pwa {
        display: none !important;
    }
    
    /* Perfil do usuário compacto no mobile */
    .user-profile-header {
        padding: 4px 8px;
        gap: 6px;
        max-width: 100%;
    }
    
    .user-name-text {
        display: none !important; /* Oculta "Olá, Fulano" no celular para dar espaço */
    }
    
    .btn-icon-small, .btn-logout-icon {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
    
    /* Reduz padding geral dos cards no celular e ativa overflow-hidden contra vazamentos */
    .card {
        padding: 16px 12px;
        overflow: hidden; /* Essencial para evitar que grids e abas quebrem as bordas */
        width: 100%;
        max-width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }
    
    /* Ajustes do Formulário e Wizard */
    .form-tabs {
        margin-bottom: 16px;
        padding: 3px;
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
        display: flex;
        gap: 6px;
    }
    
    .form-tabs::-webkit-scrollbar {
        display: none; /* Esconde scrollbar */
    }
    
    .tab-btn {
        padding: 6px 10px;
        font-size: 10px;
        flex-shrink: 0; /* Impede que as abas se deformem/espremam */
        flex: none;
        width: auto;
    }

    /* Cosmic Stepper Mobile adjustments */
    .cosmic-stepper {
        margin-bottom: 24px;
        max-width: 100%;
    }

    .step-node {
        width: 34px;
        height: 34px;
    }

    .step-icon {
        font-size: 12px;
    }

    .step-tooltip {
        top: 40px;
        font-size: 8px;
        letter-spacing: 0.5px;
    }
    
    .form-group {
        margin-bottom: 14px;
    }
    
    .form-group-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    /* Evita auto-zoom no iOS aumentando o input para 16px */
    .form-group input[type="text"],
    .form-group input[type="date"],
    .form-group input[type="time"],
    .form-group textarea,
    .theme-select-dropdown {
        font-size: 16px;
        padding: 10px 12px;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    /* Ajustes do Calendário no Mobile */
    .calendar-days {
        gap: 4px; /* Diminui o gap para caber em telas estreitas */
    }
    
    .calendar-day {
        font-size: 12px;
    }
    
    /* Ajustes dos Stats no Header Mobile */
    .header-stats {
        gap: 8px;
        padding: 4px 8px;
        background: transparent;
        border: none;
    }
    
    .header-stat-item {
        gap: 4px;
    }
    
    .header-stats .stat-value {
        font-size: 14px;
        text-shadow: 0 0 4px var(--cyan-glow);
    }
    
    .header-stats .stat-label {
        font-size: 9px;
        letter-spacing: 0.2px;
    }
    
    /* Ajustes das Sincronicidades no Timeline */
    .timeline-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .search-bar {
        width: 100%;
    }
    
    .timeline-list {
        max-width: 100%;
    }
    
    .timeline-card {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 14px 12px;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .timeline-card-icon {
        display: none;
    }
    
    .timeline-card-content {
        gap: 6px;
        max-width: 100%;
    }
    
    .timeline-card-title {
        font-size: 14px;
        line-height: 1.4;
        word-break: break-word; /* Evita que títulos muito longos quebrem a lateral */
    }
    
    /* Rodapé do card de sinal */
    .timeline-card-actions {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
        border-top: 1px solid rgba(255, 255, 255, 0.08);
        padding-top: 8px;
        margin-top: 4px;
        box-sizing: border-box;
    }
    
    /* Botões em geral com quebra de linha segura */
    .btn {
        max-width: 100%;
        white-space: normal;
    }
    
    /* Tela de Login Móvel */
    .login-card {
        padding: 30px 16px;
        gap: 16px;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .login-logo {
        width: 56px;
        height: 56px;
    }
    
    .login-logo-area h2 {
        font-size: 24px;
    }
    
    .login-email-actions {
        gap: 8px;
    }

    /* Wisdom Banner Mobile adjustments */
    .wisdom-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .wisdom-author {
        border-left: none;
        border-top: 1.5px solid var(--cyan);
        padding-left: 0;
        padding-top: 4px;
        align-self: flex-end;
    }
    
    .wisdom-banner {
        padding: 12px 16px;
        margin-bottom: 0;
    }

    /* entry-modal Fullscreen on mobile */
    #entry-modal {
        padding: 0;
    }
    
    #entry-modal .form-card {
        max-width: 100%;
        width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
        border: none;
        padding: 30px 16px 20px 16px;
    }
    
    .close-entry-modal {
        top: 10px;
        right: 15px;
        font-size: 32px;
    }
    
    /* Adjust FAB container and size on mobile */
    .fab-container {
        bottom: 20px;
        right: 20px;
        gap: 12px;
    }
    
    .fab-main-btn {
        width: 54px;
        height: 54px;
        font-size: 20px;
    }
    
    .fab-option-btn {
        width: 44px;
        height: 44px;
        font-size: 16px;
    }
}

/* Fix diagonal animation inside wizard */
.wizard-slides-container .tab-content.active {
    animation: none !important;
}

/* Premium Scrollbar Styling for elements (such as .form-card and pages) */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: rgba(160, 32, 240, 0.35);
    border-radius: 3px;
    transition: background 0.3s;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--cyan);
}

/* Card overrides for Sincronicidade statuses */
.timeline-card.portal {
    border-color: rgba(212, 175, 55, 0.15) !important;
    background: linear-gradient(135deg, var(--card-bg) 0%, rgba(212, 175, 55, 0.02) 100%) !important;
}

.timeline-card.portal:hover {
    border-color: var(--gold) !important;
    box-shadow: 0 4px 20px var(--gold-glow) !important;
}

.timeline-card.acted {
    border-color: rgba(0, 242, 254, 0.15) !important;
    background: linear-gradient(135deg, var(--card-bg) 0%, rgba(0, 242, 254, 0.02) 100%) !important;
}

.timeline-card.acted:hover {
    border-color: var(--cyan) !important;
    box-shadow: 0 4px 20px var(--cyan-glow) !important;
}

.timeline-card.open {
    border-color: hsla(276, 100%, 65%, 0.15) !important;
    background: linear-gradient(135deg, var(--card-bg) 0%, hsla(276, 100%, 65%, 0.02) 100%) !important;
}

.timeline-card.open:hover {
    border-color: var(--violet) !important;
    box-shadow: 0 4px 20px var(--violet-glow) !important;
}

/* Entry Type Badges */
.entry-type-badge {
    font-family: 'Outfit', sans-serif;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 12px;
    width: fit-content;
    margin-bottom: 6px;
    border: 1px solid transparent;
}

.entry-type-badge.diary-badge {
    color: var(--violet);
    background: rgba(160, 32, 240, 0.08);
    border-color: rgba(160, 32, 240, 0.18);
}

.entry-type-badge.sync-badge {
    color: var(--gold);
    background: rgba(212, 175, 55, 0.08);
    border-color: rgba(212, 175, 55, 0.18);
}

.modal-section.diary h4 {
    border-left-color: var(--violet) !important;
}
.modal-section.portal h4 {
    border-left-color: var(--gold) !important;
}

/* Custom premium ambient styling for Synchronicity Modal */
#entry-modal.sync-mode .form-card {
    background: 
        url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cpolygon points='100,20 169,60 169,140 100,180 31,140 31,60' stroke='rgba(212, 175, 55, 0.02)' stroke-width='0.6' fill='none'/%3E%3Cpolygon points='100,180 31,60 169,60' stroke='rgba(0, 242, 254, 0.015)' stroke-width='0.5' fill='none'/%3E%3Cpolygon points='100,20 31,140 169,140' stroke='rgba(0, 242, 254, 0.015)' stroke-width='0.5' fill='none'/%3E%3Ccircle cx='100' cy='100' r='80' stroke='rgba(212, 175, 55, 0.015)' stroke-width='0.5' fill='none'/%3E%3Cpath d='M100 20 L100 180 M31 60 L169 140 M31 140 L169 60' stroke='rgba(212, 175, 55, 0.01)' stroke-width='0.5' fill='none'/%3E%3C/svg%3E") no-repeat right 10px bottom 10px / 240px 240px,
        linear-gradient(135deg, hsl(248, 50%, 8%) 0%, hsl(248, 55%, 4%) 100%) !important;
    border-color: rgba(212, 175, 55, 0.25) !important;
    box-shadow: 0 15px 50px rgba(0,0,0,0.9), 0 0 40px rgba(212, 175, 55, 0.15) !important;
}

#entry-modal.sync-mode #form-modal-title {
    color: transparent;
    background: linear-gradient(135deg, #ffffff 40%, var(--gold) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    font-family: 'Outfit', sans-serif;
    font-size: 28px;
    font-weight: 300;
    letter-spacing: 2px;
    text-transform: uppercase;
    text-shadow: none;
    margin-bottom: 4px;
}

#entry-modal.sync-mode #form-modal-subtitle {
    color: var(--text-muted);
    font-size: 12px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

/* Focused inputs inside sync-mode modal */
#entry-modal.sync-mode input[type="text"]:focus,
#entry-modal.sync-mode input[type="date"]:focus,
#entry-modal.sync-mode input[type="time"]:focus,
#entry-modal.sync-mode textarea:focus {
    border-color: var(--gold) !important;
    box-shadow: 0 0 8px var(--gold-glow) !important;
}

/* Next/Prev buttons on Sincronia Modal hover glow */
#entry-modal.sync-mode .btn-primary:hover {
    box-shadow: 0 4px 15px var(--cyan-glow) !important;
}
#entry-modal.sync-mode .btn-success:hover {
    box-shadow: 0 4px 15px var(--gold-glow) !important;
}

/* Premium Login Logo Image */
.login-logo-img {
    width: 140px;
    height: 140px;
    object-fit: contain;
    margin-bottom: 8px;
    filter: drop-shadow(0 0 15px rgba(212, 175, 55, 0.3));
    border-radius: 50%;
    border: 1.5px solid rgba(212, 175, 55, 0.2);
    background: rgba(6, 5, 15, 0.4);
    padding: 10px;
    transition: var(--transition-smooth);
}

.login-logo-img:hover {
    transform: scale(1.05) rotate(5deg);
    filter: drop-shadow(0 0 25px rgba(212, 175, 55, 0.5));
    border-color: rgba(212, 175, 55, 0.4);
}



