/* Explain: Base styles for UI components like buttons, cards, and form fields. */
/* ===== Header ===== */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    border-bottom: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    transition: box-shadow 0.25s ease;
}

.site-header.is-stuck {
    box-shadow: 0 8px 22px -18px rgba(12, 16, 48, 0.55);
}

/* ===== Top utility bar ===== */
.topbar {
    background: var(--primary-color);
    color: #fff;
}

.topbar-link {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    color: rgba(255, 255, 255, 0.75);
    font-weight: 600;
    font-size: 0.8rem;
    transition: color 0.2s ease;
}

.topbar-link:hover {
    color: #fff;
}

.topbar-link i {
    color: var(--accent-color);
}

/* ===== Brand wordmark & navigation ===== */
.brand-wordmark {
    display: block;
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1.1rem;
    letter-spacing: -0.03em;
    line-height: 1.05;
    color: var(--primary-color);
}

.brand-tagline {
    display: block;
    margin-top: 0.2rem;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--accent-ink);
}

.nav-link {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.5rem 0.9rem;
    border-radius: var(--radius-pill);
    border: 1px solid transparent;
    background: transparent;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    cursor: pointer;
    transition: color 0.2s ease, background 0.2s ease;
}

.nav-link:hover {
    color: var(--primary-color);
    background: var(--primary-soft);
}

/* ===== Buttons ===== */
.btn-solid,
.btn-ghost,
.btn-gold {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.72rem 1.35rem;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-weight: 600;
    font-size: 0.94rem;
    line-height: 1.2;
    min-height: 44px;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.btn-solid {
    background: var(--primary-color);
    color: #fff;
}

.btn-solid:hover {
    background: var(--primary-hover);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.btn-ghost {
    background: var(--surface-color);
    border-color: var(--border-color);
    color: var(--text-color);
}

.btn-ghost:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: var(--primary-soft);
}

.btn-gold {
    background: var(--accent-color);
    color: var(--accent-ink);
    font-weight: 700;
    font-size: 0.9rem;
}

.btn-gold:hover {
    filter: brightness(0.96);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

/* ===== Cards & surfaces ===== */
.panel {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xs);
}

.panel-soft {
    background: var(--surface-alt);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.panel-elevated {
    box-shadow: var(--shadow-lg);
}

.folder-card {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-height: 100%;
    padding: 1.4rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--surface-color);
    text-align: left;
    cursor: pointer;
    transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
}

.folder-card:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.folder-icon,
.icon-tile {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    flex-shrink: 0;
    border-radius: 12px;
    background: var(--primary-soft);
    color: var(--primary-color);
    font-size: 1.05rem;
}

.folder-icon-accent,
.icon-tile-accent {
    background: var(--accent-soft);
    color: var(--accent-ink);
}

/* ===== Eyebrows & figures ===== */
.section-label {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--primary-color);
}

.stat-num {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1.9rem;
    line-height: 1;
    letter-spacing: -0.03em;
    color: var(--primary-color);
}

.step-number {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 2.1rem;
    line-height: 1;
    letter-spacing: -0.04em;
    color: var(--border-color);
}

/* ===== Form controls ===== */
.field-label {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.field {
    width: 100%;
    min-height: 44px;
    padding: 0.72rem 0.9rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--surface-color);
    color: var(--text-color);
    font-family: inherit;
    font-size: 0.95rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px var(--primary-soft);
}

/* ===== Pills & badges ===== */
.pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.26rem 0.66rem;
    border-radius: var(--radius-pill);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    background: var(--surface-alt);
    color: var(--text-muted);
    white-space: nowrap;
}

.pill-brand,
.pill-admin {
    background: var(--primary-soft);
    color: var(--primary-color);
}

.pill-approved {
    background: #e5f2ea;
    color: #276a4a;
}

.pill-pending {
    background: #fdf1da;
    color: #8a6412;
}

.pill-rejected {
    background: #fbe7e3;
    color: #93362a;
}

.pill-new {
    background: var(--accent-color);
    color: var(--accent-ink);
}

/* ===== Data table ===== */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.data-table th {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--surface-alt);
    text-align: left;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--text-muted);
    white-space: nowrap;
}

.data-table td {
    padding: 0.85rem 0.75rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.data-table tbody tr {
    transition: background 0.18s ease;
}

.data-table tbody tr:hover {
    background: var(--primary-soft);
}

/* ===== File rows ===== */
.file-row {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 0.8rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--surface-color);
    transition: border-color 0.2s ease;
}

.file-row:hover {
    border-color: var(--primary-color);
}

/* ===== Tabs ===== */
.tab-btn {
    min-height: 40px;
    padding: 0.55rem 1.05rem;
    border: 1px solid transparent;
    border-radius: var(--radius-pill);
    background: transparent;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab-btn:hover {
    color: var(--primary-color);
}

.tab-btn-active {
    background: var(--surface-color);
    border-color: var(--border-color);
    color: var(--primary-color);
    box-shadow: var(--shadow-xs);
}

/* ===== Toast ===== */
.toast-note {
    padding: 0.8rem 1rem;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
}

.toast-success {
    background: #e7f3ec;
    border-color: #b9dcc7;
    color: #235a3d;
}

.toast-error {
    background: #fae6e2;
    border-color: #f0c4bb;
    color: #8b3225;
}

/* ===== Empty state ===== */
.empty-state {
    padding: 2.5rem 1.25rem;
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-md);
    background: var(--surface-color);
    text-align: center;
    color: var(--text-muted);
}

/* ===== Signed-out pop-up ===== */
.signout-modal {
    position: fixed;
    inset: 0;
    z-index: 90;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    background: rgba(12, 16, 48, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.signout-modal.is-open {
    display: flex;
}

.signout-dialog {
    width: 100%;
    max-width: 28rem;
    text-align: center;
    box-shadow: var(--shadow-lg);
}

/* ===== Community feed ===== */
.community-like-btn.is-liked {
    color: var(--primary-color);
    border-color: var(--primary-color);
    background: var(--primary-soft);
}

/* ===== Private messages ===== */
.dm-convo {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    width: 100%;
    padding: 0.65rem 0.7rem;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: transparent;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.dm-convo:hover {
    background: var(--surface-alt);
}

.dm-convo.is-active {
    background: var(--primary-soft);
    border-color: var(--primary-color);
}

.dm-convo-unread {
    display: inline-grid;
    place-items: center;
    min-width: 20px;
    height: 20px;
    padding: 0 0.35rem;
    flex-shrink: 0;
    border-radius: 10px;
    background: var(--primary-color);
    color: #fff;
    font-size: 0.66rem;
    font-weight: 700;
}

.dm-avatar {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    overflow: hidden;
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary-color);
    font-size: 0.78rem;
    font-weight: 700;
}

.dm-bubble {
    max-width: min(100%, 34rem);
    padding: 0.65rem 0.9rem;
    border-radius: 14px;
    font-size: 0.92rem;
    line-height: 1.55;
    white-space: pre-line;
    overflow-wrap: anywhere;
}

.dm-bubble-mine {
    margin-left: auto;
    background: var(--primary-color);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.dm-bubble-theirs {
    background: var(--surface-alt);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-bottom-left-radius: 4px;
}

.dm-time {
    padding: 0;
    border: none;
    background: none;
    font-size: 0.68rem;
    color: var(--text-muted);
    cursor: default;
}

button.dm-time {
    cursor: pointer;
}

/* ===== Presence (which members are online) ===== */
.presence-grid {
    display: grid;
    gap: 0.7rem;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 13.5rem), 1fr));
}

.presence-chip {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    width: 100%;
    min-height: 56px;
    padding: 0.65rem 0.85rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--surface-alt);
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.22s ease, box-shadow 0.22s ease, transform 0.22s ease;
}

.presence-chip:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

.presence-avatar-wrap {
    position: relative;
    display: inline-grid;
    place-items: center;
    flex-shrink: 0;
}

.presence-avatar {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary-color);
    font-size: 0.8rem;
    font-weight: 700;
}

.presence-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.presence-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    flex-shrink: 0;
    border-radius: 999px;
    background: var(--success-color);
}

.presence-dot-badge {
    position: absolute;
    right: -1px;
    bottom: -1px;
    border: 2px solid var(--surface-color);
}

/* ===== Members area: app-style tile grid ===== */
.app-grid {
    display: grid;
    gap: 0.85rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (min-width: 640px) {
    .app-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (min-width: 1024px) {
    .app-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

.app-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.7rem;
    width: 100%;
    min-height: 100%;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--surface-color);
    box-shadow: var(--shadow-xs);
    color: var(--text-color);
    font-family: inherit;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    transition: border-color 0.22s ease, box-shadow 0.22s ease, transform 0.22s ease;
}

.app-card:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.app-card:active {
    transform: translateY(0);
}

/* ===== Bottom navigation (used on the other members pages) ===== */
.has-memberbar {
    padding-bottom: calc(4.75rem + env(safe-area-inset-bottom, 0px));
}

.memberbar {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 60;
    display: block;
    border-top: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 -8px 26px -20px rgba(12, 16, 48, 0.55);
}

.memberbar-inner {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.2rem;
    width: 100%;
    max-width: 34rem;
    margin-inline: auto;
    padding: 0.4rem 0.5rem calc(0.4rem + env(safe-area-inset-bottom, 0px));
}

.memberbar-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    min-height: 50px;
    padding: 0.3rem 0.15rem;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.66rem;
    font-weight: 700;
    text-decoration: none;
    transition: color 0.2s ease, background 0.2s ease;
}

.memberbar-link i {
    font-size: 1.05rem;
}

.memberbar-link:hover,
.memberbar-link.is-active {
    color: var(--primary-color);
    background: var(--primary-soft);
}

@media (min-width: 1024px) {
    .memberbar {
        display: none;
    }

    .has-memberbar {
        padding-bottom: 0;
    }
}

@media print {
    .memberbar {
        display: none;
    }
}

/* ===== Homepage: members-area device previews ===== */
.device-stage {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 2.5rem;
}

.device-browser {
    flex: 1 1 26rem;
    width: 100%;
    max-width: 42rem;
    overflow: hidden;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--surface-color);
    box-shadow: var(--shadow-lg);
}

.device-browser-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.9rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--surface-alt);
}

.device-dots {
    display: flex;
    flex-shrink: 0;
    gap: 0.35rem;
}

.device-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: var(--border-color);
}

.device-dot-red {
    background: #e0796b;
}

.device-dot-amber {
    background: #e6bb63;
}

.device-dot-green {
    background: #7dc0a0;
}

.device-url {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    flex: 1;
    min-width: 0;
    padding: 0.3rem 0.85rem;
    overflow: hidden;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    background: var(--surface-color);
    color: var(--text-muted);
    font-size: 0.7rem;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.device-screen {
    padding: 1.35rem;
    background: var(--background-color);
}

.device-appbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.device-brandmark {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 0.95rem;
    letter-spacing: -0.03em;
    color: var(--primary-color);
}

.device-navdots {
    display: none;
    gap: 1rem;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
}

@media (min-width: 640px) {
    .device-navdots {
        display: flex;
    }
}

.device-greet {
    margin-top: 1.1rem;
    font-family: var(--font-heading);
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text-color);
}

.device-sub {
    margin-top: 0.15rem;
    font-size: 0.76rem;
    color: var(--text-muted);
}

.device-tile {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    padding: 0.85rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--surface-color);
    box-shadow: var(--shadow-xs);
}

.device-tile-label {
    font-size: 0.74rem;
    font-weight: 700;
    line-height: 1.3;
    color: var(--text-color);
}

.device-phone {
    position: relative;
    flex: 0 1 16rem;
    width: 100%;
    max-width: 17rem;
    padding: 9px;
    border-radius: 38px;
    background: #12173a;
    box-shadow: var(--shadow-lg);
}

.device-phone-notch {
    position: absolute;
    top: 9px;
    left: 50%;
    z-index: 3;
    width: 42%;
    height: 18px;
    transform: translateX(-50%);
    border-bottom-left-radius: 14px;
    border-bottom-right-radius: 14px;
    background: #12173a;
}

.device-phone-screen {
    display: flex;
    flex-direction: column;
    height: 32rem;
    overflow: hidden;
    border-radius: 30px;
    background: var(--background-color);
}

.device-phone-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.7rem 1.1rem 0.3rem;
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--text-color);
}

.device-phone-icons {
    display: inline-flex;
    gap: 0.35rem;
    font-size: 0.62rem;
}

.device-phone-body {
    flex: 1;
    min-height: 0;
    padding: 0.85rem 1rem;
    overflow: hidden;
}

.device-phone-greet {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text-color);
}

.device-phone-tiles {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.6rem;
    margin-top: 0.9rem;
}

.device-phone-tile {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.7rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--surface-color);
    box-shadow: var(--shadow-xs);
}

.device-phone-card {
    margin-top: 0.9rem;
    padding: 0.85rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--surface-color);
    box-shadow: var(--shadow-xs);
}

.device-phone-nav {
    display: flex;
    justify-content: space-around;
    padding: 0.7rem 0.75rem 1.1rem;
    border-top: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.95);
    color: var(--text-muted);
    font-size: 1rem;
}

.device-phone-nav .is-active {
    color: var(--primary-color);
}