/* LPS Warranty — same design language as the feedback portal: paper/ink, orange accent,
   Space Grotesk headings, Inter body, no all caps. */
[hidden] { display: none !important; }
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --paper: #f5f2ec;
  --cream: #ede9df;
  --ink: #0f0e0c;
  --muted: #7a7469;
  --border: #c8c0b0;
  --border-light: #e2ddd5;
  --white: #ffffff;
  --accent: #d4560a;
  --accent-bg: #fde8d8;
  --blue: #2a5c8a;
  --blue-bg: #ddeaf5;
  --green: #4a7c3f;
  --green-bg: #e3f0e0;
  --red: #b83232;
  --red-bg: #fee2e2;
  --yellow: #c17f24;
  --yellow-bg: #fdf6e3;
  --radius: 6px;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 2px 8px rgba(0,0,0,.04);
  --header-h: 54px;
}

body { font-family: 'Inter', -apple-system, sans-serif; font-size: 13px; line-height: 1.5; background: var(--paper); color: var(--ink); }
h1, h2, h3 { font-family: 'Space Grotesk', sans-serif; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 22px; }
h2 { font-size: 18px; margin-bottom: 6px; }
h3 { font-size: 14px; margin-bottom: 10px; }
code { font-family: ui-monospace, Menlo, monospace; font-size: 12px; background: var(--cream); padding: 1px 4px; border-radius: 3px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.row { display: flex; gap: 8px; align-items: center; }
.row > input, .row > select { flex: 1; }

/* ── Form controls ── */
label { display: block; font-weight: 500; margin-bottom: 12px; }
label > input, label > textarea, label > select { margin-top: 4px; }
input, select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--white);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 10px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
input:disabled, textarea:disabled { background: var(--cream); color: var(--muted); }
textarea { resize: vertical; }

.btn { font: inherit; font-weight: 600; border: 1px solid transparent; border-radius: var(--radius); padding: 8px 14px; cursor: pointer; background: none; color: var(--ink); white-space: nowrap; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--ink); color: var(--paper); }
.btn-primary:hover:not(:disabled) { background: var(--accent); }
.btn-secondary { background: var(--white); border-color: var(--border); }
.btn-secondary:hover:not(:disabled) { border-color: var(--ink); }
.btn-ghost { padding: 6px 10px; font-weight: 500; }
.btn-ghost:hover { background: var(--cream); }
.btn-link { padding: 4px 6px; font-weight: 500; color: var(--blue); }
.btn-link.danger { color: var(--red); }

/* ── Sign-in ── */
.auth { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 24px 16px; }
.auth-box { width: 100%; max-width: 380px; background: var(--white); border: 1px solid var(--border-light); border-radius: 10px; padding: 28px; box-shadow: var(--shadow); }
.auth-box .brand { margin-bottom: 22px; font-size: 20px; }
.auth-box .btn-primary { width: 100%; margin-top: 4px; }
.auth-box .btn-link { display: block; margin: 8px auto 0; }
.auth-box p.muted { margin-bottom: 14px; }
.qr { display: flex; justify-content: center; margin: 6px 0 10px; }
.qr img { width: 200px; height: 200px; }
.codes { font-family: ui-monospace, Menlo, monospace; font-size: 14px; background: var(--cream); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 14px; line-height: 1.8; }
.error { margin-top: 12px; color: var(--red); background: var(--red-bg); border-radius: var(--radius); padding: 8px 10px; }
.version { margin-top: 18px; text-align: center; font-size: 11px; color: var(--muted); }

.brand { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 17px; color: var(--ink); text-decoration: none; }
.brand span { color: var(--accent); }

/* ── App shell ── */
.topbar { position: sticky; top: 0; z-index: 10; height: var(--header-h); display: flex; align-items: center; justify-content: space-between; padding: 0 20px; background: var(--white); border-bottom: 1px solid var(--border-light); }
.topbar-right { display: flex; gap: 6px; align-items: center; }
.menu { position: relative; }
.menu-pop { position: absolute; right: 0; top: calc(100% + 4px); min-width: 210px; background: var(--white); border: 1px solid var(--border-light); border-radius: var(--radius); box-shadow: var(--shadow); padding: 4px; }
.menu-pop button { display: block; width: 100%; text-align: left; font: inherit; background: none; border: 0; padding: 8px 10px; border-radius: 4px; cursor: pointer; }
.menu-pop button:hover { background: var(--cream); }

.layout { display: grid; grid-template-columns: 320px 1fr; height: calc(100vh - var(--header-h)); }
.sidebar { display: flex; flex-direction: column; border-right: 1px solid var(--border-light); background: var(--paper); min-height: 0; }
.sidebar-tools { padding: 14px; display: flex; flex-direction: column; gap: 8px; border-bottom: 1px solid var(--border-light); }
.sidebar-tools .row select { flex: 1; min-width: 0; }
.warning { font-size: 12px; color: var(--yellow); background: var(--yellow-bg); border-radius: var(--radius); padding: 8px 10px; }
.claim-list { overflow-y: auto; flex: 1; padding: 8px; }
.claim-item { display: block; text-decoration: none; color: inherit; padding: 10px 12px; border-radius: var(--radius); margin-bottom: 2px; }
.claim-item:hover { background: var(--cream); }
.claim-item.active { background: var(--white); box-shadow: var(--shadow); }
.claim-item-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 2px; }
.claim-item-meta { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.main { overflow-y: auto; padding: 24px 28px 48px; min-width: 0; }
.empty { color: var(--muted); text-align: center; padding: 60px 20px; }
.empty.small { padding: 24px 10px; }

.pill { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.pill-pending { background: var(--yellow-bg); color: var(--yellow); }
.pill-approved { background: var(--green-bg); color: var(--green); }
.pill-denied { background: var(--red-bg); color: var(--red); }

/* ── Claim detail ── */
.claim-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 20px; }
.claim-head-right { display: flex; align-items: center; gap: 8px; }
.claim-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(300px, 2fr); gap: 16px; align-items: start; }
.claim-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.card { background: var(--white); border: 1px solid var(--border-light); border-radius: 10px; padding: 18px; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 10px; padding: 6px 0; border-top: 1px solid var(--border-light); }
.kv:first-of-type { border-top: 0; }
.kv span { color: var(--muted); }
.kv div { white-space: pre-wrap; overflow-wrap: anywhere; }

.section { border-top: 1px solid var(--border-light); padding: 8px 0; }
.section:first-of-type { border-top: 0; }
.section summary { cursor: pointer; font-weight: 600; padding: 2px 0; }
.section .kv:first-of-type { border-top: 1px solid var(--border-light); margin-top: 6px; }

.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.photo { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.photo-label { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.photo-img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--radius); background: var(--cream); display: flex; align-items: center; justify-content: center; font-size: 12px; text-align: center; padding: 0; }
img.photo-img { cursor: zoom-in; }
.file-link { color: var(--blue); text-decoration: none; font-weight: 600; }

.status-buttons { display: grid; grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); gap: 6px; margin-bottom: 14px; }
.status-btn { position: relative; margin: 0; font-weight: 600; }
/* Visually hidden radio. Without the explicit size it inherits `input { width: 100% }`
   and, being absolutely positioned, stretched the page sideways. */
.status-btn input { position: absolute; top: 0; left: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.status-btn span { display: block; text-align: center; white-space: nowrap; padding: 8px 4px; border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; font-size: 12px; }
.status-btn input:focus-visible + span { outline: 2px solid var(--accent); }
.status-pending input:checked + span { background: var(--yellow-bg); border-color: var(--yellow); color: var(--yellow); }
.refund-rate { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: end; margin-bottom: 12px; }
.refund-rate label { margin: 0; }
.rate-type { display: grid; grid-template-columns: repeat(2, minmax(64px, auto)); gap: 6px; }
.rate-type input:checked + span { background: var(--blue-bg); border-color: var(--blue); color: var(--blue); }
.status-approved input:checked + span { background: var(--green-bg); border-color: var(--green); color: var(--green); }
.status-denied input:checked + span { background: var(--red-bg); border-color: var(--red); color: var(--red); }
.decision label .muted { font-weight: 400; }
.hint { font-size: 12px; color: var(--muted); margin: -4px 0 12px; }
.decision .row { margin: 4px 0 8px; }

.history { list-style: none; display: flex; flex-direction: column; gap: 6px; font-size: 12px; }

/* ── Modal, lightbox, toast ── */
.modal { position: fixed; inset: 0; background: rgba(15,14,12,.4); display: flex; align-items: flex-start; justify-content: center; padding: 60px 16px; z-index: 50; overflow-y: auto; }
.modal-box { width: 100%; max-width: 860px; background: var(--white); border-radius: 10px; padding: 22px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.invite-result { background: var(--cream); border-radius: var(--radius); padding: 12px; margin: 12px 0; }
.invite-result input { margin-top: 6px; }
.table { width: 100%; border-collapse: collapse; margin-top: 16px; }
.table th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; padding: 6px 8px; border-bottom: 1px solid var(--border-light); }
.table td { padding: 8px; border-bottom: 1px solid var(--border-light); }
.table .actions { text-align: right; white-space: nowrap; }

.lightbox { position: fixed; inset: 0; background: rgba(15,14,12,.9); display: flex; align-items: center; justify-content: center; gap: 16px; z-index: 60; cursor: zoom-out; padding: 24px; }
.lb-figure { display: flex; flex-direction: column; align-items: center; gap: 12px; min-width: 0; max-height: 100%; cursor: default; }
.lb-figure img { max-width: calc(100vw - 200px); max-height: calc(100vh - 110px); object-fit: contain; border-radius: var(--radius); }
.lb-figure figcaption { color: var(--paper); font-size: 14px; text-align: center; }
.lb-btn { flex-shrink: 0; width: 52px; height: 52px; border-radius: 50%; border: 0; background: rgba(245,242,236,.14); color: var(--paper); font: 600 30px/1 Inter, sans-serif; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.lb-btn:hover { background: rgba(245,242,236,.28); }
.lb-btn:focus-visible { outline: 2px solid var(--accent); }
.lb-close { position: absolute; top: 20px; right: 20px; width: 44px; height: 44px; font-size: 20px; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: var(--radius); z-index: 70; box-shadow: var(--shadow); max-width: calc(100vw - 32px); }
.toast-error { background: var(--red); }
.toast-warn { background: var(--yellow); }

/* ── SKU fields + picker ── */
.sku-field label { margin-bottom: 6px; }
.sku-field .row { margin-top: 4px; }
.sku-info { margin: 0 0 12px; font-size: 12px; }
.sku-info:empty { display: none; }
.sku-ok, .sku-suggest { display: flex; align-items: center; gap: 10px; background: var(--paper); border-radius: var(--radius); padding: 6px 8px; }
.sku-ok img, .sku-suggest img { width: 44px; height: 44px; object-fit: contain; background: var(--white); border-radius: 4px; flex-shrink: 0; }
.sku-suggest { background: var(--green-bg); }
.sku-suggest > div { flex: 1; min-width: 0; }
.sku-warn { color: var(--yellow); background: var(--yellow-bg); border-radius: var(--radius); padding: 6px 8px; }

.modal-wide { max-width: 1100px; }
.picker-compare { display: flex; gap: 8px; align-items: center; overflow-x: auto; margin-bottom: 12px; }
.picker-compare:empty { display: none; }
.picker-compare img { height: 84px; width: 84px; object-fit: cover; border-radius: var(--radius); cursor: zoom-in; flex-shrink: 0; }
.picker-compare .muted { flex-shrink: 0; margin-right: 4px; }
.picker-filters { display: grid; grid-template-columns: 2fr 1fr 110px 1fr; gap: 8px; margin-bottom: 8px; }
.picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin-top: 10px; max-height: 60vh; overflow-y: auto; padding: 2px; }
.pick-tile { font: inherit; text-align: left; background: var(--white); border: 1px solid var(--border-light); border-radius: var(--radius); padding: 8px; cursor: pointer; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.pick-tile:hover, .pick-tile:focus-visible { border-color: var(--accent); outline: none; box-shadow: var(--shadow); }
.pick-img { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; background: var(--paper); border-radius: 4px; margin-bottom: 4px; overflow: hidden; }
.pick-img img { width: 100%; height: 100%; object-fit: contain; }
.pick-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-meta { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-sku { font-family: ui-monospace, Menlo, monospace; font-size: 11px; color: var(--muted); overflow-wrap: anywhere; }

/* ── Small screens ── */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; height: auto; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--border-light); }
  .claim-list { max-height: 40vh; }
  .main { padding: 18px 16px 40px; }
  .claim-grid { grid-template-columns: 1fr; }

  .kv { grid-template-columns: 1fr; gap: 2px; }
  .table { display: block; overflow-x: auto; }
  .picker-filters { grid-template-columns: 1fr 1fr; }
  .lightbox { padding: 12px; gap: 6px; }
  .lb-btn { width: 40px; height: 40px; font-size: 24px; }
  .lb-figure img { max-width: calc(100vw - 110px); }
}
.error-text { color: var(--red); }
.sku-warn-card { display: flex; align-items: center; gap: 10px; background: var(--yellow-bg); border-radius: var(--radius); padding: 6px 8px; }
.sku-warn-card img { width: 44px; height: 44px; object-fit: contain; background: var(--white); border-radius: 4px; flex-shrink: 0; }
.sku-flag { color: var(--yellow); font-weight: 600; margin-left: auto; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.photo-link { font-size: 12px; color: var(--blue); text-decoration: none; }
.photo-link:hover { text-decoration: underline; }
