:root {
    --notion-bg: #f7f9fc;
    --notion-card: #ffffff;
    --notion-text: #1f232b;
    --notion-muted: #7a7d85;
    --notion-border: #e5e7eb;
    --accent-blue: #3b82f6;
    --accent-red: #dc2626;
    --sidebar-bg: #e9effa;
    --sidebar-text: #1f2937;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    font-family: "Inter", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--notion-bg);
    color: var(--notion-text);
    margin: 0;
    min-height: 100vh;
}

a {
    color: inherit;
    text-decoration: none;
}

a:hover {
    color: var(--accent-blue);
}

#main-book {
    max-width: 1100px;
    margin: 0 auto;
    padding: 48px 24px 96px;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 48px;
}

.page-header .title {
    display: flex;
    align-items: center;
    gap: 16px;
}

.page-header .emoji {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    background: var(--notion-card);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    box-shadow: 0 8px 25px rgba(15, 23, 42, 0.07);
}

.page-header h1 {
    font-size: clamp(2rem, 4vw, 2.7rem);
    margin: 4px 0 0;
    font-weight: 600;
}

.page-header p {
    margin: 0;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.3em;
    color: var(--notion-muted);
}

.page-header .actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.pill-btn {
    border: 1px solid var(--notion-border);
    border-radius: 999px;
    padding: 8px 16px;
    font-size: 0.85rem;
    background: rgba(255, 255, 255, 0.7);
    transition: all 0.2s;
    color: var(--notion-text);
}

.pill-btn:hover {
    border-color: #b5b1ab;
    box-shadow: 0 8px 16px rgba(15, 23, 42, 0.08);
    background: #fff;
}

.pill-btn.primary {
    border-color: rgba(37, 99, 235, 0.4);
    color: var(--accent-blue);
}

.notion-block {
    background: var(--notion-card);
    border: 1px solid var(--notion-border);
    border-radius: 18px;
    padding: 28px 32px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.05);
    margin-bottom: 32px;
}

.block-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 20px;
}

.block-meta {
    font-size: 0.85rem;
    color: var(--notion-muted);
}

.capsule-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 16px;
}

.capsule-card {
    border-radius: 16px;
    border: 1px solid rgba(0, 0, 0, 0.04);
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s, transform 0.2s;
    background: #fff;
    min-height: 220px;
    height: 100%;
}

.capsule-card:hover {
    background: #fcfbf8;
    box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.15);
    transform: translateY(-1px);
}

.capsule-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.capsule-time {
    font-size: 1.35rem;
    font-weight: 600;
    line-height: 1.2;
}

.capsule-date {
    font-size: 0.75rem;
    color: var(--notion-muted);
    letter-spacing: 0.2em;
    text-transform: uppercase;
}

.capsule-symbols {
    font-size: 1rem;
    font-weight: 600;
}

.capsule-footer {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.capsule-agents {
    display: flex;
    align-items: center;
    gap: 8px;
}

.capsule-agent-count {
    font-size: 0.75rem;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: var(--notion-muted);
}

.capsule-status {
    font-size: 0.85rem;
    font-weight: 600;
}

.capsule-status.success {
    color: #059669;
}

.capsule-status.danger {
    color: #b91c1c;
}

.card-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.05rem;
    font-weight: 600;
}

.card-meta {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--notion-muted);
    margin-top: 4px;
}

.card-text {
    font-size: 0.92rem;
    margin-top: 10px;
    color: #4b5563;
    line-height: 1.6;
}

.capsule-expand {
    margin-top: 12px;
    border-radius: 14px;
    border: 1px dashed var(--notion-border);
    padding: 12px 16px;
    background: #fbfaf7;
}

.capsule-expand summary {
    cursor: pointer;
    font-size: 0.85rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--notion-muted);
}

.capsule-expand[open] {
    background: #fff;
    border-style: solid;
}

.step-list {
    margin-top: 12px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 16px;
}

.step-card {
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 12px;
    padding: 12px;
    background: #fdfcf9;
    overflow-wrap: anywhere;
    display: flex;
    flex-direction: column;
    gap: 8px;
    height: 100%;
}

.step-images {
    margin: 8px 0 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.step-image-card {
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 10px;
    background: #fff;
    padding: 8px;
    width: 180px;
    box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.03);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.step-image-thumb {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    background: #f1f5f9;
}

.step-image-desc {
    font-size: 0.8rem;
    color: var(--notion-muted);
}

.step-image-link {
    font-size: 0.75rem;
    color: #2563eb;
    text-decoration: underline;
    align-self: flex-start;
}

.image-modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    z-index: 1000;
}

.image-modal-content {
    background: #fffefc;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.4);
    max-width: 90vw;
    max-height: 90vh;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.image-modal-content img {
    max-width: 80vw;
    max-height: 70vh;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    object-fit: contain;
    background: #000;
}

.image-modal-desc {
    font-size: 0.9rem;
    color: var(--notion-muted);
}

.image-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}

.step-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.step-head-left {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.step-head-right {
    font-size: 0.75rem;
    color: var(--notion-muted);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.step-head span {
    overflow-wrap: anywhere;
}

.stage-pill {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 2px 10px;
    font-size: 0.72rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    border: 1px solid transparent;
}

.stage-pill-provider {
    background: #dbeafe;
    border-color: #93c5fd;
    color: #1e3a8a;
}

.stage-pill-final {
    background: #ecfccb;
    border-color: #bef264;
    color: #3b5b0a;
}

.stage-pill-agent {
    background: #f3e8ff;
    border-color: #d8b4fe;
    color: #6b21a8;
}

.stage-pill-other {
    background: #f3f4f6;
    border-color: #d1d5db;
    color: #374151;
}

.stage-detail {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--notion-muted);
}

.step-provider {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: #0f172a;
}

.step-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.25em;
    color: var(--notion-muted);
    margin-top: 8px;
}

.step-text {
    margin: 4px 0 0;
    padding: 8px;
    border-radius: 8px;
    background: #1118270d;
    font-size: 0.82rem;
    color: #1f2937;
    white-space: pre-wrap;
}

.step-error {
    margin-top: 8px;
    font-size: 0.8rem;
    color: var(--accent-red);
}

.csv-block {
    margin-top: 8px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    box-shadow: inset 0 0 0 1px #f8fafc;
}

.csv-toggle {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: transparent;
    border: none;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    cursor: pointer;
    color: #0f172a;
}

.csv-toggle span:last-child {
    font-size: 0.7rem;
    color: var(--notion-muted);
}

.csv-table-wrapper {
    max-height: 320px;
    overflow: auto;
    border-top: 1px solid #e5e7eb;
}

.csv-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
}

.csv-table th,
.csv-table td {
    padding: 6px 8px;
    border: 1px solid #e5e7eb;
    white-space: nowrap;
}

.csv-table th {
    background: #f8fafc;
    font-weight: 600;
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #0f172a;
}

.agent-dots {
    display: flex;
    gap: 4px;
    align-items: center;
}

.agent-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 1px solid #fff;
    background: #c5c7d2;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.15);
}

.agent-dot.alert {
    background: #f87171;
}

.badge {
    border-radius: 999px;
    padding: 4px 12px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.badge-green {
    background: #ecfdf5;
    color: #047857;
    border-color: rgba(16, 185, 129, 0.4);
}

.badge-red {
    background: #fef2f2;
    color: #b91c1c;
    border-color: rgba(252, 165, 165, 0.5);
}

.badge-neutral {
    background: #f4f4f0;
    color: #4b5563;
}

.filter-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.25em;
}

.filter-tags a {
    color: var(--notion-muted);
}

.filter-tags a.active {
    color: var(--notion-text);
    text-decoration: underline;
    text-decoration-color: var(--accent-blue);
    text-underline-offset: 6px;
}

.prompt-toggle {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0 4px;
}

.mobile-step-toggle {
    margin-top: 12px;
}

.mobile-step-toggle .pill-btn {
    width: 100%;
}

.pos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

.pos-card {
    border-radius: 16px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    background: #fcfbf8;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    cursor: pointer;
    transition: box-shadow 0.2s;
}

.pos-card:hover {
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
}

.pos-symbol {
    font-size: 1.1rem;
    font-weight: 600;
}

.pos-meta {
    font-size: 0.78rem;
    color: var(--notion-muted);
    letter-spacing: 0.2em;
    text-transform: uppercase;
}

.pos-pnl {
    font-size: 1.4rem;
    font-weight: 600;
}

.pos-pnl.positive {
    color: #059669;
}

.pos-pnl.negative {
    color: #dc2626;
}

.pos-sub {
    font-size: 0.85rem;
    color: var(--notion-muted);
}

.pos-card-main {
    flex: 1;
}

.pos-card-stats {
    text-align: right;
    min-width: 180px;
}

.pos-main-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.pos-status {
    font-size: 0.65rem;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    border: 1px solid var(--notion-border);
    border-radius: 999px;
    padding: 2px 8px;
    color: var(--notion-muted);
}
.pos-status.status-open {
    border-color: #10b981;
    color: #065f46;
    background: rgba(16, 185, 129, 0.12);
}
.pos-status.status-pending {
    border-color: #fbbf24;
    color: #92400e;
    background: rgba(251, 191, 36, 0.18);
}
.pos-status.status-partial {
    border-color: #6366f1;
    color: #312e81;
    background: rgba(99, 102, 241, 0.15);
}
.pos-status.status-closed {
    border-color: #94a3b8;
    color: #0f172a;
    background: rgba(148, 163, 184, 0.2);
}

.pos-line {
    font-size: 0.82rem;
    color: #4b5563;
    margin-top: 4px;
}

.notion-section-title {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.35em;
    color: var(--notion-muted);
}

.detail-panel {
    background: var(--notion-card);
    border: 1px solid var(--notion-border);
    border-radius: 18px;
    padding: 32px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.detail-card {
    border: 1px solid rgba(0, 0, 0, 0.04);
    border-radius: 14px;
    padding: 16px;
    background: #fbfaf7;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.summary-card {
    border-radius: 16px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    background: #fcfbf8;
    padding: 18px;
}

.summary-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.3em;
    color: var(--notion-muted);
}

.summary-value {
    font-size: 1.4rem;
    font-weight: 600;
    margin-top: 6px;
}

.summary-sub {
    margin-top: 4px;
    font-size: 0.85rem;
    color: #6b7280;
}

.meta-tags {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.meta-row {
    font-size: 0.9rem;
    color: #4b5563;
    display: flex;
    gap: 8px;
}

.detail-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.25em;
    color: var(--notion-muted);
}

.detail-value {
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: 6px;
}

.position-hero {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.hero-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
}

.hero-trade {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.3em;
    color: var(--notion-muted);
}

.hero-symbol {
    margin: 4px 0;
    font-size: 2rem;
}

.hero-pnl {
    text-align: right;
}

.hero-pnl-value {
    font-size: 2rem;
    font-weight: 600;
}

.hero-pnl-sub {
    font-size: 0.9rem;
    color: #4b5563;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
}

.stat-card {
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 12px;
    padding: 14px;
    background: #fbfaf7;
}

.stat-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.25em;
    color: var(--notion-muted);
}

.stat-value {
    margin-top: 6px;
    font-size: 1.2rem;
    font-weight: 600;
}

.stop-card {
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 14px;
    padding: 18px;
    background: #fffdf9;
}

.stop-header {
    display: flex;
    justify-content: space-between;
    font-weight: 600;
    margin-bottom: 10px;
}

.stop-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}

.stop-block {
    font-size: 0.95rem;
    color: #374151;
}

.stop-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.25em;
    color: var(--notion-muted);
    margin-bottom: 6px;
}

.stop-value {
    line-height: 1.5;
}

.timeline {
    margin-top: 20px;
    position: relative;
    padding-left: 18px;
}

.timeline::before {
    content: "";
    position: absolute;
    left: 6px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #e5e7eb;
}

.timeline-item {
    position: relative;
    padding: 12px 0 12px 16px;
}

.timeline-item::before {
    content: "";
    position: absolute;
    left: -1px;
    top: 18px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid #fff;
    background: var(--accent-blue);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.timeline-item.error::before {
    background: var(--accent-red);
    box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.2);
}

.timeline-item h4 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
}

.timeline-meta {
    font-size: 0.76rem;
    color: var(--notion-muted);
    text-transform: uppercase;
    letter-spacing: 0.2em;
    margin-top: 4px;
}

.timeline-body {
    font-size: 0.9rem;
    color: #4b5563;
    margin-top: 8px;
    line-height: 1.6;
}

.timeline.rich .timeline-item {
    padding: 20px 0 20px 16px;
}

.timeline-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
}

.timeline-stage {
    font-size: 0.75rem;
    letter-spacing: 0.25em;
}

.stage-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-weight: 600;
    text-transform: uppercase;
}

.stage-final {
    background: #dbeafe;
    color: #1d4ed8;
}

.stage-provider {
    background: #fce7f3;
    color: #be185d;
}

.stage-agent {
    background: #ecfccb;
    color: #3f6212;
}

.stage-other {
    background: #e5e7eb;
    color: #374151;
}

.timeline-provider {
    font-size: 0.85rem;
    color: var(--notion-muted);
}

.decision-snippet {
    margin-bottom: 10px;
}

.timeline-error {
    margin-top: 6px;
    font-size: 0.82rem;
    color: var(--accent-red);
}

.io-grid {
    margin-top: 14px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.io-block {
    margin-top: 10px;
}

.io-label {
    font-size: 0.75rem;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: var(--notion-muted);
}

.io-text {
    margin-top: 4px;
    background: #f6f6f3;
    padding: 8px;
    border-radius: 8px;
    font-size: 0.82rem;
    white-space: pre-wrap;
}

.muted {
    color: var(--notion-muted);
    font-size: 0.85rem;
}

/* Vue SPA layout */
.app-frame {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: var(--notion-bg);
}

.top-nav {
    position: sticky;
    top: 0;
    z-index: 40;
    background: var(--sidebar-bg);
    border-bottom: 1px solid var(--notion-border);
    padding: 20px 32px;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.08);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.nav-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
}

.nav-meta {
    font-size: 0.78rem;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: #4b5563;
}

.nav-toggle {
    display: none;
}

.top-nav-links {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.top-nav-links .nav-item {
    flex: 0 0 auto;
}

.top-nav-links .nav-footer {
    flex-basis: 100%;
    text-align: right;
    margin-top: 4px;
}

.nav-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(2px);
    z-index: 30;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-logo .emoji {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.nav-logo h2 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--sidebar-text);
}

.nav-label {
    margin: 0;
    font-size: 0.75rem;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: #4b5563;
}

.nav-item {
    border: 1px solid rgba(31, 41, 55, 0.08);
    background: rgba(255, 255, 255, 0.75);
    color: var(--sidebar-text);
    padding: 10px 14px;
    border-radius: 12px;
    text-align: left;
    font-weight: 600;
    transition: all 0.2s;
}

.nav-item:hover {
    border-color: rgba(31, 41, 55, 0.18);
    transform: translateY(-1px);
}

.nav-item.active {
    background: #e0e7ff;
    color: #1f2937;
    border-color: #c7d2fe;
    box-shadow: 0 8px 18px rgba(59, 130, 246, 0.18);
}

.nav-footer {
    margin-top: 12px;
    font-size: 0.78rem;
    color: #6b7280;
    line-height: 1.4;
}

.main-panel {
    flex: 1 1 auto;
    padding: 36px 32px 80px;
    overflow-y: auto;
    width: 100%;
}

.stack {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.muted {
    color: var(--notion-muted);
    font-size: 0.9rem;
}

.callout {
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--notion-border);
    background: #fff7ed;
    color: #9a3412;
    margin-bottom: 12px;
}

.callout.error {
    background: #fef2f2;
    color: #b91c1c;
    border-color: #fecdd3;
}

.block-skeleton {
    padding: 16px;
    border: 1px dashed var(--notion-border);
    border-radius: 12px;
    background: repeating-linear-gradient(
        -45deg,
        #f3f4f6,
        #f3f4f6 10px,
        #e5e7eb 10px,
        #e5e7eb 20px
    );
    color: #6b7280;
    font-size: 0.9rem;
}

.filter-tags .tag {
    border: 1px solid var(--notion-border);
    border-radius: 999px;
    padding: 8px 14px;
    background: #fff;
    transition: all 0.2s;
}

.filter-tags .tag.active {
    border-color: var(--accent-blue);
    color: var(--accent-blue);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.12);
}

.provider-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
}

.provider-card {
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 16px;
    padding: 16px 18px;
    background: #fbfbfe;
    box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.06);
}

.provider-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.provider-name {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.provider-time {
    margin: 4px 0 0;
    font-size: 0.75rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.provider-symbols {
    margin-top: 8px;
    font-size: 0.75rem;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--notion-muted);
}

.provider-summary {
    margin-top: 14px;
    font-size: 0.9rem;
    line-height: 1.6;
    color: #374151;
    white-space: pre-line;
}

.input {
    border: 1px solid var(--notion-border);
    border-radius: 10px;
    padding: 10px 12px;
    background: #fff;
    min-width: 220px;
}

.pager {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
}

.detail-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    margin-bottom: 12px;
}

.detail-card {
    background: #fff;
    border: 1px solid var(--notion-border);
    border-radius: 14px;
    padding: 16px;
}

.tier-board {
    margin-top: 12px;
    border: 1px solid var(--notion-border);
    border-radius: 12px;
    overflow: hidden;
}

.tier-row {
    display: grid;
    grid-template-columns: 120px 1fr 1fr 80px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--notion-border);
    background: #fff;
}

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

.tier-status.done {
    color: #059669;
}

.log-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.log-row {
    display: grid;
    grid-template-columns: 160px 120px 1fr 1fr;
    gap: 8px;
    padding: 10px 12px;
    background: #fff;
    border: 1px solid var(--notion-border);
    border-radius: 10px;
}

.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: #111827;
    color: #fff;
    padding: 12px 16px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.18);
    z-index: 50;
}

.toast.error {
    background: #b91c1c;
}

.log-view {
    font-family: "JetBrains Mono", "Fira Code", monospace;
    background: #0b1021;
    color: #e5e7eb;
    border-radius: 12px;
    padding: 12px;
    max-height: 480px;
    overflow: auto;
    border: 1px solid #11182733;
}

.log-line {
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 0.88rem;
    line-height: 1.4;
}

@media (max-width: 1080px) {
    .main-panel {
        padding: 28px 20px 64px;
    }
    .page-header,
    .block-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    .page-header .actions,
    .block-header .actions {
        width: 100%;
        flex-wrap: wrap;
    }
}

@media (max-width: 768px) {
    body {
        font-size: 0.95rem;
    }
    .top-nav {
        padding: 16px 20px;
    }
    .nav-toggle {
        display: inline-flex;
    }
    .top-nav-links {
        display: none;
        flex-direction: column;
        width: 100%;
        border: 1px solid rgba(31, 41, 55, 0.12);
        border-radius: 16px;
        padding: 12px;
        background: rgba(255, 255, 255, 0.75);
    }
    .top-nav-links.open {
        display: flex;
    }
    .top-nav-links .nav-item {
        width: 100%;
    }
    .top-nav-links .nav-footer {
        text-align: left;
    }
    .main-panel {
        padding: 20px 16px 60px;
    }
    .stack {
        gap: 16px;
    }
    .notion-block,
    .capsule-card,
    .provider-card,
    .pos-card,
    .detail-card {
        padding: 16px;
    }
    .capsule-symbols {
        font-size: 0.9rem;
    }
    .muted {
        font-size: 0.78rem;
    }
    .card-text {
        font-size: 0.86rem;
        line-height: 1.45;
    }
    .page-header .actions,
    .block-header .actions {
        flex-direction: column;
    }
    .page-header .pill-btn,
    .block-header .pill-btn {
        width: 100%;
        justify-content: center;
    }
    .capsule-footer {
        flex-direction: column;
        align-items: flex-start;
    }
    .pos-grid,
    .provider-grid,
    .detail-grid {
        grid-template-columns: 1fr;
    }
    .pos-card {
        flex-direction: column;
    }
    .pos-card .text-right {
        text-align: left;
    }
    .tier-row {
        grid-template-columns: 1fr 1fr;
        row-gap: 6px;
    }
    .log-row {
        grid-template-columns: 1fr;
    }
    .input {
        min-width: 0;
        width: 100%;
    }
    .form-grid {
        display: flex !important;
        flex-direction: column;
        gap: 12px !important;
    }
    .form-grid > * {
        width: 100%;
    }
    .filter-tags {
        gap: 8px;
        letter-spacing: 0.2em;
    }
    .pill-btn {
        width: 100%;
    }
}

@media (max-width: 768px) and (min-width: 520px) {
    .capsule-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-auto-flow: row;
    }
    .capsule-card {
        min-width: auto;
    }
    .provider-grid,
    .pos-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 520px) {
    .capsule-list {
        grid-template-columns: none;
        grid-auto-flow: column;
        grid-auto-columns: minmax(240px, 80vw);
        overflow-x: auto;
        padding-bottom: 8px;
        scroll-snap-type: x proximity;
        -webkit-overflow-scrolling: touch;
    }
    .capsule-card {
        min-width: 0;
        scroll-snap-align: start;
    }
}
