* { box-sizing: border-box; }
html, body { background: var(--bg-base); }
body {
    margin: 0;
    font-family: 'Inter', system-ui, sans-serif;
    color: var(--text-main);
    font-size: 15px;
    line-height: 1.45;
    min-height: 100vh;
}
button { font-family: inherit; }
a { color: var(--primary-light); }
[hidden] { display: none !important; }

.pt-bar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: var(--bar-height);
    padding: calc(6px + env(safe-area-inset-top)) calc(8px + env(safe-area-inset-right)) 6px calc(var(--gutter) + env(safe-area-inset-left));
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
}
.pt-bar.has-back { padding-left: calc(4px + env(safe-area-inset-left)); }
.pt-titles { flex: 1; min-width: 0; }
.pt-title { font-weight: 600; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pt-subtitle { font-size: 13px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pt-subtitle:empty { display: none; }
.pt-actions { display: flex; align-items: center; gap: 2px; }
.pt-icon-btn {
    position: relative;
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--text-main);
    font-size: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.pt-icon-btn:hover { background: rgba(236, 253, 245, 0.08); }
.pt-badge {
    position: absolute;
    top: 3px;
    right: 1px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--primary-light);
    color: #0b1410;
    font-size: 11px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
}
.pt-badge:empty { display: none; }
.pt-shake { animation: pt-shake 0.4s ease; }
@keyframes pt-shake {
    0%, 100% { transform: rotate(0); }
    25% { transform: rotate(-14deg); }
    75% { transform: rotate(14deg); }
}

.pt-menu {
    position: fixed;
    top: calc(var(--bar-height) - 4px);
    right: 8px;
    z-index: 40;
    min-width: 200px;
    background: var(--bg-card-header);
    border: 1px solid var(--border);
    border-radius: var(--radius-control);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
    padding: 6px 0;
}
.pt-menu button {
    display: block;
    width: 100%;
    padding: 11px 16px;
    border: 0;
    background: transparent;
    color: var(--text-main);
    text-align: left;
    font-size: 15px;
    cursor: pointer;
}
.pt-menu button:hover { background: rgba(236, 253, 245, 0.06); }

.pt-search {
    position: sticky;
    top: var(--bar-height);
    z-index: 25;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px var(--gutter);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    color: var(--text-muted);
}
.pt-search input {
    flex: 1;
    min-width: 0;
    background: var(--bg-input);
    border: 1px solid var(--border-input);
    border-radius: var(--radius-control);
    color: var(--text-main);
    padding: 9px 12px;
    font-size: 15px;
    outline: none;
}

.pt-main {
    max-width: 760px;
    margin: 0 auto;
    padding: var(--gutter) var(--gutter) 120px;
}
.pt-banner-host:empty { display: none; }
.pt-banner {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 12px 12px 14px;
    margin-bottom: 14px;
    border-radius: var(--radius-control);
    border: 1px solid var(--danger);
    background: var(--danger-tint);
}
.pt-banner i.pt-banner-icon { color: var(--danger); margin-top: 3px; }
.pt-banner.is-warning { border-color: var(--warning); background: var(--warning-tint); }
.pt-banner.is-warning i.pt-banner-icon { color: var(--warning); }
.pt-banner.is-info { border-color: var(--info); background: var(--info-tint); }
.pt-banner.is-info i.pt-banner-icon { color: var(--info); }
.pt-banner.is-success { border-color: var(--primary-light); background: var(--primary-tint); }
.pt-banner.is-success i.pt-banner-icon { color: var(--primary-light); }
.pt-banner-body { flex: 1; min-width: 0; }
.pt-banner-text { color: var(--text-main); word-break: break-word; }
.pt-banner-action {
    margin-top: 6px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--primary-light);
    font-weight: 600;
    cursor: pointer;
}
.pt-banner-close { border: 0; background: none; color: var(--text-muted); cursor: pointer; padding: 2px 4px; }

.pt-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    padding: 16px;
    margin-bottom: 14px;
}
.pt-card-title { font-weight: 600; font-size: 13px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 10px; }
.pt-section-title { font-weight: 600; font-size: 13px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; margin: 18px 2px 10px; }

.pt-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 46px;
    padding: 10px 18px;
    border-radius: var(--radius-control);
    border: 1px solid transparent;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}
.pt-btn[disabled] { opacity: 0.6; cursor: default; }
.pt-btn-primary { background: var(--primary-fill); color: var(--on-primary); }
.pt-btn-primary:not([disabled]):hover { background: var(--primary-fill-pressed); }
.pt-btn-ghost { background: transparent; border-color: var(--border-input); color: var(--text-main); }
.pt-btn-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.pt-btn-danger-fill { background: var(--danger); color: #fff; }
.pt-btn-block { width: 100%; }
.pt-btn-row { display: flex; gap: 10px; }
.pt-btn-row > .pt-btn { flex: 1; }

.pt-field-label { display: block; font-size: 13px; color: var(--text-secondary); margin: 10px 0 6px; }
.pt-input, .pt-textarea {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-input);
    border-radius: var(--radius-control);
    color: var(--text-main);
    padding: 12px 14px;
    font-size: 15px;
    outline: none;
    color-scheme: dark;
}
.pt-input:focus, .pt-textarea:focus { border-color: var(--primary-light); }
.pt-textarea { min-height: 110px; resize: vertical; font-family: ui-monospace, monospace; font-size: 13px; word-break: break-all; }
.pt-field-error { color: var(--danger); font-size: 13px; margin-top: 6px; }
.pt-field-error:empty { display: none; }
.has-error .pt-input, .has-error .pt-textarea { border-color: var(--danger); }

.pt-empty {
    text-align: center;
    padding: 48px 16px;
    color: var(--text-muted);
}
.pt-empty i { font-size: 34px; margin-bottom: 14px; }
.pt-empty-text { color: var(--text-secondary); margin-bottom: 18px; }

.pt-progress {
    position: fixed;
    inset: var(--bar-height) 0 0 0;
    z-index: 20;
    background: var(--scrim);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 6px;
    padding: 24px;
}
.pt-spinner {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 3px solid var(--border-input);
    border-top-color: var(--primary-light);
    animation: pt-spin 0.8s linear infinite;
    margin-bottom: 10px;
}
@keyframes pt-spin { to { transform: rotate(360deg); } }
.pt-progress-title { font-weight: 600; }
.pt-progress-text { color: var(--text-secondary); font-size: 14px; }

.pt-dialog-scrim {
    position: fixed;
    inset: 0;
    z-index: 50;
    background: var(--scrim);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--gutter);
}
.pt-dialog {
    width: 100%;
    max-width: 360px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    padding: 18px;
}
.pt-dialog-title { font-weight: 600; font-size: 17px; margin-bottom: 4px; }
.pt-dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

.pt-login { max-width: 440px; margin: 24px auto 0; }
.pt-brand { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; margin-bottom: 22px; }
.pt-brand img { width: 72px; height: 72px; border-radius: 50%; background: #fff; padding: 8px; }
.pt-brand-name { font-size: 22px; font-weight: 700; }
.pt-brand-sub { color: var(--text-secondary); }
.pt-text p { color: var(--text-secondary); margin: 0 0 10px; }
.pt-text p:last-child { margin-bottom: 0; }

.pt-list-row {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 14px 16px;
    margin-bottom: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    color: var(--text-main);
    text-align: left;
    cursor: pointer;
}
.pt-list-row:hover { border-color: var(--border-input); }
.pt-list-main { flex: 1; min-width: 0; }
.pt-list-name { font-weight: 600; }
.pt-list-sub { color: var(--text-secondary); font-size: 13px; margin-top: 2px; }
.pt-list-end { text-align: right; flex-shrink: 0; }
.pt-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--primary-tint);
    color: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.pt-connect-confirm { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.pt-connect-confirm p { color: var(--text-secondary); font-size: 14px; margin: 0 0 12px; }
.pt-connect { display: block; cursor: default; }
.pt-connect > .pt-connect-head { display: flex; align-items: center; gap: 12px; cursor: pointer; }

.pt-banners { display: grid; gap: 12px; margin-bottom: 14px; }
.pt-banner-card {
    position: relative;
    display: block;
    width: 100%;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    overflow: hidden;
    background: var(--bg-card);
    cursor: pointer;
    text-align: left;
}
.pt-banner-card img { display: block; width: 100%; aspect-ratio: 16 / 7; object-fit: cover; background: var(--bg-input); }
.pt-banner-card span { display: block; padding: 10px 14px; font-weight: 600; color: var(--text-main); }
.pt-slider {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 12px;
    margin-bottom: 14px;
    border-radius: var(--radius-card);
    scrollbar-width: none;
}
.pt-slider::-webkit-scrollbar { display: none; }
.pt-slide {
    position: relative;
    flex: 0 0 100%;
    scroll-snap-align: start;
    border: 0;
    padding: 0;
    border-radius: var(--radius-card);
    overflow: hidden;
    background: var(--bg-card);
    cursor: pointer;
}
.pt-slide .pt-slide-img { aspect-ratio: 16 / 8; border-radius: 0; }
.pt-slide .pt-slide-img img { object-fit: contain; }
.pt-slide span {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 10px 14px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
    color: #fff;
    font-weight: 600;
    text-align: left;
}
.pt-dots { display: flex; justify-content: center; gap: 6px; margin: -6px 0 14px; }
.pt-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--border-input); }
.pt-dots i.on { background: var(--primary-light); }

.pt-action-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.pt-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 120px;
    padding: 16px;
    border-radius: var(--radius-card);
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-main);
    cursor: pointer;
    text-align: center;
}
.pt-action:hover { border-color: var(--primary); }
.pt-action i { font-size: 26px; color: var(--primary-light); }
.pt-action-name { font-weight: 700; font-size: 14px; letter-spacing: 0.04em; }
.pt-action-desc { font-size: 13px; color: var(--text-muted); }

.pt-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 640px) { .pt-grid { grid-template-columns: repeat(3, 1fr); } }
.pt-tile {
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    padding: 10px;
    color: var(--text-main);
    text-align: left;
    min-width: 0;
}
button.pt-tile { cursor: pointer; }
.pt-img {
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: var(--radius-control);
    background: var(--bg-input);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    color: var(--text-muted);
    font-size: 30px;
    flex-shrink: 0;
}
.pt-img img { width: 100%; height: 100%; object-fit: cover; }
.pt-img-sm { width: 64px; height: 64px; font-size: 22px; }
.pt-tile-name { font-weight: 600; margin-top: 10px; overflow-wrap: anywhere; }
.pt-tile-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.pt-price-row { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.pt-rate { font-weight: 700; }
.pt-mrp { color: var(--text-muted); text-decoration: line-through; font-size: 13px; }
.pt-disc { color: var(--primary-light); font-size: 12px; font-weight: 600; }
.pt-tile-foot { margin-top: auto; padding-top: 10px; }

.pt-stepper {
    display: flex;
    align-items: center;
    border: 1px solid var(--primary);
    border-radius: var(--radius-control);
    overflow: hidden;
    height: 40px;
}
.pt-stepper button {
    width: 40px;
    height: 100%;
    border: 0;
    background: var(--primary-tint);
    color: var(--primary-light);
    font-size: 14px;
    cursor: pointer;
    flex-shrink: 0;
}
.pt-stepper input {
    flex: 1;
    min-width: 0;
    width: 100%;
    height: 100%;
    border: 0;
    background: transparent;
    color: var(--text-main);
    text-align: center;
    font-weight: 600;
    font-size: 15px;
    outline: none;
}
.pt-add-btn { width: 100%; min-height: 40px; padding: 6px 12px; }

.pt-cart-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 15;
    padding: 10px var(--gutter) calc(10px + env(safe-area-inset-bottom));
    background: var(--bg-card);
    border-top: 1px solid var(--border);
}
.pt-cart-bar-inner { max-width: 760px; margin: 0 auto; display: flex; align-items: center; gap: 12px; }
.pt-cart-bar-text { flex: 1; min-width: 0; }
.pt-cart-bar-count { font-size: 13px; color: var(--text-secondary); }
.pt-cart-bar-total { font-weight: 700; font-size: 17px; }

.pt-line {
    display: flex;
    gap: 12px;
    padding: 12px;
    margin-bottom: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
}
.pt-line-main { flex: 1; min-width: 0; }
.pt-line-top { display: flex; gap: 8px; align-items: flex-start; }
.pt-line-name { flex: 1; min-width: 0; font-weight: 600; overflow-wrap: anywhere; }
.pt-line-total { font-weight: 700; white-space: nowrap; }
.pt-line-sub { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
.pt-line-tools { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.pt-line-tools .pt-stepper { width: 150px; }
.pt-remove { border: 0; background: none; color: var(--text-muted); font-size: 16px; padding: 8px; cursor: pointer; margin-left: auto; }

.pt-summary-row { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; color: var(--text-secondary); }
.pt-summary-row strong { color: var(--text-main); font-weight: 600; }
.pt-summary-row.is-total { border-top: 1px solid var(--border); margin-top: 6px; padding-top: 11px; color: var(--text-main); font-weight: 700; font-size: 17px; }
.pt-order-line { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.pt-order-line:last-child { border-bottom: 0; }
.pt-order-line > div:first-child { flex: 1; min-width: 0; }
.pt-order-line-name { overflow-wrap: anywhere; }
.pt-order-line-rate { font-size: 13px; color: var(--text-muted); }
.pt-order-line-total { font-weight: 600; white-space: nowrap; }

.pt-sticky-actions {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 15;
    padding: 10px var(--gutter) calc(10px + env(safe-area-inset-bottom));
    background: var(--bg-card);
    border-top: 1px solid var(--border);
}
.pt-sticky-actions > div { max-width: 760px; margin: 0 auto; }

.pt-pill {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid currentColor;
    white-space: nowrap;
}
.pt-pill.is-danger { color: var(--danger); background: var(--danger-tint); }
.pt-pill.is-success { color: var(--primary-light); background: var(--primary-tint); }
.pt-pill.is-warning { color: var(--warning); background: var(--warning-tint); }
.pt-pill.is-info { color: var(--info); background: var(--info-tint); }
.pt-pill.is-neutral { color: var(--text-secondary); background: transparent; }
.pt-pill:empty { display: none; }

.pt-range-btn { width: 100%; margin-bottom: 14px; justify-content: flex-start; }
.pt-record-amount { font-weight: 700; }
.pt-record-date { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

.pt-detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 8px; }
.pt-detail-number { font-size: 18px; font-weight: 700; overflow-wrap: anywhere; }
.pt-detail-party { color: var(--text-secondary); margin-bottom: 6px; }
.pt-kv { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; color: var(--text-secondary); }
.pt-kv strong { color: var(--text-main); font-weight: 600; text-align: right; }
.pt-item-line { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.pt-item-line:last-child { border-bottom: 0; }
.pt-item-line-main { flex: 1; min-width: 0; }
.pt-item-group { font-size: 12px; color: var(--text-muted); }
.pt-item-meta { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--text-secondary); margin-top: 3px; }
.pt-confirm-text { color: var(--text-secondary); margin-bottom: 10px; }

.pt-tabs {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 15;
    display: flex;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    padding-bottom: env(safe-area-inset-bottom);
}
.pt-tab {
    flex: 1;
    border: 0;
    background: transparent;
    color: var(--text-muted);
    padding: 10px 4px 12px;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}
.pt-tab i { font-size: 18px; }
.pt-tab.is-active { color: var(--primary-light); }
.pt-month { font-size: 13px; font-weight: 600; color: var(--text-muted); padding: 14px 2px 6px; }
.pt-tr-row { display: flex; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.pt-tr-row:last-child { border-bottom: 0; }
.pt-tr-type { font-weight: 600; }
.pt-tr-date { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.pt-tr-amt { font-weight: 700; white-space: nowrap; }
.pt-card-flush { padding: 0; overflow: hidden; }

.pt-result-card { padding: 0; overflow: hidden; border-color: var(--primary-light); }
.pt-result-card.is-failed { border-color: var(--danger); }
.pt-result-head { background: var(--primary-tint); text-align: center; padding: 22px 16px; }
.pt-result-card.is-failed .pt-result-head { background: var(--danger-tint); }
.pt-result-head i { font-size: 40px; color: var(--primary-light); }
.pt-result-card.is-failed .pt-result-head i { color: var(--danger); }
.pt-result-title { font-size: 20px; font-weight: 700; margin-top: 10px; }
.pt-result-number { color: var(--text-secondary); margin-top: 4px; font-weight: 600; }
.pt-result-message { color: var(--text-secondary); margin-top: 6px; white-space: pre-line; word-break: break-word; }
.pt-result-meta { padding: 12px 16px; color: var(--text-muted); font-size: 13px; border-bottom: 1px solid var(--border); text-align: center; }

.pt-dr { color: var(--warning) !important; }
.pt-cr { color: var(--primary-light) !important; }
.pt-muted { color: var(--text-muted); }
.pt-small { font-size: 13px; }
.pt-copy { user-select: all; overflow-wrap: anywhere; }
.pt-mt { margin-top: 14px; }
.pt-center { text-align: center; }
