:root {
    --bg: #fdf7f9;
    --card: rgba(255, 255, 255, .88);
    --card-soft: rgba(255, 245, 248, .62);
    --border: rgba(248, 180, 200, .35);
    --border-soft: rgba(248, 180, 200, .2);
    --text: #2d2430;
    --muted: #8a7a85;
    --primary: #e8a0b4;
    --primary-dark: #d4859a;
    --primary-soft: rgba(248, 180, 200, .12);
    --green: #7ec8a0;
    --red: #e8a0a0;
    --amber: #e8c8a0;
    --shadow: 0 8px 30px rgba(60, 40, 50, .04), inset 0 1px 0 rgba(255, 255, 255, .4);
    --font: "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html { min-height: 100%; background: #fefcfd; }

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    font-family: var(--font);
    background:
        radial-gradient(circle at 8% 2%, rgba(248, 180, 200, .14), transparent 27rem),
        radial-gradient(circle at 92% 4%, rgba(253, 216, 228, .5), transparent 25rem),
        linear-gradient(180deg, #fefcfd, #fdf5f7);
}

a { color: inherit; }
button, input { font: inherit; }

.glass-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 24px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    color: var(--primary-dark);
    font-size: 1.25rem;
    font-weight: 760;
    letter-spacing: -.02em;
    text-decoration: none;
}

.brand-mark {
    display: grid;
    width: 2rem;
    height: 2rem;
    place-items: center;
    border-radius: 50%;
    color: white;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    box-shadow: 0 8px 18px rgba(212, 133, 154, .24);
}

.eyebrow {
    color: var(--primary-dark);
    font-size: .69rem;
    font-weight: 760;
    letter-spacing: .16em;
}

.notice {
    margin: 0 0 1.25rem;
    padding: .9rem 1rem;
    border: 1px solid transparent;
    border-radius: 12px;
    font-size: .9rem;
    line-height: 1.55;
}

.notice.success { color: #4f8d6c; background: rgba(126, 200, 160, .1); border-color: rgba(126, 200, 160, .25); }
.notice.error { color: #b46d73; background: rgba(232, 160, 160, .1); border-color: rgba(232, 160, 160, .24); }
.notice.info { color: var(--primary-dark); background: var(--primary-soft); border-color: var(--border-soft); }

.auth-body {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 1.5rem;
    overflow-x: hidden;
}

.auth-shell { position: relative; z-index: 1; width: min(100%, 31rem); }

.auth-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    padding: 1rem 1.25rem;
}

.auth-nav-links { display: flex; gap: .35rem; }

.soft-link, .tab-link {
    border: 0;
    border-radius: 9px;
    color: var(--muted);
    background: transparent;
    cursor: pointer;
    font-size: .9rem;
    font-weight: 600;
    text-decoration: none;
    transition: .2s ease;
}

.soft-link { padding: .55rem .8rem; }
.soft-link:hover, .soft-link.active { color: var(--primary-dark); background: var(--primary-soft); }

.auth-card { padding: 2.25rem; }
.auth-heading { margin-bottom: 1.7rem; text-align: center; }
.auth-heading h1 { margin: .45rem 0 .55rem; font-size: 1.8rem; letter-spacing: -.035em; }
.auth-heading p { margin: 0; color: var(--muted); font-size: .92rem; }
.auth-footnote { margin: 1rem 0 0; color: #a9939f; font-size: .78rem; text-align: center; }
.filing-link { color: inherit; text-decoration: none; }
.filing-link:hover { color: var(--rose-strong); text-decoration: underline; }

.stack-form { display: grid; gap: 1rem; }
.stack-form label { display: grid; gap: .45rem; }
.stack-form label > span { color: #62545f; font-size: .84rem; font-weight: 650; }

.stack-form input, .copy-row input {
    width: 100%;
    min-width: 0;
    border: 1px solid rgba(248, 180, 200, .3);
    border-radius: 12px;
    outline: none;
    color: var(--text);
    background: rgba(255, 255, 255, .68);
    transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}

.stack-form input { padding: .88rem 1rem; }
.stack-form input:focus, .copy-row input:focus { border-color: var(--primary-dark); box-shadow: 0 0 0 3px rgba(248, 180, 200, .12); background: white; }
.stack-form input::placeholder { color: #b8a0aa; }

.primary-button, .secondary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 3rem;
    padding: .82rem 1.25rem;
    border: 0;
    border-radius: 14px;
    cursor: pointer;
    font-weight: 680;
    text-align: center;
    text-decoration: none;
    transition: transform .2s ease, box-shadow .2s ease, opacity .2s ease;
}

.primary-button { color: white; background: linear-gradient(135deg, var(--primary), var(--primary-dark)); box-shadow: 0 10px 24px rgba(212, 133, 154, .2); }
.secondary-button { color: var(--primary-dark); background: var(--primary-soft); border: 1px solid var(--border-soft); }
.primary-button:hover, .secondary-button:hover { transform: translateY(-2px); }
.primary-button:disabled, .secondary-button:disabled { cursor: not-allowed; opacity: .5; transform: none; box-shadow: none; }
.stack-form .primary-button { width: 100%; margin-top: .25rem; }

.petals { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.petals i { position: absolute; bottom: -3rem; width: .8rem; height: .8rem; border-radius: 70% 0 70% 0; background: #f7c3d2; opacity: 0; animation: petal 13s linear infinite; }
.petals i:nth-child(1) { left: 8%; animation-delay: 0s; }
.petals i:nth-child(2) { left: 24%; animation-delay: 3s; transform: scale(.7); }
.petals i:nth-child(3) { left: 43%; animation-delay: 6s; }
.petals i:nth-child(4) { left: 61%; animation-delay: 2s; transform: scale(.8); }
.petals i:nth-child(5) { left: 78%; animation-delay: 8s; }
.petals i:nth-child(6) { left: 91%; animation-delay: 5s; transform: scale(.65); }
@keyframes petal { 10% { opacity: .7; } 90% { opacity: .45; } 100% { bottom: 110vh; transform: translateX(5rem) rotate(320deg); opacity: 0; } }

.dashboard-body { padding: 2rem 1rem 3rem; }
.dashboard-shell { width: min(100%, 64rem); margin: 0 auto; }

.pill-nav {
    position: sticky;
    z-index: 20;
    top: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    min-height: 4.25rem;
    margin-bottom: 2rem;
    padding: .8rem 1rem .8rem 1.2rem;
    border-radius: 50px;
}

.tab-list { display: flex; align-items: center; gap: .3rem; }
.tab-link { display: inline-flex; align-items: center; gap: .35rem; padding: .52rem .72rem; white-space: nowrap; }
.tab-link:hover, .tab-link.active { color: var(--primary-dark); background: var(--primary-soft); }
.nav-form { margin: 0; }
.danger-link:hover { color: #ba6e78; background: rgba(232, 160, 160, .1); }

.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 1.5rem; margin-bottom: 1.55rem; padding: 0 .2rem; }
.page-heading h1 { margin: .25rem 0 .3rem; font-size: clamp(1.8rem, 3vw, 2.45rem); letter-spacing: -.045em; }
.page-heading p { margin: 0; color: var(--muted); }
.health-badge, .quiet-chip { display: inline-flex; align-items: center; gap: .4rem; padding: .46rem .7rem; border-radius: 999px; color: #5c9274; background: rgba(126, 200, 160, .11); font-size: .78rem; font-weight: 650; }
.health-badge i { width: .5rem; height: .5rem; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 .25rem rgba(126, 200, 160, .13); }
.quiet-chip { color: var(--primary-dark); background: var(--primary-soft); }

.onboarding-card, .detail-card, .form-card, .stats-explain, .one-time-secret { padding: 1.5rem; }
.onboarding-card { margin-bottom: 2rem; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.section-heading h2, .detail-card h2, .form-card h2, .stats-explain h2, .one-time-secret h2 { margin: .2rem 0 .25rem; font-size: 1.2rem; letter-spacing: -.025em; }
.progress-text { color: var(--muted); font-size: .8rem; }

.steps { display: grid; gap: .5rem; margin-top: 1.1rem; }
.step { display: grid; grid-template-columns: 2rem 1fr auto; align-items: center; gap: .85rem; padding: .75rem; border-radius: 14px; background: var(--card-soft); border: 1px solid rgba(248, 200, 215, .3); }
.step b { display: grid; width: 2rem; height: 2rem; place-items: center; border-radius: 50%; color: var(--primary-dark); background: var(--primary-soft); }
.step.done b { color: white; background: var(--green); }
.step div { display: grid; gap: .15rem; }
.step strong { font-size: .88rem; }
.step span { color: var(--muted); font-size: .78rem; }
.step a { color: var(--primary-dark); font-size: .78rem; font-weight: 680; text-decoration: none; }

.metric-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; margin-bottom: 2rem; }
.metric-card { position: relative; min-height: 10.6rem; padding: 1.4rem; transition: transform .25s ease, box-shadow .25s ease; }
.metric-card:hover, .detail-card:hover { transform: translateY(-4px); box-shadow: 0 18px 38px rgba(80, 50, 65, .07); }
.metric-card p { margin: 1rem 0 .35rem; color: var(--muted); font-size: .82rem; }
.metric-card h2 { margin: 0 0 .75rem; font-size: 1.55rem; }
.metric-card small { display: flex; align-items: center; gap: .45rem; color: #a08c98; }
.metric-icon { display: grid; width: 2.45rem; height: 2.45rem; place-items: center; border-radius: 12px; font-size: 1.1rem; }
.metric-icon.rose { color: var(--primary-dark); background: var(--primary-soft); }
.metric-icon.coral { color: #c87f87; background: rgba(232, 160, 160, .11); }
.metric-icon.amber { color: #b68754; background: rgba(232, 200, 160, .14); }
.status-dot { display: inline-block; width: .58rem; height: .58rem; border-radius: 50%; }
.status-dot.green { background: var(--green); box-shadow: 0 0 7px rgba(126, 200, 160, .45); }
.status-dot.red { background: var(--red); box-shadow: 0 0 7px rgba(232, 160, 160, .4); }
.status-dot.amber { background: var(--amber); box-shadow: 0 0 7px rgba(232, 200, 160, .45); }

.two-column { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; margin-bottom: 2rem; }
.detail-card { transition: transform .25s ease, box-shadow .25s ease; }
.info-list { display: grid; gap: .75rem; margin: 1.15rem 0 0; }
.info-list div, .config-list > div { padding: .78rem; border: 1px solid rgba(248, 200, 215, .32); border-radius: 10px; background: var(--card-soft); }
.info-list dt, .config-list > div > span { margin-bottom: .3rem; color: var(--muted); font-size: .76rem; font-weight: 650; }
.info-list dd { display: flex; align-items: baseline; justify-content: space-between; gap: .75rem; margin: 0; font-size: .9rem; word-break: break-word; }
.info-list dd small { color: #b09aa6; white-space: nowrap; }
.config-list { display: grid; gap: .75rem; margin-top: 1.15rem; }
.config-list > div > strong { display: block; font-size: .9rem; }
.copy-row { display: flex; gap: .55rem; }
.copy-row input { padding: .72rem .85rem; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .82rem; }
.copy-row.compact input { padding: .58rem .68rem; background: rgba(255,255,255,.72); }
.copy-button { flex: 0 0 auto; border: 1px solid var(--border-soft); border-radius: 8px; color: var(--primary-dark); background: var(--primary-soft); cursor: pointer; font-size: .78rem; font-weight: 680; padding: .45rem .72rem; }
.copy-button:disabled { cursor: not-allowed; opacity: .45; }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.mini-stat { padding: 1rem; text-align: center; }
.mini-stat span { display: block; margin-bottom: .3rem; color: var(--muted); font-size: .75rem; }
.mini-stat strong { font-size: 1.3rem; }
.large-stats .mini-stat { padding: 1.6rem 1rem; }

.action-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.action-grid form, .action-grid button { width: 100%; }
.form-card > p, .stats-explain p, .one-time-secret p { color: var(--muted); line-height: 1.7; }
.narrow-card { width: min(100%, 42rem); margin: 0 auto; }
.device-status { display: flex; align-items: center; gap: .8rem; margin-top: 1.3rem; padding: .9rem 1rem; border-radius: 12px; background: rgba(126, 200, 160, .09); }
.device-status div { display: grid; gap: .2rem; }
.device-status span { color: var(--muted); font-size: .78rem; }
.account-grid { align-items: start; }
.one-time-secret { display: grid; grid-template-columns: 1fr minmax(18rem, .9fr); align-items: center; gap: 1.25rem; margin-bottom: 1.5rem; border-color: rgba(126, 200, 160, .3); }
.one-time-secret .copy-row { align-items: stretch; }
.stats-explain { margin-top: .25rem; }
.delivery-progress { width: 100%; height: .7rem; margin-top: 1rem; accent-color: var(--primary-dark); }
.stats-explain small { color: var(--muted); }

footer { margin-top: 2.5rem; color: #ad98a3; font-size: .75rem; text-align: center; }

.preview-banner {
    position: fixed;
    z-index: 1000;
    right: 1rem;
    bottom: 1rem;
    max-width: min(28rem, calc(100vw - 2rem));
    padding: .72rem 1rem;
    border: 1px solid rgba(212, 133, 154, .3);
    border-radius: 12px;
    color: #765964;
    background: rgba(255, 250, 252, .95);
    box-shadow: 0 12px 30px rgba(70, 40, 55, .12);
    font-size: .8rem;
    line-height: 1.5;
    backdrop-filter: blur(16px);
}

.preview-banner.action-notice { color: #4f8d6c; border-color: rgba(126, 200, 160, .35); }

@media (max-width: 900px) {
    .pill-nav { position: static; align-items: flex-start; border-radius: 24px; }
    .tab-list { flex-wrap: wrap; justify-content: flex-end; }
    .metric-grid { grid-template-columns: 1fr 1fr; }
    .metric-card:last-child { grid-column: 1 / -1; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .one-time-secret { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
    .dashboard-body { padding: .75rem .75rem 2rem; }
    .auth-body { padding: .75rem; }
    .auth-card { padding: 1.5rem; }
    .pill-nav { gap: .8rem; padding: 1rem; }
    .pill-nav, .page-heading { align-items: stretch; flex-direction: column; }
    .tab-list { display: grid; grid-template-columns: 1fr 1fr; }
    .tab-link { justify-content: center; }
    .nav-form .tab-link { width: 100%; }
    .health-badge { align-self: flex-start; }
    .metric-grid, .two-column, .action-grid { grid-template-columns: 1fr; }
    .metric-card:last-child { grid-column: auto; }
    .stats-grid { gap: .7rem; }
    .step { grid-template-columns: 2rem 1fr; }
    .step a { grid-column: 2; }
    .copy-row { flex-direction: column; }
    .copy-button { min-height: 2.5rem; }
    .info-list dd { align-items: flex-start; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
