:root {
  color-scheme: dark;
  --ink: #eef6f1;
  --muted: #9fb2a9;
  --surface: #0c211a;
  --surface-2: #102a21;
  --surface-3: #17362b;
  --line: rgba(214, 174, 97, .22);
  --gold: #d6ae61;
  --gold-soft: #f5e7c5;
  --green: #2bc47d;
  --red: #ef6b62;
  --amber: #f5bd55;
  --blue: #70a7ff;
  --shadow: 0 28px 90px rgba(0, 0, 0, .38);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: #06110d; }
body { min-width: 320px; min-height: 100vh; margin: 0; color: var(--ink); background: radial-gradient(circle at 20% -10%, rgba(38, 112, 82, .34), transparent 38rem), radial-gradient(circle at 100% 20%, rgba(214, 174, 97, .12), transparent 30rem), #06110d; }
button, input, select, textarea { font: inherit; }
button, .button { display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 11px 17px; border: 1px solid transparent; border-radius: 13px; color: #071611; background: linear-gradient(135deg, var(--gold-soft), var(--gold)); font-weight: 850; text-decoration: none; cursor: pointer; transition: transform .18s ease, filter .18s ease, border-color .18s ease; }
button:hover, .button:hover { filter: brightness(1.05); transform: translateY(-1px); }
button:disabled { opacity: .55; cursor: wait; transform: none; }
button.secondary, .button.secondary { border-color: rgba(214, 174, 97, .35); color: var(--gold-soft); background: rgba(214, 174, 97, .08); }
button.ghost, .button.ghost { border-color: rgba(255,255,255,.1); color: var(--ink); background: rgba(255,255,255,.035); }
button.danger, .button.danger { border-color: rgba(239, 107, 98, .4); color: #ffd8d5; background: rgba(239, 107, 98, .12); }
a { color: var(--gold-soft); }
h1, h2, h3, p { overflow-wrap: anywhere; }
h1 { margin: 0 0 14px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(2rem, 6vw, 4.4rem); font-weight: 550; line-height: 1.02; letter-spacing: -.035em; }
h2 { margin: 0 0 12px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(1.45rem, 3vw, 2.25rem); font-weight: 550; }
h3 { margin: 0; font-size: 1rem; }
p { line-height: 1.6; }
[hidden] { display: none !important; }
.app-shell { width: min(1180px, 100%); min-height: 100vh; margin: auto; padding: max(18px, env(safe-area-inset-top)) 22px max(28px, env(safe-area-inset-bottom)); }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 12px 0 22px; }
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--gold-soft); font-weight: 900; letter-spacing: .08em; text-decoration: none; text-transform: uppercase; }
.brand-logo { position: relative; flex: 0 0 118px; width: 118px; height: 40px; overflow: hidden; border: 1px solid rgba(214,174,97,.5); border-radius: 12px; background: #fff; box-shadow: 0 8px 24px rgba(0,0,0,.18); }
.brand-logo img { position: absolute; top: -29px; left: -81px; width: 220px; max-width: none; height: auto; }
.brand-name { white-space: nowrap; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.eyebrow { margin: 0 0 10px; color: var(--gold); font-size: .76rem; font-weight: 900; letter-spacing: .18em; text-transform: uppercase; }
.muted { color: var(--muted); }
.small { font-size: .84rem; }
.hero { display: grid; min-height: calc(100vh - 110px); place-items: center; }
.hero-card { width: min(860px, 100%); padding: clamp(28px, 6vw, 72px); border: 1px solid var(--line); border-radius: 32px; background: linear-gradient(145deg, rgba(16, 42, 33, .94), rgba(7, 22, 17, .94)); box-shadow: var(--shadow); }
.hero-card p { max-width: 680px; color: var(--muted); font-size: 1.04rem; }
.hero-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 28px 0; }
.hero-grid article { padding: 18px; border: 1px solid rgba(255,255,255,.08); border-radius: 18px; background: rgba(255,255,255,.025); }
.hero-grid span { display: block; margin-bottom: 8px; color: var(--gold); font-size: 1.4rem; }
.notice, .success-message { padding: 13px 15px; border-radius: 13px; }
.notice { border: 1px solid rgba(239,107,98,.35); color: #ffd9d6; background: rgba(239,107,98,.11); }
.success-message { border: 1px solid rgba(43,196,125,.35); color: #c8ffe4; background: rgba(43,196,125,.11); }
.panel { padding: clamp(22px, 4vw, 42px); border: 1px solid var(--line); border-radius: 26px; background: rgba(12, 33, 26, .92); box-shadow: var(--shadow); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.full { grid-column: 1 / -1; }
.form-section { grid-column: 1 / -1; margin-top: 10px; padding-top: 23px; border-top: 1px solid rgba(255,255,255,.09); }
.form-section:first-child { margin-top: 0; padding-top: 0; border: 0; }
.form-section p { margin: 5px 0 0; }
label { display: grid; align-content: start; gap: 7px; color: #dcebe3; font-size: .88rem; font-weight: 750; }
input, select, textarea { width: 100%; min-height: 46px; padding: 12px 13px; border: 1px solid rgba(255,255,255,.13); border-radius: 12px; outline: none; color: var(--ink); background: rgba(3,14,10,.48); }
input:focus, select:focus, textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(214,174,97,.11); }
textarea { min-height: 104px; resize: vertical; }
input[type="color"] { padding: 5px; }
input[type="checkbox"], input[type="radio"] { width: 19px; min-height: 19px; accent-color: var(--gold); }
.check-row { display: flex; align-items: flex-start; gap: 10px; }
.check-row span { line-height: 1.5; }
.type-picker { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.type-option { position: relative; display: grid; min-height: 145px; place-items: center; padding: 18px; border: 1px solid rgba(255,255,255,.11); border-radius: 18px; text-align: center; background: rgba(255,255,255,.025); cursor: pointer; }
.type-option input { position: absolute; opacity: 0; }
.type-option:has(input:checked) { border-color: var(--gold); background: rgba(214,174,97,.1); box-shadow: inset 0 0 0 1px var(--gold); }
.type-icon { color: var(--gold); font-size: 2rem; }
.type-option strong { display: block; margin: 8px 0 4px; font-size: 1.05rem; }
.public-warning { padding: 16px; border: 1px solid rgba(245,189,85,.34); border-radius: 14px; color: #ffedc7; background: rgba(245,189,85,.08); }
.upload-box { display: grid; gap: 12px; padding: 17px; border: 1px dashed rgba(214,174,97,.42); border-radius: 16px; background: rgba(214,174,97,.035); }
.upload-actions { display: flex; flex-wrap: wrap; gap: 9px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
.crop-editor { display: grid; gap: 12px; width: min(440px, 100%); }
.crop-editor canvas { width: 100%; aspect-ratio: 1; border-radius: 18px; background: #071611; cursor: grab; touch-action: none; }
.image-preview { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; }
.photo-item { display: grid; width: 132px; overflow: hidden; border: 1px solid rgba(255,255,255,.09); border-radius: 16px; background: rgba(255,255,255,.025); }
.photo-item img { width: 100%; aspect-ratio: 1; object-fit: cover; }
.photo-item div { display: grid; gap: 8px; padding: 10px; }
.photo-item button { min-height: 38px; padding: 7px 10px; }
.document-list { display: grid; gap: 8px; }
.document-item { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 14px; border: 1px solid rgba(255,255,255,.08); border-radius: 12px; background: rgba(255,255,255,.025); }
.document-item span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.privacy-box { grid-column: 1 / -1; max-height: 280px; overflow: auto; padding: 18px; border: 1px solid rgba(255,255,255,.1); border-radius: 15px; color: var(--muted); background: rgba(0,0,0,.16); font-size: .86rem; }
.privacy-box h3 { color: var(--gold-soft); }
.dashboard { padding-top: 12px; }
.toolbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 22px; margin: 20px 0 26px; }
.toolbar h1 { font-size: clamp(2.2rem, 5vw, 3.8rem); }
.stats-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin: 22px 0; }
.stats-grid article { padding: 17px; border: 1px solid rgba(255,255,255,.08); border-radius: 16px; background: rgba(255,255,255,.025); }
.stats-grid span { display: block; min-height: 35px; color: var(--muted); font-size: .79rem; }
.stats-grid strong { color: var(--gold-soft); font-size: 1.7rem; }
.workflow { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 20px 0; }
.workflow span { padding: 13px; border: 1px solid var(--line); border-radius: 13px; color: var(--muted); background: rgba(214,174,97,.035); font-size: .84rem; }
.workflow b { color: var(--gold); }
.list-controls { display: grid; grid-template-columns: 1fr 230px; gap: 12px; margin: 20px 0 12px; }
.tag-list { display: grid; gap: 11px; }
.tag-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 17px 19px; border: 1px solid rgba(255,255,255,.085); border-radius: 17px; background: rgba(255,255,255,.027); }
.tag-main { min-width: 0; }
.tag-main h3 { margin: 7px 0 4px; }
.tag-main p { margin: 2px 0; color: var(--muted); font-size: .87rem; }
.status-line { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; }
.tag-code { color: var(--gold-soft); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-weight: 800; letter-spacing: .1em; }
.badge { display: inline-flex; padding: 5px 9px; border-radius: 999px; font-size: .72rem; font-weight: 900; text-transform: uppercase; }
.status-inventory { color: #d6e4dc; background: rgba(159,178,169,.18); }
.status-sold { color: #ffedbd; background: rgba(245,189,85,.17); }
.status-active { color: #c9ffe4; background: rgba(43,196,125,.17); }
.status-lost, .status-emergency { color: #ffd5d2; background: rgba(239,107,98,.18); }
.status-found { color: #d7e7ff; background: rgba(112,167,255,.18); }
.status-suspended { color: #e0d8dd; background: rgba(149,130,141,.19); }
.modal { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; padding: 18px; background: rgba(0,0,0,.72); backdrop-filter: blur(9px); }
.modal-card { width: min(960px, 100%); max-height: 94vh; overflow: auto; padding: clamp(22px, 4vw, 38px); border: 1px solid var(--line); border-radius: 25px; background: #0a1d17; box-shadow: var(--shadow); }
.public-wrap { width: min(680px, 100%); margin: 18px auto; }
.public-card { overflow: hidden; border: 1px solid var(--line); border-radius: 30px; background: linear-gradient(160deg, #102a21, #071611 70%); box-shadow: var(--shadow); }
.public-cover { min-height: 120px; background: radial-gradient(circle at 15% 0%, color-mix(in srgb, var(--profile-color, #d6ae61) 55%, transparent), transparent 28rem), #0c211a; }
.public-body { padding: clamp(24px, 6vw, 46px); }
.profile-photo { width: 132px; height: 132px; margin-top: -92px; margin-bottom: 18px; border: 5px solid #0d241c; border-radius: 34px; object-fit: cover; background: #132d24; }
.profile-placeholder { display: grid; place-items: center; color: var(--gold); font-size: 3rem; }
.public-title { font-size: clamp(2.1rem, 7vw, 3.7rem); }
.alert-grid { display: grid; gap: 9px; margin: 22px 0; }
.alert-card { padding: 14px 15px; border-left: 4px solid var(--amber); border-radius: 10px; color: #ffedc8; background: rgba(245,189,85,.09); }
.public-gallery { margin: 22px 0; }
.public-gallery h3 { margin-bottom: 10px; color: var(--gold-soft); }
.public-gallery > div { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; }
.public-gallery a { overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-3); }
.public-gallery img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; transition: transform .18s ease; }
.public-gallery a:hover img { transform: scale(1.03); }
.emergency-actions { display: grid; gap: 10px; margin: 24px 0; }
.emergency-actions a, .emergency-actions button { width: 100%; min-height: 55px; }
.call-primary { color: #fff !important; background: linear-gradient(135deg, #20a765, #14824d) !important; }
.call-911 { color: #fff !important; background: linear-gradient(135deg, #e85f57, #b93c36) !important; }
.detail-groups { display: grid; gap: 16px; margin-top: 28px; }
.detail-group { padding: 18px; border: 1px solid rgba(255,255,255,.08); border-radius: 16px; background: rgba(255,255,255,.025); }
.detail-group h3 { margin-bottom: 10px; color: var(--gold-soft); }
.detail-group dl { display: grid; grid-template-columns: minmax(100px, .7fr) 1.3fr; gap: 8px 14px; margin: 0; }
.detail-group dt { color: var(--muted); }
.detail-group dd { margin: 0; white-space: pre-line; }
.location-panel { margin-top: 20px; padding: 17px; border: 1px solid rgba(112,167,255,.26); border-radius: 16px; background: rgba(112,167,255,.07); }
.owner-link { display: block; margin-top: 28px; color: var(--muted); font-size: .86rem; text-align: center; }
.qr-sheet { max-width: 860px; margin: 20px auto; padding: 36px; border-radius: 24px; color: #17251d; background: #fff; text-align: center; }
.qr-sheet .eyebrow { color: #765719; }
.qr-sheet .muted { color: #5b675f; }
.qr-production { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin: 26px 0; }
.qr-box { padding: 20px; border: 2px dashed #284c38; border-radius: 16px; }
.qr-code img, .qr-code canvas { margin: auto; }
.qr-url { overflow-wrap: anywhere; color: #44524a; font-size: .75rem; }
.activation-card { max-width: 560px; margin: 25px auto 0; padding: 22px; border: 2px solid #8a6b2f; border-radius: 16px; background: #fff9ec; }
.login-card, .manage-card { width: min(900px, 100%); margin: 35px auto; }
.footer-note { margin-top: 28px; color: var(--muted); font-size: .78rem; text-align: center; }
.center-actions { justify-content: center; margin-top: 25px; }

@media (max-width: 920px) {
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
  .workflow { grid-template-columns: repeat(2, 1fr); }
  .tag-row { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 650px) {
  .app-shell { padding-inline: 14px; }
  .topbar, .toolbar { align-items: flex-start; flex-direction: column; }
  .brand { gap: 10px; letter-spacing: .06em; }
  .brand-logo { flex-basis: 106px; width: 106px; height: 36px; }
  .brand-logo img { top: -26px; left: -73px; width: 198px; }
  .hero-grid, .type-picker, .form-grid, .qr-production, .list-controls { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .workflow { grid-template-columns: 1fr; }
  .panel, .public-body { padding: 22px; }
  .document-item { align-items: flex-start; flex-direction: column; }
  .public-gallery > div { grid-template-columns: repeat(2, 1fr); }
  .detail-group dl { grid-template-columns: 1fr; gap: 2px; }
  .detail-group dd { margin-bottom: 9px; }
}

@media print {
  .no-print, .topbar { display: none !important; }
  body, .app-shell { background: #fff; }
  .app-shell { width: 100%; max-width: none; padding: 0; }
  .qr-sheet { max-width: none; margin: 0; box-shadow: none; }
  .qr-box, .activation-card { break-inside: avoid; }
}
