:root {
    --bg: #eef2f7;
    --card: #ffffff;
    --text: #111827;
    --muted: #6b7280;
    --line: #e5e7eb;
    --green: #16a34a;
    --green-dark: #15803d;
}
* { box-sizing: border-box; }
html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}
body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    background:
        radial-gradient(circle at top left, rgba(34,197,94,0.16), transparent 34%),
        linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, "Malgun Gothic", sans-serif;
    color: var(--text);
}
html.progress-open,
html.progress-open body {
    overflow: hidden;
    overscroll-behavior: none;
}
.wrap {
    width: 100%;
    max-width: 720px;
    margin: 0 auto;
    padding-top: max(14px, env(safe-area-inset-top));
    padding-right: max(10px, env(safe-area-inset-right));
    padding-bottom: max(28px, env(safe-area-inset-bottom));
    padding-left: max(10px, env(safe-area-inset-left));
}
.card {
    background: rgba(255,255,255,0.96);
    border: 1px solid rgba(226,232,240,0.9);
    border-radius: 24px;
    padding: 16px;
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.10);
}
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}
.header > div { min-width: 0; }
.brand-title-row {
    display: flex;
    align-items: baseline;
    gap: 7px;
    min-width: 0;
}
.app-version {
    color: #9ca3af;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0;
    white-space: nowrap;
}
h1 {
    margin: 0;
    font-size: 22px;
    font-weight: 950;
    letter-spacing: -0.05em;
}
.brand-sub {
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}
.header-actions {
    display: flex;
    flex-wrap: nowrap;
    justify-content: flex-end;
    gap: 6px;
    flex-shrink: 0;
}
.account-form { margin-top: 14px; }
.account-note { margin-top: 14px; line-height: 1.6; }
.logout {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 11px;
    border-radius: 999px;
    background: #f1f5f9;
    color: #475569;
    text-decoration: none;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}
.empty-state {
    background: linear-gradient(135deg, #111827, #1f2937);
    color: #e5e7eb;
    border-radius: 22px;
    padding: 30px 16px;
    margin-top: 10px;
    text-align: center;
    font-size: 18px;
    font-weight: 900;
}
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
    gap: 10px;
    margin-top: 10px;
}
.summary-card,
.invoice-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    border-radius: 22px;
    padding: 13px;
    min-width: 0;
    overflow: hidden;
    box-shadow: 0 10px 22px rgba(15,23,42,0.08);
}
.summary-card {
    background: linear-gradient(145deg, #111827 0%, #1f2937 100%);
    color: #fff;
}
.invoice-card {
    background: #ffffff;
    border: 1px solid var(--line);
    color: #111827;
}
.section-title {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    font-size: 14px;
    font-weight: 950;
    letter-spacing: -0.03em;
    color: inherit;
    opacity: 0.92;
    text-align: center;
}
.total-number,
.invoice-total {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 3px;
    margin: 7px 0 12px;
    font-weight: 950;
    letter-spacing: -0.055em;
    text-align: center;
}
.total-number span,
.invoice-total span {
    font-size: 40px;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}
.total-number em,
.invoice-total em {
    font-style: normal;
    font-size: 16px;
    font-weight: 900;
}
.item-list,
.invoice-list {
    display: grid;
    align-content: start;
    gap: 7px;
}
.item-row,
.invoice-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    column-gap: 8px;
    min-height: 35px;
    border-radius: 13px;
    padding: 8px 9px;
}
.item-row {
    background: rgba(255,255,255,0.10);
    border: 1px solid rgba(255,255,255,0.08);
}
.invoice-row {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
}
.item-row span,
.invoice-row span {
    font-size: 14px;
    font-weight: 850;
    white-space: nowrap;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
}
.item-row b,
.invoice-row b {
    font-size: 15px;
    font-weight: 950;
    white-space: nowrap;
    text-align: right;
    min-width: 42px;
    font-variant-numeric: tabular-nums;
}
.range-card {
    margin-top: 10px;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 12px 13px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
    box-shadow: 0 8px 18px rgba(15,23,42,0.05);
}
.range-card span {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 900;
    color: #334155;
    margin-bottom: 4px;
}
.range-card span::before {
    content: "🕒";
    font-size: 13px;
}
.range-card b {
    display: block;
    color: #111827;
    font-size: 13px;
    word-break: keep-all;
    line-height: 1.45;
    font-variant-numeric: tabular-nums;
}
.updated-info {
    margin-top: 6px;
    color: #64748b;
    font-size: 11px;
    font-weight: 750;
    font-variant-numeric: tabular-nums;
}
button {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    min-height: 52px;
    border: 0;
    color: #fff;
    background: var(--green-dark);
    padding: 15px 15px;
    border-radius: 18px;
    font-size: 16px;
    font-weight: 950;
    cursor: pointer;
    text-decoration: none;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
button:active { transform: scale(0.985); }
button:disabled { opacity: 0.65; cursor: wait; }
.btn-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 12px;
}
#fetchBtn {
    background: linear-gradient(135deg, #16a34a, #22c55e);
    box-shadow: 0 12px 22px rgba(34,197,94,0.28);
}
#fetchBtn::before {
    content: "↻";
    margin-right: 7px;
    font-size: 18px;
    line-height: 1;
}
.secondary {
    background: linear-gradient(135deg, #334155, #111827);
    box-shadow: 0 12px 22px rgba(15,23,42,0.18);
}
.secondary::before {
    content: "📅";
    margin-right: 7px;
    font-size: 15px;
}
.holiday-submit {
    background: linear-gradient(135deg, #16a34a, #22c55e);
    box-shadow: 0 12px 22px rgba(34,197,94,0.28);
}
.holiday-submit::before {
    content: "🔍";
    margin-right: 7px;
    font-size: 15px;
}
input {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 16px;
    padding: 13px;
    font-size: 16px;
    background: #fff;
    font-weight: 800;
}
label {
    display: block;
    font-size: 13px;
    font-weight: 900;
    margin: 12px 0 6px;
    color: #334155;
}
.holiday-box {
    display: none;
    margin-top: 12px;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 14px;
    box-shadow: 0 10px 22px rgba(15,23,42,0.06);
}
.holiday-box .desc {
    color: #475569;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 10px 11px;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.55;
    margin-bottom: 10px;
}
.error {
    background: #fff1f2;
    border: 1px solid #fecdd3;
    color: #9f1239;
    border-radius: 16px;
    padding: 13px;
    margin-top: 12px;
    white-space: pre-wrap;
    font-size: 13px;
    font-weight: 750;
    line-height: 1.45;
}
.success {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #166534;
    border-radius: 16px;
    padding: 13px;
    margin: 12px 0;
    font-size: 13px;
    font-weight: 800;
    line-height: 1.5;
}
.section-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
    margin-bottom: 12px;
    padding: 5px;
    border-radius: 17px;
    background: #f1f5f9;
}
.section-tabs a {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    border-radius: 13px;
    color: #64748b;
    text-decoration: none;
    font-size: 13px;
    font-weight: 900;
    letter-spacing: -0.02em;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
.section-tabs a.active {
    color: #ffffff;
    background: linear-gradient(135deg, #16a34a, #22c55e);
    box-shadow: 0 7px 16px rgba(34,197,94,0.24);
}
.subscription-updated {
    margin: 9px 2px 0;
    color: #64748b;
    font-size: 11px;
    font-weight: 750;
    text-align: right;
}
.upload-details {
    margin-top: 12px;
    border: 1px solid var(--line);
    border-radius: 19px;
    background: #ffffff;
    overflow: hidden;
}
.upload-details summary {
    padding: 14px 15px;
    color: #334155;
    font-size: 13px;
    font-weight: 900;
    cursor: pointer;
    list-style: none;
}
.upload-details summary::-webkit-details-marker { display: none; }
.upload-details summary::after {
    content: "+";
    float: right;
    color: #16a34a;
    font-size: 18px;
    line-height: 1;
}
.upload-details[open] summary::after { content: "−"; }
.upload-content {
    padding: 0 15px 15px;
    border-top: 1px solid #f1f5f9;
}
.upload-content input[type="file"] {
    margin-top: 8px;
    padding: 10px;
    font-size: 12px;
    font-weight: 700;
}
.upload-content button { margin-top: 10px; }
.privacy-note {
    margin-top: 9px;
    color: #64748b;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.55;
}
.subscription-status-card {
    overflow: hidden;
    border: 1px solid #dbe3ec;
    border-radius: 22px;
    background: #ffffff;
    box-shadow: 0 12px 26px rgba(15,23,42,0.07);
}
.subscription-status-title {
    padding: 16px 17px;
    color: #ffffff;
    background:
        radial-gradient(circle at 92% 0%, rgba(74,222,128,0.22), transparent 42%),
        linear-gradient(145deg, #172033, #0f172a);
    font-size: 19px;
    font-weight: 950;
    letter-spacing: -0.035em;
}
.subscription-status-list {
    display: grid;
    gap: 8px;
    padding: 12px;
    background: #f8fafc;
}
.subscription-status-row {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr);
    align-items: center;
    min-height: 62px;
    padding: 8px 9px 8px 12px;
    border: 1px solid #e5eaf0;
    border-radius: 14px;
    background: #ffffff;
    box-shadow: 0 3px 10px rgba(15,23,42,0.035);
}
.subscription-status-row.today {
    border-color: #86efac;
    background: linear-gradient(100deg, #f0fdf4, #ffffff 52%);
    box-shadow: 0 5px 14px rgba(22,163,74,0.09);
}
.subscription-date {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    color: #334155;
    font-size: 15px;
    font-weight: 950;
    font-variant-numeric: tabular-nums;
}
.subscription-today {
    display: inline-flex;
    align-items: center;
    min-height: 18px;
    padding: 2px 7px;
    border-radius: 999px;
    color: #15803d;
    background: #dcfce7;
    font-size: 9px;
    font-weight: 950;
}
.subscription-status-row.sunday .subscription-date { color: #dc2626; }
.subscription-status-row.saturday .subscription-date { color: #2563eb; }
.subscription-status-row.public-holiday .subscription-date { color: #dc2626; }
.subscription-status-row.substitute-holiday .subscription-date { color: #2563eb; }
.subscription-date { min-width: 0; }
.subscription-holiday { max-width: 100%; font-size: 10px; font-weight: 700; position: relative; }
.subscription-holiday summary { min-height: 24px; line-height: 24px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; list-style: none; }
.subscription-holiday summary::-webkit-details-marker { display: none; }
.subscription-holiday[open] > span { position: absolute; z-index: 2; top: 100%; left: 0; width: max-content; max-width: 200px; padding: 6px 8px; border: 1px solid currentColor; border-radius: 8px; background: white; white-space: normal; box-shadow: 0 3px 10px #0f172a15; }
.subscription-values {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: center;
    gap: 6px;
    width: 100%;
}
.subscription-value {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-width: 0;
    min-height: 42px;
    padding: 7px 9px;
    border: 1px solid transparent;
    border-radius: 11px;
    white-space: nowrap;
}
.subscription-value.fertile {
    color: #166534;
    border-color: #bbf7d0;
    background: #f0fdf4;
}
.subscription-value.special {
    color: #9a3412;
    border-color: #fed7aa;
    background: #fff7ed;
}
.subscription-label {
    font-size: 11px;
    font-weight: 900;
    line-height: 1.1;
    flex-shrink: 0;
}
.subscription-count {
    display: inline-flex;
    align-items: baseline;
    gap: 2px;
    flex-shrink: 0;
}
.subscription-value b {
    color: currentColor;
    font-size: 19px;
    font-weight: 950;
    font-variant-numeric: tabular-nums;
}
.subscription-value small {
    font-size: 9px;
    font-weight: 900;
}
.subscription-no-data {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    border: 1px dashed #d7dee7;
    border-radius: 11px;
    color: #94a3b8;
    background: #f8fafc;
    font-size: 16px;
    font-weight: 900;
}
.subscription-status-note {
    margin: 3px 13px 14px;
    padding: 11px 12px;
    border-radius: 13px;
    color: #475569;
    background: #f8fafc;
    font-size: 11px;
    font-weight: 750;
    line-height: 1.5;
}
.subscription-range {
    margin-bottom: 10px;
    color: #64748b;
    font-size: 12px;
    font-weight: 800;
    text-align: center;
}
.trace-date-card {
    margin-bottom: 11px;
    padding: 13px;
    border: 1px solid #dbe3ec;
    border-radius: 18px;
    background: linear-gradient(135deg, #f8fafc, #ffffff);
}
.trace-date-label {
    display: block;
    margin: 0 0 7px;
    color: #334155;
    font-size: 13px;
    font-weight: 950;
}
.trace-date-field {
    min-width: 0;
    padding: 10px 11px;
    border: 1px solid #e2e8f0;
    border-radius: 13px;
    background: #ffffff;
}
.trace-date-field span {
    display: block;
    margin-bottom: 5px;
    color: #64748b;
    font-size: 10px;
    font-weight: 900;
}
.trace-date-field input {
    width: 100%;
    min-height: 48px;
    padding: 8px 9px;
    font-size: 15px;
    font-weight: 900;
}
.trace-reset-notice {
    margin-top: 8px;
    padding: 8px 10px;
    border: 1px solid #bbf7d0;
    border-radius: 10px;
    color: #166534;
    background: #f0fdf4;
    font-size: 10px;
    font-weight: 850;
}
.trace-reset-notice[hidden] { display: none; }
.trace-edit-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
    padding: 10px 12px;
    border: 1px solid #bfdbfe;
    border-radius: 14px;
    color: #1e3a8a;
    background: #eff6ff;
    font-size: 12px;
    font-weight: 900;
}
.trace-new-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 0 10px;
    border-radius: 10px;
    color: #ffffff;
    background: #334155;
    text-decoration: none;
    white-space: nowrap;
    font-size: 11px;
    font-weight: 900;
}
.trace-layout {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}
.trace-building-card {
    overflow: hidden;
    border: 1px solid #dbe3ec;
    border-radius: 20px;
    background: #ffffff;
    box-shadow: 0 8px 20px rgba(15,23,42,0.055);
}
.trace-building-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 14px;
    color: #ffffff;
    background: linear-gradient(135deg, #334155, #172033);
    font-size: 17px;
    font-weight: 950;
}
.trace-correction {
    display: flex;
    align-items: center;
    gap: 6px;
}
.trace-correction label {
    margin: 0;
    color: #bbf7d0;
    font-size: 10px;
    font-weight: 900;
    white-space: nowrap;
}
.trace-correction input {
    width: 72px;
    min-height: 34px;
    padding: 5px 7px;
    border: 1px solid rgba(255,255,255,0.20);
    border-radius: 9px;
    color: #ffffff;
    background: rgba(255,255,255,0.12);
    font-size: 14px;
    font-weight: 950;
    text-align: right;
    font-variant-numeric: tabular-nums;
}
.trace-correction input:focus {
    outline: 2px solid rgba(134,239,172,0.38);
    border-color: #86efac;
}
.trace-input-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 11px;
}
.trace-field { min-width: 0; }
.trace-field label {
    margin: 0 0 5px;
    color: #475569;
    font-size: 11px;
    font-weight: 900;
}
.trace-number-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 5px;
    align-items: center;
}
.trace-field.has-adjusted .trace-number-row {
    grid-template-columns: minmax(0, 1fr) auto;
}
.trace-field input {
    width: 100%;
    min-height: 47px;
    padding: 10px 9px;
    border-radius: 12px;
    border-color: #dbe3ec;
    color: #0f172a;
    font-size: 18px;
    font-weight: 950;
    text-align: right;
    font-variant-numeric: tabular-nums;
}
.trace-adjusted-value {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 54px;
    min-height: 35px;
    padding: 4px 6px;
    border: 1px solid #bbf7d0;
    border-radius: 10px;
    color: #166534;
    background: #f0fdf4;
    font-size: 11px;
    font-weight: 950;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.trace-field input:focus {
    outline: 3px solid rgba(34,197,94,0.18);
    border-color: #4ade80;
}
.trace-building-total {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin: 0 11px 11px;
    padding: 10px 12px;
    border-radius: 12px;
    color: #166534;
    background: #f0fdf4;
    font-size: 12px;
    font-weight: 900;
}
.trace-building-total b {
    font-size: 18px;
    font-weight: 950;
    font-variant-numeric: tabular-nums;
}
.trace-summary-card {
    margin-top: 11px;
    overflow: hidden;
    border-radius: 21px;
    color: #ffffff;
    background:
        radial-gradient(circle at 95% 0%, rgba(74,222,128,0.25), transparent 40%),
        linear-gradient(145deg, #172033, #0f172a);
    box-shadow: 0 13px 28px rgba(15,23,42,0.17);
}
.trace-summary-title {
    padding: 14px 15px 7px;
    color: #86efac;
    font-size: 12px;
    font-weight: 950;
    letter-spacing: 0.04em;
}
.trace-summary-date {
    padding: 0 15px 12px;
    font-size: 19px;
    font-weight: 950;
    font-variant-numeric: tabular-nums;
}
.trace-summary-values {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
    padding: 0 11px 12px;
}
.trace-summary-value {
    min-width: 0;
    padding: 10px 7px;
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 13px;
    background: rgba(255,255,255,0.08);
    text-align: center;
}
.trace-summary-value span {
    display: block;
    margin-bottom: 4px;
    color: #cbd5e1;
    font-size: 11px;
    font-weight: 850;
}
.trace-summary-value b {
    font-size: 21px;
    font-weight: 950;
    font-variant-numeric: tabular-nums;
}
.trace-summary-value small {
    margin-left: 2px;
    color: #86efac;
    font-size: 10px;
    font-weight: 900;
}
.trace-save {
    margin-top: 12px;
    background: linear-gradient(135deg, #16a34a, #22c55e);
    box-shadow: 0 12px 22px rgba(34,197,94,0.26);
}
.trace-updated {
    margin: 8px 2px 0;
    color: #64748b;
    font-size: 11px;
    font-weight: 750;
    text-align: right;
}
.trace-history {
    margin-top: 12px;
    overflow: hidden;
    border: 1px solid #dbe3ec;
    border-radius: 18px;
    background: #ffffff;
}
.trace-history summary {
    padding: 13px 14px;
    color: #334155;
    font-size: 13px;
    font-weight: 950;
    cursor: pointer;
    list-style: none;
}
.trace-history summary::-webkit-details-marker { display: none; }
.trace-history summary::after {
    content: "+";
    float: right;
    color: #16a34a;
    font-size: 18px;
}
.trace-history[open] summary::after { content: "−"; }
.trace-history-list {
    display: grid;
    gap: 7px;
    padding: 0 10px 10px;
}
.trace-history-row {
    padding: 10px;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    color: #475569;
    background: #f8fafc;
    font-size: 10px;
    font-weight: 850;
}
.trace-history-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
}
.trace-history-date {
    padding: 7px 8px;
    border-radius: 9px;
    background: #ffffff;
}
.trace-history-date span {
    display: block;
    margin-bottom: 2px;
    color: #64748b;
    font-size: 9px;
}
.trace-history-date strong {
    display: block;
    color: #0f172a;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}
.trace-history-values {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px;
    margin-top: 7px;
}
.trace-history-values span {
    min-width: 0;
    padding: 6px 4px;
    border-radius: 8px;
    color: #334155;
    background: #ffffff;
    text-align: center;
    font-variant-numeric: tabular-nums;
}
.trace-history-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 6px;
    margin-top: 7px;
}
.trace-history-actions a,
.trace-history-actions button {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    margin: 0;
    padding: 7px 8px;
    border: 0;
    border-radius: 10px;
    text-decoration: none;
    font-size: 11px;
    font-weight: 900;
}
.trace-edit-action { color: #ffffff; background: #334155; }
.trace-delete-form { margin: 0; }
.trace-delete-action {
    width: 100%;
    color: #b91c1c;
    background: #fee2e2;
    box-shadow: none;
}
.trace-history-time {
    margin-top: 6px;
    color: #94a3b8;
    font-size: 9px;
    text-align: right;
}
.progress-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding-top: max(22px, env(safe-area-inset-top));
    padding-right: max(22px, env(safe-area-inset-right));
    padding-bottom: max(22px, env(safe-area-inset-bottom));
    padding-left: max(22px, env(safe-area-inset-left));
    background: rgba(15, 23, 42, 0.62);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}
.progress-panel {
    position: relative;
    width: min(100%, 410px);
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.16);
    border-radius: 30px;
    padding: 27px 22px 23px;
    color: #fff;
    background:
        radial-gradient(circle at 12% 0%, rgba(74,222,128,0.28), transparent 38%),
        radial-gradient(circle at 100% 100%, rgba(34,197,94,0.18), transparent 42%),
        linear-gradient(145deg, #172033 0%, #0f172a 100%);
    box-shadow: 0 28px 75px rgba(2, 6, 23, 0.46);
}
.progress-glow {
    position: absolute;
    width: 150px;
    height: 150px;
    top: -80px;
    right: -55px;
    border-radius: 50%;
    background: rgba(74,222,128,0.24);
    filter: blur(8px);
    animation: glowFloat 2.8s ease-in-out infinite;
}
.progress-icon {
    position: relative;
    display: grid;
    place-items: center;
    width: 58px;
    height: 58px;
    margin: 0 auto 14px;
    border-radius: 20px;
    font-size: 27px;
    background: linear-gradient(145deg, rgba(74,222,128,0.28), rgba(34,197,94,0.10));
    border: 1px solid rgba(134,239,172,0.28);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.15), 0 12px 26px rgba(34,197,94,0.15);
    animation: iconPulse 1.8s ease-in-out infinite;
}
.progress-kicker {
    position: relative;
    text-align: center;
    color: #86efac;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.08em;
}
.progress-title {
    position: relative;
    margin-top: 5px;
    text-align: center;
    font-size: 21px;
    font-weight: 950;
    letter-spacing: -0.045em;
}
.progress-percent {
    position: relative;
    margin: 17px 0 11px;
    text-align: center;
    font-size: 48px;
    line-height: 1;
    font-weight: 950;
    letter-spacing: -0.06em;
    font-variant-numeric: tabular-nums;
}
.progress-percent span {
    margin-left: 2px;
    color: #86efac;
    font-size: 20px;
    letter-spacing: 0;
}
.progress-track {
    position: relative;
    height: 14px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255,255,255,0.10);
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: inset 0 2px 5px rgba(2,6,23,0.28);
}
.progress-fill {
    position: relative;
    width: 0%;
    height: 100%;
    overflow: hidden;
    border-radius: inherit;
    background: linear-gradient(90deg, #22c55e 0%, #4ade80 54%, #86efac 100%);
    box-shadow: 0 0 20px rgba(74,222,128,0.42);
    transition: width 0.42s cubic-bezier(.22,.8,.22,1);
}
.progress-fill::after {
    content: "";
    position: absolute;
    inset: 0;
    width: 45%;
    transform: translateX(-120%) skewX(-20deg);
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.56), transparent);
    animation: progressShine 1.35s linear infinite;
}
.progress-message {
    position: relative;
    margin-top: 17px;
    text-align: center;
    font-size: 15px;
    font-weight: 900;
    line-height: 1.4;
}
.progress-detail {
    position: relative;
    min-height: 36px;
    margin-top: 5px;
    text-align: center;
    color: #cbd5e1;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.5;
}
.progress-safe {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin-top: 15px;
    color: #94a3b8;
    font-size: 11px;
    font-weight: 750;
}
.progress-safe::before {
    content: "✓";
    display: grid;
    place-items: center;
    width: 17px;
    height: 17px;
    border-radius: 50%;
    color: #052e16;
    background: #86efac;
    font-size: 11px;
    font-weight: 950;
}
@keyframes progressShine {
    to { transform: translateX(280%) skewX(-20deg); }
}
@keyframes iconPulse {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-3px) scale(1.04); }
}
@keyframes glowFloat {
    0%, 100% { transform: translate(0,0) scale(1); opacity: 0.75; }
    50% { transform: translate(-12px,12px) scale(1.12); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
    .progress-fill, .progress-fill::after, .progress-icon, .progress-glow { animation: none; }
    .progress-fill { transition: none; }
}
.login-title {
    text-align: center;
    margin-bottom: 16px;
}
.login-title .brand-title-row { justify-content: center; }
.login-title h1 { font-size: 26px; }
.login-title .desc {
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
    margin-top: 5px;
}
@media (max-width: 430px) {
    .wrap {
        padding-top: max(8px, env(safe-area-inset-top));
        padding-right: max(7px, env(safe-area-inset-right));
        padding-bottom: max(18px, env(safe-area-inset-bottom));
        padding-left: max(7px, env(safe-area-inset-left));
    }
    .card { padding: 13px; border-radius: 21px; }
    .header { gap: 8px; margin-bottom: 11px; }
    h1 { font-size: 20px; }
    .brand-sub { font-size: 11px; }
    .logout { min-height: 40px; padding: 0 10px; font-size: 11px; }
    .dashboard-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 7px;
    }
    .summary-card, .invoice-card { padding: 10px 8px; border-radius: 18px; }
    .section-title { font-size: 13px; white-space: nowrap; }
    .total-number, .invoice-total { margin: 7px 0 10px; }
    .total-number span, .invoice-total span { font-size: clamp(31px, 9.2vw, 38px); }
    .total-number em, .invoice-total em { font-size: 14px; }
    .item-list, .invoice-list { gap: 6px; }
    .item-row, .invoice-row { padding: 8px 7px; min-height: 33px; column-gap: 6px; }
    .item-row span, .invoice-row span { font-size: 12px; }
    .item-row b, .invoice-row b { font-size: 14px; min-width: 38px; }
    .range-card { padding: 11px 12px; }
    button { min-height: 50px; padding: 13px 12px; border-radius: 16px; font-size: 15px; }
    .section-tabs { gap: 5px; padding: 4px; }
    .section-tabs a { min-height: 44px; padding: 0 3px; font-size: 11px; }
    input, select, textarea,
    .upload-content input[type="file"],
    .trace-field input,
    .trace-correction input,
    .trace-date-field input {
        font-size: 16px;
    }
    .trace-summary-value b { font-size: 19px; }
    .trace-date-card { padding: 10px; }
    .trace-date-field { padding: 8px; }
    .trace-date-field input { font-size: 16px; }
    .trace-date-field input { min-height: 42px; padding: 5px 4px; }
    .trace-edit-banner { padding: 8px 9px; font-size: 10px; }
    .trace-new-link { min-height: 32px; padding: 0 8px; font-size: 10px; }
    .trace-layout { gap: 6px; }
    .trace-building-card { border-radius: 15px; }
    .trace-building-title {
        gap: 4px;
        padding: 9px 7px;
        font-size: 14px;
    }
    .trace-correction { gap: 3px; }
    .trace-correction label { font-size: 8px; }
    .trace-correction input {
        width: 55px;
        min-height: 36px;
        padding: 4px 5px;
        border-radius: 8px;
    }
    .trace-input-grid { gap: 5px; padding: 7px 6px; }
    .trace-field.has-adjusted { grid-column: 1 / -1; }
    .trace-field label { margin-bottom: 3px; font-size: 9px; }
    .trace-field input {
        min-height: 42px;
        padding: 6px 5px;
        border-radius: 9px;
    }
    .trace-adjusted-value {
        min-width: 49px;
        min-height: 31px;
        padding: 3px 4px;
        border-radius: 8px;
        font-size: 10px;
    }
    .trace-field input[type="number"],
    .trace-correction input[type="number"] { -moz-appearance: textfield; }
    .trace-field input[type="number"]::-webkit-inner-spin-button,
    .trace-field input[type="number"]::-webkit-outer-spin-button,
    .trace-correction input[type="number"]::-webkit-inner-spin-button,
    .trace-correction input[type="number"]::-webkit-outer-spin-button {
        margin: 0;
        -webkit-appearance: none;
    }
    .trace-building-total {
        gap: 3px;
        margin: 0 6px 7px;
        padding: 7px 6px;
        font-size: 9px;
    }
    .trace-building-total b { font-size: 14px; white-space: nowrap; }
    .trace-history-row { padding: 8px; }
    .trace-history-date { padding: 6px; }
    .trace-history-date strong { font-size: 11px; }
}
@media (max-width: 380px) {
    .wrap {
        padding-right: max(5px, env(safe-area-inset-right));
        padding-left: max(5px, env(safe-area-inset-left));
    }
    .card { padding: 11px; border-radius: 19px; }
    .header { gap: 8px; margin-bottom: 11px; }
    h1 { font-size: 19px; }
    .brand-sub { font-size: 10px; }
    .section-tabs a { font-size: 10px; }
    .dashboard-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
    .summary-card, .invoice-card { padding: 9px 7px; border-radius: 17px; }
    .section-title { font-size: 13px; }
    .total-number, .invoice-total { margin: 6px 0 10px; }
    .total-number span, .invoice-total span { font-size: 32px; }
    .item-list, .invoice-list { gap: 6px; }
    .item-row, .invoice-row { padding: 7px 6px; min-height: 32px; column-gap: 5px; }
    .item-row span, .invoice-row span { font-size: 11px; }
    .item-row b, .invoice-row b { font-size: 13px; min-width: 32px; }
    .progress-overlay {
        padding-right: max(14px, env(safe-area-inset-right));
        padding-left: max(14px, env(safe-area-inset-left));
    }
    .progress-panel { border-radius: 25px; padding: 22px 16px 19px; }
    .progress-kicker { font-size: 10px; }
    .progress-title { font-size: 19px; }
    .progress-percent { font-size: 43px; }
    .subscription-status-list { gap: 7px; padding: 9px; }
    .subscription-status-row { grid-template-columns: 78px minmax(0, 1fr); padding-right: 7px; padding-left: 9px; }
    .subscription-date { font-size: 14px; }
    .subscription-values { gap: 5px; }
    .subscription-value { min-height: 40px; padding: 6px 7px; }
    .subscription-label { font-size: 10px; }
    .subscription-value b { font-size: 17px; }
    .trace-layout { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; }
    .trace-building-title { padding-right: 6px; padding-left: 6px; }
}
@media (max-width: 340px) {
    .card { padding-right: 8px; padding-left: 8px; }
    .dashboard-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; }
    .summary-card, .invoice-card { padding-right: 5px; padding-left: 5px; }
    .item-row, .invoice-row { padding-right: 5px; padding-left: 5px; }
    .item-row span, .invoice-row span { font-size: 10px; }
    .item-row b, .invoice-row b { font-size: 12px; min-width: 29px; }
}
@media (max-height: 700px) {
    .progress-overlay {
        align-items: center;
        padding-top: max(12px, env(safe-area-inset-top));
        padding-bottom: max(12px, env(safe-area-inset-bottom));
    }
    .progress-panel { padding-top: 17px; padding-bottom: 16px; border-radius: 24px; }
    .progress-icon { width: 46px; height: 46px; margin-bottom: 9px; border-radius: 16px; font-size: 22px; }
    .progress-title { margin-top: 3px; font-size: 18px; }
    .progress-percent { margin: 12px 0 9px; font-size: 39px; }
    .progress-track { height: 12px; }
    .progress-message { margin-top: 12px; font-size: 14px; }
    .progress-detail { min-height: 0; font-size: 11px; }
    .progress-safe { margin-top: 10px; font-size: 10px; }
}
@media (min-width: 600px) {
    .wrap {
        padding-right: max(16px, env(safe-area-inset-right));
        padding-left: max(16px, env(safe-area-inset-left));
    }
    .card { padding: 20px; border-radius: 28px; }
    .dashboard-grid { gap: 14px; }
    .summary-card, .invoice-card { padding: 16px; border-radius: 24px; }
    .total-number span, .invoice-total span { font-size: 44px; }
    .item-row, .invoice-row { min-height: 40px; padding: 9px 11px; }
    .item-row span, .invoice-row span { font-size: 15px; }
    .item-row b, .invoice-row b { font-size: 16px; }
    .progress-panel { width: min(100%, 430px); }
}

/* v9.3: thumb-friendly controls, readable corrected numbers, two columns. */
[hidden] { display: none !important; }
button, input, a { -webkit-tap-highlight-color: transparent; }
button, .section-tabs a, .logout { touch-action: manipulation; }
button:disabled { cursor: wait; opacity: 0.7; }
:focus-visible { outline: 3px solid #22c55e; outline-offset: 3px; }
.trace-field.has-adjusted { grid-column: 1 / -1; }
.trace-history-status { padding: 0 12px 12px; font-size: 12px; color: #475569; overflow-wrap: anywhere; }
.trace-history-more { display: block; margin: 0 auto 12px; width: calc(100% - 24px); min-height: 44px; font-size: 13px; }
.trace-reload-link { display: flex; align-items: center; justify-content: center; min-height: 44px; margin-bottom: 12px; color: #15803d; font-size: 13px; }
.trace-new-link, .trace-history-actions a, .trace-history-actions button, .logout { min-height: 44px; }
.trace-date-field input { min-width: 0; max-width: 100%; }

@media (max-width: 430px) {
    .wrap { padding-top: max(6px, env(safe-area-inset-top)); }
    .card { padding: 10px; }
    .header { gap: 6px; }
    h1 { font-size: clamp(18px, 5vw, 21px); }
    .app-version { font-size: 11px; }
    .brand-title-row { gap: 5px; }
    .brand-sub { font-size: 11px; }
    .logout { padding: 0 9px; font-size: 11px; }
    .section-tabs a { font-size: 12px; min-height: 46px; }
    .trace-layout { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .trace-building-title { flex-wrap: wrap; padding: 10px 8px; gap: 6px; font-size: 16px; }
    .trace-correction { width: 100%; justify-content: space-between; gap: 5px; }
    .trace-correction label { font-size: 11px; }
    .trace-correction input { width: 78px; min-height: 44px; font-size: 16px; }
    .trace-input-grid { padding: 9px 7px; gap: 9px; }
    .trace-field label { font-size: 12px; margin-bottom: 5px; }
    .trace-number-row { gap: 5px; }
    .trace-field.has-adjusted .trace-number-row { grid-template-columns: minmax(0, 1fr) auto; }
    .trace-field input { min-height: 46px; padding: 7px 5px; font-size: 17px; font-weight: 800; }
    .trace-adjusted-value { min-width: 0; min-height: 38px; padding: 4px 3px; font-size: 12px; white-space: nowrap; }
    .trace-building-total { flex-wrap: wrap; font-size: 11px; padding: 9px 7px; }
    .trace-building-total b { font-size: 16px; }
    .trace-date-field { padding: 7px 6px; }
    .trace-date-field input { min-height: 44px; font-size: 16px; padding: 5px 0; }
    .trace-date-field span { font-size: 11px; }
    .trace-updated, .trace-history-time, .subscription-updated { font-size: 11px; line-height: 1.5; }
    .trace-edit-banner { flex-wrap: wrap; font-size: 12px; }
    .trace-new-link { font-size: 12px; }
    .trace-history-date span { font-size: 11px; }
    .trace-history-date strong { font-size: 13px; }
    .trace-history-actions a, .trace-history-actions button { font-size: 13px; }
    .item-row, .invoice-row { min-height: 38px; }
    .item-row span, .invoice-row span { font-size: 12px; }
    .item-row b, .invoice-row b { font-size: 15px; min-width: 0; }
    .item-row, .invoice-row { flex-wrap: wrap; overflow-wrap: anywhere; }
    .subscription-status-row { grid-template-columns: 76px minmax(0, 1fr); }
    .subscription-value { padding: 6px 4px; flex-wrap: nowrap; }
    .subscription-label { font-size: 10px; }
    .subscription-value b { font-size: 16px; }
    .subscription-status-note { font-size: 12px; }
}
@media (max-height: 500px) {
    .progress-overlay { overflow-y: auto; align-items: flex-start; }
    .progress-panel { margin: auto 0; }
}

.trace-summary-meta {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    column-gap: 12px;
    row-gap: 4px;
    margin: 4px 0 10px;
}
.trace-summary-meta .trace-summary-date { margin: 0; }
.trace-summary-total {
    color: #cbd5e1;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.trace-summary-total b { margin-left: 3px; color: #86efac; font-size: 14px; font-weight: 900; }
.trace-summary-total small { margin-left: 2px; font-size: 10px; }
.trace-date-picker { position: relative; }
.trace-info-heading { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 4px 8px; margin-bottom: 14px; }
.trace-info-heading .trace-date-label { margin: 0; }
.trace-application-date { color: #64748b; font-size: 11px; font-weight: 650; white-space: nowrap; }
.trace-quick-days { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px; }
.trace-quick-button {
    display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
    min-width: 0; min-height: 100px; padding: 8px 1px 6px; margin: 0;
    border: 1px solid transparent; border-radius: 15px; background: transparent;
    color: #334155; box-shadow: none; cursor: pointer; font-variant-numeric: tabular-nums;
}
.trace-quick-button:disabled { opacity: 1; cursor: default; }
.trace-quick-circle {
    display: flex; position: relative; align-items: center; justify-content: center;
    width: clamp(44px, 12vw, 52px); height: clamp(44px, 12vw, 52px);
    border: 1px solid #dbe3ec; border-radius: 50%; background: #ffffff;
}
.trace-quick-weekday { font-size: 23px; font-weight: 900; line-height: 1; }
.trace-quick-date { margin-top: 6px; color: #64748b; font-size: 11px; font-weight: 700; }
.trace-quick-state { margin-top: 3px; color: #15803d; font-size: 10px; font-weight: 800; }
.trace-quick-today { position: absolute; top: -9px; left: 50%; transform: translateX(-50%); padding: 2px 6px; border-radius: 7px; color: #15803d; background: #dcfce7; font-size: 9px; line-height: 1.2; font-weight: 850; white-space: nowrap; }
.trace-quick-lock { position: absolute; right: -2px; bottom: -2px; display: grid; place-items: center; width: 20px; height: 20px; border: 2px solid #f8fafc; border-radius: 50%; background: #64748b; }
.trace-quick-lock svg { width: 11px; height: 11px; fill: none; stroke: #ffffff; stroke-width: 2; }
.trace-quick-lock[hidden], .trace-quick-today[hidden], .trace-quick-retry[hidden] { display: none; }
.trace-quick-button[data-weekday="토"] .trace-quick-weekday { color: #2563eb; }
.trace-quick-button[data-weekday="일"] .trace-quick-weekday { color: #dc2626; }
.trace-quick-button.is-selected:not(.is-registered) { border-color: #bbf7d0; background: #f0fdf4; }
.trace-quick-button.is-selected:not(.is-registered) .trace-quick-circle { border-color: #16a34a; background: linear-gradient(145deg, #16a34a, #22c55e); box-shadow: 0 4px 10px #16a34a26; }
.trace-quick-button.is-selected:not(.is-registered) .trace-quick-weekday { color: #ffffff; }
.trace-quick-button.is-registered .trace-quick-circle { background: #e9eef3; border-color: #e2e8f0; }
.trace-quick-button.is-registered .trace-quick-weekday, .trace-quick-button.is-registered .trace-quick-state { color: #94a3b8; }
.trace-quick-button.is-registered.is-selected { border-color: #cbd5e1; }
.trace-quick-feedback { min-height: 14px; margin: 9px 2px 11px; color: #64748b; font-size: 10px; line-height: 1.5; }
.trace-quick-retry { margin-bottom: 10px; min-height: 44px; padding: 7px 12px; border-radius: 10px; color: #334155; background: #e2e8f0; font-size: 12px; box-shadow: none; }
.trace-calendar-field { display: block; }
.trace-date-field .trace-calendar-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 5px; margin-bottom: 7px; }
.trace-date-field .trace-calendar-heading span { margin: 0; }
.trace-date-field .trace-calendar-heading span:last-child { font-size: 10px; font-weight: 650; }
.trace-date-field.trace-calendar-field .trace-date-display { font-size: 15px; }
@media (hover: hover) { .trace-quick-button:not(:disabled):hover { background: #f0fdf4; } }
@media (prefers-reduced-motion: no-preference) { .trace-quick-button, .trace-quick-circle { transition: background .15s ease, border-color .15s ease; } }
.trace-date-picker input[type="date"] { color: transparent; -webkit-text-fill-color: transparent; }
.trace-date-picker input[type="date"]:focus { color: #0f172a; -webkit-text-fill-color: #0f172a; }
.trace-date-picker input[type="date"]:focus + .trace-date-display { visibility: hidden; }
.trace-date-field .trace-date-display {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 9px;
    right: 28px;
    display: flex;
    align-items: center;
    margin: 0;
    color: #0f172a;
    font-size: 15px;
    font-weight: 900;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    pointer-events: none;
}
@media (max-width: 430px) {
    .trace-date-field .trace-date-display { left: 6px; font-size: clamp(12px, 3.2vw, 14px); }
    .trace-summary-meta { column-gap: 8px; }
    .trace-summary-meta .trace-summary-date { font-size: 14px; }
    .trace-summary-total { font-size: 11px; }
    .trace-summary-total b { font-size: 12px; }
}
