@charset "UTF-8";

/* Ramon design system base
 * - Imports shared 12-column layout grid and primitives from layout.css
 * - Defines design tokens (colors, typography, radii, spacing)
 * - Styles Ramon-specific structures (nav stack, floating button, popup)
 *
 * This stylesheet is intended for Datastar / Ramon pages only.
 */

@import "./layout.css";
@import "./dropdown.css";
@import "./datepicker.css";

:root {
    /* Typography */
    --typography-font-family: "Poppins", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --typography-small-regular-font-size: 12px;
    --typography-small-11-regular-font-size: 11px;
    --typography-small-8-regular-font-size: 8px;
    --typography-body-regular-font-size: 13px;
    --typography-font-weight-light: 300;
    --typography-font-weight-regular: 400;

    /* Color tokens based on UX design spec */
    --color-chrome-bg: #0d1a15;
    /* Dark top/chrome background */
    --color-body-bg: #f8f6f6;
    /* Main app body background */
    --color-surface: #ffffff;
    /* Cards / sections */
    --color-primary-action: #e92063;
    /* Primary CTAs, Ramon button */
    --color-session-bg: #fdf2f6;
    /* Light rose for Ramon Session surfaces */

    --color-text-main: #111827;
    /* Main text */
    --color-text-muted: #6b7280;
    /* Secondary text */
    --color-secondary: #707683;
    /* Muted/secondary text (assistant, expandable) */
    --color-border-subtle: #f0f0f0;
    /* Subtle borders and dividers */

    /* Bridge: datepicker.css uses --mdc-theme-primary for .day.selected */
    --mdc-theme-primary: var(--color-primary-action);

    /* Semantic colors (placeholder values; refine as needed) */
    --color-success: #16a34a;
    --color-warning: #f59e0b;
    --color-error: #dc2626;

    /* Radii */
    --radius-card: 16px;
    /* iOS-style card radius */
    --radius-button: 999px;
    /* Pill buttons */
    --radius-segment: 12px;
    /* Segmented role-filter pill corner radius */

    /* Segmented role-filter track */
    --color-segmented-track: #eef1f5;

    /* Spacing scale (multiples of 4px) */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;

    /* Ramon header/footer heights */
    --ramon-header-height: 56px;
    --ramon-footer-height: 72px;
}


/* Base page styles for Ramon pages */
body {
    margin: 0;
    padding: 0;
    font-family: var(--typography-font-family);
    font-size: var(--typography-body-regular-font-size);
    font-weight: var(--typography-font-weight-regular);
    color: var(--color-text-main);
    background-color: var(--color-body-bg);
    -webkit-text-size-adjust: 100%;
}

input,
textarea,
select {
    font-size: 16px;
}

/* Ramon nav stack container (iOS-style) */
.ramon-nav-stack {
    position: relative;
    overflow: hidden;
    width: 100%;
    height: 100dvh;
    background-color: var(--color-body-bg);
}

.ramon-screen {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    background-color: var(--color-body-bg);
    padding-top: calc(var(--ramon-header-height) + var(--space-4));
    padding-bottom: calc(var(--ramon-footer-height) + var(--space-4));
    padding-left: var(--space-4);
    padding-right: var(--space-4);
    overflow-y: auto;
    align-content: start;
    transform: translateX(100%);
    transition: transform 0.38s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform;
    pointer-events: none;
    /* inactive screens must never intercept clicks */
}

.ramon-screen.active {
    transform: none;
    will-change: auto;
    position: relative;
    pointer-events: auto;
}

.ramon-screen.prev {
    transform: translateX(-30%);
}

.ramon-screen.prev::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.15);
    pointer-events: none;
}

/* Full-page exit: slide current screen fully off-screen left before page navigation */
.ramon-screen.leaving {
    transform: translateX(-100%);
    pointer-events: none;
}

/* Back navigation: slide current screen off-screen right */
.ramon-screen.leaving-right {
    transform: translateX(100%);
    pointer-events: none;
}

/* Back navigation: previous screen slides from -30% to center */
.ramon-screen.entering {
    transform: translateX(0);
    pointer-events: none;
}

/* Static header bar behind all screens — visible during slide transitions */
.ramon-nav-bg-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: var(--ramon-header-height);
    background-color: var(--color-chrome-bg);
    z-index: 0;
}

/* Ramon header and footer bars */
.ramon-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--ramon-header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-inline: var(--space-2);
    background-color: var(--color-chrome-bg);
    color: #ffffff;
    z-index: 10;
}

.ramon-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--ramon-footer-height);
    display: flex;
    align-items: center;
    justify-content: center;
    padding-inline: var(--space-2);
    background-color: var(--color-body-bg);
    z-index: 10;
}


/* Bubble: rounded white card for Today sections, Recent Chats, etc. */
.bubble {
    background-color: var(--color-surface);
    padding: var(--space-4);
    border-top-left-radius: var(--radius-card);
    border-top-right-radius: var(--radius-card);
    border-bottom-left-radius: var(--radius-card);
    border-bottom-right-radius: var(--radius-card);
    padding-top: var(--space-2);
    padding-bottom: var(--space-2);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* When a .bubble is also a .grid, prevent wide children (flex tab bars,
   long text, entity tables) from inflating the 1fr tracks beyond the card.
   minmax(0, 1fr) sets the track minimum to 0 instead of auto.
   gap: 0 because the bubble owns its own internal spacing via padding;
   the inherited 1em grid-gap from .grid blows out the column math on
   narrow viewports (half-width bubbles get 0-width tracks, content
   escapes the rounded corner). */
.bubble.grid {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 0;
}

/* Bubble expand animation — same pattern as eg-expand-cell */
@keyframes bubble-expand {
    from {
        height: 0;
        opacity: 0;
        min-height: 0;
        padding-top: 0;
        padding-bottom: 0;
    }

    to {
        opacity: 1;
    }
}

.bubble {
    animation: bubble-expand 0.5s ease forwards;
}

/* Bubble card: grid + .js/.je/.ac from layout.css for alignment. */
.bubble-card-title {
    font-weight: 500;
    color: var(--color-text-main);
}

.bubble-card-link {
    color: var(--color-primary-action);
    cursor: pointer;
    font-weight: 700;
}

.bubble-card[data-on\:click] {
    cursor: pointer;
}

/* Shared button styles (reusing .btn from existing CSS, but themed for Ramon) */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: var(--color-primary-action);
    background-color: #fff;
    font-family: var(--typography-font-family);
    font-size: 14px;
    font-weight: 500;
    border: none;
    border-radius: var(--radius-button);
    cursor: pointer;
    padding: 0px;
    margin: 0;
    text-transform: uppercase;
    overflow: hidden;
    transition:
        background-color 0.2s ease,
        color 0.2s ease,
        box-shadow 0.2s ease;
}

.btn-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.btn.contained {
    background-color: var(--color-primary-action);
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
    padding: 8px 8px;
}

.btn.contained:hover {
    background-color: #c91854;
}

.btn.outlined {
    background-color: transparent;
    border: 2px solid var(--color-primary-action);
    padding: 8px 8px;
}

.btn.outlined:hover {
    background-color: rgba(233, 32, 99, 0.05);
}

.btn.text {
    background-color: transparent;
    color: var(--color-primary-action);
    padding-inline: 8px;
}

.btn.icon {
    background-color: transparent;
    border: none;
    padding: 8px 8px;
    margin: 0;
}

.btn.icon:hover {
    background-color: transparent;
}

/* Button pending state — spinner replaces icon while waiting for server response */
@keyframes btn-spin {
    to {
        transform: rotate(360deg);
    }
}

.btn-spinner {
    display: inline-block;
    /* visible by default in CSS; data-show hides via inline style="display:none" when signal is falsy */
    width: 16px;
    height: 16px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: btn-spin 0.7s linear infinite;
    flex-shrink: 0;
}

.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    pointer-events: none;
}

/* Floating Ramon button */
#floating-btn-container {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    width: 100%;
    display: flex;
    justify-content: center;
    pointer-events: none;
    /* let button receive events only */
}

#floating-btn-container .btn {
    min-width: 60%;
    max-width: 420px;
    height: 48px;
    pointer-events: auto;
    padding: 0 18px;
    /* Liquid-glass frosted effect */
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 999px;
    box-shadow:
        0 0 18px rgba(233, 32, 99, 0.5),
        0 0 35px rgba(233, 32, 99, 0.25),
        0 4px 20px rgba(0, 0, 0, 0.18);
}

/* Hide the floating button when the item (form) screen is active */
.ramon-nav-stack:has(#screen-item.active) #floating-btn-bubble {
    display: none;
}

/* Hide the floating button when a full-screen modal is visible.
   add-contact / invite: #modal-content carries data-show="$modalOpen", so Datastar
   toggles display:none on it — check :not(:empty) + :not(display:none).
   chat-form: .fullscreen-modal is part of the screen patch, removed when dismissed. */
.ramon-nav-stack:has(#modal-content:not(:empty):not([style*="display: none"])) #floating-btn-bubble,
.ramon-nav-stack:has(#screen-chats .fullscreen-modal) #floating-btn-bubble,
.ramon-nav-stack:has(.bottomsheet-overlay:not([style*="display: none"])) #floating-btn-bubble {
    display: none;
}

/* Popup overlay used by Ramon (Session placeholder) */
[data-show="$popupOpen"] {
    display: block;
    /* attribute hook is managed by Datastar; style via child elements */
}

/* Panel sizing — dvh responds to on-screen keyboard on iOS 15.4+ / Chrome 108+ */
#ramon-popup-panel {
    top: 20vh !important;
    height: 80vh !important;
    top: 20dvh !important;
    height: 80dvh !important;
    border-radius: 16px 16px 0 0;
}


/* Entity grid (eg-*) – for read-only tables in chat detail (entities_list).
 * Matches bases/web/.../eg.css so ramon can use eg-container, eg-header, eg-cell
 * without loading app/eg.css. Uses ramon design tokens. */
.eg-container {
    display: grid;
    /* color: var(--color-text-muted); */
    font-family: var(--typography-font-family);
    font-weight: 400;
    font-size: 12px;
}

.eg-header {
    /* color: var(--color-text-muted); */
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    padding: 14px 7px;
    border-bottom: 1px solid var(--color-border-subtle);
}

.eg-header:hover {
    background-color: #f0f0f0;
}

.eg-cell {
    white-space: normal;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 6px;
    border-bottom: 0.5px solid var(--color-border-subtle);
    border-right: 0.5px solid var(--color-border-subtle);
    animation: eg-expand-cell 0.5s ease forwards;
}

@keyframes eg-expand-cell {
    from {
        height: 0;
        opacity: 0;
        min-height: 0;
    }

    to {
        opacity: 1;
        min-height: 18px;
    }
}

.eg-cell.add-field {
    border-width: 0;
}

/* Entity row edit / ⋯ — 20px icons; scoped via .eg-row-action-btn on each button */
.eg-row-action-btn .material-symbols-outlined {
    font-size: 20px;
}

/* Signature user handle pill (used in eg-cell for :signatures field type) */
.user-handle {
    border: 0.5px solid var(--color-text-muted);
    border-radius: 16px;
    padding: 0px 8px;
    display: inline-flex;
    align-items: center;
}

/* Empty state: same font/size as table rows and cells */
.eg-empty {
    font-family: var(--typography-font-family);
    font-size: 12px;
    font-weight: 400;
    color: var(--color-text-muted);
    padding: 7px 7px 0 7px;
}

.eg-footer {
    padding: 7px;
}

/* Entity grid scrollport: flex row so sticky ::after (see .tabs::after) can hint at more columns */
.entity-grid-scroll {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    min-width: 0;
    overflow-x: auto;
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.entity-grid-scroll::-webkit-scrollbar {
    display: none;
}

.entity-grid-scroll>.eg-container {
    flex: 0 0 auto;
    min-width: min-content;
}

/* Assistant / expandable / session chat – classes used by llm_sessions, tool_components, reasoning, replies */
.secondary {
    color: var(--color-secondary);
    font-weight: var(--typography-font-weight-light);
    font-size: var(--typography-small-regular-font-size);
}

/* Material Symbols Outlined (self-contained; also loaded via Google link in html_page) */
.material-symbols-outlined {
    font-family: 'Material Symbols Outlined';
    font-weight: normal;
    font-style: normal;
    font-size: 24px;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    display: inline-block;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    font-feature-settings: 'liga';
    -webkit-font-feature-settings: 'liga';
    -webkit-font-smoothing: antialiased;
}

.expand-icon {
    vertical-align: middle;
    transition: transform 0.2s ease;
}

.expandable-container {
    display: block;
}

.expandable-header {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.expandable-content {
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
}

.reasoning {
    color: var(--color-secondary);
    font-weight: var(--typography-font-weight-light);
    font-size: var(--typography-small-regular-font-size);
}

.tools {
    margin-top: var(--space-2);
    margin-bottom: var(--space-2);
}

.partial-tools,
.partial-reasoning {
    color: var(--color-secondary);
    font-size: var(--typography-small-regular-font-size);
}

.tool-call-payload,
pre.tool-call-payload {
    font-size: var(--typography-small-8-regular-font-size);
    white-space: pre-wrap;
    margin: var(--space-2) 0;
    color: var(--color-text-muted);
}

/* ── Tab bar ─────────────────────────────────────────────────────────────── */

.tabs {
    display: flex;
    min-width: 0;
    border-bottom: 1px solid var(--color-border-subtle);
    overflow-x: auto;
    overflow-y: hidden;
    /* Hide scrollbar but keep scrolling (mobile-friendly) */
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE/Edge */
}

.tabs::-webkit-scrollbar {
    display: none;
    /* Chrome / Safari */
}

/* Fade gradient on the right edge to hint at more tabs / wide entity columns */
.tabs::after,
.entity-grid-scroll::after {
    content: '';
    position: sticky;
    right: 0;
    flex-shrink: 0;
    min-width: 32px;
    background: linear-gradient(to right, transparent, var(--color-surface));
    pointer-events: none;
}

.tablinks {
    flex-shrink: 0;
    background-color: transparent;
    border: none;
    outline: none;
    cursor: pointer;
    padding: var(--space-2) var(--space-4) var(--space-2) 0px;
    position: relative;
    font-family: var(--typography-font-family);
    font-size: var(--typography-body-regular-font-size);
    font-weight: 500;
    color: var(--color-text-muted);
    white-space: nowrap;
    transition: color 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.tablinks.active {
    color: var(--color-primary-action);
}

.tablinks.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0px;
    right: var(--space-4);
    height: 2px;
    background-color: var(--color-primary-action);
}

/* ── Segmented role filter (To Buy / To Sell) ──────────────────────────── */
.role-segmented {
    display: flex;
    width: 100%;
    gap: var(--space-1);
    padding: var(--space-1);
    background: var(--color-segmented-track);
    border-radius: var(--radius-card);
}

.role-segment {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-1);
    padding: var(--space-2) var(--space-3);
    border: none;
    outline: none;
    cursor: pointer;
    background: transparent;
    color: var(--color-text-muted);
    border-radius: var(--radius-segment);
    font-family: var(--typography-font-family);
    font-size: var(--typography-body-regular-font-size);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    white-space: nowrap;
    transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.role-segment .material-symbols-outlined {
    font-size: 18px;
}

.role-segment.active {
    background: var(--color-surface);
    color: var(--color-text-main);
    box-shadow: 0 4px 14px -2px rgba(17, 24, 39, 0.16);
}

/* ── Chats list (ramon chats screen) ───────────────────────────────────── */

.chat-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    padding: var(--space-2) 0px var(--space-2) 0px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    gap: 0.75rem;
}

.chat-row-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.chat-row.chat_row_pending {
    opacity: 0.55;
    cursor: wait;
    pointer-events: none;
}

.chat-row-top {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chat-row-icon {

    /* background-color: oklch(0.95 0.005 250); */
    /* color: oklch(0.50 0.01 250); */
    background-color: oklch(0.96 0.005 250);
    color: oklch(0.60 0.01 250);
    border-radius: 50%;
    padding: 6px;

    font-size: 18px;
    flex-shrink: 0;
}

.chat-row-icon.chat-row-icon-buyer {
    /* background-color: oklch(0.86 0.08 210); */
    /* color: oklch(0.38 0.11 195); */
    /* background-color: oklch(0.91 0.03 150); */
    /* color: oklch(0.38 0.11 195); */
    background-color: oklch(0.88 0.01 250);
    color: oklch(0.30 0.02 250);
}

.chat-row-icon.chat-row-icon-seller {
    background-color: oklch(0.95 0.04 0);
    color: oklch(0.58 0.17 0);
}

/* Analysis data-cell role icons: shrink + vertically align with label text.
   Scoped via :has() so Story 3.9 chat-list icon sizing is preserved. */
.eg-cell:has(> .chat-row-icon) {
    display: flex;
    align-items: center;
    gap: 6px;
}

.eg-cell .chat-row-icon {
    font-size: 14px;
    padding: 3px;
}

.chat-row-title {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.chat-row-name {
    font-weight: 400;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-row-name.chat-row-unread {
    font-weight: 700;
}

.chat-row-role-chip {
    display: inline-block;
    font-size: 10px;
    color: var(--color-text-secondary, #666);
    background-color: #f0f0f0;
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: capitalize;
    flex-shrink: 0;
}

.chat-members {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px 8px;
    margin-top: -8px;
}

.chat-members[data-testid="ramon-members-list"] {
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 0;
    margin-top: 0;
}

.chat-member-tag {
    flex-shrink: 0;
    font-size: 0.85em;
    color: var(--color-text-secondary, #666);
}

.chat-member-line {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
    font-size: var(--typography-small-11-regular-font-size);
}

.chat-member-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 11rem;
}

.chat-avatar {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: #f9f9f9;
    color: var(--color-secondary);
    font-size: 10px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* .chat-members .chat-member-line:nth-child(2) .chat-avatar {
    background-color: var(--color-primary-action, #1976d2);
} */

.chat-more-badge {
    font-size: 11px;
    color: #888;
    margin-left: 2px;
}

.chat-action-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: var(--color-primary-action, #e92063);
    flex-shrink: 0;
}

.chat-action-btn .material-symbols-outlined {
    color: inherit;
}

.chat-chevron {
    color: var(--color-primary-action, #e92063);
    flex-shrink: 0;
    font-size: 22px;
}

/* === Invite & Contact overlays === */

/* Lift #screen-chat above #floating-btn-container (z-index: 1000) whenever any
   popup inside it is open. The .active screen (position:relative) needs an
   explicit z-index to create a stacking context that scopes child z-indices,
   so the bottomsheet (z-index: 9998/9999) appears above the floating button
   (a global sibling at z-index 1000). */
#screen-chat:has(#modal-content:not(:empty)),
#screen-chat:has(.bottomsheet-overlay:not([style*="display: none"])),
#screen-chats:has(.bottomsheet-overlay:not([style*="display: none"])) {
    z-index: 1001;
}

/* Lock scroll on the screen container when bottom sheet overlay is visible.
   .ramon-screen has overflow-y:auto — this prevents scrolling behind the sheet. */
.ramon-screen:has(.bottomsheet-overlay:not([style*="display: none"])) {
    overflow-y: hidden !important;
}

/* ── Full-screen modal (reusable) ─────────────────────────────────────── */

.fullscreen-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #fff;
    z-index: 1002;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.fullscreen-modal-header {
    position: sticky;
    top: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-border, #ddd);
    background: #fff;
    z-index: 1;
}

.fullscreen-modal-header .back-btn {
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    padding: 4px;
    min-width: auto;
}

.fullscreen-modal-header .back-btn .material-symbols-outlined {
    font-size: 24px;
}

.fullscreen-modal-header h3 {
    margin: 0;
    font-size: 18px;
}

.fullscreen-modal-body {
    flex: 1;
    min-height: 0;
    /* override flex-item default (auto) so overflow-y can scroll */
    overflow-y: auto;
    padding: 16px;
}

.fullscreen-modal-footer {
    position: sticky;
    bottom: 0;
    padding: 12px 16px;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
    border-top: 1px solid var(--color-border, #ddd);
    background: #fff;
    z-index: 1;
}

.fullscreen-modal-footer .btn {
    width: 100%;
}

/* ── Half-screen bottom sheet (reusable) ───────────────────────────────── */
/* Overlay + sliding panel. The .active screen uses transform:none + will-change:auto
   so position:fixed children (header, footer, bottomsheet, modal) are fixed to the
   viewport — not the screen. During slide transitions, intermediate transform values
   still create a containing block, so children slide with the screen as expected.   */

.bottomsheet-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 9998;
}

.bottomsheet {
    position: fixed;
    bottom: 0;
    left: 0;
    width: calc(100% - 16px);
    height: 50%;
    overflow-y: auto;
    background: #fff;
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    padding: 8px 8px 8px 8px;
    padding-bottom: max(16px, env(safe-area-inset-bottom));
    animation: bottomsheet-expand 0.25s ease forwards;
    align-content: start;
}

@keyframes bottomsheet-expand {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

.bottomsheet .btn {
    text-align: left;
    justify-content: flex-start;
    gap: 8px;
}

/* Hide entity FAB (+) when a bottom sheet is open */
.bottomsheet-overlay:not([style*="display: none"])~.entity-fab,
.ramon-screen:has(.bottomsheet-overlay:not([style*="display: none"])) .entity-fab {
    display: none;
}

/* Chat members action buttons */
.chat-members-actions {
    display: flex;
    gap: var(--space-3, 12px);
    margin-top: var(--space-4, 16px);
}

.contact-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-1, 4px);
}

.contact-item {
    display: flex;
    align-items: center;
    gap: var(--space-2, 8px);
    padding: var(--space-2, 8px) 0;
    cursor: pointer;
    margin: 0;
}

.contact-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.contact-item .contact-info {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.contact-item .contact-name {
    min-width: 0;
}

.contact-item .contact-row-icon {
    flex-shrink: 0;
    font-size: 20px;
    color: var(--color-text-secondary, #666);
}

.contact-item .contact-role {
    flex: 0 0 auto;
    width: auto;
    min-width: 7rem;
    max-width: 10rem;
}

/* Invite form fields inside the dropdown-popup bottom-sheet */
.invite-field {
    margin-bottom: var(--space-4, 16px);
}

.invite-field > label {
    display: block;
    margin-bottom: var(--space-1, 4px);
    font-size: 14px;
    color: var(--color-text-secondary, #666);
}

.invite-field input[type="text"],
.invite-field input[type="date"],
.invite-field select {
    width: 100%;
    padding: var(--space-2, 8px);
    border: 1px solid var(--color-border, #ddd);
    border-radius: 6px;
    font-size: 16px;
}

.invite-checkbox {
    display: flex;
    align-items: center;
    gap: var(--space-2, 8px);
    margin-top: var(--space-2, 8px);
    cursor: pointer;
}

.invite-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
}

.invite-buttons {
    display: flex;
    gap: var(--space-3, 12px);
    justify-content: flex-end;
    margin-top: var(--space-4, 16px);
}

/* Active invitations list below members */
.chat-invitations {
    margin-top: var(--space-4, 16px);
    border-top: 1px solid var(--color-border, #ddd);
    padding-top: var(--space-4, 16px);
}

.invitations-header {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: var(--space-2, 8px);
    color: var(--color-text-secondary, #666);
}

.invitation-line {
    display: flex;
    align-items: center;
    gap: var(--space-3, 12px);
    padding: var(--space-2, 8px) 0;
    font-size: 14px;
}

.invitation-card {
    border: 1px solid var(--color-border, #ddd);
    border-radius: 8px;
    padding: var(--space-4, 16px);
    margin-bottom: var(--space-4, 16px);
}

.invitation-name {
    font-weight: 500;
    flex: 1;
}

.invitation-perms {
    color: var(--color-text-secondary, #666);
    font-size: 12px;
}

.invitation-expires {
    color: var(--color-text-secondary, #666);
    font-size: 12px;
}

/* QR code + link display in success bottom-sheet */
.invite-qr {
    display: flex;
    justify-content: center;
    margin: var(--space-4, 16px) 0;
}

.invite-qr svg {
    border: 1px solid var(--color-border, #ddd);
    border-radius: 8px;
    padding: var(--space-2, 8px);
    background: white;
}

.invite-link-row {
    display: flex;
    align-items: center;
    gap: var(--space-2, 8px);
    margin: var(--space-4, 16px) 0;
}

.invite-link {
    flex: 1;
    padding: var(--space-3, 12px);
    background: var(--color-surface-alt, #f5f5f5);
    border-radius: 6px;
    word-break: break-all;
    font-size: 14px;
}

/* ── Entity form fields ─────────────────────────────────────────────────── */

.label {
    font-size: var(--typography-small-regular-font-size);
    color: rgba(0, 0, 0, 0.54);
    margin-bottom: -8px;
}

.input {
    width: 100%;
    padding-bottom: 8px;
    font-size: 14px;
    border: none;
    border-bottom: 0.5px solid #AAA;
    border-radius: 0;
    transition: border-color 0.6s ease;
    color: var(--color-text-main);
    background: transparent;
    box-sizing: border-box;
}

.input:focus {
    border-color: var(--color-primary-action);
    border-bottom-width: 2px;
    outline: none;
}

input:disabled {
    border-bottom: none;
}

.taia-textarea {
    border: none;
    border-bottom: 0.5px solid #AAA;
    border-right: 0.5px solid #AAA;
    box-sizing: border-box;
    transition: border-color 0.3s;
    width: 100%;
    font-family: var(--typography-font-family);
    font-size: var(--typography-small-regular-font-size);
    background: transparent;
    resize: vertical;
}

.taia-textarea:focus {
    outline: none;
    border-color: var(--color-primary-action);
    border-bottom-width: 2px;
}

/* Actions bar — bottom-anchored bar for save/cancel buttons on item screen */
.actions-bar-bottom {
    padding: var(--space-4) var(--space-4);
    width: calc(100% - 48px) !important;
}

/* Loading skeleton for nav-stack screens (optimistic navigation placeholder) */
.screen-loading {
    padding: 0.5rem 0 1rem 0;
    display: flex;
    flex-direction: column;
    gap: 0;
    width: 100%;
    grid-column: span 12;
}

.screen-loading-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--color-border-subtle);
    animation: skeleton-fade-in 0.3s ease-out both;
}

.screen-loading-row:last-child {
    border-bottom: none;
}

.screen-loading-row:nth-child(1) {
    animation-delay: 0s;
}

.screen-loading-row:nth-child(2) {
    animation-delay: 0.08s;
}

.screen-loading-row:nth-child(3) {
    animation-delay: 0.16s;
}

.screen-loading-row:nth-child(4) {
    animation-delay: 0.24s;
}

.screen-loading-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--color-border-subtle);
    flex-shrink: 0;
    animation: skeleton-pulse 1.4s ease-in-out infinite;
}

.screen-loading-lines {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.screen-loading-line {
    height: 12px;
    border-radius: 6px;
    background: var(--color-border-subtle);
    animation: skeleton-pulse 1.4s ease-in-out infinite;
}

.screen-loading-line:nth-child(1) {
    width: 55%;
}

.screen-loading-line:nth-child(2) {
    width: 80%;
}

.screen-loading-row:nth-child(2) .screen-loading-line:nth-child(1) {
    width: 40%;
}

.screen-loading-row:nth-child(2) .screen-loading-line:nth-child(2) {
    width: 65%;
}

.screen-loading-row:nth-child(3) .screen-loading-line:nth-child(1) {
    width: 60%;
}

.screen-loading-row:nth-child(3) .screen-loading-line:nth-child(2) {
    width: 45%;
}

.screen-loading-row:nth-child(4) .screen-loading-line:nth-child(1) {
    width: 35%;
}

.screen-loading-row:nth-child(4) .screen-loading-line:nth-child(2) {
    width: 70%;
}

@keyframes skeleton-pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }
}

@keyframes skeleton-fade-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ---------------------------------------------------------------------------
   Tips & Help panel (progressive onboarding)
   --------------------------------------------------------------------------- */

.ramon-tip-banner {
    margin: 8px 16px;
    padding: 10px 14px;
    background: #fff8e1;
    border-left: 3px solid #f9a825;
    border-radius: 8px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    animation: ramon-tip-fade-in 0.3s ease;
}

.ramon-starter-suggestion {
    max-width: 320px;
    margin: 0 auto;
}

.ramon-help-panel {
    position: absolute;
    inset: 0;
    z-index: 10;
    background: #ffffff;
    border-radius: inherit;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.ramon-help-panel-header {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 20px;
    border-bottom: 1px solid #eaeaea;
    background: #ffffff;
    flex-shrink: 0;
}

.ramon-help-panel>div:last-child {
    overflow-y: auto;
    flex: 1;
}

.ramon-help-panel-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.ramon-help-formula {
    word-break: break-word;
}

/* PWA install prompt — hidden by default, shown when JS adds .pwa-installable to body */
.pwa-install-prompt {
    display: none;
}

body.pwa-installable .pwa-install-prompt {
    display: block;
}

@keyframes ramon-tip-fade-in {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}
/* ---------------------------------------------------------------------------
 * Home navigation drawer (Story 9.1)
 * ------------------------------------------------------------------------- */

.ramon-header-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
    color: #ffffff;
    cursor: pointer;
    border-radius: var(--radius-button);
}

.ramon-header-icon-btn:hover {
    background-color: rgba(255, 255, 255, 0.08);
}

.drawer-root {
    pointer-events: none;
}

.drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 1001;
    pointer-events: auto;
}

.drawer-panel {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: min(80vw, 300px);
    background: var(--color-chrome-bg);
    color: #ffffff;
    z-index: 1002;
    transform: translateX(-100%);
    transition: transform 250ms ease-in-out;
    pointer-events: auto;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.25);
    padding-top: var(--ramon-header-height);
    overflow-y: auto;
}

.drawer-panel.open {
    transform: translateX(0);
}

.drawer-menu {
    display: flex;
    flex-direction: column;
    padding: var(--space-2) 0;
}

.drawer-menu-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    width: 100%;
    padding: var(--space-3) var(--space-4);
    background: transparent;
    border: none;
    color: inherit;
    font-family: var(--typography-font-family);
    font-size: var(--typography-body-regular-font-size);
    text-align: left;
    cursor: pointer;
}

.drawer-menu-item:hover {
    background-color: rgba(255, 255, 255, 0.08);
}

.drawer-menu-item:focus-visible {
    background-color: rgba(255, 255, 255, 0.08);
    outline: 2px solid rgba(255, 255, 255, 0.6);
    outline-offset: -2px;
}

.drawer-menu-item-label {
    font-weight: 500;
}
