/* Silvey theme, matched to the hiring_manager app:
   navy #0a1d4f, blue #2055ce; Space Grotesk (body), Outfit (display). */

@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("vendor/fonts/space-grotesk-latin.woff2") format("woff2");
}

@font-face {
  font-family: "Outfit";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("vendor/fonts/outfit-latin.woff2") format("woff2");
}

:root {
  --background: #f4f6f8;
  --foreground: #333333;
  --card: #ffffff;
  --card-foreground: #333333;
  --primary: #2055ce;
  --primary-foreground: #ffffff;
  --secondary: #e8e8e8;
  --secondary-foreground: #0a1d4f;
  --muted: #eef1f4;
  --muted-foreground: #667085;
  --accent: #eaf0fb;
  --accent-foreground: #0a1d4f;
  --destructive: #dc2626;
  --destructive-foreground: #ffffff;
  --border: #e1e5e9;
  --input: #e1e5e9;
  --ring: #2055ce;
  --radius: 0.5rem;
  --success: #16a34a;
  --success-foreground: #ffffff;
  --warning: #f59e0b;
  --warning-foreground: #1a1a1a;

  --navy: #0a1d4f;
  --brand-blue: #2055ce;

  --sidebar-background: #0a1d4f;
  --sidebar-foreground: #dbe3f3;
  --sidebar-accent: #15265c;
  --sidebar-border: #1b2c63;

  --heading: var(--navy);
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --font-sans: "Space Grotesk", system-ui, -apple-system, sans-serif;
  --font-display: "Outfit", "Space Grotesk", system-ui, sans-serif;
}

:root.dark {
  --background: #0b1220;
  --foreground: #e7ebf2;
  --card: #121a2b;
  --card-foreground: #e7ebf2;
  --primary: #4f7fe8;
  --primary-foreground: #ffffff;
  --secondary: #1c2740;
  --secondary-foreground: #d8e0ee;
  --muted: #1c2740;
  --muted-foreground: #9aa6bd;
  --accent: #18223a;
  --accent-foreground: #d8e0ee;
  --destructive: #ef4444;
  --destructive-foreground: #ffffff;
  --border: #243149;
  --input: #243149;
  --ring: #4f7fe8;
  --success: #22c55e;
  --success-foreground: #04130a;
  --warning: #fbbf24;
  --warning-foreground: #1a1200;

  --sidebar-background: #071233;
  --sidebar-foreground: #cdd7ec;
  --sidebar-accent: #102046;
  --sidebar-border: #18254d;

  --heading: var(--foreground);
}

* {
  box-sizing: border-box;
  border-color: var(--border);
}

/* Keep the hidden attribute winning over component display rules. */
[hidden] {
  display: none !important;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--background);
  color: var(--foreground);
  min-height: 100vh;
}

/* Navy brand bar, echoing the hiring_manager sidebar */
.app-header {
  background: var(--sidebar-background);
  color: var(--sidebar-foreground);
  border-bottom: 1px solid var(--sidebar-border);
}

.header-inner {
  width: min(30rem, 100%);
  margin: 0 auto;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.brand-mark {
  display: flex;
  height: 2.25rem;
  width: 2.25rem;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #ffffff;
}

.brand-text {
  line-height: 1.2;
  flex: 1;
}

.brand-name {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #ffffff;
}

.brand-sub {
  font-size: 0.7rem;
  color: color-mix(in srgb, var(--sidebar-foreground) 80%, transparent);
}

#theme-toggle {
  border: none;
  background: none;
  color: var(--sidebar-foreground);
  border-radius: calc(var(--radius) - 2px);
  padding: 0.4rem 0.6rem;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.15s;
}

#theme-toggle:hover {
  background: var(--sidebar-accent);
  color: #ffffff;
}

main {
  width: min(30rem, 100%);
  margin: 0 auto;
  padding: 1.5rem 1rem 2rem;
}

.page-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  line-height: 1.3;
  color: var(--heading);
}

.status {
  margin: 0.15rem 0 1.25rem;
  font-size: 0.75rem;
  line-height: 1.3;
  color: var(--muted-foreground);
}

.link-btn {
  border: none;
  background: none;
  padding: 0;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  color: var(--primary);
  cursor: pointer;
  text-decoration: underline;
}

/* Summary = navy brand card */
.summary {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  background: var(--navy);
  color: #ffffff;
  border-radius: var(--radius);
  border: 1px solid var(--sidebar-border);
  box-shadow: var(--shadow-sm);
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
}

.summary-label {
  font-size: 0.8rem;
  color: #dbe3f3;
}

.summary-total {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

h2 {
  margin: 0 0 0.85rem;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--card-foreground);
}

section > h2,
#requests-heading {
  color: var(--heading);
}

.card {
  background: var(--card);
  color: var(--card-foreground);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
}

.field-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.85rem;
}

.field-row label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted-foreground);
}

.field-row input,
.field-row textarea,
.field-row select,
.alloc-row select,
.alloc-row input {
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--input);
  border-radius: calc(var(--radius) - 2px);
  font-size: 0.9rem;
  font-family: var(--font-sans);
  background: var(--background);
  color: var(--foreground);
  transition: box-shadow 0.15s, border-color 0.15s;
}

.field-row input:focus-visible,
.field-row textarea:focus-visible,
.field-row select:focus-visible,
.alloc-row select:focus-visible,
.alloc-row input:focus-visible,
.scan-row input:focus-visible {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--ring) 35%, transparent);
}

.scan-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.radio-group {
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 2px);
  padding: 0.65rem 0.85rem 0.75rem;
  margin: 0 0 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.radio-group legend {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted-foreground);
  padding: 0 0.35rem;
}

.radio-group label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  cursor: pointer;
}

.radio-group input[type="radio"] {
  accent-color: var(--primary);
}

.alloc-row {
  display: grid;
  grid-template-columns: 1.4fr 1.2fr 5.5rem auto;
  gap: 0.4rem;
  align-items: center;
  margin-bottom: 0.5rem;
}

.alloc-row select,
.alloc-row input {
  min-width: 0;
  width: 100%;
}

.alloc-remove {
  border: none;
  background: none;
  color: var(--muted-foreground);
  font-size: 1.1rem;
  line-height: 1;
  padding: 0.2rem 0.35rem;
  cursor: pointer;
  border-radius: calc(var(--radius) - 2px);
}

.alloc-remove:hover {
  color: var(--destructive);
}

.alloc-sum {
  margin: 0.5rem 0 0.85rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted-foreground);
  font-variant-numeric: tabular-nums;
}

.coding-error {
  margin: 0 0 0.85rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--destructive);
}

.coding-heading {
  margin: 0 0 0.4rem;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
}

.coding-list {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
}

.coding-list li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}

.scan-row input[type="file"] {
  flex: 1;
  min-width: 0;
  font-size: 0.8rem;
  font-family: var(--font-sans);
  color: var(--muted-foreground);
}

/* Buttons follow the hiring_manager variants: primary, outline, destructive */
button {
  font-family: var(--font-sans);
}

.scan-row button,
.actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  height: 2.5rem;
  padding: 0 1rem;
  border: none;
  border-radius: calc(var(--radius) - 2px);
  background: var(--primary);
  color: var(--primary-foreground);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.15s, opacity 0.15s;
}

.scan-row button:hover,
.actions button:hover {
  background: color-mix(in srgb, var(--primary) 90%, transparent);
}

.scan-row button:focus-visible,
.actions button:focus-visible,
#theme-toggle:focus-visible,
.edit-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--background), 0 0 0 4px var(--ring);
}

.scan-row button:disabled,
.actions button:disabled {
  pointer-events: none;
  opacity: 0.5;
}

.actions .btn-deny {
  background: var(--destructive);
  color: var(--destructive-foreground);
}

.actions .btn-deny:hover {
  background: color-mix(in srgb, var(--destructive) 90%, transparent);
}

.actions #cancel-edit,
.actions .btn-update {
  background: var(--background);
  border: 1px solid var(--input);
  color: var(--foreground);
}

.actions #cancel-edit:hover,
.actions .btn-update:hover {
  background: var(--accent);
  color: var(--accent-foreground);
}

.actions .btn-approve {
  background: var(--success);
  color: var(--success-foreground);
}

.actions .btn-approve:hover {
  background: color-mix(in srgb, var(--success) 90%, transparent);
}

.receipt-list {
  list-style: none;
  margin: 0 0 0.5rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.receipt-list li {
  background: var(--muted);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 2px);
  padding: 0.5rem 0.6rem;
  font-size: 0.82rem;
}

.receipt-view {
  border: none;
  background: none;
  color: var(--muted-foreground);
  cursor: pointer;
  padding: 0.15rem 0.3rem;
  border-radius: calc(var(--radius) - 2px);
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.receipt-view:hover,
.receipt-view:focus-visible {
  color: var(--primary);
}

.receipt-preview {
  position: fixed;
  z-index: 50;
  width: min(20rem, calc(100vw - 2rem));
  max-height: 24rem;
  overflow: auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgb(0 0 0 / 0.25);
  padding: 0.6rem;
}

.receipt-preview img {
  max-width: 100%;
  display: block;
  border-radius: calc(var(--radius) - 2px);
}

.receipt-preview pre {
  margin: 0;
  font-size: 0.72rem;
  white-space: pre-wrap;
  color: var(--foreground);
}

.receipt-fields {
  display: grid;
  grid-template-columns: 5.5rem 1.4fr 1.2fr;
  gap: 0.4rem;
  margin-top: 0.45rem;
}

.receipt-fields input,
.receipt-fields select {
  min-width: 0;
  width: 100%;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--input);
  border-radius: calc(var(--radius) - 2px);
  font-size: 0.82rem;
  font-family: var(--font-sans);
  background: var(--card);
  color: var(--foreground);
}

.receipt-list .receipt-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.receipt-list .alloc-remove {
  flex-shrink: 0;
}

.scan-result {
  margin: 0.4rem 0 0;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--success);
}

:root.dark .scan-result {
  color: #4ade80;
}

fieldset {
  border: none;
  margin: 0;
  padding: 0;
}

fieldset:disabled {
  opacity: 0.5;
  pointer-events: none;
}

.actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.25rem;
}

.state {
  margin: 0 0 1rem;
  font-size: 0.875rem;
  color: var(--muted-foreground);
}

.state-error {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: color-mix(in srgb, var(--destructive) 8%, var(--card));
  border: 1px solid color-mix(in srgb, var(--destructive) 40%, transparent);
  border-radius: var(--radius);
  padding: 0.6rem 0.75rem;
}

.state-error p {
  margin: 0;
  flex: 1;
  font-size: 0.85rem;
  color: var(--destructive);
}

.state-error button {
  height: 2rem;
  padding: 0 0.75rem;
  border: 1px solid var(--destructive);
  border-radius: calc(var(--radius) - 2px);
  background: none;
  color: var(--destructive);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
}

.state-empty {
  background: var(--muted);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
  font-size: 0.85rem;
}

.manager-note {
  background: color-mix(in srgb, var(--warning) 10%, var(--card));
  border: 1px solid color-mix(in srgb, var(--warning) 45%, transparent);
  border-radius: var(--radius);
  padding: 0.7rem 0.85rem;
  margin-bottom: 0.85rem;
  font-size: 0.8rem;
}

.manager-note strong {
  color: var(--heading);
}

.manager-note p {
  margin: 0.3rem 0 0;
  color: var(--muted-foreground);
}

.requests {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.requests li {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 0.75rem 1rem;
}

.request-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.request-merchant {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.9rem;
  font-weight: 500;
}

.amount {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

/* Badges: rounded-full px-2.5 py-0.5 text-xs font-semibold, solid variants */
.chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.125rem 0.625rem;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid transparent;
}

.chip-pending {
  background: var(--secondary);
  color: var(--secondary-foreground);
}

.chip-approved {
  background: var(--success);
  color: var(--success-foreground);
}

.chip-denied {
  background: var(--destructive);
  color: var(--destructive-foreground);
}

.chip-changes_requested {
  background: var(--warning);
  color: var(--warning-foreground);
}

.request-note {
  margin: 0.45rem 0 0;
  font-size: 0.78rem;
  color: var(--muted-foreground);
}

.edit-btn {
  margin-top: 0.6rem;
  height: 2rem;
  padding: 0 0.75rem;
  border: 1px solid var(--input);
  border-radius: calc(var(--radius) - 2px);
  background: var(--background);
  color: var(--foreground);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.15s;
}

.edit-btn:hover {
  background: var(--accent);
  color: var(--accent-foreground);
}

.detail-list {
  margin: 0 0 1rem;
}

.detail-list div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--border);
}

.detail-list dt {
  color: var(--muted-foreground);
  font-size: 0.85rem;
}

.detail-list dd {
  margin: 0;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.receipt-details {
  margin-bottom: 1rem;
  font-size: 0.85rem;
}

.receipt-details summary {
  cursor: pointer;
  color: var(--primary);
  font-weight: 500;
}

.receipt-details pre {
  background: var(--muted);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 2px);
  padding: 0.7rem 0.85rem;
  overflow-x: auto;
  font-size: 0.75rem;
  color: var(--foreground);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Feedback */
.header-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

#feedback-dialog {
  background: var(--card);
  color: var(--card-foreground);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1.25rem 1.5rem;
  width: min(28rem, 90vw);
}

#feedback-dialog::backdrop {
  background: rgba(0, 0, 0, 0.4);
}

#feedback-dialog textarea {
  width: 100%;
  resize: vertical;
}
