:root {
  --navy-950: #0b1f33;
  --navy-900: #102a43;
  --navy-800: #243b53;
  --navy-600: #486581;
  --slate-500: #829ab1;
  --slate-300: #bcccdc;
  --slate-200: #d9e2ec;
  --slate-100: #eaf0f5;
  --paper: #ffffff;
  --canvas: #f4f7fa;
  --teal: #0f9488;
  --teal-soft: #d8f3ef;
  --amber: #d97706;
  --amber-soft: #fff3cf;
  --red: #c24141;
  --red-soft: #fde8e8;
  --green: #177245;
  --green-soft: #dcf4e6;
  --shadow: 0 12px 35px rgba(16, 42, 67, 0.09);
  --radius: 18px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { min-height: 100%; background: var(--canvas); color: var(--navy-950); }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 8% -5%, rgba(15, 148, 136, 0.11), transparent 31rem),
    var(--canvas);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--navy-900); text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }

.topbar {
  min-height: 70px;
  padding: 12px clamp(18px, 5vw, 64px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  color: white;
  background: var(--navy-950);
}

.brand { display: flex; align-items: center; gap: 11px; color: white; }
.brand-mark { width: 41px; height: 41px; display: grid; place-items: center; border-radius: 13px; background: var(--teal); font-weight: 900; font-size: 1.35rem; }
.brand strong, .brand small { display: block; }
.brand small { margin-top: 2px; color: var(--slate-300); font-size: .72rem; letter-spacing: .04em; }

.user-chip { display: flex; align-items: center; gap: 13px; color: var(--slate-200); font-size: .85rem; }
.user-chip form { margin: 0; }
.link-button { border: 0; padding: 5px 0; color: white; background: transparent; text-decoration: underline; text-underline-offset: 3px; }

.primary-nav {
  padding: 0 clamp(18px, 5vw, 64px);
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--slate-200);
  background: rgba(255, 255, 255, .93);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.primary-nav a { padding: 14px 17px 12px; border-bottom: 3px solid transparent; font-size: .9rem; font-weight: 750; }
.primary-nav a:hover { border-color: var(--teal); color: var(--teal); }

.shell { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 34px 0 76px; }
.narrow-shell { width: min(460px, calc(100% - 32px)); padding-top: 64px; }

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 10px; font-size: clamp(2rem, 5vw, 3.4rem); line-height: 1.04; letter-spacing: -.045em; }
h2 { margin-bottom: 8px; font-size: 1.16rem; letter-spacing: -.015em; }
.muted { color: var(--navy-600); line-height: 1.55; }
.eyebrow { margin-bottom: 8px; color: var(--teal); font-size: .72rem; font-weight: 900; letter-spacing: .13em; text-transform: uppercase; }
.optional { color: var(--slate-500); font-size: .75rem; font-weight: 600; }

.page-heading { margin-bottom: 28px; }
.split-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 25px; }
.split-heading .muted { margin-bottom: 0; }

.card { border: 1px solid rgba(188, 204, 220, .72); border-radius: var(--radius); background: var(--paper); box-shadow: var(--shadow); }

.button {
  min-height: 44px;
  padding: 10px 17px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 12px;
  font-weight: 800;
  line-height: 1.15;
}
.button.primary { color: white; background: var(--navy-900); }
.button.primary:hover { background: var(--navy-800); }
.button.secondary { border-color: var(--slate-300); color: var(--navy-900); background: white; }
.button.secondary:hover { border-color: var(--teal); color: var(--teal); }
.button.approve { color: white; background: var(--green); }
.button.danger { color: var(--red); border-color: #efb5b5; background: var(--red-soft); }
.button.wide { width: 100%; }

.messages { margin-bottom: 22px; display: grid; gap: 8px; }
.message { padding: 13px 16px; border-radius: 12px; border: 1px solid var(--slate-300); background: white; }
.message.success { border-color: #9ad3b2; background: var(--green-soft); color: #0d5532; }
.message.error { border-color: #efb5b5; background: var(--red-soft); color: #8f2929; }
.message.warning { border-color: #efd28e; background: var(--amber-soft); color: #7b4b00; }

.stats-grid { margin-bottom: 20px; display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
.stats-grid article { min-height: 104px; padding: 17px; display: flex; flex-direction: column; justify-content: space-between; border: 1px solid var(--slate-200); border-radius: 15px; background: rgba(255,255,255,.82); }
.stats-grid strong { font-size: 2rem; letter-spacing: -.04em; }
.stats-grid span { color: var(--navy-600); font-size: .78rem; font-weight: 700; }
.stats-grid .attention { border-color: #edcb73; background: var(--amber-soft); }

.quick-add, .export-strip { margin-bottom: 18px; padding: 17px 19px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.quick-add small, .export-strip small { margin-top: 3px; display: block; color: var(--navy-600); }
.quick-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.quick-actions a { padding: 9px 13px; border-radius: 999px; color: var(--navy-900); background: var(--slate-100); font-size: .82rem; font-weight: 800; }
.quick-actions a:hover { color: white; background: var(--teal); }

.filter-bar { margin: 25px 0 13px; display: grid; grid-template-columns: minmax(200px, 1.7fr) repeat(3, minmax(125px, .8fr)) auto; gap: 8px; }
input, select, textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--slate-300);
  border-radius: 11px;
  color: var(--navy-950);
  background: white;
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(15,148,136,.13); }
input[type="checkbox"], input[type="radio"] { width: auto; min-height: auto; accent-color: var(--teal); }

.asset-list { display: grid; gap: 9px; }
.asset-row { min-height: 92px; padding: 14px 16px; display: grid; grid-template-columns: 48px 1fr auto; align-items: center; gap: 14px; border: 1px solid var(--slate-200); border-radius: 15px; background: white; box-shadow: 0 5px 20px rgba(16,42,67,.045); transition: transform .15s, border-color .15s; }
.asset-row:hover { transform: translateY(-2px); border-color: var(--teal); }
.type-icon { width: 45px; height: 45px; display: grid; place-items: center; border-radius: 14px; font-weight: 900; }
.type-asset { color: #174f8a; background: #deecfa; }
.type-component { color: #7d4d00; background: var(--amber-soft); }
.type-bulk_bin { color: #0c665e; background: var(--teal-soft); }
.asset-main strong, .asset-main small { display: block; }
.asset-main strong { margin-bottom: 4px; }
.asset-main small { margin-top: 2px; color: var(--navy-600); }
.asset-meta { display: grid; justify-items: end; gap: 6px; }
.asset-meta small { color: var(--navy-600); }

.status { width: max-content; padding: 6px 9px; border-radius: 999px; color: var(--navy-800); background: var(--slate-100); font-size: .71rem; font-weight: 900; }
.status-approved { color: var(--green); background: var(--green-soft); }
.status-submitted { color: #7b4b00; background: var(--amber-soft); }
.status-rejected { color: var(--red); background: var(--red-soft); }
.status-labelled { color: #0c665e; background: var(--teal-soft); }

.empty-state { padding: 60px 24px; text-align: center; }
.empty-icon { margin: 0 auto 15px; width: 62px; height: 62px; display: grid; place-items: center; border-radius: 50%; color: var(--teal); background: var(--teal-soft); font-size: 2rem; }
.empty-state p { color: var(--navy-600); }
.export-strip { margin-top: 24px; }
.export-strip > div:last-child { display: flex; gap: 8px; }

.login-card { padding: 30px; }
.login-card h1 { font-size: 2.15rem; }
.stack-form { display: grid; gap: 15px; }
.stack-form label { display: grid; gap: 7px; font-weight: 800; }
.field-error, .errorlist { margin: 7px 0; padding: 10px 12px; border-radius: 9px; color: #8f2929; background: var(--red-soft); list-style: none; }

.asset-form { display: grid; gap: 14px; }
.form-section { padding: 22px; display: grid; grid-template-columns: 42px 1fr; gap: 17px; }
.section-number { width: 39px; height: 39px; display: grid; place-items: center; border-radius: 12px; color: white; background: var(--navy-900); font-weight: 900; }
.section-content h2 { margin-top: 7px; margin-bottom: 18px; }
.form-grid { display: grid; gap: 15px; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field { display: grid; gap: 6px; align-content: start; }
.field label { color: var(--navy-800); font-size: .8rem; font-weight: 850; }
.field small { color: var(--navy-600); line-height: 1.4; }
.field.span-two { grid-column: 1 / -1; }
.checkbox-field { align-self: end; }
.checkbox-field label { min-height: 44px; padding: 11px 13px; display: flex; align-items: center; gap: 9px; border: 1px solid var(--slate-300); border-radius: 11px; background: white; }
.record-type-grid > div { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.record-type-grid label { padding: 13px; display: flex; align-items: center; gap: 8px; border: 1px solid var(--slate-300); border-radius: 11px; font-weight: 800; }
.photo-input { min-height: 88px; padding: 24px; border: 2px dashed var(--slate-300); background: var(--canvas); }
.photo-input.has-files { border-color: var(--teal); background: var(--teal-soft); }
.notes-section { padding: 22px; }
.sticky-actions { padding: 14px 0; display: flex; justify-content: flex-end; gap: 9px; position: sticky; bottom: 0; z-index: 8; background: linear-gradient(transparent, var(--canvas) 28%); }

.detail-hero { margin-bottom: 22px; display: flex; justify-content: space-between; align-items: flex-end; gap: 25px; }
.asset-code { width: max-content; padding: 8px 12px; border-radius: 9px; color: white; background: var(--navy-900); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 850; letter-spacing: .04em; }
.detail-grid { margin-bottom: 17px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.detail-card { padding: 22px; }
.detail-list { margin: 15px 0 0; }
.detail-list div { padding: 10px 0; display: grid; grid-template-columns: 135px 1fr; gap: 12px; border-bottom: 1px solid var(--slate-100); }
.detail-list div:last-child { border-bottom: 0; }
.detail-list dt { color: var(--navy-600); font-size: .78rem; font-weight: 800; }
.detail-list dd { margin: 0; font-weight: 700; }
.evidence-note { margin: 15px 0 0; padding: 12px; border-radius: 10px; color: #6d4900; background: var(--amber-soft); font-size: .81rem; line-height: 1.45; }
.component-section, .photos-section, .action-panel, .notes-display { margin-top: 14px; padding: 22px; }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 15px; }
.section-heading p { margin-bottom: 0; color: var(--navy-600); font-size: .85rem; }
.component-grid { margin-top: 14px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.component-grid a { padding: 13px; border-radius: 11px; background: var(--slate-100); }
.component-grid strong, .component-grid small { display: block; }
.component-grid small { margin-top: 4px; color: var(--navy-600); }
.photo-grid { margin-top: 15px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; }
.photo-grid a { overflow: hidden; position: relative; min-height: 150px; border-radius: 12px; background: var(--slate-100); }
.photo-grid img { width: 100%; height: 180px; display: block; object-fit: cover; }
.photo-grid span { position: absolute; left: 8px; bottom: 8px; padding: 5px 8px; border-radius: 7px; color: white; background: rgba(11,31,51,.84); font-size: .7rem; font-weight: 800; }
.photo-upload { margin-top: 15px; display: grid; grid-template-columns: 160px 1fr auto; gap: 8px; }
.action-panel { display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.action-panel p { margin-bottom: 0; color: var(--navy-600); }
.action-buttons { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.action-buttons form { margin: 0; }

.label-stage { min-height: 380px; display: grid; place-items: center; border-radius: var(--radius); background: #dce3e8; }
.label-image { width: min(580px, 94%); image-rendering: crisp-edges; background: white; box-shadow: 0 18px 45px rgba(11,31,51,.2); }
.label-actions { margin-top: 18px; display: flex; justify-content: center; flex-wrap: wrap; gap: 9px; }
.printer-hint { margin-top: 16px; text-align: center; color: var(--navy-600); }

.settings-grid { display: grid; grid-template-columns: repeat(3, 1fr); align-items: start; gap: 14px; }
.settings-card { padding: 21px; }
.settings-card form > div { display: grid; gap: 5px; }
.settings-card form label { font-size: .78rem; font-weight: 800; }
.mini-list { margin-top: 19px; display: grid; gap: 6px; }
.mini-list span { padding: 9px; border-radius: 9px; background: var(--slate-100); }
.mini-list strong, .mini-list small { display: block; }
.mini-list small { margin-top: 3px; color: var(--navy-600); }

@media (max-width: 900px) {
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
  .filter-bar { grid-template-columns: 1fr 1fr; }
  .filter-bar input[type="search"] { grid-column: 1 / -1; }
  .detail-grid, .settings-grid { grid-template-columns: 1fr; }
  .component-grid { grid-template-columns: repeat(2, 1fr); }
  .photo-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 620px) {
  .topbar { padding: 11px 15px; }
  .brand small, .user-chip > span { display: none; }
  .primary-nav { padding: 0 8px; justify-content: space-around; }
  .primary-nav a { flex: 1; padding: 13px 7px 11px; text-align: center; }
  .shell { width: min(100% - 22px, 1180px); padding-top: 23px; }
  h1 { font-size: 2.25rem; }
  .split-heading { align-items: stretch; flex-direction: column; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .stats-grid article { min-height: 88px; }
  .quick-add, .export-strip { align-items: stretch; flex-direction: column; }
  .quick-actions, .export-strip > div:last-child { display: grid; grid-template-columns: 1fr 1fr; }
  .filter-bar { grid-template-columns: 1fr; }
  .filter-bar input[type="search"] { grid-column: auto; }
  .asset-row { grid-template-columns: 43px 1fr; }
  .asset-meta { grid-column: 2; justify-items: start; }
  .form-section { padding: 17px; grid-template-columns: 1fr; }
  .section-number { width: 34px; height: 34px; }
  .form-grid.two, .record-type-grid > div { grid-template-columns: 1fr; }
  .field.span-two { grid-column: auto; }
  .detail-hero { align-items: flex-start; flex-direction: column; }
  .detail-list div { grid-template-columns: 105px 1fr; }
  .section-heading { align-items: stretch; flex-direction: column; }
  .component-grid, .photo-grid { grid-template-columns: repeat(2, 1fr); }
  .photo-grid img { height: 145px; }
  .photo-upload { grid-template-columns: 1fr; }
  .action-panel { align-items: stretch; flex-direction: column; }
  .action-buttons { justify-content: stretch; }
  .action-buttons .button, .action-buttons form, .action-buttons form .button { width: 100%; }
  .sticky-actions { padding-top: 28px; }
}

@media print {
  @page { size: 58mm 34mm; margin: 0; }
  body { background: white; }
  .topbar, .primary-nav, .no-print, .messages { display: none !important; }
  .shell { width: 58mm; margin: 0; padding: 0; }
  .label-stage { width: 58mm; min-height: 0; display: block; background: white; }
  .label-image { width: 58mm; height: auto; display: block; box-shadow: none; }
}
html .android-print-action[hidden] {
  display: none;
}
