:root {
  --font-geist-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-geist-mono: "SFMono-Regular", Menlo, Consolas, monospace;
  --ink: #1e2522;
  --muted: #6f746f;
  --paper: #f5f1e8;
  --card: #fffdf8;
  --line: #ddd8cd;
  --coral: #ff7058;
  --coral-dark: #dd4e38;
  --mint: #d9eee3;
  --shadow: 0 18px 50px rgba(43, 45, 40, 0.09);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-geist-sans), "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; }
button { color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.app-shell {
  min-height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(circle at 83% 8%, rgba(255, 211, 141, 0.32), transparent 26rem),
    radial-gradient(circle at 5% 29%, rgba(185, 225, 207, 0.25), transparent 24rem),
    var(--paper);
}

.topbar {
  width: min(1180px, calc(100% - 40px));
  height: 92px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(30, 37, 34, 0.13);
}
.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand-mark {
  width: 43px; height: 43px; border-radius: 14px;
  display: grid; place-items: center;
  background: var(--ink); color: #fffaf1;
  font-size: 21px; font-weight: 800;
  transform: rotate(-3deg);
  box-shadow: 4px 4px 0 var(--coral);
}
.brand > span:last-child { display: flex; flex-direction: column; }
.brand strong { font-size: 20px; letter-spacing: .1em; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.sync-pill { padding: 7px 10px; border-radius: 999px; background: #dcefe2; color: #2b7247; font-size: 10px; font-weight: 750; }
.sync-pill.saving { background: #fff0c8; color: #856221; }
.sync-pill.offline { background: #fde1dc; color: #a13f32; }
.icon-button, .close-button {
  border: 1px solid var(--line); background: rgba(255,255,255,.42); cursor: pointer;
  display: grid; place-items: center;
}
.icon-button { width: 42px; height: 42px; border-radius: 50%; font-weight: 800; letter-spacing: 2px; }
.icon-button:hover, .close-button:hover { background: #fff; }
.add-button {
  min-height: 44px; border: 0; border-radius: 14px; padding: 0 19px;
  background: var(--ink); color: white; font-weight: 700; cursor: pointer;
  box-shadow: 0 8px 18px rgba(30,37,34,.15);
  transition: transform .18s ease, box-shadow .18s ease;
}
.add-button:hover { transform: translateY(-2px); box-shadow: 0 12px 24px rgba(30,37,34,.19); }
.add-button span { font-size: 20px; margin-right: 4px; vertical-align: -1px; }

.overview {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto; padding: 38px 0 34px;
}
.eyebrow { margin: 0 0 12px; color: var(--coral-dark); font-size: 12px; line-height: 1; font-weight: 800; letter-spacing: .19em; text-transform: uppercase; }

.spend-card {
  position: relative; overflow: hidden;
  min-height: 0; padding: 28px 31px;
  background: var(--ink); color: #fff;
  border-radius: 28px 28px 28px 8px;
  box-shadow: 12px 13px 0 rgba(195, 217, 205, .85), var(--shadow);
}
.spend-card::after {
  content: ""; position: absolute; width: 220px; height: 220px; border: 50px solid rgba(255,255,255,.04);
  border-radius: 50%; right: -105px; top: 60px;
}
.spend-card-head { position: relative; z-index: 1; display: flex; justify-content: space-between; color: #aeb7b0; font-size: 12px; }
.live-dot { display: inline-flex; align-items: center; gap: 7px; }
.live-dot i { width: 7px; height: 7px; border-radius: 50%; background: #6de2a0; box-shadow: 0 0 0 4px rgba(109,226,160,.13); }
.overview-body { position: relative; z-index: 1; display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(300px, .65fr); gap: 42px; align-items: end; }
.total-stack { position: relative; z-index: 1; margin-top: 26px; min-height: 100px; }
.primary-total { display: flex; align-items: baseline; gap: 8px; }
.primary-total strong, .empty-total strong { font-family: var(--font-geist-mono), monospace; font-size: clamp(40px, 5vw, 59px); letter-spacing: -.07em; }
.primary-total small { color: #aeb7b0; }
.fx-status { margin-top: 11px; padding: 0; border: 0; background: transparent; color: #8f9991; font-size: 11px; cursor: pointer; }
.fx-status:hover { color: white; }
.fx-status:disabled { cursor: wait; }
.fx-status.has-error { color: #ffad9e; }
.secondary-total { display: inline-block; padding: 5px 10px; margin: 13px 8px 0 0; border-radius: 8px; background: rgba(255,255,255,.1); }
.secondary-total strong { font-family: var(--font-geist-mono), monospace; font-size: 15px; }
.total-stack p, .empty-total p { margin: 10px 0 0; color: #8f9991; font-size: 11px; }
.empty-total { position: relative; z-index: 1; margin-top: 26px; min-height: 100px; }
.spend-stats { position: relative; z-index: 1; padding: 11px 0 11px 36px; display: grid; grid-template-columns: 1fr 1fr; border-left: 1px solid rgba(255,255,255,.13); }
.spend-stats div { display: flex; flex-direction: column; gap: 6px; }
.spend-stats div + div { padding-left: 24px; border-left: 1px solid rgba(255,255,255,.13); }
.spend-stats span { color: #8f9991; font-size: 11px; }
.spend-stats strong { font-size: 14px; }

.due-alerts {
  width: min(1180px, calc(100% - 40px)); margin: 0 auto 24px; padding: 20px;
  border: 2px solid #ef6a51; border-radius: 22px; background: #fff3ef;
  box-shadow: 0 12px 35px rgba(194, 73, 50, .1);
}
.due-alert-head { margin-bottom: 13px; display: flex; align-items: center; gap: 11px; }
.alert-pulse { width: 34px; height: 34px; flex: none; display: grid; place-items: center; border-radius: 50%; background: #e95038; color: white; font-size: 19px; font-weight: 900; box-shadow: 0 0 0 7px rgba(233,80,56,.12); animation: alert-pulse 1.8s ease-in-out infinite; }
.due-alert-head > div { display: flex; flex-direction: column; gap: 3px; }
.due-alert-head strong { color: #a73526; font-size: 18px; }
.due-alert-head small { color: #8c665f; font-size: 10px; }
.due-alert-list { display: grid; gap: 8px; }
.due-alert-list article { padding: 12px; display: grid; grid-template-columns: 42px 1fr auto auto; gap: 12px; align-items: center; border: 1px solid #f0c5bb; border-radius: 14px; background: white; }
.due-alert-list img, .due-avatar { width: 42px; height: 42px; border-radius: 11px; object-fit: cover; }
.due-avatar { display: grid; place-items: center; background: #fee1d9; color: #ad402f; font-weight: 850; }
.due-alert-copy { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.due-alert-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.due-alert-copy span { color: #b34837; font-size: 10px; font-weight: 700; }
.due-alert-price { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.due-alert-price strong { font-family: var(--font-geist-mono), monospace; font-size: 13px; }
.due-alert-price small { color: var(--muted); font-size: 9px; }
.due-alert-list article > button { min-width: 76px; height: 38px; border: 0; border-radius: 11px; background: #e95038; color: white; font-size: 11px; font-weight: 800; cursor: pointer; }
.due-alert-list article > button:hover { background: #ca3c28; }

.next-strip {
  width: min(1180px, calc(100% - 40px)); margin: 0 auto 58px; padding: 18px 20px;
  display: grid; grid-template-columns: auto 1fr auto auto; gap: 17px; align-items: center;
  background: rgba(255,255,255,.55); border: 1px solid var(--line); border-radius: 22px;
}
.date-ticket { width: 52px; height: 55px; display: flex; flex-direction: column; justify-content: center; align-items: center; background: #f4c969; border-radius: 12px; line-height: 1; }
.date-ticket strong { font-family: var(--font-geist-mono), monospace; font-size: 20px; }
.date-ticket span { margin-top: 5px; font-size: 10px; font-weight: 700; }
.next-copy { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.next-copy small { color: var(--coral-dark); font-size: 11px; font-weight: 750; }
.next-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 16px; }
.next-price { display: flex; align-items: baseline; gap: 8px; }
.next-price strong { font-family: var(--font-geist-mono), monospace; }
.next-price span { color: var(--muted); font-size: 11px; }
.next-strip > button { border: 0; border-radius: 11px; padding: 10px 15px; background: var(--ink); color: white; font-weight: 650; cursor: pointer; }

.list-section { width: min(1180px, calc(100% - 40px)); margin: 0 auto; min-height: 460px; }
.section-heading { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 26px; }
.section-heading h2 { margin: 0; font-size: clamp(31px, 4vw, 43px); line-height: 1; letter-spacing: -.045em; }
.view-toggle { padding: 4px; display: flex; background: #e9e4d9; border-radius: 13px; }
.view-toggle button { border: 0; padding: 10px 13px; border-radius: 10px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 650; cursor: pointer; }
.view-toggle button.selected { background: var(--card); color: var(--ink); box-shadow: 0 3px 10px rgba(30,37,34,.08); }
.view-toggle span { margin-left: 4px; opacity: .58; }
.filters { margin-bottom: 18px; display: flex; gap: 12px; align-items: center; }
.search-box { position: relative; flex: 0 0 235px; }
.search-box span { position: absolute; left: 14px; top: 10px; color: var(--muted); font-size: 20px; transform: rotate(-12deg); }
.search-box input { width: 100%; height: 43px; padding: 0 13px 0 40px; border: 1px solid var(--line); border-radius: 13px; background: rgba(255,255,255,.45); outline: 0; font-size: 13px; }
.search-box input:focus { border-color: var(--ink); background: white; }
.category-scroll { flex: 1; display: flex; gap: 7px; overflow-x: auto; scrollbar-width: none; }
.category-scroll::-webkit-scrollbar { display: none; }
.category-scroll button { flex: none; height: 39px; padding: 0 13px; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--muted); font-size: 12px; cursor: pointer; }
.category-scroll button.selected { border-color: var(--ink); background: var(--ink); color: white; }

.subscription-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 13px; }
.subscription-card { overflow: hidden; background: var(--card); border: 1px solid var(--line); border-radius: 20px; transition: transform .18s ease, box-shadow .18s ease; }
.subscription-card:hover { transform: translateY(-2px); box-shadow: 0 14px 35px rgba(43,45,40,.08); }
.card-main { width: 100%; padding: 19px; display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: 13px; align-items: center; text-align: left; }
.card-edit-area { min-width: 0; padding: 0; border: 0; background: transparent; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 13px; align-items: center; text-align: left; cursor: pointer; }
.service-avatar { width: 48px; height: 48px; overflow: hidden; display: grid; place-items: center; border-radius: 15px; background: color-mix(in srgb, var(--accent) 17%, white); color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 30%, white); font-size: 19px; font-weight: 850; }
.service-avatar img { width: 100%; height: 100%; display: block; object-fit: cover; }
.app-store-icon { transition: transform .18s ease; }
.app-store-icon:hover { transform: scale(1.05); }
.service-info { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.service-title { display: flex; align-items: center; gap: 7px; min-width: 0; }
.service-title strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.service-title i { flex: none; padding: 3px 6px; border-radius: 5px; background: #fff0be; color: #806218; font-size: 9px; font-style: normal; font-weight: 800; }
.renewal-badge { flex: none; padding: 4px 7px; border-radius: 999px; font-size: 8px; line-height: 1; font-weight: 850; }
.renewal-badge.auto { background: #dff3e6; color: #227044; }
.renewal-badge.renewed { background: #dceef9; color: #276581; }
.renewal-badge.due { background: #fee0da; color: #a93b2e; }
.renewal-badge.unconfirmed { background: #fff0c9; color: #82601d; }
.renewal-badge.cancelled { background: #e9e7e2; color: #77736b; }
.service-info > small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 10px; }
.service-price { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.service-price strong { font-family: var(--font-geist-mono), monospace; font-size: 15px; letter-spacing: -.04em; }
.service-price small { color: var(--muted); font-size: 10px; }
.card-foot { min-height: 45px; padding: 0 19px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-top: 1px solid #ebe7de; }
.card-foot > span { color: var(--muted); font-size: 10px; }
.card-foot > span i { display: inline-block; width: 5px; height: 5px; margin-right: 5px; vertical-align: 1px; border-radius: 50%; background: #66ad80; }
.card-foot > span.due-soon { color: var(--coral-dark); font-weight: 700; }
.card-foot > span.due-soon i { background: var(--coral); }
.card-foot > div { display: flex; gap: 7px; }
.card-foot button { border: 0; padding: 5px; background: transparent; color: var(--muted); font-size: 10px; cursor: pointer; }
.card-foot button:hover { color: var(--ink); }
.card-foot .renew-button { padding: 6px 9px; border-radius: 8px; background: var(--ink); color: white; font-weight: 750; }
.card-foot .renew-button:hover { color: white; background: #38413d; }
.renewed-note { padding: 5px; color: #277048; font-size: 10px; font-weight: 750; }
.card-foot .danger-link:hover { color: #bf3b2f; }

.empty-state { padding: 75px 20px; text-align: center; border: 1px dashed #c8c2b7; border-radius: 22px; background: rgba(255,255,255,.22); }
.empty-state > span { width: 54px; height: 54px; margin: 0 auto 16px; display: grid; place-items: center; border-radius: 50%; background: var(--mint); font-size: 26px; }
.empty-state h3 { margin: 0; font-size: 18px; }
.empty-state p { margin: 8px 0 23px; color: var(--muted); font-size: 12px; }

footer { width: min(1180px, calc(100% - 40px)); margin: 70px auto 0; padding: 25px 0 35px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; }
footer button { border: 0; background: none; color: inherit; cursor: pointer; }
.floating-add { display: none; }

.modal-backdrop { position: fixed; inset: 0; z-index: 40; padding: 24px; display: grid; place-items: center; background: rgba(21,25,23,.52); backdrop-filter: blur(8px); animation: fade-in .18s ease both; }
.sheet { width: min(610px, 100%); max-height: min(810px, calc(100vh - 48px)); overflow-y: auto; padding: 28px; background: var(--card); border: 1px solid rgba(255,255,255,.7); border-radius: 27px; box-shadow: 0 28px 80px rgba(20,25,22,.25); animation: rise-in .22s ease both; }
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 23px; }
.sheet-head h2 { margin: 0; font-size: 31px; letter-spacing: -.04em; }
.close-button { width: 39px; height: 39px; border-radius: 50%; font-size: 23px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.amount-row { grid-template-columns: 1.55fr .7fr; }
.field { margin-bottom: 14px; display: flex; flex-direction: column; gap: 7px; }
.field > span, .color-picker > span { color: #616761; font-size: 11px; font-weight: 700; }
.field input, .field select { width: 100%; height: 47px; padding: 0 13px; border: 1px solid #d8d3c9; border-radius: 12px; background: white; outline: 0; color: var(--ink); font-size: 13px; }
.field input:focus, .field select:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(30,37,34,.07); }
.app-icon-picker { margin: -2px 0 14px; padding: 14px; border: 1px solid #ded9cf; border-radius: 15px; background: #f7f4ed; }
.app-icon-heading { margin-bottom: 9px; display: flex; align-items: center; justify-content: space-between; color: #616761; font-size: 11px; font-weight: 700; }
.app-icon-heading button { padding: 0; border: 0; background: transparent; color: #a4483c; font-size: 9px; cursor: pointer; }
.selected-app-icon { margin-bottom: 10px; display: flex; align-items: center; gap: 9px; color: #4d6657; font-size: 10px; font-weight: 700; }
.selected-app-icon img { width: 38px; height: 38px; border-radius: 10px; object-fit: cover; }
.app-search-row { display: grid; grid-template-columns: minmax(0, 1fr) 82px 64px; gap: 7px; }
.app-search-row input, .app-search-row select { min-width: 0; height: 41px; padding: 0 10px; border: 1px solid #d6d1c7; border-radius: 10px; background: white; outline: 0; font-size: 11px; }
.app-search-row > button { border: 0; border-radius: 10px; background: var(--ink); color: white; font-size: 11px; font-weight: 750; cursor: pointer; }
.app-search-row > button:disabled { opacity: .55; cursor: wait; }
.app-results { max-height: 183px; margin-top: 9px; overflow-y: auto; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.app-results > button { min-width: 0; padding: 7px; border: 1px solid #e0dcd3; border-radius: 11px; background: white; display: flex; align-items: center; gap: 8px; text-align: left; cursor: pointer; }
.app-results > button:hover { border-color: var(--ink); }
.app-results img { width: 36px; height: 36px; flex: none; border-radius: 9px; object-fit: cover; }
.app-results span { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.app-results strong, .app-results small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-results strong { font-size: 10px; }
.app-results small { color: var(--muted); font-size: 8px; }
.app-store-note { display: block; margin-top: 8px; color: var(--muted); font-size: 8px; line-height: 1.45; }
.renewal-mode-picker { margin-bottom: 14px; }
.renewal-mode-picker > span { display: block; margin-bottom: 7px; color: #616761; font-size: 11px; font-weight: 700; }
.renewal-mode-picker > div { padding: 4px; display: grid; grid-template-columns: 1fr 1fr; gap: 4px; background: #ebe7de; border-radius: 13px; }
.renewal-mode-picker button { min-height: 55px; padding: 8px 11px; border: 0; border-radius: 10px; background: transparent; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; color: var(--muted); text-align: left; cursor: pointer; }
.renewal-mode-picker button.selected { background: white; color: var(--ink); box-shadow: 0 3px 10px rgba(30,37,34,.08); }
.renewal-mode-picker strong { font-size: 11px; }
.renewal-mode-picker small { font-size: 8px; }
.form-options { margin-top: 2px; padding: 16px; display: flex; align-items: center; justify-content: space-between; gap: 18px; background: #f3f0e8; border-radius: 15px; }
.trial-toggle { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.trial-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle { position: relative; flex: none; width: 37px; height: 22px; border-radius: 99px; background: #c8c5bd; transition: background .18s ease; }
.toggle::after { content: ""; position: absolute; width: 16px; height: 16px; top: 3px; left: 3px; border-radius: 50%; background: white; transition: transform .18s ease; box-shadow: 0 2px 4px rgba(0,0,0,.18); }
.trial-toggle input:checked + .toggle { background: var(--coral); }
.trial-toggle input:checked + .toggle::after { transform: translateX(15px); }
.trial-toggle > span:last-child { display: flex; flex-direction: column; gap: 3px; }
.trial-toggle strong { font-size: 11px; }
.trial-toggle small { color: var(--muted); font-size: 9px; }
.color-picker { flex: none; display: flex; flex-direction: column; gap: 7px; }
.color-picker > div { display: flex; gap: 6px; }
.color-picker button { width: 20px; height: 20px; padding: 0; border: 2px solid transparent; border-radius: 50%; cursor: pointer; }
.color-picker button.selected { outline: 2px solid var(--ink); outline-offset: 2px; }
.sheet-actions { display: grid; grid-template-columns: 1fr 2fr; gap: 10px; margin-top: 22px; }
.sheet-actions button { min-height: 49px; border-radius: 13px; font-weight: 750; cursor: pointer; }
.secondary-button { border: 1px solid var(--line); background: transparent; }
.save-button { border: 0; background: var(--ink); color: white; }

.tools-sheet { width: min(520px, 100%); }
.privacy-note { padding: 17px; margin-bottom: 15px; display: flex; align-items: flex-start; gap: 12px; background: var(--mint); border-radius: 15px; }
.privacy-note > span { width: 32px; height: 32px; flex: none; display: grid; place-items: center; background: white; border-radius: 10px; }
.privacy-note strong { font-size: 12px; }
.privacy-note p { margin: 5px 0 0; color: #557062; font-size: 10px; line-height: 1.55; }
.tool-list { overflow: hidden; border: 1px solid var(--line); border-radius: 16px; }
.tool-list > button { width: 100%; padding: 14px; border: 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 35px 1fr auto; gap: 11px; align-items: center; background: white; text-align: left; cursor: pointer; }
.tool-list > button:last-of-type { border-bottom: 0; }
.tool-list > button:hover { background: #faf8f2; }
.tool-list > button > span { width: 35px; height: 35px; display: grid; place-items: center; border-radius: 10px; background: #f0ede5; font-size: 18px; }
.tool-list > button > div { display: flex; flex-direction: column; gap: 3px; }
.tool-list strong { font-size: 12px; }
.tool-list small { color: var(--muted); font-size: 9px; }
.tool-list i { color: var(--muted); font-size: 22px; font-style: normal; }
.tool-list .danger-tool strong { color: #b93d31; }
.tool-list .danger-tool > span { background: #fde4df; color: #b93d31; }
.install-tip { margin: 16px 3px 0; color: var(--muted); font-size: 10px; line-height: 1.55; }

.toast { position: fixed; z-index: 80; left: 50%; bottom: 30px; transform: translateX(-50%); padding: 11px 17px; border-radius: 999px; background: var(--ink); color: white; font-size: 12px; font-weight: 650; box-shadow: 0 12px 35px rgba(0,0,0,.2); animation: toast-in .25s ease both; }
.loading-screen { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 14px; background: var(--paper); color: var(--muted); font-size: 12px; }
.loading-mark { width: 54px; height: 54px; display: grid; place-items: center; border-radius: 18px; background: var(--ink); color: white; font-size: 24px; font-weight: 800; box-shadow: 6px 6px 0 var(--coral); animation: breathe 1.2s ease-in-out infinite alternate; }

.auth-screen { min-height: 100vh; padding: 24px; display: grid; place-items: center; background: radial-gradient(circle at 80% 15%, rgba(255,211,141,.35), transparent 24rem), var(--paper); }
.auth-card { width: min(420px, 100%); padding: 30px; border: 1px solid var(--line); border-radius: 26px; background: var(--card); box-shadow: var(--shadow); }
.auth-brand { margin-bottom: 31px; display: flex; align-items: center; gap: 12px; }
.auth-brand > span { width: 43px; height: 43px; display: grid; place-items: center; border-radius: 14px; background: var(--ink); color: white; font-size: 20px; font-weight: 850; box-shadow: 4px 4px 0 var(--coral); }
.auth-brand strong { font-size: 19px; letter-spacing: .06em; }
.auth-card h1 { margin: 0 0 9px; font-size: 30px; letter-spacing: -.04em; }
.auth-card p { margin: 0 0 21px; color: var(--muted); font-size: 12px; line-height: 1.65; }
.auth-card code { padding: 2px 5px; border-radius: 5px; background: #eeeae1; font-size: 10px; }
.auth-card label { display: flex; flex-direction: column; gap: 7px; }
.auth-card label span { color: #616761; font-size: 11px; font-weight: 750; }
.auth-card input { height: 48px; padding: 0 13px; border: 1px solid #d5d0c6; border-radius: 12px; outline: 0; }
.auth-card input:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(30,37,34,.07); }
.auth-error { margin-top: 9px; color: #b43f31; font-size: 10px; }
.auth-submit { width: 100%; min-height: 48px; margin-top: 17px; border: 0; border-radius: 12px; background: var(--ink); color: white; font-weight: 750; cursor: pointer; }
.auth-card > small { display: block; margin-top: 18px; color: #91958f; text-align: center; font-size: 9px; }

@keyframes fade-in { from { opacity: 0; } }
@keyframes rise-in { from { opacity: 0; transform: translateY(16px) scale(.98); } }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 10px); } }
@keyframes breathe { to { transform: scale(1.05) rotate(-2deg); } }
@keyframes alert-pulse { 50% { box-shadow: 0 0 0 11px rgba(233,80,56,.05); transform: scale(1.03); } }

@media (max-width: 820px) {
  .topbar, .overview, .due-alerts, .next-strip, .list-section, footer { width: min(100% - 28px, 680px); }
  .topbar { height: 74px; }
  .brand-mark { width: 38px; height: 38px; border-radius: 12px; font-size: 18px; }
  .desktop-add { display: none; }
  .overview { padding: 27px 0 30px; }
  .spend-card { padding: 25px; border-radius: 25px 25px 25px 8px; box-shadow: 9px 10px 0 rgba(195,217,205,.85); }
  .overview-body { grid-template-columns: 1fr; gap: 18px; }
  .total-stack { margin-top: 24px; }
  .spend-stats { padding: 20px 0 0; border-left: 0; border-top: 1px solid rgba(255,255,255,.13); }
  .primary-total strong, .empty-total strong { font-size: clamp(40px, 12vw, 56px); }
  .next-strip { margin-bottom: 58px; }
  .section-heading { align-items: center; }
  .filters { align-items: stretch; flex-direction: column; }
  .search-box { flex-basis: auto; }
  .subscription-grid { grid-template-columns: 1fr; }
  .due-alert-list article { grid-template-columns: 42px 1fr auto; }
  .due-alert-price { grid-column: 2; align-items: flex-start; }
  .due-alert-list article > button { grid-row: 1 / span 2; grid-column: 3; }
  .floating-add { position: fixed; right: 20px; bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 20; width: 58px; height: 58px; display: grid; place-items: center; border: 0; border-radius: 19px; background: var(--coral); color: white; font-size: 30px; box-shadow: 0 13px 30px rgba(218,78,56,.33); cursor: pointer; }
  footer { padding-bottom: 100px; }
}

@media (max-width: 540px) {
  .overview { padding-top: 22px; }
  .spend-card-head { font-size: 10px; }
  .next-strip { padding: 13px; grid-template-columns: auto 1fr auto; gap: 11px; }
  .next-price { grid-column: 2; justify-self: start; }
  .next-strip > button { grid-row: 1 / span 2; grid-column: 3; }
  .date-ticket { grid-row: 1 / span 2; }
  .section-heading { align-items: flex-start; flex-direction: column; gap: 21px; }
  .view-toggle { width: 100%; }
  .view-toggle button { flex: 1; }
  .card-main { grid-template-columns: 44px minmax(0, 1fr); padding: 16px 14px; gap: 10px; }
  .card-edit-area { gap: 8px; }
  .service-title { flex-wrap: wrap; gap: 5px; }
  .renewal-badge { padding: 3px 6px; }
  .service-avatar { width: 44px; height: 44px; border-radius: 13px; }
  .service-price strong { font-size: 13px; }
  .card-foot { min-height: 52px; padding: 5px 13px; }
  .card-foot > div { justify-content: flex-end; }
  .modal-backdrop { padding: 0; align-items: end; }
  .sheet { width: 100%; max-height: 92vh; padding: 24px 18px calc(24px + env(safe-area-inset-bottom)); border-radius: 26px 26px 0 0; }
  .sheet::before { content: ""; display: block; width: 34px; height: 4px; margin: -12px auto 19px; border-radius: 99px; background: #d1cdc4; }
  .field-row, .amount-row { grid-template-columns: 1fr 1fr; gap: 9px; }
  .app-search-row { grid-template-columns: minmax(0, 1fr) 76px; }
  .app-search-row > button { grid-column: 1 / -1; min-height: 39px; }
  .app-results { grid-template-columns: 1fr; }
  .form-options { align-items: flex-start; flex-direction: column; }
  .color-picker { width: 100%; }
  .color-picker > div { justify-content: space-between; }
  .color-picker button { width: 26px; height: 26px; }
}

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

/* v2: custom categories, uploaded icons, and variable monthly amounts */
.brand-app-icon { width: 44px; height: 44px; display: block; border-radius: 13px; object-fit: cover; box-shadow: 4px 4px 0 rgba(255,112,88,.32); }
.category-scroll button.hidden-category { border-style: dashed; border-color: #a68c70; color: #725d48; background: #f3eadc; }
.category-scroll button.hidden-category.selected { border-style: solid; border-color: #6f5540; color: white; background: #6f5540; }
.renewal-badge.hidden { background: #f1e5d5; color: #76583e; }
.icon-source-actions { margin: 7px 0 9px; display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 9px; }
.upload-icon-button { padding: 7px 10px; border: 1px solid #cfc9be; border-radius: 9px; background: white; color: var(--ink); font-size: 10px; font-weight: 750; cursor: pointer; }

.monthly-amounts { margin: 0 0 16px; padding: 15px; border: 1px solid #dacbb7; border-radius: 16px; background: #fbf5ea; }
.hidden-pricing-mode { margin: 0 0 14px; }
.hidden-pricing-mode > span { display: block; margin-bottom: 7px; color: #616761; font-size: 11px; font-weight: 700; }
.hidden-pricing-mode > div { padding: 4px; display: grid; grid-template-columns: 1fr 1fr; gap: 4px; border-radius: 13px; background: #ebe3d7; }
.hidden-pricing-mode button { min-height: 53px; padding: 8px 11px; border: 0; border-radius: 10px; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; background: transparent; color: var(--muted); cursor: pointer; }
.hidden-pricing-mode button.selected { background: white; color: var(--ink); box-shadow: 0 3px 10px rgba(30,37,34,.08); }
.hidden-pricing-mode strong { font-size: 11px; }
.hidden-pricing-mode small { font-size: 8px; }
.monthly-amounts-head { margin-bottom: 11px; display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.monthly-amounts-head > div { display: flex; flex-direction: column; gap: 4px; }
.monthly-amounts-head strong { font-size: 12px; }
.monthly-amounts-head small { color: var(--muted); font-size: 9px; line-height: 1.5; }
.monthly-amounts-head button { flex: none; padding: 7px 9px; border: 0; border-radius: 8px; background: #6f5540; color: white; font-size: 9px; font-weight: 750; cursor: pointer; }
.add-month-row-button { width: 100%; min-height: 38px; margin-top: 10px; border: 1px dashed #b99d7c; border-radius: 9px; background: #fffaf3; color: #6f5540; font-size: 10px; font-weight: 750; cursor: pointer; }
.month-amount-row { margin-top: 7px; display: grid; grid-template-columns: 1fr 1fr 31px; gap: 7px; }
.month-amount-row input { min-width: 0; height: 39px; padding: 0 9px; border: 1px solid #d9cbb8; border-radius: 9px; background: white; }
.month-amount-row button { border: 0; border-radius: 9px; background: #f5dfd9; color: #a43d31; font-size: 18px; cursor: pointer; }
.record-danger-zone { margin-top: 17px; padding: 12px; display: flex; justify-content: flex-end; gap: 8px; border: 1px solid #efd0c9; border-radius: 13px; background: #fff7f5; }
.record-danger-zone button { padding: 8px 11px; border: 1px solid #dfaea4; border-radius: 9px; background: white; color: #a8382e; font-size: 10px; font-weight: 750; cursor: pointer; }

.category-settings { margin-bottom: 18px; padding: 15px; border: 1px solid var(--line); border-radius: 16px; background: #f8f5ee; }
.category-settings-head { margin-bottom: 12px; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.category-settings-head > div { display: flex; flex-direction: column; gap: 4px; }
.category-settings-head strong { font-size: 13px; }
.category-settings-head small { color: var(--muted); font-size: 9px; line-height: 1.5; }
.category-settings-head button, .save-category-button { padding: 8px 10px; border: 0; border-radius: 9px; background: var(--ink); color: white; font-size: 9px; font-weight: 750; cursor: pointer; }
.category-setting-row { margin-top: 7px; display: grid; grid-template-columns: minmax(0,1fr) 105px 32px; gap: 7px; }
.category-setting-row input, .category-setting-row select { min-width: 0; height: 39px; padding: 0 9px; border: 1px solid #d9d3c8; border-radius: 9px; background: white; font-size: 10px; }
.category-setting-row > button { border: 0; border-radius: 9px; background: #f6dfda; color: #a23b30; font-size: 17px; cursor: pointer; }
.save-category-button { width: 100%; margin-top: 12px; min-height: 39px; }
.backup-live-status { margin: -4px 0 16px; padding: 14px; display: grid; grid-template-columns: 9px minmax(0,1fr) auto; gap: 10px; align-items: center; border: 1px solid #cce3d5; border-radius: 15px; background: #f1faf4; }
.backup-live-dot { width: 9px; height: 9px; border-radius: 50%; background: #42a36c; box-shadow: 0 0 0 5px rgba(66,163,108,.10); }
.backup-live-status > div { display: flex; flex-direction: column; gap: 4px; }
.backup-live-status strong { font-size: 11px; }
.backup-live-status small { color: #5e7465; font-size: 9px; line-height: 1.5; }
.backup-live-status b { padding: 5px 7px; border-radius: 999px; background: #dcefe3; color: #397250; font-size: 8px; }
.backup-live-status.has-error { border-color: #edc6bd; background: #fff5f2; }
.backup-live-status.has-error .backup-live-dot { background: #d95545; box-shadow: 0 0 0 5px rgba(217,85,69,.10); }
.backup-live-status.has-error b { background: #f5dcd6; color: #9d3a30; }
.realtime-backups { margin: 0 0 18px; padding: 14px; border: 1px solid #ded6ca; border-radius: 15px; background: #fffdf8; }
.realtime-backups-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.realtime-backups-head > div { display: flex; flex-direction: column; gap: 4px; }
.realtime-backups-head strong { font-size: 12px; }
.realtime-backups-head small { color: var(--muted); font-size: 9px; line-height: 1.5; }
.realtime-backups-head > span { flex: none; padding: 4px 7px; border-radius: 999px; background: #eee8de; color: #756b5e; font-size: 8px; font-weight: 750; }
.realtime-backup-list { margin-top: 10px; display: grid; gap: 7px; }
.realtime-backup-row { min-height: 48px; padding: 8px 9px 8px 11px; display: flex; align-items: center; justify-content: space-between; gap: 10px; border: 1px solid #e5ded3; border-radius: 11px; background: white; }
.realtime-backup-row > div { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.realtime-backup-row strong { font-size: 10px; }
.realtime-backup-row small { overflow: hidden; color: var(--muted); font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.realtime-backup-row button { flex: none; padding: 7px 10px; border: 1px solid #b9a58d; border-radius: 8px; background: #fffaf3; color: #634c38; font-size: 9px; font-weight: 750; cursor: pointer; }
.realtime-backup-empty { margin-top: 10px; padding: 12px; border-radius: 10px; background: #f5f1ea; color: var(--muted); font-size: 9px; text-align: center; }
.month-report-toolbar { width: min(1180px, calc(100% - 40px)); margin: -35px auto 38px; padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; gap: 18px; border: 1px solid #dfd4c3; border-radius: 16px; background: rgba(255,255,255,.62); box-shadow: 0 8px 28px rgba(48,42,35,.05); }
.month-report-toolbar > div:first-child { display: flex; flex-direction: column; gap: 3px; }
.month-report-toolbar strong { font-size: 12px; }
.month-report-toolbar small { color: var(--muted); font-size: 9px; }
.month-report-controls { display: flex; align-items: center; gap: 6px; }
.month-report-controls button { height: 36px; min-width: 36px; padding: 0 10px; border: 1px solid #d6cabb; border-radius: 9px; background: white; color: var(--ink); font-size: 18px; cursor: pointer; }
.month-report-controls input { height: 36px; padding: 0 9px; border: 1px solid #d6cabb; border-radius: 9px; background: white; color: var(--ink); font-size: 11px; }
.month-report-controls .month-current-button { font-size: 10px; font-weight: 750; }
[hidden] { display: none !important; }

@media (max-width: 540px) {
  .brand-app-icon { width: 39px; height: 39px; border-radius: 12px; }
  .category-settings-head { flex-direction: column; }
  .category-settings-head button { width: 100%; }
  .category-setting-row { grid-template-columns: minmax(0,1fr) 96px 32px; }
  .month-amount-row { grid-template-columns: minmax(0,1fr) minmax(0,1fr) 31px; }
  .month-report-toolbar { width: calc(100% - 28px); margin: -34px auto 32px; align-items: stretch; flex-direction: column; gap: 10px; }
  .month-report-controls { display: grid; grid-template-columns: 36px minmax(0,1fr) 36px auto; }
  .month-report-controls input { min-width: 0; width: 100%; }
}
