/* Reset & Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: #f5f5f7;
    /* Light grey background for the page */
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    color: #222222;
}



/* Card Metaphor */
.card {
    background-color: #ffffff;
    /* Off-white/White card */
    border-radius: 24px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    /* Subtle drop shadow */
    padding: 32px 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Typography Hierarchy */
h1 {
    font-size: 20px;
    font-weight: 700;
    color: #222222;
    margin-bottom: 4px;
}

.subtitle {
    font-size: 14px;
    font-weight: 400;
    color: #666666;
}

.section-label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #888888;
    font-weight: 600;
    margin-bottom: 12px;
}

.content-value {
    font-size: 17px;
    color: #222222;
    line-height: 1.5;
}

.read-only {
    color: #555555;
    /* Muted text for context */
}

/* Dividers */
.divider {
    border: none;
    border-top: 1px solid #eeeeee;
    margin: 0;
}

.dotted-divider {
    border-top: 2px dotted #eeeeee;
    margin: 0;
}

.double-line {
    border-top: 3px double #eeeeee;
}

/* Focus Section (Action) */
.action-container {
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.checkbox-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
    margin-top: 2px;
}

.checkbox-btn .icon {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 2px solid #222222;
    border-radius: 50%;
    transition: all 0.2s ease;
    position: relative;
}

.checkbox-btn.completed .icon {
    background-color: #27ae60;
    /* Green */
    border-color: #27ae60;
}

.checkbox-btn.completed .icon::after {
    content: '✓';
    color: white;
    font-size: 14px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: bold;
}

.input-wrapper {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.action-input {
    width: 100%;
    border: none;
    font-size: 18px;
    font-weight: 600;
    /* Boldest text */
    color: #222222;
    font-family: 'Inter', sans-serif;
    outline: none;
    background: transparent;
    padding: 0;
    margin: 0;
    resize: none;
    overflow: hidden;
    min-height: 28px;
    /* Approximate height of one line */
    white-space: pre-wrap;
    /* Ensure wrapping */
    line-height: 1.4;
}

.action-input.completed {
    text-decoration: line-through;
    color: #888888;
}

.warning-text {
    font-size: 12px;
    color: #e67e22;
    /* Orange */
    margin-top: 6px;
}

.hidden {
    display: none !important;
}

/* Anchor Section (Why) */
.anchor-text {
    display: flex;
    gap: 12px;
}

.anchor-bar {
    width: 4px;
    background-color: #3498db;
    /* Subtle colored bar */
    border-radius: 2px;
    flex-shrink: 0;
}

.anchor-content {
    flex: 1;
    min-width: 0;
    display: block;
}

.anchor-name {
    font-weight: 500;
    color: #222222;
    font-style: italic;
    white-space: normal;
    overflow-wrap: break-word;
    word-wrap: break-word;
    width: 100%;
}

.description-text {
    font-size: 13px;
    color: #666666;
    margin-top: 4px;
    line-height: 1.4;
}

/* Log Section */
.mood-selector {
    display: flex;
    justify-content: space-between;
    margin-bottom: 24px;
}

.mood-btn {
    background: none;
    border: none;
    font-size: 32px;
    cursor: pointer;
    filter: grayscale(100%);
    opacity: 0.5;
    transition: all 0.2s ease;
    padding: 8px;
    border-radius: 12px;
}

.mood-btn:hover {
    background-color: #f9f9f9;
    opacity: 0.8;
}

.mood-btn.selected {
    filter: grayscale(0%);
    opacity: 1;
    transform: scale(1.1);
    background-color: #f0f0f0;
}

.mt-4 {
    margin-top: 24px;
}

.reflection-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    margin-bottom: 24px;
    outline: none;
    transition: border-color 0.2s;
    resize: none;
    /* Disable manual resize */
    overflow-y: hidden;
    /* Hide scrollbar for auto-expand effect */
    min-height: 48px;
}

.reflection-input:focus {
    border-color: #222222;
}

.main-btn {
    width: 100%;
    padding: 16px;
    background-color: #222222;
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.main-btn:hover {
    background-color: #000000;
}

.main-btn.completed-action {
    background-color: #27ae60;
    /* Brighter color for completion */
}

.main-btn.completed-action:hover {
    background-color: #219150;
}

.history-link-container {
    text-align: center;
    margin-top: 16px;
}

.history-link {
    font-size: 12px;
    color: #888888;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s;
}

.history-link:hover {
    border-bottom-color: #888888;
}

/* Footer (Motivation) */
.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 12px;
    padding-top: 8px;
}

.footer-content {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.spark-icon {
    font-size: 16px;
}

.card-footer p {
    font-size: 13px;
    color: #555555;
    line-height: 1.5;
    font-style: italic;
}

.logout-container {
    display: flex;
    justify-content: center;
    margin-top: 80px;
    /* Increased from 40px */
    margin-bottom: 20px;
    width: 100%;
}

.logout-action {
    background-color: transparent;
    color: #444444;
    /* Darker grey */
    border: 1px solid #999999;
    /* Darker border */
    min-width: 140px;
    width: auto;
    padding: 12px 24px;
}

.logout-action:hover {
    background-color: #f5f5f5;
    color: #222222;
    border-color: #666666;
}

/* Login Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal-card {
    background-color: #ffffff;
    border-radius: 24px;
    padding: 40px 32px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    text-align: center;
    position: relative;
    /* Added for absolute close button */
}

.modal-card h2 {
    font-size: 24px;
    font-weight: 700;
    color: #222222;
    margin-bottom: 8px;
}

.modal-subtitle {
    color: #666666;
    margin-bottom: 32px;
    font-size: 15px;
}

.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #444444;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    font-size: 16px;
    font-family: 'Inter', sans-serif;
    outline: none;
    transition: border-color 0.2s;
}

.form-group input:focus {
    border-color: #222222;
}

.error-message {
    color: #e74c3c;
    font-size: 13px;
    margin-bottom: 16px;
    background-color: #fdedec;
    padding: 8px;
    border-radius: 8px;
}

/* ... existing styles ... */

.login-btn {
    margin-top: 8px;
}

/* =========================================
   MERGED AGENT STYLES & LAYOUT
   ========================================= */

:root {
    /* Agent Theme Variables */
    --agent-bg: #ffffff;
    --agent-panel: #ffffff;
    --agent-muted: #667085;
    --agent-text: #0f172a;
    --agent-accent: #2563eb;
    --agent-accent-2: #10b981;
    --agent-danger: #e11d48;
    --agent-border: #e5e7eb;
    --agent-soft: #f8fafc;
    --agent-radius: 16px;
}

/* Update Container for Two Tiles */
.app-container {
    width: 100%;
    /* Increase max-width to allow side-by-side if needed, 
       but user likely wants vertical stack or responsive grid */
    max-width: 1000px;
    margin: 0 auto;
}

/* Intro Section */
.intro-section {
    text-align: center;
    margin-bottom: 32px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.app-logo {
    display: block;
    margin: 0 auto 16px;
    max-height: 56px;
    width: auto;
    object-fit: contain;
}

.intro-title {
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #222, #555);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.intro-text {
    color: #666666;
    font-size: 15px;
    line-height: 1.5;
}

/* Entry Tiles Navigation */
.entry-tiles {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-bottom: 24px;
}

.entry-tile {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 16px;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 140px;
    justify-content: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02);
}

.entry-tile:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.05);
    border-color: #ccc;
}

.entry-tile.active {
    background: #222;
    color: white;
    border-color: #222;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

.entry-tile.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f5f5f5;
    border-color: #eee;
    pointer-events: none;
}

.locked-message {
    text-align: center;
    font-size: 0.85rem;
    color: #e67e22;
    /* Warning orange */
    margin-top: -16px;
    margin-bottom: 24px;
    font-style: italic;
}

.retry-link {
    background: none;
    border: none;
    color: #3498db;
    text-decoration: underline;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    margin-top: 4px;
    padding: 0;
}

.retry-link:hover {
    color: #2980b9;
}



.entry-icon {
    font-size: 1.2rem;
}

.entry-label {
    font-weight: 600;
    font-size: 0.95rem;
}

/* wrapper for the two tiles */
.tiles-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    justify-content: center;
    align-items: flex-start;
}

/* Each tile shares .card styles but we might want specific overrides */
.tile {
    flex: 1;
    min-width: 320px;
    /* Minimum width before wrapping */
    max-width: 480px;
    /* Keep the Paaal card's original feel */
    background-color: #ffffff;
    border-radius: 24px;
    padding: 32px 24px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    gap: 24px;
    position: relative;
    /* For stacking context */
}

/* AGENT SPECIFIC STYLES */

.agent-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.header-left {
    flex: 1;
}

.agent-stats {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--agent-muted);
    background: var(--agent-soft);
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid var(--agent-border);
}

.stat-item {
    font-weight: 500;
}

.stat-separator {
    color: #cbd5e1;
}

/* Add Credit Button Styles */
.add-credit-action {
    background-color: #222;
    color: #fff;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    margin-left: 10px;
    font-weight: 600;
    transition: background-color 0.2s;
}

.add-credit-action:hover {
    background-color: #000;
}

/* Modal Close Button */
.close-modal-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #888;
    line-height: 1;
    transition: color 0.2s;
}

.close-modal-btn:hover {
    color: #222;
}

.payment-link {
    display: inline-block;
    margin-top: 10px;
    color: #0074d4;
    font-weight: bold;
    text-decoration: underline;
    word-break: break-all;
}

.expiration-box {
    margin-bottom: 20px;
    padding: 24px;
    background: #fff1f2;
    border: 1px solid #e11d48;
    border-radius: 12px;
    text-align: center;
}

.expiration-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.warning-msg {
    color: #be123c;
    font-weight: 700;
    font-size: 16px;
}

.detail-msg {
    color: #881337;
    font-size: 14px;
}

.action-btn {
    background: #e11d48;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.action-btn:hover {
    background: #be123c;
}

.suggestion-btn.disabled-btn {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: #f5f5f5;
    pointer-events: none;
}



.chat-placeholder {
    min-height: 400px;
    border: 1px dashed var(--agent-border);
    border-radius: 12px;
    background: var(--agent-soft);
    position: relative;
    overflow: hidden;
    /* For ChatKit containment */
}

/* Specific Tile Widths */
#agent-view.tile {
    max-width: 100%;
    /* Fill the container (1000px) */
    width: 100%;
}

#card-view.tile {
    max-width: 480px;
    /* Keep original card width */
    width: 100%;
}

/* Suggestion Buttons */
.suggestion-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.suggestion-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: transparent;
    border: 1px solid var(--agent-border);
    color: var(--agent-text);
    border-radius: 12px;
    padding: 0.5rem 0.8rem;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.suggestion-btn:hover {
    background-color: var(--agent-soft);
    border-color: var(--agent-muted);
}

.suggestion-btn.active {
    background-color: #f0f0f0;
    border-color: #222;
    color: #000;
    font-weight: 500;
}

/* Error states in Agent */
.agent-error {
    color: var(--agent-danger);
    font-size: 0.9em;
    margin-top: 8px;
    min-height: 1.2em;
}

/* ChatKit overrides if needed */
openai-chatkit {
    width: 100%;
    height: 100%;
}

/* Responsive Tweaks */
@media (max-width: 768px) {
    .tiles-wrapper {
        flex-direction: column;
        align-items: center;
    }

    .tile {
        width: 100%;
        max-width: 480px;
    }
}

/* Modal Body Text & Checkbox - Smaller Text */
.modal-body-text {
    font-size: 11px;
    color: #666;
    margin-bottom: 20px;
    line-height: 1.5;
    text-align: left;
}

.modal-body-text a {
    color: #222;
    text-decoration: underline;
}

.checkbox-group {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 24px;
}

/* Beta User Section */
.beta-section {
    text-align: center;
    background-color: #f0f7ff;
    /* Very light blue background */
    border: 1px solid #cce5ff;
    border-radius: 8px;
    padding: 12px 16px;
    margin: 16px auto;
    /* Centered with vertical spacing */
    max-width: 600px;
    font-size: 0.9rem;
    color: #333;
}

.beta-text {
    margin-bottom: 4px;
}

.beta-text a {
    color: #0056b3;
    font-weight: 600;
    text-decoration: underline;
}

.beta-note {
    font-size: 0.8rem;
    color: #555;
    margin-top: 4px;
}

.checkbox-group input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin-top: 1px;
    cursor: pointer;
    flex-shrink: 0;
    accent-color: #222;
}

.checkbox-group label {
    font-size: 11px;
    line-height: 1.4;
    color: #444;
    cursor: pointer;
    text-transform: none;
    letter-spacing: normal;
    font-weight: 400;
    display: inline;
    margin-bottom: 0;
}

.checkbox-group label a {
    color: #222;
    text-decoration: underline;
    font-weight: 600;
}

/* Disabled Submit Button Styling */
button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: #ccc;
    /* Optional: grey out background */
}

/* =========================================
   PAAAL SNAPSHOT UI
   ========================================= */

/* Container */
.snapshot-container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    z-index: 900;
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex;
    flex-direction: column;
}

/* Refresh Button */
/* Refresh Button */
.snapshot-refresh-btn {
    position: absolute;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid #e0e0e0;
    background: #ffffff;
    color: #444;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 910;
    /* Above header */
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.snapshot-refresh-btn:hover {
    background-color: #f8f8f8;
    color: #222;
    border-color: #ccc;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.spin-anim {
    animation: spin 1s linear infinite;
    pointer-events: none;
    /* Prevent double click while loading */
}

@keyframes spin {
    100% {
        transform: rotate(360deg);
    }
}

/* DESKTOP (Default: Right Sidebar) */
@media (min-width: 1200px) {
    .snapshot-refresh-btn {
        top: 16px;
        right: 16px;
    }

    .snapshot-container {
        position: fixed;
        top: 24px;
        right: 24px;
        /* bottom: 24px;  Don't stretch full height, just sticky content */
        width: 300px;
        max-height: calc(100vh - 48px);
        border-radius: 20px;
        overflow-y: auto;
        padding: 0;
    }

    /* Hide Mobile Toggle on Desktop */
    .mobile-only {
        display: none !important;
    }

    .snapshot-content {
        padding: 24px;
        display: flex;
        flex-direction: column;
        gap: 20px;
    }
}

/* MOBILE / TABLET (Bottom Sheet) */
@media (max-width: 1200px) {
    .snapshot-container {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-width: 600px;
        /* Center on tablets */
        margin: 0 auto;
        border-radius: 24px 24px 0 0;
        background: #ffffff;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
        transform: translateY(calc(100% - 60px));
        /* Collapsed: Show only header */
    }

    .snapshot-refresh-btn {
        top: 14px;
        right: 52px;
        /* Left of the toggle icon */
    }

    .snapshot-container.expanded {
        transform: translateY(0);
    }

    .snapshot-header {
        height: 60px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0 24px;
        cursor: pointer;
        border-bottom: 1px solid #f0f0f0;
    }

    .header-title {
        font-weight: 700;
        font-size: 15px;
        color: #222;
    }

    .toggle-icon {
        font-size: 14px;
        color: #666;
        transition: transform 0.3s;
    }

    .snapshot-container.expanded .toggle-icon {
        transform: rotate(180deg);
    }

    .snapshot-content {
        padding: 24px;
        padding-bottom: 40px;
        /* Safe area */
        overflow-y: auto;
        max-height: 70vh;
        display: flex;
        flex-direction: column;
        gap: 16px;
    }
}


/* ROWS AND CONTENT */
.snapshot-row {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.row-label {
    width: 24px;
    height: 24px;
    background: #f0f0f0;
    color: #666;
    border-radius: 6px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 11px;
    font-weight: 800;
    flex-shrink: 0;
    margin-top: 2px;
}

.row-data {
    flex: 1;
    min-width: 0;
    /* Text truncation fix */
}

/* Plan Row */
.plan-name {
    font-weight: 700;
    font-size: 14px;
    color: #222;
    line-height: 1.3;
}

.plan-intent {
    font-size: 11px;
    color: #888;
    margin-top: 2px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Areas Row */
.area-chips {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.area-chip {
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 12px;
    background: #f5f5f5;
    color: #666;
    font-weight: 500;
}

.area-chip.active {
    background: #222;
    color: #fff;
}

.area-chip.placeholder {
    width: 40px;
    height: 20px;
    background: #eee;
    border-radius: 12px;
}

/* Achievement Row */
.achieve-name {
    font-size: 13px;
    color: #444;
    font-weight: 500;
    margin-bottom: 2px;
}

.achieve-progress {
    font-size: 11px;
    color: #27ae60;
    /* Green for progress */
    font-weight: 600;
}

/* Action Row */
.action-row {
    align-items: center;
    /* Center button vertically */
}

.action-data {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.action-main {
    flex: 1;
}

.action-name {
    font-weight: 700;
    font-size: 13px;
    color: #222;
    line-height: 1.3;
}

.queue-count {
    font-size: 10px;
    color: #888;
    margin-top: 2px;
}

.snap-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid #e0e0e0;
    background: #fff;
    color: #ccc;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.snap-btn:hover {
    border-color: #27ae60;
    color: #27ae60;
    background: #f0fff4;
}

/* Log Row */
.log-data {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    align-items: center;
    font-size: 11px;
    color: #666;
}

.stat-label {
    color: #999;
}

.mood-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #eee;
    display: inline-block;
}

/* Mood Colors */
.mood-dot[data-mood="1"] {
    background: #95a5a6;
}

/* Sad - Grey */
.mood-dot[data-mood="2"] {
    background: #f1c40f;
}

/* Neutral - Yellow */
.mood-dot[data-mood="3"] {
    background: #2ecc71;
}

/* Happy - Green */
.mood-dot[data-mood="4"] {
    background: #e67e22;
}

/* Excited - Orange */