body { margin: 0; background: #f1ecf3; font-family: Arial, sans-serif; color: #1a1a25; }
.app { max-width: 560px; margin: 0 auto; min-height: 100vh; padding: 8px 10px 78px; box-sizing: border-box; }
.title { text-align: center; font-family: Georgia, serif; font-size: 36px; margin: 4px 0; line-height: 1; }
.top-date { font-size: 14px; font-weight: 700; margin: 0 0 8px 6px; }
.date-strip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; }
.date-pill {
    min-width: 72px; text-align: center; color: #fff; border-radius: 10px; padding: 7px 5px;
    background: linear-gradient(180deg, #2c94e7, #7d3ac6); box-shadow: 0 3px 10px rgba(0,0,0,0.2);
}
.date-pill.active { outline: 2px solid #f16a6a; }
.date-pill .d1 { font-size: 15px; font-weight: 700; line-height: 1.1; }
.date-pill .d2 { font-size: 12px; }
.mode-bar {
    margin-top: 6px;
    border-radius: 999px;
    padding: 0;
    background: linear-gradient(90deg, #1f8be1, #23ca74);
    display: grid;
    grid-template-columns: 1fr 1fr;
    position: relative;
    border: 1px solid #7cbde8;
    overflow: hidden;
}
.mode-bar a {
    text-decoration: none;
    color: #e8f6ff;
    font-weight: 700;
    font-size: 13px;
    text-align: center;
    padding: 9px 6px;
    border-radius: 999px;
    background: transparent;
    transition: all .15s ease;
    position: relative;
    z-index: 2;
}
.mode-bar a.active {
    color: #fff;
    text-shadow: 0 1px 3px rgba(0,0,0,0.35);
}
.mode-bar .mode-knob {
    position: absolute;
    top: 4px;
    width: calc(50% - 8px);
    height: calc(100% - 8px);
    border-radius: 999px;
    background: #ffef6a;
    box-shadow: 0 2px 6px rgba(0,0,0,0.22);
    z-index: 1;
    transition: left .2s ease;
}
.mode-bar.customer .mode-knob { left: 4px; }
.mode-bar.market .mode-knob { left: calc(50% + 4px); }
.mode-bar.customer a:first-of-type,
.mode-bar.market a:last-of-type {
    color: #0f5689;
    text-shadow: none;
}
.market-card {
    border-radius: 30px;
    padding: 12px 16px;
    margin-top: 10px;
    background: linear-gradient(90deg, #f7f7de 0%, #ffe733 72%, #ffea5f 100%);
    box-shadow: 0 5px 12px rgba(0,0,0,0.14);
}
.market-card .row { display: flex; justify-content: space-between; align-items: center; }
.market-card .name { font-size: 30px; font-weight: 800; margin: 0 0 4px; line-height: 1; color: #141725; letter-spacing: .4px; }
.market-card .meta { font-size: 21px; margin: 2px 0; font-weight: 600; line-height: 1.2; color: #1b2334; }
.market-card .arrow { font-size: 36px; color: #333; }
.title-row { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; }
.copy-btn {
    border: 0; background: transparent; width: 26px; height: 26px; border-radius: 0;
    display: inline-flex; align-items: center; justify-content: center; margin: 0; padding: 0; color: #333; cursor: pointer;
}
.copy-btn i { font-size: 20px; }
.win-card .row { align-items: flex-start; }
.win-card .title-row { gap: 6px; }
.win-card .name,
.win-card .cname {
    font-size: 38px;
    font-weight: 800;
    margin: 0;
    line-height: 1.05;
    letter-spacing: 0.2px;
}
.win-card .copy-btn {
    width: 24px;
    height: 24px;
    margin-top: 2px;
}
.win-card .copy-btn i {
    font-size: 18px;
}
.win-card .arrow {
    font-size: 44px;
    line-height: 1;
    margin-top: 10px;
    color: #2d2d2d;
}
.win-stats {
    display: flex;
    gap: 30px;
    margin-top: 6px;
    font-size: 37px;
    font-weight: 600;
    color: #1f2734;
    line-height: 1.1;
}
.win-stats span { white-space: nowrap; }
.customer-head {
    border-radius: 999px; background: #1375c4; color: #d4ecff; font-weight: 700;
    text-align: center; padding: 10px; margin-top: 10px;
}
.customer-card {
    border-radius: 30px;
    padding: 12px 16px;
    margin-top: 10px;
    background: linear-gradient(90deg, #f7f7de 0%, #ffe733 72%, #ffea5f 100%);
    box-shadow: 0 5px 12px rgba(0,0,0,0.14);
}
.customer-card .cname { font-size: 30px; font-weight: 800; margin: 0 0 4px; line-height: 1; color: #141725; letter-spacing: .4px; }
.customer-card .meta { font-size: 21px; line-height: 1.2; font-weight: 600; color: #1b2334; }
.customer-card .actions { float: right; margin-top: -4px; }
.customer-card .actions span { margin-left: 10px; font-size: 22px; }
.login-box {
    max-width: 420px; margin: 70px auto; background: #fff; border-radius: 16px;
    padding: 20px; box-shadow: 0 8px 24px rgba(0,0,0,0.18);
}
input, button { width: 100%; box-sizing: border-box; border-radius: 8px; border: 1px solid #ccc; padding: 9px; margin-bottom: 9px; font-size: 14px; }
button { background: #2d83e5; color: #fff; border: 0; font-weight: 700; cursor: pointer; }
.alert { border-radius: 8px; padding: 10px; margin-bottom: 10px; }
.alert.error { background: #ffe5e5; color: #a31616; }
.alert.ok { background: #e8ffe7; color: #156a12; }
.bottom-nav {
    position: fixed; left: 0; right: 0; bottom: 0; height: 62px; background: #f5f1f6;
    border-top: 1px solid #ddd; display: flex; max-width: 640px; margin: 0 auto;
}
.bottom-nav a {
    flex: 1; text-align: center; text-decoration: none; color: #23222e; font-size: 12px;
    display: flex; align-items: center; justify-content: center; font-weight: 700; flex-direction: column; gap: 3px;
}
.bottom-nav a.active { color: #c82683; }
.bottom-nav a i { font-size: 16px; }
.mini { font-size: 13px; color: #666; margin: 8px 2px; }
.card-empty { text-align: center; color: #555; margin-top: 20px; font-size: 17px; }
.overlay-bg {
    position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 10;
    touch-action: none;
}
.overlay-form {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    top: max(10px, env(safe-area-inset-top, 0px));
    bottom: max(72px, calc(62px + env(safe-area-inset-bottom, 0px)));
    width: min(360px, calc(100vw - 16px));
    box-sizing: border-box;
    background: #fff;
    border-radius: 18px;
    padding: 14px 14px 0;
    box-shadow: 0 12px 32px rgba(0,0,0,0.32);
    z-index: 20;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    display: flex;
    flex-direction: column;
}
.overlay-form h3 {
    margin: 0 0 10px; font-size: 18px; flex-shrink: 0;
    position: sticky; top: 0; background: #fff; z-index: 2; padding-bottom: 6px;
}
.overlay-form .overlay-form-body { flex: 1 1 auto; min-height: 0; }
.overlay-form .overlay-form-actions {
    position: sticky; bottom: 0; flex-shrink: 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.92) 0%, #fff 18%);
    padding: 12px 0 16px; margin-top: 8px;
    border-top: 1px solid #e8ecf2;
    z-index: 2;
}
.overlay-form .row { display: flex; gap: 8px; }
.overlay-form .row button,
.overlay-form .row a { margin-bottom: 0; min-height: 44px; display: flex; align-items: center; justify-content: center; }
.settings-card {
    border-radius: 16px; margin-top: 10px; background: #fff; box-shadow: 0 4px 10px rgba(0,0,0,0.12); padding: 12px;
}
.settings-card h3 { margin: 0 0 8px; font-size: 20px; display: flex; align-items: center; gap: 8px; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.settings-grid .full { grid-column: 1 / -1; }
.settings-card input[type="checkbox"] { width: auto; margin-right: 6px; }
.toolbar {
    display: flex; gap: 8px; margin-top: 10px;
}
.toolbar a {
    flex: 1; text-decoration: none; color: #fff; background: #0a6fc1; padding: 10px; border-radius: 10px; text-align: center; font-weight: 700;
}
a.card-link, a.card-link-inner { text-decoration: none; color: inherit; display: block; }
a.card-link:hover .view-hint, a.card-link-inner:hover .view-hint { text-decoration: underline; }
.view-hint { font-size: 14px; font-weight: 600; color: #1d6fd1; margin-left: 6px; }
.dust-card {
    background: #fff;
    border-radius: 16px;
    border: 1px solid #e8e0f0;
    box-shadow: 0 4px 18px rgba(88, 52, 140, 0.08);
}
.report-hero {
    padding: 16px;
    margin-bottom: 12px;
}
.report-hero-head {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 14px;
}
.report-hero-icon {
    width: 44px; height: 44px; border-radius: 12px;
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    color: #fff; display: flex; align-items: center; justify-content: center;
    font-size: 20px; flex-shrink: 0;
}
.report-title { margin: 0 0 4px; font-size: 24px; font-weight: 800; color: #1e1b2e; letter-spacing: -0.02em; }
.report-ui-tag {
    display: inline-block; font-size: 10px; font-weight: 800; text-transform: uppercase;
    letter-spacing: 0.06em; color: #6d28d9; background: #ede9fe; padding: 2px 8px; border-radius: 999px;
}
.report-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 10px;
}
.stat-card {
    background: #faf8fc;
    border: 1px solid #ece6f4;
    border-radius: 12px;
    padding: 10px 8px;
    text-align: center;
}
.stat-card .stat-label {
    font-size: 11px;
    font-weight: 700;
    color: #6b6280;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-bottom: 4px;
}
.stat-card .stat-value { font-size: 16px; font-weight: 800; color: #1e1b2e; }
.stat-card.play .stat-value { color: #6d28d9; }
.stat-card.win .stat-value { color: #059669; }
.result-banner {
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
    background: #f3eeff; border-radius: 10px; padding: 10px 12px;
    font-size: 13px; color: #4c1d95;
}
.result-banner .sep { opacity: 0.5; }
.report-stats { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.stat-pill {
    background: #fff; border: 1px solid #d8e0ef; border-radius: 999px;
    padding: 6px 12px; font-size: 13px; font-weight: 600; color: #334155;
}
.stat-pill.play strong { color: #7c3aed; }
.stat-pill.win strong { color: #059669; }
.report-actions { display: flex; gap: 8px; margin: 12px 0; flex-wrap: wrap; }
.report-action-btn {
    width: auto;
    margin: 0;
    padding: 10px 14px;
    border: 1px solid #d9e2ef;
    border-radius: 10px;
    background: #fff;
    color: #1e293b;
    font-size: 13px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    white-space: nowrap;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.08);
}
.report-action-btn i { font-size: 14px; color: #2563eb; }
.report-action-btn:hover {
    border-color: #bfdbfe;
    background: #f8fbff;
}
.report-section-title {
    margin: 0 0 12px; font-size: 16px; font-weight: 800; color: #1e1b2e;
    display: flex; align-items: center; gap: 8px;
}
.report-section-title i { color: #7c3aed; }
.report-panel {
    background: #fff; border: 1px solid #e2e8f0; border-radius: 14px;
    padding: 14px; margin-bottom: 16px; box-shadow: 0 2px 10px rgba(15, 40, 90, 0.06);
}
.report-raw-slip { margin-top: 12px; }
.report-raw-slip summary {
    cursor: pointer; font-size: 12px; font-weight: 700; color: #64748b; padding: 6px 0;
}
.report-slip {
    background: #f8fafc; border: 1px solid #dbe4f0; border-radius: 12px; padding: 14px;
    white-space: pre-wrap; font-size: 12px; line-height: 1.5; max-height: 280px; overflow: auto;
    font-family: ui-monospace, Consolas, monospace; margin-top: 8px;
}
.slip-tables { display: flex; flex-direction: column; gap: 12px; }
.slip-grand-bar {
    display: flex; justify-content: space-between; align-items: center;
    background: linear-gradient(90deg, #6d28d9, #9333ea); color: #fff;
    border-radius: 10px; padding: 12px 14px; font-weight: 700;
}
.slip-grand-label { font-size: 13px; opacity: 0.9; }
.slip-grand-value { font-size: 20px; letter-spacing: 0.02em; }
.slip-section-card {
    border: 1px solid #e2e8f0; border-radius: 12px; overflow: hidden; background: #fafbfc;
}
.slip-section-head {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 12px; background: #eef2ff; border-bottom: 1px solid #e2e8f0;
}
.slip-section-title { font-weight: 800; font-size: 14px; color: #1e293b; }
.slip-section-total { font-weight: 800; font-size: 14px; color: #0d6efd; }
.slip-section-empty { margin: 10px 12px; font-size: 12px; color: #94a3b8; }
.slip-table-wrap { overflow-x: auto; }
.slip-detail-table {
    width: 100%; border-collapse: collapse; font-size: 13px; background: #fff;
}
.slip-detail-table th {
    background: #f1f5f9; color: #475569; text-align: left; padding: 8px 10px;
    font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 700;
}
.slip-detail-table td { padding: 8px 10px; border-top: 1px solid #eef2f7; }
.slip-detail-table tr:hover td { background: #f8fafc; }
.slip-detail-table .idx { width: 36px; color: #94a3b8; font-size: 12px; }
.slip-detail-table .val { font-weight: 700; color: #0f172a; font-variant-numeric: tabular-nums; }
.slip-detail-table .num { text-align: right; font-weight: 700; color: #0d6efd; white-space: nowrap; }
.slip-empty {
    padding: 20px; text-align: center; color: #64748b; font-size: 14px;
    background: #f8fafc; border-radius: 10px; border: 1px dashed #cbd5e1;
}
.back-link { margin: 0 0 8px; }
.back-link a { font-weight: 700; color: #0d6efd; text-decoration: none; }
.report-filters {
    background: #fff; border-radius: 12px; padding: 12px; margin-bottom: 14px;
    border: 1px solid #e2e8f0; box-shadow: 0 1px 6px rgba(0,0,0,.04);
}
.filter-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.btn-filter {
    width: 100%; padding: 12px 16px; font-size: 14px; font-weight: 700;
    background: linear-gradient(90deg, #6d28d9, #9333ea); border: none; border-radius: 12px;
    color: #fff; cursor: pointer;
}
.btn-filter:hover { filter: brightness(1.05); }
.breakdown-table-wrap { overflow-x: auto; margin-bottom: 16px; border-radius: 12px; border: 1px solid #e2e8f0; }
.breakdown-table { width: 100%; border-collapse: collapse; font-size: 12px; background: #fff; min-width: 520px; }
.breakdown-table th {
    background: #1e3a5f; color: #fff; text-align: left; padding: 10px 8px; font-weight: 700;
    white-space: nowrap;
}
.breakdown-table td { padding: 9px 8px; border-bottom: 1px solid #eef2f7; }
.breakdown-table tr:nth-child(even) td { background: #f8fafc; }
.breakdown-table .name-col { font-weight: 700; color: #0f172a; min-width: 90px; }
.market-mini-table {
    margin-top: 10px; padding-top: 10px; border-top: 1px dashed rgba(0,0,0,.15);
}
.market-mini-row {
    display: grid; grid-template-columns: 1fr auto; gap: 2px 8px;
    font-size: 12px; padding: 6px 0; border-bottom: 1px solid rgba(0,0,0,.06);
}
.market-mini-row .m-name { font-weight: 800; color: #1a2340; grid-column: 1 / -1; }
.market-mini-row .m-amt { color: #475569; }
.market-mini-row .m-tot { font-weight: 700; color: #0d6efd; text-align: right; }
.market-mini-more { font-size: 11px; color: #64748b; margin-top: 4px; font-style: italic; }
.payout-card { border: 2px solid #c7d7f5; background: linear-gradient(180deg, #fff, #f5f9ff); }
.ank-rate-preview {
    margin: 8px 0 10px; padding: 8px 10px; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px;
}
.ank-rate-preview summary {
    cursor: pointer; font-weight: 800; font-size: 12px; color: #6d28d9; padding: 4px 0;
    list-style-position: inside;
}
.ank-rate-preview[open] summary { margin-bottom: 4px; }
.hint-block { font-size: 12px; color: #64748b; margin: 0 0 10px; }
.win-detail-table th { font-size: 10px; }
.report-stats-grid { grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); }
.win-card { border-radius: 16px; }
.win-card .cname, .win-card .name { font-size: 18px !important; }
.win-stats { font-size: 15px !important; gap: 16px !important; margin-top: 8px !important; }

.table-card {
    border-radius: 16px; background: #fff; box-shadow: 0 4px 10px rgba(0,0,0,0.1); margin-top: 10px; padding: 12px;
}
.table-card .name { font-weight: 800; font-size: 24px; margin-bottom: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: #edf4ff; border-radius: 999px; padding: 6px 10px; font-size: 13px; font-weight: 700; }
.table-total { margin-top: 8px; font-weight: 700; color: #0f4b85; }
.field { margin-bottom: 8px; }
.field label { display: block; font-size: 12px; color: #555; margin-bottom: 4px; font-weight: 700; }
.field select { width: 100%; box-sizing: border-box; border-radius: 8px; border: 1px solid #ccc; padding: 9px; font-size: 14px; background: #fff; }
.sync-bar { margin: 10px 0; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sync-bar .hint { font-size: 12px; color: #666; flex: 1; min-width: 140px; }

pre.result-preview {
    white-space: pre-wrap;
    word-break: break-word;
    background: #f4f6f8;
    border: 1px solid #dde3ea;
    border-radius: 8px;
    padding: 12px;
    font-size: 13px;
    line-height: 1.45;
    margin: 6px 0 0;
}
.btn-sync { width: auto; padding: 8px 12px; font-size: 13px; background: #0a6fc1; }
#forward-picker-modal { display: none; position: fixed; inset: 0; z-index: 30; }
#forward-picker-modal.open { display: block; }
#forward-picker-modal .overlay-form { z-index: 31; }
.action-row { display: flex; gap: 8px; margin-top: 10px; }
.btn-muted { background: #777; }
.btn-danger { background: #c93030; }
.market-card .tools { display: flex; gap: 6px; }
.market-card .tools button { width: auto; margin: 0; padding: 8px 10px; font-size: 12px; }
.customer-card .actions { display: flex; gap: 8px; margin-bottom: 8px; float: none; }
.customer-card .actions form { margin: 0; }
.customer-card .actions button, .customer-card .actions a {
    width: auto; margin: 0; display: inline-block; padding: 8px 10px; border-radius: 8px; text-decoration: none; color: #fff; font-size: 13px;
}
.customer-card .actions a { background: #1d6fd1; }
.customer-card .actions .del { background: #bf2f2f; border: 0; }
.customer-card .actions .tog { background: #4a4a4a; border: 0; }

@media (max-width: 480px) {
    .app { max-width: 100%; padding: 6px 8px 76px; }
    .title { font-size: 30px; margin-top: 2px; }
    .top-date { font-size: 13px; }
    .market-card .name { font-size: 28px; }
    .market-card .meta { font-size: 20px; }
    .market-card .arrow { font-size: 34px; }
    .copy-btn i { font-size: 19px; }
    .customer-card .cname { font-size: 28px; }
    .customer-card .meta { font-size: 20px; }
    .win-card .name,
    .win-card .cname { font-size: 13px; }
    .win-card .arrow { font-size: 13px; margin-top: 8px; }
    .win-card .copy-btn i { font-size: 13px; }
    .win-stats { font-size: 13px; gap: 14px; margin-top: 4px; }
    .table-card .name { font-size: 20px; }
    .chip { font-size: 12px; padding: 5px 8px; }
    .settings-grid { grid-template-columns: 1fr; }
    .date-pill { min-width: 65px; }
    .date-pill .d1 { font-size: 13px; }
    .date-pill .d2 { font-size: 11px; }
    .mode-bar a { font-size: 12px; padding: 8px 4px; }
    .bottom-nav { height: 60px; }
    .bottom-nav a { font-size: 11px; }
    .bottom-nav a i { font-size: 15px; }
}

@media (min-width: 481px) and (max-width: 768px) {
    .title { font-size: 34px; }
    .market-card .name { font-size: 30px; }
    .market-card .meta { font-size: 21px; }
    .customer-card .cname { font-size: 30px; }
    .customer-card .meta { font-size: 21px; }
    .win-card .name,
    .win-card .cname { font-size: 13px; }
    .win-card .arrow { font-size: 13px; }
    .win-stats { font-size: 13px; }
    .table-card .name { font-size: 22px; }
}
