/* 公共组件外观；参数由 theme-tokens.css 提供，页面文件保留布局与交互样式。 */
html {
    background: var(--bg-page);
}

body {
    min-width: 0;
    position: relative;
    overflow-x: hidden;
    background: var(--bg-page);
    letter-spacing: -0.005em;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    color: inherit;
}

.app {
    background: var(--bg-page);
}

/* ---------- Navigation and product identity ---------- */

.nav-bar {
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 50;
    min-height: var(--nav-height);
    padding: var(--nav-padding);
    margin-bottom: var(--nav-content-gap);
    border-bottom: none;
}

/* Shared header/backdrop material lives in glass-surfaces.css. */
.ui-dialog--confirm {
    box-shadow: 0 12px 32px rgba(var(--text-primary-rgb), .1);
}
.ui-dialog--confirm .dc-dialog-header { background: transparent; }

.nav-back {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: var(--nav-back-size);
    height: var(--nav-back-size);
    border: none;
    border-radius: var(--nav-back-radius);
    cursor: pointer;
    transition: background 0.15s;
    background: var(--bg-card);
    box-shadow: var(--shadow-card);
    color: var(--text-primary);
    font-size: 0;
}

.nav-back::before {
    content: "";
    display: block;
    flex: none;
    width: calc(var(--nav-back-icon-size) * .4);
    height: calc(var(--nav-back-icon-size) * .4);
    border-left: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: translateX(2px) rotate(45deg);
}

.nav-back:active {
    background: rgba(var(--bg-card-rgb), 0.82);
    box-shadow: 0 2px 8px rgba(var(--shadow-card-ink-rgb), 0.06);
    transform: scale(0.96);
}

.nav-title {
    min-width: 0;
    margin-left: var(--nav-title-gap);
    margin-right: var(--nav-title-gap);
    font-family: var(--nav-title-font-family);
    font-size: var(--nav-title-font-size);
    font-weight: var(--nav-title-font-weight);
    line-height: var(--nav-title-line-height);
    letter-spacing: var(--nav-title-letter-spacing);
    color: var(--text-primary);
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    /* Center the visible glyphs, not just the font's asymmetric line box. */
    transform: translateY(var(--nav-title-optical-offset));
}

@media (pointer: coarse) {
    .nav-back { min-width: 44px; min-height: 44px; }
}

.home-masthead {
    min-height: 58px;
    padding: 17px 18px 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}



.home-product {
    display: flex;
    align-items: center;
    grid-gap:7px;gap: 7px;
    min-height: 12px;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: var(--font-size-9);
    font-weight: var(--font-weight-700);
    line-height: 12px;
    letter-spacing: 0.12em;
}

.home-product i {
    display: block;
    flex: 0 0 6px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent-red);
    box-shadow: 0 0 0 4px rgba(var(--accent-red-rgb), 0.09);
}

.home-product.connected i {
    background: var(--accent-green);
    box-shadow: 0 0 0 4px rgba(var(--accent-green-rgb), 0.09);
}

.home-product.connecting {
    color: var(--text-warning);
}

.home-product.connecting i {
    background: var(--accent-amber);
    box-shadow: 0 0 0 3px rgba(var(--accent-warning-rgb), 0.14);
    animation: connection-breathe 1.6s ease-in-out infinite;
}

@keyframes connection-breathe {
    0%, 100% {
        opacity: 0.55;
        transform: scale(0.78);
        box-shadow: 0 0 0 2px rgba(var(--accent-warning-rgb), 0.1);
    }
    50% {
        opacity: 1;
        transform: scale(1.28);
        box-shadow: 0 0 0 5px rgba(var(--accent-warning-rgb), 0.18);
    }
}

@media (prefers-reduced-motion: reduce) {
    .home-product.connecting i {
        animation: none;
    }
}

.home-product span {
    display: block;
    line-height: 12px;
}
/* ---------- Shared surface language ---------- */
.user-card {
    border: none;
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    box-shadow: var(--shadow-card);
}
.quick-task-card {
    border: none;
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    box-shadow: var(--shadow-card);
}
.agent-entry-card {
    border: none;
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    box-shadow: var(--shadow-card);
}
.app-download-entry {
    border: none;
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    box-shadow: var(--shadow-card);
}

.user-card,
.quick-task-card,
.agent-entry-card,
.settings-user,
.app-download-entry {
    transition: transform 0.16s ease, border-color 0.16s ease,
                background 0.16s ease, box-shadow 0.16s ease;
}
.quick-task-card:active {
    transform: scale(0.992);
    border-color: var(--border-strong);
    box-shadow: var(--shadow-press);
}
.agent-entry-card:active {
    transform: scale(0.992);
    border-color: var(--border-strong);
    box-shadow: var(--shadow-press);
}
.settings-user:active {
    transform: scale(0.992);
}
.app-download-entry:active {
    transform: scale(0.992);
    border-color: var(--border-strong);
    box-shadow: var(--shadow-press);
}

.user-card {
    margin-top: 4px;
    padding: 14px;
}

.user-status {
    font-family: var(--font-mono);
    font-size: var(--meta-font-size);
    letter-spacing: 0.02em;
}

.user-status.connected { color: var(--text-positive); }
.user-status.connecting { color: var(--text-warning); }
.user-status.disconnected { color: var(--text-negative); }
.user-status.paused { color: var(--text-secondary); }

.user-avatar {
    background: linear-gradient(145deg, var(--avatar-gradient-start), var(--avatar-gradient-end));
    box-shadow: 0 5px 14px rgba(var(--accent-blue-rgb), 0.16);
}

.quick-task-card,
.agent-entry-card {
    padding: 13px 14px;
}

.quick-task-label,
.agent-entry-label {
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: var(--font-size-9);
    font-weight: var(--font-weight-700);
    letter-spacing: 0.11em;
}

.quick-task-value,
.agent-entry-value {
    font-size: var(--font-size-14);
    font-weight: var(--list-title-font-weight);
    line-height: var(--list-title-line-height);
}

.quick-task-btn {
    min-width: 58px;
    padding: 8px 14px;
    border-radius: var(--radius-md);
    background: var(--accent-blue);
    box-shadow: 0 4px 12px rgba(var(--accent-blue-rgb), 0.16);
}

.agent-entry-arrow {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border-radius: var(--radius-9);
    background: var(--bg-input);
    font-size: var(--font-size-16);
}

/* Shared heading typography; page styles only control placement and spacing.
   section-label/settings-hint remain layout-compatible entry points. */
.section-title,
.section-label,
.settings-hint,
.detail-title {
    font-family: var(--section-title-font-family);
    font-size: var(--section-title-font-size);
    font-weight: var(--section-title-font-weight);
    line-height: var(--section-title-line-height);
    letter-spacing: var(--section-title-letter-spacing);
    text-transform: uppercase;
    color: var(--text-primary);
}

.section-title,
.detail-title {
    margin: 0;
}

.section-title--accent,
.detail-title {
    color: var(--text-brand);
}

.detail-title {
    font-size: var(--detail-title-font-size);
    letter-spacing: var(--detail-title-letter-spacing);
}

.section-sub,
.section-count,
.section-label .refresh-indicator,
.settings-hint > span {
    text-transform: none;
}

.section-label {
    padding: 0 calc(var(--page-gutter) + var(--section-title-inset)) var(--section-title-gap);
    margin-top: var(--section-gap);
}

/* 所有子页面统一留出“导航栏 → 首个内容标题”的垂直节奏。 */
.nav-bar + .section-label {
    padding-top: 0;
    margin-top: 0;
}

#page-search .search-page-header + .section-label {
    padding-top: 0;
    margin-top: 0;
}

.nav-bar + .settings-user {
    margin-top: 0;
}

.section-sub {
    font-size: var(--meta-font-size);
    font-weight: var(--font-weight-500);
}

.list-row {
    padding: var(--list-row-padding);
    border-bottom-color: var(--border);
}

.row-title {
    font-size: var(--list-title-font-size);
    font-weight: var(--list-title-font-weight);
    line-height: var(--list-title-line-height);
}

.row-meta {
    margin-top: var(--space-xs);
    color: var(--text-secondary);
    font-size: var(--list-description-font-size);
    line-height: var(--list-description-line-height);
    font-family: var(--site-font);
}
.empty-state {
    padding: var(--space-3xl) var(--surface-padding);
    color: var(--text-secondary);
}

/* ---------- Inputs and actions ---------- */

.form-card {
    padding: 15px;
}

/* ---------- Settings ---------- */

.settings-hint {
    padding: 0 calc(var(--page-gutter) + var(--section-title-inset)) var(--section-title-gap);
}

.nav-bar + .settings-hint,
.page-content > .settings-hint:first-child {
    padding-top: 0;
    margin-top: 0;
    padding-bottom: var(--section-title-gap);
}

.settings-user {
    padding: 15px;
}

.settings-card {
    margin-bottom: var(--section-gap);
}

.settings-row {
    min-height: var(--list-row-min-height);
    padding: var(--settings-row-padding);
}

.settings-row-title {
    font-size: var(--list-title-font-size);
    font-weight: var(--list-title-font-weight);
    line-height: var(--list-title-line-height);
}

.settings-row-sub {
    font-size: var(--list-description-font-size);
    line-height: var(--list-description-line-height);
}

.status-card {
    padding: 15px 8px;
}

.status-item-label {
    font-family: var(--font-mono);
    font-size: var(--font-size-9);
}

.app-download-entry {
    min-height: 72px;
    background: var(--bg-card);
}

.app-download-logo {
    border-radius: var(--radius-12);
    box-shadow: 0 5px 14px rgba(var(--accent-blue-rgb), 0.16);
}

.app-download-action {
    color: var(--text-brand);
}

.app-download-action b {
    background: rgba(var(--accent-blue-rgb), 0.08);
}

/* ---------- Search ---------- */

.search-trigger,
.search-input-wrap {
    border: none;
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    box-shadow: var(--shadow-card);
}

.search-page-header {
    border-bottom: none;
    margin-bottom: var(--nav-content-gap);
}

.search-input-wrap:focus-within {
    border-color: rgba(var(--accent-blue-rgb), 0.38);
    box-shadow: var(--focus-ring);
}

/* ---------- Cohort board: same surface as every other list ---------- */

.cohort-search-bar {
    padding-top: 12px;
    background: rgba(var(--bg-budget-rgb), 0.72);
    backdrop-filter: blur(16px) saturate(135%);
    -webkit-backdrop-filter: blur(16px) saturate(135%);
}
.cohort-filter-panel {
    padding: 3px;
}

.cohort-search-box,
.cohort-time-box {
    border-radius: var(--radius-10);
}

.cohort-search-box:focus-within,
.cohort-time-box:focus-within {
    background: rgba(var(--accent-blue-rgb), 0.045);
    box-shadow: inset 0 0 0 1px rgba(var(--accent-blue-rgb), 0.16);
}

.cohort-field-icon {
    background: transparent;
}

.cohort-time-label {
    background: rgba(var(--accent-blue-rgb), 0.08);
    color: var(--text-brand);
}

.cohort-capsule {
    border-color: var(--border);
    background: var(--bg-card);
    box-shadow: none;
}

.cohort-grp-bar {
    border-radius: var(--radius-lg);
}

.cohort-grp.open > .cohort-grp-bar {
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.cohort-detail {
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.cohort-fn-track {
    background: var(--bg-input);
}

.cohort-fn-track i {
    background: rgba(var(--accent-blue-rgb), 0.82);
}

/* ---------- Agent and timeline ---------- */

#page-agent .nav-bar {
    border-bottom: none;
}

/* Agent chat surfaces are shared with AI Studio in chat-surface.css. */

@media (prefers-reduced-motion: reduce) {
    .user-card,
    .quick-task-card,
    .agent-entry-card,
    .settings-user,
    .app-download-entry {
        transition: none;
    }
}

.settings-hint--spaced { margin-top: var(--section-gap); }
