* {
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    background: #000;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif;
    color: #e5e5e5;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 720px;
    margin: 0 auto;
    padding: 3rem 1.5rem 4rem;
}

h1 {
    font-size: 1.8rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.5px;
    margin: 0 0 0.3rem;
    text-align: center;
}

.subtitle {
    color: #999;
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

.tagline {
    color: #95bf47;
    font-family: 'Brush Script MT', 'Segoe Script', 'Dancing Script', cursive;
    font-size: 1.4rem;
    font-weight: 400;
    letter-spacing: 0.5px;
    margin-bottom: 0.75rem;
    text-align: center;
}

/* ─── Help Panel ───────────────────────────────────── */

.help-panel {
    margin-top: 2rem;
    border-top: 1px solid #1a1a1a;
    padding-top: 0.5rem;
}

.help-panel summary {
    padding: 0.75rem 0;
    font-size: 0.8rem;
    font-weight: 500;
    color: #555;
    cursor: pointer;
    user-select: none;
    list-style: none;
    transition: color 0.15s;
}

.help-panel summary:hover {
    color: #aaa;
}

.help-panel summary::before {
    content: '? ';
    color: #444;
}

.help-panel[open] summary {
    color: #aaa;
}

.help-panel summary::-webkit-details-marker {
    display: none;
}

.help-body {
    padding: 0 0 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.help-item {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.help-item strong {
    font-size: 0.75rem;
    font-weight: 600;
    color: #999;
}

.help-item span {
    font-size: 0.75rem;
    color: #666;
    line-height: 1.5;
}

/* ─── Connection Cards ──────────────────────────── */

.connection-card {
    background: #0d0d0d;
    border: 1px solid #222;
    border-radius: 10px;
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.connection-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #1a1a1a;
}

.connection-title {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #777;
}

.connection-status {
    font-size: 0.7rem;
    color: #666;
    font-weight: 500;
}

.connection-status.connected {
    color: #4ade80;
}

.connection-status.failed {
    color: #f87171;
}

.connected-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.connected-shop {
    font-size: 0.9rem;
    color: #ccc;
}

.btn-disconnect {
    font-size: 0.75rem;
    color: #888;
    background: transparent;
    border: 1px solid #333;
    border-radius: 6px;
    padding: 0.3rem 0.75rem;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
}

.btn-disconnect:hover {
    color: #f87171;
    border-color: #f87171;
}

.btn-connect {
    width: 100%;
    background: transparent;
    color: #ccc;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 0.7rem 1rem;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    margin-top: 0.75rem;
    transition: all 0.15s;
}

.btn-connect:hover {
    border-color: #666;
    color: #fff;
}

.cred-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.cred-fields {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.cred-fields label {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #777;
    display: block;
    margin-bottom: 0.35rem;
}

.cred-fields input {
    width: 100%;
    background: #111;
    border: 1px solid #222;
    border-radius: 8px;
    color: #e5e5e5;
    padding: 0.65rem 0.85rem;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.15s;
}

.cred-fields input:focus {
    border-color: #444;
}

.cred-fields input::placeholder {
    color: #555;
}

.btn-detect {
    background: transparent;
    border: 1px solid #333;
    border-radius: 4px;
    color: #888;
    font-size: 0.55rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0.15rem 0.45rem;
    cursor: pointer;
    margin-left: 0.4rem;
    vertical-align: middle;
    transition: all 0.15s;
}

.btn-detect:hover {
    color: #fff;
    border-color: #555;
}

.optional-label {
    font-weight: 400;
    color: #555;
    text-transform: none;
    letter-spacing: 0;
    font-size: 0.6rem;
}

.field-hint {
    font-size: 0.7rem;
    color: #555;
    margin: 0.25rem 0 0;
}

/* ─── Sync Options ──────────────────────────────── */

.sync-options {
    display: flex;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
    padding: 0.75rem 1rem;
    background: #0d0d0d;
    border: 1px solid #222;
    border-radius: 10px;
}

.sync-option label {
    font-size: 0.8rem;
    color: #aaa;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: color 0.15s;
}

.sync-option label:hover {
    color: #fff;
}

.sync-option input[type="checkbox"] {
    accent-color: #fff;
    width: 14px;
    height: 14px;
}

/* ─── Sync Button ───────────────────────────────── */

.btn-sync {
    width: 100%;
    background: #fff;
    color: #000;
    border: none;
    border-radius: 10px;
    padding: 0.85rem 1.5rem;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-sync:hover:not(:disabled) {
    background: #e0e0e0;
    transform: translateY(-1px);
}

.btn-sync:disabled {
    background: #333;
    color: #666;
    cursor: not-allowed;
}

.btn-again {
    margin-bottom: 1rem;
}

.payment-note {
    font-size: 0.7rem;
    color: #555;
    text-align: center;
    margin-top: 0.5rem;
}

/* ─── Progress Panel ────────────────────────────── */

.progress-panel {
    display: none;
}

.progress-panel.show {
    display: block;
}

.progress-hero {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1rem 0 1.5rem;
}

.progress-ring-wrap {
    position: relative;
    width: 120px;
    height: 120px;
    flex-shrink: 0;
}

.progress-ring {
    width: 120px;
    height: 120px;
    transform: rotate(-90deg);
}

.progress-ring-bg {
    fill: none;
    stroke: #1a1a1a;
    stroke-width: 6;
}

.progress-ring-fill {
    fill: none;
    stroke: #fff;
    stroke-width: 6;
    stroke-linecap: round;
    stroke-dasharray: 326.73;
    stroke-dashoffset: 326.73;
}

.progress-ring-spinner {
    fill: none;
    stroke: #333;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-dasharray: 40 286.73;
    stroke-dashoffset: 0;
    opacity: 0;
    transition: opacity 0.3s;
}

.progress-ring.working .progress-ring-spinner {
    opacity: 1;
    animation: spinTrack 2s linear infinite;
}

.progress-ring.working .progress-ring-fill {
    animation: ringPulse 2s ease-in-out infinite;
}

.progress-ring.working .progress-ring-bg {
    animation: bgPulse 2s ease-in-out infinite;
}

@keyframes spinTrack {
    0% { stroke-dashoffset: 0; }
    100% { stroke-dashoffset: -326.73; }
}

@keyframes ringPulse {
    0%, 100% { stroke-opacity: 1; stroke-width: 6; }
    50% { stroke-opacity: 0.6; stroke-width: 8; }
}

@keyframes bgPulse {
    0%, 100% { stroke: #1a1a1a; }
    50% { stroke: #2a2a2a; }
}

.progress-ring-label {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    font-variant-numeric: tabular-nums;
}

.progress-ring.working + .progress-ring-label {
    animation: labelPulse 2s ease-in-out infinite;
}

@keyframes labelPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.progress-info {
    flex: 1;
    min-width: 0;
}

.progress-current {
    font-size: 1.1rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 0.3rem;
}

.progress-current.working::after {
    content: '';
    animation: dots 1.4s steps(4, end) infinite;
}

@keyframes dots {
    0% { content: ''; }
    25% { content: '.'; }
    50% { content: '..'; }
    75% { content: '...'; }
}

.progress-current.complete {
    color: #4ade80;
}

.progress-current.has-errors {
    color: #f87171;
}

.progress-counter {
    font-size: 0.8rem;
    color: #888;
    font-variant-numeric: tabular-nums;
}

/* ─── Progress Log ──────────────────────────────── */

.progress-log {
    border-top: 1px solid #1a1a1a;
}

.log-entry {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.45rem 0;
    border-bottom: 1px solid #111;
    font-size: 0.8rem;
    color: #bbb;
    animation: fadeIn 0.2s ease;
}

.log-entry.error {
    color: #888;
}

.log-check {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    border-radius: 50%;
    background: #fff;
    position: relative;
}

.log-check::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 1px;
    width: 4px;
    height: 7px;
    border: solid #000;
    border-width: 0 1.5px 1.5px 0;
    transform: rotate(45deg);
}

.log-x {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    border-radius: 50%;
    background: #c44;
    display: flex;
    align-items: center;
    justify-content: center;
}

.log-x::after {
    content: '\00d7';
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
}

.log-detail {
    margin-left: auto;
    color: #888;
    font-size: 0.75rem;
    font-variant-numeric: tabular-nums;
}

.log-detail.err {
    color: #c66;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ─── Auth ─────────────────────────────────────── */

.auth-container {
    max-width: 400px;
    padding-top: 6rem;
}

.auth-card {
    padding: 1.5rem;
}

.auth-card .cred-fields {
    margin-bottom: 0.5rem;
}

.auth-btn {
    margin-top: 0.75rem;
}

.auth-error {
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid #f8717133;
    color: #f87171;
    font-size: 0.8rem;
    padding: 0.6rem 0.85rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.permission-warnings {
    background: rgba(251, 191, 36, 0.1);
    border: 1px solid #fbbf2433;
    color: #fbbf24;
    font-size: 0.78rem;
    padding: 0.6rem 0.85rem;
    border-radius: 8px;
    margin-top: 0.75rem;
    line-height: 1.5;
}

.permission-warnings div + div {
    margin-top: 0.35rem;
}

.auth-success {
    background: rgba(74, 222, 128, 0.1);
    border: 1px solid #4ade8033;
    color: #4ade80;
    font-size: 0.8rem;
    padding: 0.6rem 0.85rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.auth-switch {
    text-align: center;
    font-size: 0.8rem;
    color: #666;
    margin-top: 1rem;
}

.auth-switch a {
    color: #ccc;
    text-decoration: none;
}

.auth-switch a:hover {
    color: #fff;
}

.top-bar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #1a1a1a;
    position: relative;
}

.hamburger {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background: #888;
    border-radius: 1px;
    transition: background 0.15s;
}

.hamburger:hover span {
    background: #fff;
}

.nav-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: #111;
    border: 1px solid #222;
    border-radius: 10px;
    padding: 0.5rem 0;
    min-width: 200px;
    z-index: 100;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.nav-menu.open {
    display: block;
}

.nav-menu a,
.nav-menu span {
    display: block;
    padding: 0.6rem 1.25rem;
    font-size: 0.9rem;
    color: #999;
    text-decoration: none;
    transition: all 0.1s;
}

.nav-menu a:hover {
    color: #fff;
    background: #1a1a1a;
}

.nav-menu .nav-divider {
    border-top: 1px solid #222;
    margin: 0.35rem 0;
}

.nav-menu .nav-email {
    font-size: 0.8rem;
    color: #555;
    padding: 0.5rem 1.25rem;
}

.nav-menu .nav-logout:hover {
    color: #f87171;
}

.user-email {
    font-size: 0.95rem;
    color: #666;
}

.btn-logout {
    font-size: 0.95rem;
    color: #666;
    text-decoration: none;
    padding: 0.3rem 0;
    transition: color 0.15s;
}

.btn-logout:hover {
    color: #f87171;
}

.btn-topbar {
    font-size: 0.95rem;
    color: #999;
    text-decoration: none;
    padding: 0.3rem 0;
    transition: color 0.15s;
}

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

/* ─── History ──────────────────────────────────── */

.history-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.history-item {
    padding: 0.85rem 0;
    border-bottom: 1px solid #1a1a1a;
}

.history-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.3rem;
}

.history-date {
    font-size: 0.8rem;
    color: #999;
    font-variant-numeric: tabular-nums;
}

.history-status {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
}

.status-ok {
    color: #4ade80;
    background: rgba(74, 222, 128, 0.1);
}

.status-warn {
    color: #fbbf24;
    background: rgba(251, 191, 36, 0.1);
}

.status-running {
    color: #60a5fa;
    background: rgba(96, 165, 250, 0.1);
}

.status-fail {
    color: #f87171;
    background: rgba(248, 113, 113, 0.1);
}

.history-details {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.history-records {
    font-size: 0.75rem;
    color: #777;
}

.history-errors {
    font-size: 0.7rem;
    color: #c66;
    max-width: 400px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-empty {
    text-align: center;
    padding: 3rem 0;
}

.history-empty p {
    color: #666;
    font-size: 0.85rem;
}

.history-back {
    margin-top: 1.5rem;
}

/* ─── Privacy Policy ───────────────────────────── */

.policy-container {
    max-width: 720px;
}

.policy-back {
    font-size: 0.8rem;
    color: #666;
    text-decoration: none;
    transition: color 0.15s;
}

.policy-back:hover {
    color: #ccc;
}

.policy-content {
    margin-top: 1.5rem;
}

.policy-content section {
    margin-bottom: 2rem;
}

.policy-content section {
    background: #0d0d0d;
    border: 1px solid #1a1a1a;
    border-radius: 10px;
    padding: 1.25rem 1.5rem;
}

.policy-content h2 {
    font-size: 1rem;
    font-weight: 600;
    color: #e5e5e5;
    margin: 0 0 0.75rem;
}

.policy-content p {
    font-size: 0.85rem;
    color: #999;
    line-height: 1.7;
    margin: 0 0 0.6rem;
}

.policy-content ul {
    margin: 0 0 0.6rem;
    padding-left: 1.5rem;
}

.policy-content li {
    font-size: 0.85rem;
    color: #999;
    line-height: 1.7;
    margin-bottom: 0.4rem;
}

.policy-content strong {
    color: #ccc;
}

.policy-content a {
    color: #aaa;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.policy-content a:hover {
    color: #fff;
}

.policy-content code {
    font-size: 0.75rem;
    background: #1a1a1a;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    color: #ccc;
}

/* ─── How It Works ────────────────────────────────── */

.steps {
    margin-top: 1.5rem;
}

.step {
    display: flex;
    gap: 1rem;
    padding: 1.25rem 0;
    border-bottom: 1px solid #1a1a1a;
}

.step:last-child {
    border-bottom: none;
}

.step-number {
    flex-shrink: 0;
    width: 2.2rem;
    height: 2.2rem;
    border-radius: 50%;
    background: #1a1a1a;
    color: #fff;
    font-size: 0.95rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}

.step-content h3 {
    color: #fff;
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0 0 0.3rem;
}

.step-content p {
    color: #888;
    font-size: 0.85rem;
    line-height: 1.5;
    margin: 0;
}

.how-cta {
    text-align: center;
    margin-top: 2rem;
}

.footer-link {
    display: block;
    text-align: center;
    font-size: 0.9rem;
    color: #555;
    text-decoration: none;
    margin-top: 2rem;
    transition: color 0.15s;
}

.footer-link:hover {
    color: #888;
}

/* ─── Pricing ──────────────────────────────────── */

.pricing-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    margin-top: 1.5rem;
}

.pricing-card {
    background: #0d0d0d;
    border: 1px solid #222;
    border-radius: 12px;
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
}

.pricing-card-highlight {
    border-color: #444;
}

.pricing-tier {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #777;
    margin-bottom: 1rem;
}

.pricing-price {
    font-size: 2.5rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 1.5rem;
}

.pricing-period {
    font-size: 1rem;
    font-weight: 400;
    color: #666;
}

.pricing-features {
    list-style: none;
    padding: 0;
    margin: 0 0 1.5rem;
    flex: 1;
}

.pricing-features li {
    font-size: 0.85rem;
    color: #999;
    line-height: 1.6;
    padding: 0.3rem 0;
    padding-left: 1.25rem;
    position: relative;
}

.pricing-features li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.55rem;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #444;
}

.pricing-card-highlight .pricing-features li::before {
    background: #4ade80;
}

.pricing-btn {
    text-align: center;
    text-decoration: none;
    margin-top: auto;
}

.pricing-email {
    text-align: center;
    margin-top: auto;
    margin-bottom: 0.75rem;
    font-size: 0.8rem;
}

.pricing-email a {
    color: #888;
    text-decoration: none;
    transition: color 0.15s;
}

.pricing-email a:hover {
    color: #fff;
}

/* ─── Responsive ────────────────────────────────── */

@media (max-width: 600px) {
    .cred-row {
        grid-template-columns: 1fr;
    }

    .sync-options {
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    .progress-hero {
        flex-direction: column;
        text-align: center;
    }

    .pricing-grid {
        grid-template-columns: 1fr;
    }
}
