/* Design tokens derived from Airbnb's DESIGN.md (VoltAgent/awesome-design-md),
   grounded in lost-found's own domain rather than copied verbatim. */
:root {
  --color-primary: #ff385c;
  --color-primary-active: #e00b41;
  --color-primary-disabled: #ffd1da;
  --color-canvas: #ffffff;
  --color-surface-soft: #f7f7f7;
  --color-surface-strong: #f2f2f2;
  --color-ink: #222222;
  --color-body: #3f3f3f;
  --color-muted: #6a6a6a;
  --color-muted-soft: #929292;
  --color-on-primary: #ffffff;
  --color-hairline: #dddddd;
  --color-hairline-soft: #ebebeb;
  --color-border-strong: #c1c1c1;
  --color-error: #c13515;
  --color-error-hover: #b32505;
  --color-error-bg: #fdeeea;

  /* Case/item status — lost-found's own semantic layer, not in Airbnb's doc */
  --color-status-active-bg: #e5f5ec;
  --color-status-active-fg: #0f7a3d;
  --color-status-closed-bg: #f2f2f2;
  --color-status-closed-fg: #6a6a6a;
  --color-status-draft-bg: #fdf1e0;
  --color-status-draft-fg: #b36b00;
  --color-status-claimed-bg: #eef2ff;
  --color-status-claimed-fg: #3b4ecc;

  --font-family: 'Noto Sans TC', -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Microsoft JhengHei', sans-serif;

  --space-xxs: 2px;
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-base: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-xxl: 48px;
  --space-section: 64px;

  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --shadow-card: rgba(0, 0, 0, 0.02) 0 0 0 1px, rgba(0, 0, 0, 0.04) 0 2px 6px 0, rgba(0, 0, 0, 0.1) 0 4px 8px 0;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
}

body {
  margin: 0;
  background: var(--color-canvas);
  color: var(--color-ink);
  font-family: var(--font-family);
  font-size: 16px;
  line-height: 1.5;
  font-weight: 400;
}

h1,
h2,
h3 {
  color: var(--color-ink);
  margin: 0 0 var(--space-base);
  text-wrap: balance;
}

h1 {
  font-size: 21px;
  font-weight: 700;
  line-height: 1.43;
}

h2 {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.25;
}

p {
  color: var(--color-body);
  margin: 0 0 var(--space-base);
}

a {
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 500;
}

a:hover {
  text-decoration: underline;
}

ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Site header */
.site-header {
  border-bottom: 1px solid var(--color-hairline-soft);
}

.site-header__inner {
  max-width: 960px;
  margin: 0 auto;
  padding: var(--space-base) var(--space-lg);
  display: flex;
  align-items: center;
}

.brand {
  font-size: 20px;
  font-weight: 700;
  color: var(--color-ink);
}

.brand:hover {
  text-decoration: none;
}

/* Page containers */
.page {
  max-width: 720px;
  margin: 0 auto;
  padding: var(--space-xl) var(--space-lg) var(--space-xxl);
}

.page--narrow {
  max-width: 400px;
}

.page--wide {
  max-width: 960px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 48px;
  padding: 0 var(--space-lg);
  border-radius: var(--radius-sm);
  border: none;
  font-family: var(--font-family);
  font-size: 16px;
  font-weight: 500;
  line-height: 1.25;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.btn-primary,
button[type='submit'] {
  background: var(--color-primary);
  color: var(--color-on-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 48px;
  padding: 0 var(--space-lg);
  border-radius: var(--radius-sm);
  border: none;
  font-family: var(--font-family);
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
}

.btn-primary:hover,
button[type='submit']:hover {
  background: var(--color-primary-active);
}

.btn-secondary {
  background: var(--color-canvas);
  color: var(--color-ink);
  border: 1px solid var(--color-ink);
}

.btn-secondary:hover {
  background: var(--color-surface-soft);
}

.btn-sm {
  height: 36px;
  padding: 0 var(--space-base);
  font-size: 14px;
}

.btn-link {
  display: inline-block;
  margin-top: var(--space-sm);
}

/* Forms */
.form {
  display: flex;
  flex-direction: column;
  gap: var(--space-base);
}

.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.field label {
  font-size: 14px;
  font-weight: 500;
  color: var(--color-body);
}

input[type='text'],
input[type='email'],
input[type='password'],
input[type='datetime-local'],
input[type='file'],
input[type='tel'],
textarea,
select {
  width: 100%;
  padding: 12px var(--space-base);
  border: 1px solid var(--color-hairline);
  border-radius: var(--radius-sm);
  font-family: var(--font-family);
  font-size: 16px;
  color: var(--color-ink);
  background: var(--color-canvas);
}

textarea {
  min-height: 100px;
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--color-ink);
  box-shadow: 0 0 0 1px var(--color-ink);
}

.error {
  background: var(--color-error-bg);
  color: var(--color-error);
  padding: var(--space-md) var(--space-base);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
}

/* Cards */
.card {
  background: var(--color-canvas);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: var(--space-lg);
}

/* Case / item list as cards */
.stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-base);
}

.list-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-base);
  background: var(--color-canvas);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: var(--space-base) var(--space-lg);
}

.list-card__title {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-ink);
}

.list-card a {
  font-weight: 600;
}

.list-card__meta {
  margin: var(--space-xxs) 0 0;
}

/* Public URL callout on the case manage page */
.public-url-box {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  margin-bottom: var(--space-base);
  word-break: break-all;
}

.public-url-box .hint {
  margin: 0;
}

/* Draft review crop thumbnail */
.draft-thumb-link {
  display: block;
  align-self: flex-start;
}

.draft-thumb {
  display: block;
  max-width: 200px;
  max-height: 200px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-card);
  object-fit: cover;
}

/* Status badges — claim-tag style, keyed to known values with a neutral fallback */
.status {
  display: inline-flex;
  align-items: center;
  padding: var(--space-xs) var(--space-md);
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.18;
  background: var(--color-surface-strong);
  color: var(--color-muted);
}

.status[data-status='active'] {
  background: var(--color-status-active-bg);
  color: var(--color-status-active-fg);
}

.status[data-status='closed'] {
  background: var(--color-status-closed-bg);
  color: var(--color-status-closed-fg);
}

.status[data-status='draft'] {
  background: var(--color-status-draft-bg);
  color: var(--color-status-draft-fg);
}

.status[data-status='claimed'] {
  background: var(--color-status-claimed-bg);
  color: var(--color-status-claimed-fg);
}

/* Comments */
.comment {
  padding: var(--space-base);
  border-bottom: 1px solid var(--color-hairline-soft);
}

.comment:last-child {
  border-bottom: none;
}

.comment__author {
  font-weight: 600;
  color: var(--color-ink);
}

.comment__meta {
  display: block;
  font-size: 13px;
  color: var(--color-muted);
  margin-top: var(--space-xxs);
}

/* Draft review fieldsets */
fieldset {
  border: 1px solid var(--color-hairline);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  margin: 0 0 var(--space-base);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

fieldset legend {
  padding: 0 var(--space-xs);
  font-weight: 600;
}

.field--checkbox {
  flex-direction: row;
  align-items: center;
  gap: var(--space-sm);
}

.field--checkbox label {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-weight: 400;
}

/* Admin table */
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--color-canvas);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

th,
td {
  text-align: left;
  padding: var(--space-md) var(--space-base);
  border-bottom: 1px solid var(--color-hairline-soft);
  font-size: 14px;
}

th {
  background: var(--color-surface-soft);
  font-weight: 600;
  color: var(--color-body);
}

tr:last-child td {
  border-bottom: none;
}

.actions-row {
  display: flex;
  align-items: center;
  gap: var(--space-base);
  flex-wrap: wrap;
}

/* Detection progress */
.progress-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-base);
  padding: var(--space-xxl) var(--space-lg);
  text-align: center;
}

.spinner {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  border: 3px solid var(--color-hairline);
  border-top-color: var(--color-primary);
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .spinner {
    animation: none;
  }
}

.progress-text {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-ink);
  margin: 0;
}

.progress-count {
  font-size: 14px;
  color: var(--color-muted);
  margin: 0;
  font-variant-numeric: tabular-nums;
}

/* Empty state / helper text */
.hint {
  color: var(--color-muted);
  font-size: 14px;
}

@media (max-width: 480px) {
  .page {
    padding: var(--space-lg) var(--space-base) var(--space-xl);
  }

  .list-card {
    flex-direction: column;
    align-items: flex-start;
  }
}
