:root {
  color-scheme: light dark;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  line-height: 1.45;
  --gold: #a26f29;
  --gold-hover: light-dark(#8c5e20, #bb8337);
  --gold-light: light-dark(#8a5a1c, #c3924b);
  --gold-border: light-dark(#d9bf96, #5d4324);
  --focus-ring: #a26f292d;
  --on-gold: #fff;
  --bg: light-dark(#f6f3ee, #090909);
  --text: light-dark(#1f1b16, #f4f0e9);
  --heading: light-dark(#120f0b, #fff);
  --header-bg: light-dark(#fff, #050505);
  --header-border: light-dark(#e6dccd, #2f2415);
  --header-text: light-dark(#5c554c, #c5bfb6);
  --header-shadow: light-dark(#3c280a14, #0008);
  --sidebar-bg: light-dark(#fbf9f5, #0d0d0d);
  --sidebar-border: light-dark(#e6dfd4, #292929);
  --sidebar-heading: light-dark(#8a8278, #817b73);
  --account-text: light-dark(#2a251f, #e8e3dc);
  --account-small: light-dark(#7d756b, #8f8981);
  --account-hover-bg: light-dark(#f4ece0, #17130e);
  --account-hover-border: light-dark(#e3cfae, #4a3820);
  --account-active-bg: light-dark(#f6ead8, #1c160f);
  --account-active-text: light-dark(#7a5119, #e6bd7c);
  --account-active-small: light-dark(#8f6a35, #c2a77f);
  --card-from: light-dark(#fff, #171717);
  --card-to: light-dark(#fdfbf8, #121212);
  --card-shadow: light-dark(#3c280a0f, #0005);
  --border: light-dark(#e4ddd2, #303030);
  --divider: light-dark(#ece5da, #2d2d2d);
  --label: light-dark(#3b352e, #d6d0c8);
  --input-bg: light-dark(#fff, #0b0b0b);
  --input-border: light-dark(#cfc6b8, #46413a);
  --input-text: light-dark(#1f1b16, #fff);
  --muted: light-dark(#6f685f, #aaa39a);
  --hint: light-dark(#7d766c, #8e8880);
  --subtle: light-dark(#8a8379, #7f7971);
  --mono: light-dark(#7a5a2a, #cdb48e);
  --money: light-dark(#5e4520, #d8c29f);
  --negative: light-dark(#b33a2c, #e5a099);
  --danger: light-dark(#b4382b, #e59a91);
  --warn-bg: light-dark(#fbf1e1, #291d0e);
  --warn-border: light-dark(#e7c993, #6b4c25);
  --warn-text: light-dark(#7a4f12, #e3bd83);
  --ok-bg: light-dark(#eaf6ec, #15251a);
  --ok-border: light-dark(#b5dbbd, #315c3a);
  --ok-text: light-dark(#22652f, #9dd2a6);
  --th-bg: light-dark(#f5efe6, #0d0d0d);
  --th-text: light-dark(#6e5124, #cdb48e);
  --row-hover: light-dark(#faf4ea, #1b1711);
  --status-bg: light-dark(#eee9e1, #292929);
  --status-text: light-dark(#4f4840, #d5d0c8);
  --status-confirmed-bg: light-dark(#e3f3e6, #17271b);
  --status-confirmed-text: light-dark(#256b33, #a6d2ad);
  --status-downloaded-bg: light-dark(#f8ecd8, #2a2114);
  --status-downloaded-text: light-dark(#7f5718, #e0bd87);
  --status-released-bg: light-dark(#f6eedf, #24201a);
  --status-released-text: light-dark(#7d5a22, #d8b87f);
  --status-released-border: light-dark(#d6b680, #76552b);
  --tab-text: light-dark(#5f574d, #bdb6ad);
  --tab-border: light-dark(#ddd3c4, #38332c);
  --tab-active-bg: light-dark(#a26f29, #5f421d);
  --segment-bg: light-dark(#f4efe7, #111);
  --segment-active-bg: light-dark(#fff, #2a2116);
  color: var(--text);
  background: var(--bg);
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--bg); }
header { min-height: 76px; background: var(--header-bg); color: var(--heading); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; padding: 12px 30px; border-bottom: 1px solid var(--header-border); box-shadow: 0 10px 30px var(--header-shadow); }
header .brand { display: flex; align-items: center; gap: 20px; color: var(--heading); text-decoration: none; font-size: 21px; font-weight: 760; letter-spacing: .01em; }
.brand img { display: block; width: 152px; height: 42px; object-fit: contain; }
.brand .logo-on-dark { display: none; }
:root[data-theme="dark"] .brand .logo-on-dark { display: block; }
:root[data-theme="dark"] .brand .logo-on-light { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .brand .logo-on-dark { display: block; }
  :root:not([data-theme="light"]) .brand .logo-on-light { display: none; }
}
.brand span { padding-left: 20px; border-left: 1px solid var(--gold-border); }
header nav { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; color: var(--header-text); font-size: 14px; }
header form { margin: 0; }
.link { background: transparent; border: 0; padding: 0; color: var(--gold-light); }
.prefs { display: flex; gap: 8px; }
.segmented { display: flex; padding: 2px; border: 1px solid var(--border); border-radius: 8px; background: var(--segment-bg); }
.segmented button { display: grid; place-items: center; min-width: 32px; height: 28px; padding: 0 8px; border: 0; border-radius: 6px; background: transparent; color: var(--header-text); font-size: 12px; font-weight: 700; letter-spacing: .04em; }
.segmented button:hover:not(:disabled) { background: var(--account-hover-bg); border: 0; transform: none; }
.segmented button[aria-pressed="true"] { background: var(--segment-active-bg); color: var(--gold-light); box-shadow: 0 0 0 1px var(--gold-border); }
.segmented button:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
.segmented svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.app { display: grid; grid-template-columns: 245px minmax(0, 1fr); min-height: calc(100vh - 76px); }
aside { background: var(--sidebar-bg); border-right: 1px solid var(--sidebar-border); padding: 28px 18px; }
aside h2 { font-size: 11px; text-transform: uppercase; letter-spacing: .14em; color: var(--sidebar-heading); margin: 0 10px 13px; }
.account { display: block; padding: 13px 14px; margin: 6px 0; border: 1px solid transparent; border-radius: 8px; color: var(--account-text); text-decoration: none; transition: background .16s ease, border-color .16s ease; }
.account:hover { background: var(--account-hover-bg); border-color: var(--account-hover-border); }
.account small { display: block; color: var(--account-small); font-size: 12px; margin-top: 3px; }
.account.active { background: var(--account-active-bg); border-color: var(--gold); color: var(--account-active-text); box-shadow: inset 3px 0 0 var(--gold); }
.account.active small { color: var(--account-active-small); }
.settings { display: block; margin: 24px 11px; color: var(--gold-light); font-size: 14px; }
.content { padding: 38px; max-width: none; width: 100%; min-width: 0; }
.pagehead { display: flex; justify-content: space-between; align-items: start; }
.pagehead h1, .content > h1 { margin: 0; color: var(--heading); letter-spacing: -.025em; }
.pagehead p { margin: 5px 0 20px; color: var(--gold-light); }
.card { background: linear-gradient(145deg, var(--card-from), var(--card-to)); border: 1px solid var(--border); border-radius: 11px; padding: 25px; margin: 0 0 22px; box-shadow: 0 16px 36px var(--card-shadow); }
.card h1, .card h2 { margin-top: 0; color: var(--heading); }
.card h2 { font-size: 18px; }
.gridform { display: grid; grid-template-columns: repeat(3, minmax(170px, 1fr)) auto; gap: 16px; align-items: end; }
label { display: grid; gap: 7px; font-size: 13px; font-weight: 650; color: var(--label); }
input { width: 100%; padding: 10px 11px; border: 1px solid var(--input-border); border-radius: 7px; color: var(--input-text); font: inherit; background: var(--input-bg); outline: none; }
input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--focus-ring); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.mono { font-variant-numeric: tabular-nums; font-family: ui-monospace, "Cascadia Code", Consolas, monospace; color: var(--mono); }
.muted { color: var(--muted); font-weight: 500; }
button { border: 1px solid var(--gold); border-radius: 7px; padding: 11px 16px; background: var(--gold); color: var(--on-gold); font-weight: 750; cursor: pointer; transition: background .16s ease, border-color .16s ease, transform .16s ease; }
button:hover:not(:disabled) { background: var(--gold-hover); border-color: var(--gold-hover); transform: translateY(-1px); }
button:disabled { opacity: .38; cursor: not-allowed; }
.secondary { padding: 7px 10px; background: transparent; color: var(--gold-light); margin-left: 10px; }
.secondary:hover:not(:disabled) { color: var(--on-gold); }
.inline { display: inline; }
.hint { font-size: 12px; color: var(--hint); margin-bottom: 0; }
.warning, .notice.error { background: var(--warn-bg); border: 1px solid var(--warn-border); color: var(--warn-text); }
.notice { padding: 12px 14px; border-radius: 8px; margin-bottom: 18px; }
.notice.success { background: var(--ok-bg); border: 1px solid var(--ok-border); color: var(--ok-text); }
.tablewrap { overflow-x: auto; width: 100%; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; background: var(--th-bg); color: var(--th-text); }
th, td { padding: 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th:nth-child(2), td:nth-child(2) { white-space: normal; overflow-wrap: anywhere; }
tbody tr:hover { background: var(--row-hover); }
.money { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--money); }
.money.negative { color: var(--negative); }
td a, .auth a { color: var(--gold-light); }
.danger-link { display: inline-block; margin-left: 12px; color: var(--danger) !important; }
.status { display: inline-block; padding: 3px 8px; border-radius: 99px; background: var(--status-bg); color: var(--status-text); font-size: 12px; }
.status.confirmed { background: var(--status-confirmed-bg); color: var(--status-confirmed-text); }
.status.downloaded { background: var(--status-downloaded-bg); color: var(--status-downloaded-text); }
.status.released { background: var(--status-released-bg); color: var(--status-released-text); border: 1px solid var(--status-released-border); }
.cancel { display: inline-block; color: var(--gold-light); text-align: center; padding: 9px; }
.auth { min-height: calc(100vh - 76px); display: grid; place-items: center; padding: 25px; }
.auth .card { width: min(440px, 100%); border-top: 3px solid var(--gold); }
.auth form { display: grid; gap: 16px; }
.auth p, .content > p { color: var(--muted); }
.partner-content { padding-top: 30px; }
.partner-content .pagehead { align-items: center; margin-bottom: 20px; }
.partner-content .pagehead p { margin-bottom: 0; }
.refresh { color: var(--gold-light); border: 1px solid var(--gold-border); border-radius: 7px; padding: 9px 13px; text-decoration: none; }
.partner-tabs { display: flex; gap: 8px; margin: 0 0 18px; }
.partner-tab { color: var(--tab-text); text-decoration: none; padding: 9px 15px; border: 1px solid var(--tab-border); border-radius: 99px; }
.partner-tab.active { color: var(--on-gold); background: var(--tab-active-bg); border-color: var(--gold); }
.partner-table { padding: 0; overflow: hidden; }
.partner-table th, .partner-table td { padding: 13px 14px; vertical-align: middle; }
.partner-table th:nth-child(2), .partner-table td:nth-child(2) { white-space: nowrap; overflow-wrap: normal; }
.partner-table th:nth-child(3), .partner-table td:nth-child(3) { white-space: normal; min-width: 210px; }
.partner-table th:last-child, .partner-table td:last-child { min-width: 490px; }
.partner-table .money small { display: block; color: var(--subtle); font-size: 11px; font-weight: 500; margin-top: 2px; }
.charge-form { display: grid; grid-template-columns: minmax(170px, 1fr) 120px auto; gap: 8px; align-items: center; }
.charge-form input { min-width: 0; }
.amount-input { position: relative; display: block; }
.amount-input span { position: absolute; left: 11px; top: 10px; color: var(--subtle); }
.amount-input input { padding-left: 28px; }
.charge-form button { white-space: nowrap; }
.charge-confirm { width: min(560px, 100%) !important; }
.eyebrow { color: var(--gold-light) !important; text-transform: uppercase; letter-spacing: .12em; font-size: 12px; font-weight: 800; }
.charge-confirm dl { margin: 22px 0; }
.charge-confirm dl div { display: grid; grid-template-columns: 150px 1fr; gap: 18px; padding: 11px 0; border-bottom: 1px solid var(--divider); }
.charge-confirm dt { color: var(--hint); }
.charge-confirm dd { margin: 0; color: var(--heading); overflow-wrap: anywhere; }
@media (max-width: 800px) {
  header { padding: 12px 18px; }
  .brand { gap: 12px !important; }
  .brand img { width: 116px; height: 34px; }
  .brand span { padding-left: 12px; font-size: 17px; }
  .app { grid-template-columns: 1fr; min-height: calc(100vh - 76px); }
  aside { border-right: 0; border-bottom: 1px solid var(--sidebar-border); }
  .content { padding: 22px; }
  .gridform { grid-template-columns: 1fr; }
  .partner-table th:last-child, .partner-table td:last-child { min-width: 360px; }
  .charge-form { grid-template-columns: 1fr; }
  header nav .user { display: none; }
}
