@font-face {
  font-family: Geist;
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('fonts/geist-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: Geist;
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('fonts/geist-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Geist Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/geist-mono-400-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: light;
  --canvas: #fafafa;
  --surface: #fff;
  --subtle: #f5f5f5;
  --ink: #171717;
  --muted: #666;
  --line: #e5e5e5;
  --control-line: #858585;
  --solid: #171717;
  --solid-hover: #383838;
  --solid-fg: #fff;
  --focus: #0066cc;
  --pending-bg: #fff4d5;
  --pending-fg: #764600;
  --paid-bg: #e7f7ed;
  --paid-fg: #176139;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;
  --space-12: 48px;
  --radius-1: 6px;
  --radius-2: 8px;
  --page-gutter: clamp(16px, 3.5vw, 48px);
  /* Django's native widgets consume the same semantic colors as the workspace. */
  --primary: var(--subtle);
  --primary-fg: var(--ink);
  --secondary: var(--solid);
  --accent: var(--ink);
  --body-bg: var(--surface);
  --body-fg: var(--ink);
  --body-quiet-color: var(--muted);
  --body-medium-color: var(--ink);
  --body-loud-color: var(--ink);
  --darkened-bg: var(--subtle);
  --selected-bg: var(--subtle);
  --selected-row: var(--subtle);
  --hairline-color: var(--line);
  --border-color: var(--line);
  --header-bg: var(--surface);
  --header-color: var(--ink);
  --header-branding-color: var(--ink);
  --header-link-color: var(--ink);
  --breadcrumbs-bg: var(--surface);
  --breadcrumbs-fg: var(--muted);
  --breadcrumbs-link-fg: var(--ink);
  --link-fg: var(--ink);
  --link-hover-color: var(--muted);
  --link-selected-fg: var(--ink);
  --button-fg: var(--solid-fg);
  --button-bg: var(--solid);
  --button-hover-bg: var(--solid-hover);
  --default-button-bg: var(--solid);
  --default-button-hover-bg: var(--solid-hover);
  --close-button-bg: var(--solid);
  --close-button-hover-bg: var(--solid-hover);
  --object-tools-bg: var(--solid);
  --object-tools-hover-bg: var(--solid-hover);
  --font-family-primary: Geist, "Segoe UI", "Noto Sans CJK SC", "Microsoft YaHei UI", system-ui, sans-serif;
  --font-family-monospace: "Geist Mono", ui-monospace, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --canvas: #0a0a0a;
    --surface: #111;
    --subtle: #1b1b1b;
    --ink: #ededed;
    --muted: #a1a1a1;
    --line: #303030;
    --control-line: #767676;
    --solid: #ededed;
    --solid-hover: #ccc;
    --solid-fg: #171717;
    --focus: #6caeff;
    --pending-bg: #38270b;
    --pending-fg: #ffd17a;
    --paid-bg: #163122;
    --paid-fg: #90dfaa;
    --error-fg: #ff9a93;
    --message-success-bg: #183323;
    --message-warning-bg: #392a13;
    --message-error-bg: #3b1b1b;
  }
}

body { background: var(--canvas); }
#header { box-sizing: border-box; min-height: 64px; height: auto; padding: var(--space-3) var(--page-gutter); gap: var(--space-3); border-bottom: 1px solid var(--line); }
.workspace-brand, .workspace-account { display: flex; align-items: center; }
#header .workspace-brand { gap: var(--space-3); text-decoration: none; }
.workspace-logo { display: block; flex: none; width: 36px; height: 36px; object-fit: contain; }
.brand-title { font-size: 1rem; font-weight: 600; white-space: nowrap; }
.brand-context { color: var(--muted); font-size: .8125rem; padding-left: var(--space-3); border-left: 1px solid var(--line); white-space: nowrap; }
#user-tools.workspace-account { gap: var(--space-4); padding: 0; margin: 0; text-transform: none; letter-spacing: 0; font-size: .8125rem; }
.workspace-account .account-name { color: var(--muted); font-weight: 500; max-width: 18ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#user-tools.workspace-account a, #user-tools.workspace-account button { color: var(--ink); border: 0; line-height: 1.4; min-height: 32px; display: inline-flex; align-items: center; white-space: nowrap; }
#user-tools.workspace-account a:hover, #user-tools.workspace-account button:hover { text-decoration: underline; text-underline-offset: 3px; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

#content { min-width: 0; padding: var(--space-8) var(--page-gutter) var(--space-12); }
#content > h1, .signin-layout h1 { color: var(--ink); font-weight: 600; font-size: 2rem; margin: 0 0 var(--space-2); letter-spacing: -.025em; line-height: 1.25; }
div.breadcrumbs { padding: var(--space-3) var(--page-gutter); border-bottom: 1px solid var(--line); }
#nav-sidebar { background: var(--surface); border-color: var(--line); }
#nav-sidebar .module, #nav-sidebar .module caption, #nav-sidebar tr { background: transparent; }
#nav-sidebar .module caption a { color: var(--muted); font-weight: 600; }
#nav-sidebar tr.current-model { background: var(--subtle); }
#nav-sidebar tr.current-model th a { font-weight: 600; }
#nav-sidebar td, #nav-sidebar th { font-size: .875rem; border-color: var(--line); padding-block: var(--space-2); }
#nav-sidebar #nav-filter { background: var(--surface); padding: var(--space-2); }
.toggle-nav-sidebar { background: var(--surface); }
#nav-sidebar .current-app .section:link, #nav-sidebar .current-app .section:visited { color: var(--ink); }

.workspace-home #content { max-width: 1200px; margin-inline: auto; }
.workspace-intro, .workspace-section-note { color: var(--muted); font-size: .875rem; margin: 0 0 var(--space-6); line-height: 1.5; }
.workspace-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--space-6); align-items: start; }
.workspace-modules { grid-column: span 8; min-width: 0; display: grid; gap: var(--space-8); }
.workspace-history { grid-column: span 4; min-width: 0; }
.workspace-orders { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: var(--space-6); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-2); padding: var(--space-6); }
.queue-summary { display: grid; gap: var(--space-2); }
.queue-actions { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-2); }
.workspace-orders h2, .workspace-group h2, .workspace-history h2 { margin: 0; font-size: 1rem; font-weight: 600; line-height: 1.25; color: var(--ink); }
.workspace-orders p { margin: 0; color: var(--muted); font-size: .875rem; line-height: 1.5; }
.workspace-orders .queue-total { display: flex; align-items: baseline; gap: var(--space-2); }
.queue-total data { color: var(--ink); font-size: 2.5rem; line-height: 1.1; letter-spacing: -.04em; font-weight: 600; font-variant-numeric: tabular-nums; }
a.workspace-open, a.workspace-action { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); box-sizing: border-box; min-height: 36px; padding: var(--space-1) var(--space-3); border-radius: var(--radius-1); border: 1px solid var(--line); font-weight: 500; white-space: nowrap; }
a.workspace-open { color: var(--solid-fg); background: var(--solid); border-color: var(--solid); }
a.workspace-open:hover { color: var(--solid-fg); background: var(--solid-hover); }
a.workspace-action { color: var(--ink); background: var(--surface); }
a.workspace-action:hover { background: var(--subtle); }
.workspace-group:not(:has(li)) { display: none; }
.workspace-group h2, .workspace-history h2 { padding-bottom: var(--space-3); border-bottom: 1px solid var(--line); }
.workspace-group ul, .workspace-history ol { padding: 0; margin: 0; list-style: none; }
.workspace-resource { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-3) 0; border-bottom: 1px solid var(--line); }
.resource-title { font-size: .875rem; font-weight: 600; }
a.resource-title:hover { text-decoration: underline; text-underline-offset: 3px; }
.workspace-resource p { color: var(--muted); margin: var(--space-1) 0 0; line-height: 1.5; }
.workspace-empty { color: var(--muted); margin: var(--space-3) 0 0; line-height: 1.5; }
.workspace-history li { display: grid; gap: var(--space-1); padding: var(--space-3) 0; border-bottom: 1px solid var(--line); list-style: none; }
.workspace-history strong { overflow-wrap: anywhere; font-weight: 500; font-size: .875rem; }
.workspace-history time, .history-action { color: var(--muted); font-size: .75rem; }

.change-list #changelist, .change-form #content-main > form, .password-change-form #content-main > form { border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius-2); }
.change-form #content-main > form, .password-change-form #content-main > form { padding: var(--space-4); }
#changelist .results { overflow-x: auto; }
#changelist table thead th { background: var(--subtle); color: var(--ink); white-space: nowrap; }
#changelist table tbody td, #changelist table tbody th { vertical-align: middle; }
#changelist table tbody th a { text-decoration: underline; text-decoration-color: var(--control-line); text-underline-offset: 3px; }
#changelist table :is(.field-total, .field-price, .field-rating, .column-total, .column-price, .column-rating) { text-align: right; }
#changelist :is(#toolbar, .actions, #changelist-filter) { background: var(--surface); }
#changelist-filter h2, .module h2, .module caption, .inline-group h2 { font-weight: 600; }
.selector-chosen-title { color: var(--solid-fg); }
.object-tools a { letter-spacing: 0; font-size: .8125rem; padding-block: var(--space-2); }
.order-state { display: inline-block; border-radius: var(--radius-1); padding: var(--space-1) var(--space-2); font-weight: 600; white-space: nowrap; }
.order-state--pending { background: var(--pending-bg); color: var(--pending-fg); }
.order-state--paid { background: var(--paid-bg); color: var(--paid-fg); }
.order-state--cancelled { background: var(--subtle); color: var(--muted); }
.field-number > a, .field-number .readonly { font-family: var(--font-family-monospace); }
.field-total, .field-price, .field-created_at, .workspace-history time { font-variant-numeric: tabular-nums; }
.form-row { border-color: var(--line); }
.form-row .readonly { color: var(--ink); overflow-wrap: anywhere; }
input:is([type=text], [type=password], [type=number], [type=email], [type=search]), textarea, select { border-color: var(--control-line); }

.login { background: var(--canvas); }
.login #container { width: 100%; min-width: 0; margin: 0; padding: 0; min-height: 100dvh; border: 0; border-radius: 0; background: transparent; }
.login #header { justify-content: flex-start; padding: var(--space-3) var(--page-gutter); }
.login #main { display: flex; align-items: flex-start; justify-content: center; }
.login #main main { flex: 0 1 460px; min-width: 0; }
.login #content { box-sizing: border-box; width: 100%; padding: clamp(48px, 12vh, 128px) var(--page-gutter) var(--space-12); }
.signin-layout { display: flow-root; }
.signin-intro { color: var(--muted); margin: 0 0 var(--space-6); font-size: .875rem; line-height: 1.5; }
.login .signin-layout .form-row { padding: 0 0 var(--space-4); border: 0; }
.login .signin-layout .form-row label { color: var(--ink); font-size: .875rem; padding: 0; margin-bottom: var(--space-1); font-weight: 500; }
.login .form-row #id_username, .login .form-row #id_password { background: var(--surface); border: 1px solid var(--control-line); border-radius: var(--radius-1); min-height: 44px; padding: var(--space-2) var(--space-3); font-size: 1rem; }
.login .signin-layout .submit-row { border: 0; background: none; padding: var(--space-2) 0 0; }
.signin-layout .submit-row input[type=submit] { width: 100%; min-height: 44px; border-radius: var(--radius-1); font-size: .875rem; font-weight: 600; }

@media (max-width: 1180px) {
  .workspace-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .workspace-modules { grid-column: span 4; }
  .workspace-history { grid-column: span 2; }
}
@media (max-width: 900px) {
  .workspace-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .workspace-modules, .workspace-history { grid-column: 1 / -1; }
}
@media (max-width: 767px) {
  #header { flex-direction: row; align-items: center; flex-wrap: wrap; }
  #user-tools.workspace-account { width: auto; min-width: 0; flex-wrap: wrap; column-gap: var(--space-3); row-gap: 0; }
  #content { padding-block: var(--space-6) var(--space-8); }
  #content > h1, .signin-layout h1 { font-size: 1.5rem; }
  .workspace-intro { margin-bottom: var(--space-4); }
  .workspace-orders { gap: var(--space-4); padding: var(--space-4); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; }
}
