/* ─── Reset & base ──────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --accent:      #FF6900;
  --accent-dark: #E05500;
  --accent-light: #FFF0E6;
  --green:       #057a55;
  --red:         #c81e1e;
  --amber:       #c27803;
  --bg:          #F2F2F2;
  --surface:     #FFFFFF;
  --surface2:    #EBEBEB;
  --text:        #0D0D0D;
  --text-muted:  #6B6B6B;
  --border:      #E0E0E0;
  --header-h:    52px;
  --breadcrumb-h:52px;
  --actions-h:   96px;
  --radius:      12px;
}

html, body {
  height: 100%;
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

/* ─── Screen system ─────────────────────────────────────────────────────── */
.screen {
  display: none;
  flex-direction: column;
  height: 100dvh;
  width: 100%;
  position: absolute;
  inset: 0;
}
.screen.active { display: flex; }

/* ─── Login ─────────────────────────────────────────────────────────────── */
#screen-login {
  align-items: center;
  justify-content: center;
  background: var(--bg);
}
.login-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 2rem;
  width: min(400px, 92vw);
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}
.logo      { font-size: 2rem; font-weight: 800; color: var(--accent); letter-spacing: -1px; }
.tagline   { color: var(--text-muted); font-size: 0.875rem; margin-bottom: 0.25rem; }
label      { font-size: 0.8125rem; font-weight: 500; color: var(--text-muted); }
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
textarea {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
  resize: none;
}
input:focus, textarea:focus { border-color: var(--accent); }

/* ─── Buttons ───────────────────────────────────────────────────────────── */
.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.875rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  transition: background 0.15s;
}
.btn-primary:hover:not(:disabled) { background: var(--accent-dark); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem;
  font-size: 0.9375rem;
  cursor: pointer;
  width: 100%;
}

.btn-icon {
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 0.9375rem;
  cursor: pointer;
  padding: 0.5rem 0.75rem;
}

.error   { color: var(--red); font-size: 0.875rem; }
.hidden  { display: none !important; }
.optional { color: var(--text-muted); font-size: 0.75em; font-weight: 400; }

/* ─── App Header ────────────────────────────────────────────────────────── */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-h);
  padding: 0 0.875rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  position: relative;
  z-index: 30;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.app-version {
  font-size: 0.6875rem;
  color: var(--text-muted);
  font-weight: 400;
  letter-spacing: 0.02em;
  align-self: flex-end;
  margin-bottom: 1px;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 700;
  flex-shrink: 0;
}

#user-name {
  font-size: 0.9375rem;
  font-weight: 600;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.menu-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 0.5rem;
}
.menu-btn span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text);
  border-radius: 1px;
}

.app-menu {
  position: absolute;
  top: var(--header-h);
  right: 0.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  z-index: 50;
  min-width: 150px;
  overflow: hidden;
}
.app-menu button {
  display: block;
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text);
  padding: 0.875rem 1rem;
  text-align: left;
  font-size: 0.9375rem;
  cursor: pointer;
}
.app-menu button:hover { background: var(--surface2); }
.menu-btn-danger { color: #c00 !important; border-top: 1px solid var(--border); }

/* Label sheet */
.label-toggle {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.label-toggle-btn {
  flex: 1;
  padding: 0.5rem;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  font-size: 0.9rem;
  cursor: pointer;
}
.label-toggle-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.label-count-text {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin: 0 0 0.75rem;
  min-height: 1.1em;
}
.label-paper-row {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.backup-description {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin: 0;
}
.delete-account-loading {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin: 0;
}
.delete-account-team-notice {
  background: #f0f7ff;
  border: 1px solid #bcd8f5;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  color: #1a5fa8;
}
.delete-account-last-user {
  background: #fff5f5;
  border: 1.5px solid #f5c6c6;
  border-radius: 8px;
  padding: 0.875rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.delete-account-last-title {
  font-weight: 700;
  color: #c00;
  margin: 0;
  font-size: 0.9375rem;
}
.delete-account-last-body {
  font-size: 0.8125rem;
  color: #7a0000;
  margin: 0;
  line-height: 1.5;
}

/* ─── Breadcrumb ─────────────────────────────────────────────────────────── */
.breadcrumb-section {
  height: var(--breadcrumb-h);
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.breadcrumb-scroll {
  height: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.breadcrumb-scroll::-webkit-scrollbar { display: none; }

.breadcrumb-inner {
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 0.75rem;
  gap: 0;
  white-space: nowrap;
  min-width: max-content;
}

.breadcrumb-empty {
  color: var(--text-muted);
  font-size: 0.875rem;
  padding: 0 0.25rem;
  font-style: italic;
}
.breadcrumb-pick-btn {
  background: transparent;
  border: 1px dashed var(--border);
  border-radius: 20px;
  cursor: pointer;
  padding: 0.3125rem 0.875rem;
}

.crumb {
  display: inline-flex;
  align-items: center;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 0.3125rem 0.75rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.crumb:hover { background: var(--surface); color: var(--text); }
.crumb.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

.crumb-sep {
  color: var(--text-muted);
  padding: 0 0.25rem;
  font-size: 1rem;
  user-select: none;
}

/* ─── Action Buttons ─────────────────────────────────────────────────────── */
.action-grid {
  flex-shrink: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0.5rem 0.625rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.375rem;
}

.action-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.625rem 0.75rem;
  color: var(--text);
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.3;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  text-align: left;
}
.action-btn:hover { background: var(--surface); border-color: var(--accent); }
.action-btn.active {
  background: rgba(255, 105, 0, 0.12);
  border-color: var(--accent);
  color: var(--accent);
}

.action-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
}

/* ─── Camera Section ─────────────────────────────────────────────────────── */
.camera-section {
  flex: 1;
  display: flex;
  overflow: hidden;
  min-height: 0;
}

.camera-view-wrap {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: #000;
}

#camera-feed {
  width: 100% !important;
  height: 100% !important;
}

/* Suppress html5-qrcode chrome */
#camera-feed > * > img,
#camera-feed button,
#camera-feed select { display: none !important; }
#camera-feed video  { object-fit: cover !important; width: 100% !important; height: 100% !important; }
#camera-feed__scan_region { background: transparent !important; border: none !important; }

/* Camera idle overlay */
.camera-idle {
  position: absolute;
  inset: 0;
  background: #1a1a1a;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.625rem;
  cursor: pointer;
  z-index: 5;
  transition: background 0.2s;
}
.camera-idle:active { background: #2a2a2a; }
.camera-idle-icon { font-size: 2.25rem; opacity: 0.45; }
.camera-idle-text { color: rgba(255,255,255,0.4); font-size: 0.8125rem; letter-spacing: 0.03em; }

/* QR targeting frame */
.scan-frame {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
.scan-corner {
  position: absolute;
  width: 22px; height: 22px;
  border-color: rgba(255,255,255,0.9);
  border-style: solid;
}
.tl { top: calc(50% - 90px); left:  calc(50% - 90px); border-width: 3px 0 0 3px; border-radius: 4px 0 0 0; }
.tr { top: calc(50% - 90px); right: calc(50% - 90px); border-width: 3px 3px 0 0; border-radius: 0 4px 0 0; }
.bl { bottom: calc(50% - 90px); left:  calc(50% - 90px); border-width: 0 0 3px 3px; border-radius: 0 0 0 4px; }
.br { bottom: calc(50% - 90px); right: calc(50% - 90px); border-width: 0 3px 3px 0; border-radius: 0 0 4px 0; }

.scan-mode-label {
  position: absolute;
  bottom: calc(50% - 110px);
  background: rgba(0,0,0,0.65);
  color: #fff;
  font-size: 0.8125rem;
  padding: 0.25rem 0.75rem;
  border-radius: 99px;
}

/* Camera controls panel */
.camera-controls {
  width: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  flex-shrink: 0;
}

.take-photo-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.375rem;
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.5);
  cursor: pointer;
  font-size: 0.6875rem;
  transition: color 0.15s;
}
.take-photo-btn:not(:disabled) { color: #fff; }

.shutter-outer {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 3px solid currentColor;
  display: flex;
  align-items: center;
  justify-content: center;
}
.shutter-inner {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: currentColor;
  transition: transform 0.1s;
}
.take-photo-btn:not(:disabled):active .shutter-inner { transform: scale(0.85); }

/* ─── Photo Strip ────────────────────────────────────────────────────────── */
.photo-strip {
  flex-shrink: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 0.5rem 0.625rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.photo-strip-inner {
  display: flex;
  gap: 0.375rem;
  overflow-x: auto;
  flex: 1;
  scrollbar-width: none;
}
.photo-strip-inner::-webkit-scrollbar { display: none; }

.photo-thumb {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid var(--border);
}

.photo-strip-next {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.5rem 0.875rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ─── Toast ─────────────────────────────────────────────────────────────── */
.toast {
  position: absolute;
  bottom: 0.75rem;
  left: 0.75rem;
  right: 0.75rem;
  background: rgba(13, 13, 13, 0.92);
  border: 1px solid rgba(255,255,255,0.1);
  color: #f5f5f5;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  font-size: 0.9375rem;
  z-index: 60;
  backdrop-filter: blur(4px);
  text-align: center;
}
.toast.success { border-color: var(--green); }
.toast.error   { border-color: var(--red); }

/* ─── Asset Details Screen ───────────────────────────────────────────────── */
#screen-details {
  background: var(--bg);
  overflow-y: auto;
}

.detail-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 0.5rem 0.75rem 0.25rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 5;
  flex-shrink: 0;
}
.detail-header h2 { font-size: 1rem; font-weight: 700; }

.detail-form {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding-bottom: 2rem;
  flex-shrink: 0;   /* allow parent screen to scroll rather than collapsing this form */
}

.captured-photos-preview {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
  scrollbar-width: none;
}
.captured-photos-preview::-webkit-scrollbar { display: none; }
.captured-photos-preview:empty { display: none; }
.captured-photos-preview img {
  width: 80px;
  height: 80px;
  border-radius: 8px;
  object-fit: cover;
  border: 2px solid var(--border);
  flex-shrink: 0;
}

.qty-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.qty-row label  { white-space: nowrap; }
.qty-row input  { width: 90px; flex-shrink: 0; }
.qty-hint { color: var(--text-muted); font-size: 0.8125rem; }

.location-confirm {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.625rem 0.875rem;
  font-size: 0.875rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.location-confirm-label { color: var(--text-muted); font-size: 0.75rem; }
.location-confirm-path  { color: var(--text); font-weight: 500; }

/* ─── Location Picker Bottom Sheet ──────────────────────────────────────── */
.picker-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 70;
  display: flex;
  align-items: flex-end;
}

.picker-sheet {
  background: var(--surface);
  border-radius: var(--radius) var(--radius) 0 0;
  width: 100%;
  max-height: 70dvh;
  display: flex;
  flex-direction: column;
  padding: 0 1rem 1.5rem;
  overflow: hidden;
}

.picker-handle {
  width: 40px; height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 0.75rem auto 0;
  flex-shrink: 0;
}

.picker-title {
  font-size: 1rem;
  font-weight: 700;
  padding: 0.75rem 0 0.5rem;
  flex-shrink: 0;
  color: var(--text-muted);
}

.picker-list {
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.picker-item {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  color: var(--text);
  font-size: 0.9375rem;
  cursor: pointer;
  text-align: left;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.picker-item:hover { background: var(--surface); border-color: var(--accent); }
.picker-item-icon { color: var(--text-muted); }

.picker-loading { color: var(--text-muted); text-align: center; padding: 1rem; font-size: 0.875rem; }
.picker-empty   { color: var(--text-muted); text-align: center; padding: 1rem; font-size: 0.875rem; }

.picker-cancel {
  margin-top: 0.5rem;
  flex-shrink: 0;
}

/* ─── View Assets button ─────────────────────────────────────────────────── */
.action-btn-view {
  background: rgba(255, 105, 0, 0.08);
  border-color: rgba(255, 105, 0, 0.4);
  color: var(--accent);
}
.action-btn-view:hover {
  background: rgba(255, 105, 0, 0.15);
  border-color: var(--accent);
}

/* ─── Asset List Screen ──────────────────────────────────────────────────── */
#screen-list { background: var(--bg); }

.list-subtree-toggle {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  color: var(--text-muted);
  font-size: 0.8125rem;
  cursor: pointer;
  white-space: nowrap;
  padding-right: 0.25rem;
  flex-shrink: 0;
}
.list-subtree-toggle input { accent-color: var(--accent); cursor: pointer; }

.list-container {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.list-empty {
  color: var(--text-muted);
  text-align: center;
  padding: 3rem 1rem;
  font-size: 0.9375rem;
  line-height: 1.6;
}

.asset-card {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;           /* prevent flex parent compressing cards — list must scroll */
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
}

.asset-card-main {
  display: flex;
}

.asset-thumb {
  width: 72px;
  height: 72px;
  object-fit: cover;
  flex-shrink: 0;
}

.asset-thumb-placeholder {
  width: 72px;
  height: 72px;
  background: var(--surface2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1.5rem;
}

.asset-card-body {
  flex: 1;
  padding: 0.625rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.asset-card-name {
  font-weight: 600;
  font-size: 0.9375rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.asset-card-code {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.02em;
}

.asset-card-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.asset-qty-badge {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 0.1rem 0.45rem;
  font-weight: 600;
  font-size: 0.7rem;
  color: var(--text);
}

.asset-card-desc {
  font-size: 0.8125rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.asset-card-location {
  font-size: 0.75rem;
  color: var(--accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.asset-card-when {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.asset-photo-count {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 0.1rem 0.45rem;
  font-size: 0.7rem;
  color: var(--text-muted);
}

.asset-card-photos {
  display: none;
  overflow-x: auto;
  gap: 0.5rem;
  padding: 0.625rem 0.75rem;
  border-top: 1px solid var(--border);
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}

.asset-card.expanded .asset-card-photos {
  display: flex;
}

.asset-card-photos img {
  height: 150px;
  width: auto;
  border-radius: 6px;
  flex-shrink: 0;
  scroll-snap-align: start;
  object-fit: cover;
}

/* ─── Location Tree (accordion) ─────────────────────────────────────── */
.location-tree-sheet { max-height: 80dvh; }

.tree-node-row {
  display: flex;
  align-items: stretch;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 0.25rem;
  overflow: hidden;
}
.tree-node-row:hover { border-color: var(--accent); }

.tree-toggle {
  background: transparent;
  border: none;
  border-right: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.7rem;
  padding: 0 0.75rem;
  flex-shrink: 0;
  transition: color 0.15s, background 0.15s;
}
.tree-toggle:hover { color: var(--accent); background: rgba(0,0,0,0.04); }

.tree-toggle-spacer {
  width: 36px;
  flex-shrink: 0;
}

.tree-node-name {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text);
  cursor: pointer;
  font-size: 0.9375rem;
  padding: 0.75rem 0.875rem;
  text-align: left;
  transition: color 0.15s;
}
.tree-node-name:hover { color: var(--accent); }

.tree-children {
  display: none;
  padding-left: 1rem;
  padding-top: 0.125rem;
}
.tree-children.open { display: block; }

/* ─── Label Preview Overlay ──────────────────────────────────────────────── */
.label-preview-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 60;
}

.label-preview-sheet {
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  padding: 24px 24px 36px;
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.label-preview-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
}

/* The label card — designed to look like a printable adhesive label */
.label-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 16px 24px;
  width: 220px;
}

.label-qr-canvas {
  width: 160px;
  height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* qrcodejs generates an img inside the target div */
.label-qr-canvas img { display: block; }

.label-code {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.05em;
  text-align: center;
}

.label-name {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ─── Value row on capture form ─────────────────────────────────────────── */
.value-row {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.75rem;
}
.value-field {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.value-field label { font-size: 0.8125rem; font-weight: 600; color: var(--text-muted); }
.value-field input { font-size: 0.9375rem; }

/* ─── Asset Edit Sheet ───────────────────────────────────────────────────── */
.asset-edit-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  display: flex;
  align-items: flex-end;
}
.asset-edit-overlay.hidden { display: none; }

.asset-edit-sheet {
  background: var(--surface);
  border-radius: 16px 16px 0 0;
  padding: 1.25rem 1rem 2rem;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 85vh;
  overflow-y: auto;
}
.asset-edit-title { font-size: 1rem; font-weight: 700; margin: 0 0 0.25rem; }
.asset-edit-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.25rem;
}
.asset-edit-actions button { flex: 1; }

.form-row {
  display: flex;
  gap: 0.75rem;
}
.form-row .form-group { flex: 1; }

/* ─── Asset Detail Screen ───────────────────────────────────────────────── */
#screen-asset-detail { background: var(--bg); }

.asset-detail-photos {
  display: flex;
  overflow-x: auto;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  background: #000;
  min-height: 220px;
  align-items: center;
}

.asset-detail-photo-item {
  position: relative;
  flex-shrink: 0;
  scroll-snap-align: start;
  border-radius: 8px;
  overflow: hidden;
}
.asset-detail-photo-item img {
  display: block;
  height: 200px;
  width: auto;
  max-width: 280px;
  object-fit: cover;
  border-radius: 8px;
}
.asset-detail-photo-item.is-hero img {
  border: 2px solid var(--accent);
}

.asset-detail-photo-actions {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.25rem 0.375rem;
  background: rgba(0,0,0,0.55);
  border-radius: 0 0 8px 8px;
}
.asset-detail-no-photo {
  color: rgba(255,255,255,0.5);
  font-size: 0.875rem;
  text-align: center;
  width: 100%;
}

.photo-hero-btn, .photo-delete-btn {
  background: transparent;
  border: none;
  color: #fff;
  cursor: pointer;
  font-size: 1rem;
  padding: 0.125rem 0.25rem;
  line-height: 1;
  border-radius: 4px;
  transition: background 0.15s;
}
.photo-hero-btn  { color: rgba(255,255,255,0.6); }
.photo-hero-btn:hover  { background: rgba(255,255,255,0.15); color: gold; }
.photo-delete-btn:hover { background: rgba(200,0,0,0.5); }
.photo-hero-badge { color: gold; font-size: 1rem; padding: 0.125rem 0.25rem; }

.asset-detail-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}
.asset-detail-name {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
}
.asset-detail-code {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.02em;
}
.asset-detail-desc {
  font-size: 0.9375rem;
  color: var(--text-muted);
  white-space: pre-wrap;
}
.asset-detail-location {
  font-size: 0.8125rem;
  color: var(--accent);
}
.asset-detail-when {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.asset-detail-values {
  display: flex;
  gap: 1rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.625rem 0.875rem;
  margin-top: 0.25rem;
}
.asset-detail-values.hidden { display: none; }
.asset-value-item { display: flex; flex-direction: column; gap: 0.125rem; }
.asset-value-label { font-size: 0.6875rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.asset-value-amount { font-size: 1rem; font-weight: 700; color: var(--text); }

.asset-detail-auction {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.625rem 0.875rem;
  margin-top: 0.25rem;
}
.auction-label { font-size: 0.6875rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.auction-flags { display: flex; gap: 1.25rem; }
.auction-toggle {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
}
.auction-toggle input { accent-color: var(--accent); width: 1rem; height: 1rem; cursor: pointer; }

/* ── Lifecycle card ───────────────────────────────────────────────────────── */
.asset-detail-lifecycle {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.625rem 0.875rem;
  margin-top: 0.25rem;
}
.lifecycle-section-label {
  font-size: 0.6875rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.125rem;
}
.lifecycle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.lifecycle-subrow {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding-left: 1rem;
}
.lifecycle-subrow.hidden { display: none; }
.lifecycle-label {
  font-size: 0.8125rem;
  color: var(--text-muted);
  flex-shrink: 0;
}
.lifecycle-sublabel {
  font-size: 0.75rem;
  color: var(--text-muted);
  flex-shrink: 0;
}
.lifecycle-text-input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.25rem 0.5rem;
  font-size: 0.875rem;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  outline: none;
  min-width: 0;
}
.lifecycle-text-input:focus { border-color: var(--accent); }
.lifecycle-date-input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.25rem 0.5rem;
  font-size: 0.875rem;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  outline: none;
}
.lifecycle-date-input:focus { border-color: var(--accent); }
.lifecycle-select {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.25rem 0.5rem;
  font-size: 0.875rem;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  outline: none;
  cursor: pointer;
}
.lifecycle-select:focus { border-color: var(--accent); }

.asset-detail-footer {
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
  display: flex;
  gap: 0.5rem;
}
.asset-detail-add-photo { flex: 1; }
.asset-detail-smart-label { flex: 1; }

.btn-icon-danger { color: #c00; }
.btn-icon-danger:hover { background: rgba(200,0,0,0.08); }

.btn-detail-edit {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 0.375rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.02em;
}
.btn-detail-edit:hover { background: var(--accent-dark); }

.btn-detail-delete {
  background: transparent;
  color: #c00;
  border: 1.5px solid #c00;
  border-radius: 6px;
  padding: 0.375rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.02em;
}
.btn-detail-delete:hover { background: rgba(200,0,0,0.08); }
