/* SpaceSync shared UI — source of truth for Usage · Billing modal + installer + popup.
   Edit THIS file. Then run scripts/sync-ss-ui.sh (build.ps1 also copies into the installer).
   Copy targets:
     dashboard/static/css/ss-ui.css
     installer/windows/wwwroot/ss-ui.css
     chrome-extension/popup/ss-ui.css
     homepage/ss-ui.css
   Do not re-declare these colors / radii / paddings in installer app.css or dashboard.css. */
:root {
  --ss-bg: #faf8f5;
  --ss-card: #ffffff;
  --ss-text: #1c1c1e;
  --ss-text2: #8e8e93;
  --ss-text3: #aeaeb2;
  --ss-muted: #8e8e93;
  --ss-line: #e5e5ea;
  --ss-blue: #0a66ff;
  --ss-btn-face: #F4F6F8;
  --ss-btn-icon: #7B8794;
  --ss-nm-dark: rgba(15, 21, 29, 0.16);
  --ss-nm-light: rgba(255, 255, 255, 0.95);
  --ss-blue-bg: #e8f1ff;
  --ss-btn: #1c1c1e;
  --ss-btn-hover: #000000;
  --ss-switch-off: #e5e5ea;
  --ss-accent: #12b76a;
  --ss-accent-hover: #0e9f5c;
  --ss-danger: #ff3b30;
  --ss-radius-shell: 22px;
  --ss-radius-card: 18px;
  --ss-radius-pill: 999px;
  --ss-shadow-shell: 0 24px 64px rgba(0, 0, 0, 0.18);
  --ss-shadow-card: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.04);
  --ss-pad-shell: 18px 16px 16px;
  --ss-pad-card: 16px 16px 14px;
  --ss-gap-stack: 12px;
  --ss-font: "DM Sans", "Segoe UI", system-ui, sans-serif;
}

.ss-ui,
.ss-ui body {
  margin: 0;
  background: var(--ss-bg);
  color: var(--ss-text);
  font-family: var(--ss-font);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

.ss-shell,
.ub-shell {
  background: var(--ss-bg);
  border-radius: var(--ss-radius-shell);
  padding: var(--ss-pad-shell);
  box-shadow: var(--ss-shadow-shell);
}

.ss-header,
.ub-shell .ub-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  padding: 0 2px;
}

.ss-header img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  flex-shrink: 0;
}

.ss-title,
.ub-shell .ub-title {
  margin: 0;
  flex: 1;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ss-text);
}

.ss-stack,
.ub-shell .ub-body {
  display: flex;
  flex-direction: column;
  gap: var(--ss-gap-stack);
}

.ss-card,
.ub-shell .ub-card {
  background: var(--ss-card);
  border-radius: var(--ss-radius-card);
  padding: var(--ss-pad-card);
  box-shadow: var(--ss-shadow-card);
}

.ss-card-head,
.ub-shell .ub-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.ss-card-title,
.ub-shell .ub-card-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--ss-text);
  letter-spacing: -0.01em;
}

.ss-label,
.ub-shell .ub-kv-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--ss-text2);
}

.ss-value {
  margin-top: 4px;
  font-size: 18px;
  font-weight: 800;
  color: var(--ss-text);
  letter-spacing: -0.02em;
  line-height: 1.15;
  word-break: keep-all;
  overflow-wrap: normal;
  hyphens: none;
}

.ss-hint,
.ub-shell .ub-hint,
.ub-shell .ub-plan-hint {
  margin: 8px 0 0;
  font-size: 11px;
  color: var(--ss-text2);
  line-height: 1.45;
  word-break: keep-all;
  overflow-wrap: break-word;
  hyphens: none;
}

.ss-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ss-row-top {
  align-items: flex-start;
}

.ss-inline {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.ss-inline .ss-label,
.ss-inline .ss-hint {
  margin: 0;
  white-space: nowrap;
}

.ss-nowrap {
  white-space: nowrap;
}

/* Switch — on = modal blue */
.ss-switch,
.ub-shell .ub-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  flex-shrink: 0;
}
.ss-switch input,
.ub-shell .ub-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.ss-switch-ui,
.ub-shell .ub-switch-ui {
  width: 42px;
  height: 26px;
  border-radius: var(--ss-radius-pill);
  background: var(--ss-switch-off);
  position: relative;
  transition: background 0.18s;
}
.ss-switch-ui::after,
.ub-shell .ub-switch-ui::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: transform 0.18s;
}
.ss-switch input:checked + .ss-switch-ui,
.ub-shell .ub-switch input:checked + .ub-switch-ui {
  background: var(--ss-blue);
}
.ss-switch input:checked + .ss-switch-ui::after,
.ub-shell .ub-switch input:checked + .ub-switch-ui::after {
  transform: translateX(16px);
}
.ub-shell .ub-switch input:disabled {
  cursor: default;
}
.ub-shell .ub-switch input:disabled + .ub-switch-ui {
  opacity: 0.95;
}

/* Badge / plan pill */
.ss-badge,
.ub-shell .ub-plan-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--ss-radius-pill);
  background: var(--ss-blue-bg);
  color: var(--ss-blue);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 10px;
}

/* Status capsule (popup) */
.ss-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  padding: 6px 12px;
  border-radius: var(--ss-radius-pill);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  background: #e5e5ea;
  color: #3a3a3c;
}
.ss-pill-ok { background: var(--ss-accent); color: #fff; }
.ss-pill-unknown { background: #e5e5ea; color: #3a3a3c; }
.ss-pill-bad { background: #ffe5e3; color: #c41d16; }

/* Buttons — modal black pills */
.ss-btn-primary,
.ss-btn-ghost,
.ss-btn-sec,
.ub-shell .ub-pill,
.ub-shell .ub-pill-block {
  border: none;
  border-radius: var(--ss-radius-pill);
  padding: 10px 18px;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  line-height: 1.2;
  text-align: center;
  font-family: inherit;
  white-space: nowrap;
}
.ss-btn-primary,
.ub-shell .ub-pill,
.ub-shell .ub-pill-block {
  background: var(--ss-btn);
  color: #fff;
}
.ss-btn-primary:hover,
.ub-shell .ub-pill:hover,
.ub-shell .ub-pill-block:hover {
  background: var(--ss-btn-hover);
}
.ss-btn-primary:disabled,
.ub-shell .ub-pill:disabled,
.ub-shell .ub-pill-block:disabled {
  opacity: 0.4;
  cursor: default;
  background: var(--ss-btn);
}
.ss-btn-block,
.ub-shell .ub-pill-block {
  width: 100%;
  display: block;
}
.ss-btn-ghost,
.ss-btn-sec,
.ub-shell .ub-pill.ub-pill-muted,
.ub-shell .ub-pill-block.ub-pill-muted {
  background: #e5e5ea;
  color: #3a3a3c;
  padding: 8px 12px;
  font-size: 12px;
}
.ss-btn-ghost:hover,
.ss-btn-sec:hover {
  background: #d8d8dc;
}

.ss-link,
.ub-shell .ub-portal-link {
  display: inline-block;
  margin-top: 10px;
  font-size: 11px;
  color: var(--ss-blue);
  text-decoration: none;
  font-weight: 500;
}
.ss-link:hover,
.ub-shell .ub-portal-link:hover {
  text-decoration: underline;
}

.ss-input {
  width: 100%;
  box-sizing: border-box;
  border: none;
  background: var(--ss-bg);
  border-radius: 12px;
  padding: 11px 14px;
  margin-top: 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ss-text);
  font-family: inherit;
}
.ss-input:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(10, 102, 255, 0.18);
  background: #fff;
}

.ss-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 14px 0 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--ss-text);
  cursor: pointer;
}
.ss-check input {
  width: 18px;
  height: 18px;
  margin-top: 1px;
  accent-color: var(--ss-blue);
  flex-shrink: 0;
}

.ss-terms {
  margin-top: 8px;
  max-height: 168px;
  overflow: auto;
  background: var(--ss-bg);
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 13px;
  color: #3a3a3c;
}
.ss-terms p { margin: 0 0 8px; }
.ss-terms p:last-child { margin-bottom: 0; }
.ss-terms ul { margin: 0 0 8px 18px; padding: 0; }
.ss-terms li { margin-bottom: 4px; }

.ss-progress { margin-top: 16px; }
.ss-bar {
  height: 6px;
  background: #ececf0;
  border-radius: var(--ss-radius-pill);
  overflow: hidden;
}
.ss-bar-fill {
  height: 100%;
  width: 0;
  background: var(--ss-btn);
  border-radius: var(--ss-radius-pill);
  transition: width 0.25s ease;
}

/* Numbers, dates, money: never break in the middle of a token */
.ss-value-keep,
.ss-value-date,
.ss-value-time,
.ub-shell .ub-credit-num,
.ub-shell .ub-credit-amt,
.ub-shell .ub-side-value,
.ub-shell .ub-wallet-row-head span:last-child,
.ub-shell .ub-month-pct,
.ub-shell .ub-pack-credits,
.ub-shell .ub-pack-price,
.ub-shell .ub-num,
.ub-shell .ub-table th.ub-num,
.ub-shell .ub-table td.ub-num,
.ub-shell .ub-cat-chip strong,
.ub-shell .ub-select {
  word-break: keep-all;
  overflow-wrap: normal;
  hyphens: none;
}

.ub-shell .ub-summary-row,
.ub-shell .ub-summary-main,
.ub-shell .ub-summary-side,
.ub-shell .ub-wallet-row-head,
.ub-shell .ub-pack-row,
.ub-shell .ub-plan-row {
  min-width: 0;
}

.ub-shell .ub-summary-side {
  max-width: 46%;
  flex: 0 1 auto;
  text-align: right;
}

.ub-shell .ub-side-value {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: baseline;
  column-gap: 6px;
  row-gap: 2px;
  margin-top: 3px;
  font-size: 14px;
  font-weight: 700;
  color: var(--ss-text);
}

.ss-value-date {
  font-weight: 700;
  white-space: nowrap;
}

.ss-value-time {
  font-size: 11px;
  font-weight: 500;
  color: var(--ss-text2);
  white-space: nowrap;
}

.ub-shell .ub-wallet-row-head {
  flex-wrap: wrap;
  justify-content: space-between;
}

.ub-shell .ub-wallet-row-head span:last-child,
.ub-shell .ub-pack-price,
.ub-shell .ub-num,
.ub-shell .ub-table td.ub-num,
.ub-shell .ub-cat-chip strong {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.ub-shell .ub-pack-credits {
  flex: 1 1 auto;
  min-width: 0;
}

.ub-shell .ub-pack-price {
  flex: 0 0 auto;
}

.ub-shell .ub-tax-note,
.ub-shell .ub-cat-chip,
.ub-shell .ub-credit-label,
.ub-shell .ub-credit-sub,
.ub-shell .ub-side-label {
  word-break: keep-all;
  overflow-wrap: break-word;
  hyphens: none;
}

/* Usage · Billing credit amount — never break mid-word */
.ub-shell .ub-credit-num,
.ss-credit-num {
  font-size: clamp(20px, 6.4vw, 34px);
  font-weight: 800;
  line-height: 1.05;
  color: var(--ss-text);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  white-space: nowrap;
  word-break: keep-all;
  overflow-wrap: normal;
  hyphens: none;
}
.ub-shell .ub-credit-amt {
  display: inline-block;
  white-space: nowrap;
  word-break: keep-all;
}

.ss-dev {
  background: var(--ss-card);
  border-radius: var(--ss-radius-card);
  box-shadow: var(--ss-shadow-card);
  padding: 0 16px 4px;
}
.ss-dev > summary {
  cursor: pointer;
  list-style: none;
  padding: 14px 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--ss-text2);
  user-select: none;
}
.ss-dev > summary::-webkit-details-marker { display: none; }
.ss-dev > summary::after {
  content: "▸";
  float: right;
  color: var(--ss-text3);
}
.ss-dev[open] > summary::after { content: "▾"; }
.ss-dev[open] > summary {
  border-bottom: 1px solid var(--ss-line);
  margin-bottom: 12px;
}

.ss-msg {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--ss-bg);
  color: var(--ss-text2);
  font-size: 12px;
}
.ss-msg-error { background: #ffe5e3; color: #c41d16; }
.ss-msg-ok { background: #e8f8f0; color: #0f6b5c; }

.ss-nbtn-row{
  display:flex;
  align-items:stretch;
  gap:8px;
  width:100%;
  min-width:0;
  overflow:visible;
  margin-bottom:14px;
  padding:0;
}
.ss-nbtn{
  flex:1 1 0; min-width:0;
  display:flex; flex-direction:column; align-items:center; justify-content:flex-start; gap:5px;
  box-sizing:border-box;
  padding:11px 4px 10px; border:0; cursor:pointer;
  background:var(--ss-btn-face, #F4F6F8);
  border-radius:14px;
  color:var(--ss-btn-icon, #7B8794);
  box-shadow:
     3px  3px 7px var(--ss-nm-dark,  rgba(15,21,29,.16)),
    -3px -3px 6px var(--ss-nm-light, rgba(255,255,255,.95));
  transition:box-shadow .16s, color .16s, transform .16s;
}
.ss-nbtn .ss-ic{ height:24px; display:flex; align-items:center; justify-content:center; overflow:hidden; flex:none; }
.ss-nbtn .ss-ic svg,
.ss-nbtn svg{ width:24px; height:24px; flex:none; }
.ss-nbtn .ss-ic-flow svg{ fill:currentColor; }
.ss-nbtn .ss-ic-mirror svg,
.ss-nbtn .ss-ic-programs svg{ fill:none; stroke:currentColor; }
.ss-nbtn .ss-nbtn-lb{
  font-size:10.5px; letter-spacing:-.1px; line-height:1.15; font-weight:600;
  color:var(--ss-muted);
  text-align:center; word-break:keep-all;
  min-height:2.3em;
  display:flex; align-items:center; justify-content:center;
  max-width:100%;
}
.ss-nbtn:hover{ color:var(--ss-blue); }
.ss-nbtn:hover .ss-nbtn-lb{ color:var(--ss-blue); }
.ss-nbtn:active{
  transform:translateY(1px);
  box-shadow:
    inset  3px  3px 6px var(--ss-nm-dark),
    inset -2px -2px 5px var(--ss-nm-light);
  color:var(--ss-blue);
}
.ss-nbtn:focus-visible{ outline:2px solid var(--ss-blue); outline-offset:2px; }
.ss-nbtn:disabled{
  opacity:.45;
  cursor:not-allowed;
  transform:none;
}
