:root {
  --bg: #f4f6f9;
  --bg-accent: #f4f6f9;
  --card: #ffffff;
  --card-soft: #fafbfc;
  --text: #17263b;
  --muted: #667085;
  --line: #d9dee7;
  --line-soft: #e9edf3;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #eef4ff;
  --success-bg: #ecfdf3;
  --success-text: #027a48;
  --error-bg: #fef3f2;
  --error-text: #b42318;
  --notice-bg: #fffaeb;
  --notice-text: #b54708;
  --shadow: 0 4px 16px rgba(16, 24, 40, 0.035);
  --shadow-soft: 0 2px 6px rgba(16, 24, 40, 0.025);
  --radius: 16px;
  --radius-sm: 12px;
  --sidebar-width: 246px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Arial, "Microsoft YaHei", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.045), transparent 18%),
    radial-gradient(circle at bottom right, rgba(15, 23, 42, 0.03), transparent 20%),
    var(--bg-accent);
}
a { color: inherit; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line-soft);
  box-shadow: 0 1px 0 rgba(16,24,40,0.02);
}
.topbar-inner {
  max-width: 100%;
  margin: 0 auto;
  padding: 12px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
}
.brand-block {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}
.brand-mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: #fff;
  font-weight: 800;
  letter-spacing: .03em;
  background: linear-gradient(180deg, #3b82f6 0%, var(--primary) 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.24), 0 8px 18px rgba(37,99,235,.18);
  flex: 0 0 auto;
}
.brand-copy { min-width: 0; }
.brand-copy h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}
.top-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 9px 13px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--line);
  color: #344054;
  font-weight: 700;
  text-decoration: none;
  box-shadow: var(--shadow-soft);
}
.top-action:hover { background: #f8fafc; }
.top-action-danger { color: #b42318; }

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  align-items: start;
  gap: 0;
}
.left-menu {
  position: sticky;
  top: 65px;
  height: calc(100vh - 65px);
  padding: 16px 12px 16px 16px;
  border-right: 1px solid var(--line-soft);
  background: rgba(255,255,255,.58);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  overflow-y: auto;
}
.left-menu-inner {
  display: grid;
  gap: 18px;
}
.menu-section-title {
  margin: 0 0 9px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-weight: 800;
}
.menu-links { display: grid; gap: 7px; }
.menu-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 42px;
  padding: 10px 12px;
  border-radius: 11px;
  text-decoration: none;
  color: #344054;
  background: transparent;
  border: 1px solid transparent;
  font-weight: 700;
  line-height: 1.2;
}
.menu-link:hover {
  background: #fff;
  border-color: var(--line-soft);
}
.menu-link.active {
  background: var(--primary-soft);
  border-color: #cfe0ff;
  color: var(--primary-dark);
}
.menu-parent {
  display: grid;
  gap: 6px;
}
.submenu-links {
  display: grid;
  gap: 6px;
  margin-left: 12px;
  padding-left: 12px;
  border-left: 2px solid var(--line-soft);
}
.submenu-link {
  display: flex;
  align-items: center;
  min-height: 36px;
  padding: 8px 10px;
  border-radius: 10px;
  color: #475467;
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  border: 1px solid transparent;
}
.submenu-link:hover {
  background: #fff;
  border-color: var(--line-soft);
}
.submenu-link.active {
  background: #eef4ff;
  border-color: #cfe0ff;
  color: var(--primary-dark);
}
.menu-link-danger { color: #b42318; }

.container {
  max-width: 1260px;
  width: 100%;
  margin: 22px auto;
  padding: 0 16px 56px;
}
.app-container {
  max-width: 1180px;
}
.user-strip {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.user-strip span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--line-soft);
  box-shadow: var(--shadow-soft);
}
.user-strip strong { color: var(--text); }

.messages {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}
.message {
  padding: 14px 16px;
  border-radius: 14px;
  font-weight: 600;
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--line-soft);
}
.message.success { background: var(--success-bg); color: var(--success-text); }
.message.error { background: var(--error-bg); color: var(--error-text); }

.grid { display: grid; gap: 18px; }
.card {
  background: var(--card);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}
.subtle-card { background: var(--card-soft); }
.form-card,
.table-card,
.login-card { overflow: hidden; }
.narrow-card {
  max-width: 760px;
  margin: 0 auto;
}
.card-title-row,
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}
h2 {
  margin: 0 0 6px;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
h3 {
  margin: 0 0 6px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.eyebrow {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-weight: 700;
}
.muted {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}
.count-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  padding: 9px 14px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line-soft);
  box-shadow: var(--shadow-soft);
  color: var(--text);
  font-weight: 700;
}
.notice {
  margin: 0 0 18px;
  padding: 13px 15px;
  border-radius: 14px;
  background: var(--notice-bg);
  color: var(--notice-text);
  font-weight: 600;
  border: 1px solid #fde7c2;
}
.notice.admin { background: #eef4ff; color: #235aa8; border-color: #d8e6ff; }
.notice.readonly { background: #f8f9fb; color: #4c4c53; border-color: #ebeef2; }

.entry-form,
.user-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.login-form {
  display: grid;
  gap: 16px;
  margin-top: 18px;
}
.entry-form label,
.user-form label,
.login-form label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-weight: 600;
  min-width: 0;
}
.photo-upload-label,
.remark-field,
.entry-form button,
.form-actions { grid-column: span 2; }
.entry-form input,
.entry-form select,
.entry-form textarea,
.search-form input,
.login-form input,
.user-form input,
.user-form select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 13px 14px;
  font-size: 15px;
  background: #fff;
  color: var(--text);
  outline: none;
  transition: .18s ease;
}
.entry-form input:focus,
.entry-form select:focus,
.entry-form textarea:focus,
.search-form input:focus,
.login-form input:focus,
.user-form input:focus,
.user-form select:focus {
  border-color: rgba(37,99,235,.45);
  box-shadow: 0 0 0 4px rgba(37,99,235,.10);
}
button,
.button-secondary,
.button-small,
.language-toggle {
  border: 0;
  border-radius: 10px;
  padding: 12px 15px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: .18s ease;
}
button:hover,
.button-secondary:hover,
.button-small:hover,
.language-toggle:hover { transform: translateY(-1px); }
.entry-form button,
.login-form button,
.user-form button,
.search-form button {
  background: linear-gradient(180deg, #3b82f6 0%, var(--primary) 100%);
  color: #fff;
  box-shadow: 0 10px 20px rgba(37,99,235,.16);
}
.entry-form button:hover,
.login-form button:hover,
.user-form button:hover,
.search-form button:hover { background: linear-gradient(180deg, #2f74ee 0%, var(--primary-dark) 100%); }
.button-secondary,
.button-small,
.language-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line);
}
.form-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}
.checkbox-label { flex-direction: row !important; align-items: center; }
.checkbox-label input { width: auto; }
.user-form small { color: var(--muted); }

.current-movement-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 18px;
  padding: 12px 14px;
  border-radius: 14px;
  background: #f8fafc;
  border: 1px solid var(--line-soft);
}
.muted-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}
.current-movement-pill { font-size: 13px; }
.movement-help {
  color: var(--muted);
  font-size: 13px;
}

.scan-input-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.scan-input-row input { flex: 1; min-width: 0; }
.scan-button {
  white-space: nowrap;
  background: #111827 !important;
  box-shadow: none !important;
}
.scan-button:hover { background: #030712 !important; }

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.summary-card {
  border-radius: 14px;
  padding: 16px 18px;
  background: #fff;
  border: 1px solid var(--line-soft);
  box-shadow: var(--shadow-soft);
}
.summary-card span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}
.summary-card strong {
  display: block;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.unit-total-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin: 0 0 16px;
  color: var(--muted);
}
.unit-total-row span {
  display: inline-block;
  padding: 8px 12px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line-soft);
  color: var(--text);
  font-weight: 600;
}

.search-form {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.search-form input { width: min(360px, 100%); }
.filter-form {
  align-items: end;
}
.filter-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 160px;
  font-weight: 700;
  color: var(--muted);
  font-size: 12px;
}
.filter-field input {
  min-height: 42px;
}
.filter-field:first-child {
  min-width: 260px;
}
.date-field {
  min-width: 145px;
}

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line-soft);
  border-radius: 16px;
  background: #fff;
}
table {
  width: 100%;
  min-width: 1120px;
  border-collapse: separate;
  border-spacing: 0;
}
th, td {
  padding: 13px 14px;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--line-soft);
}
th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fafc;
  color: #667085;
  font-size: 12px;
  letter-spacing: .05em;
  text-transform: uppercase;
}
tr:nth-child(even) td { background: #fcfcfd; }
tr:hover td { background: #f9fbff; }
tr:last-child td { border-bottom: 0; }
.number {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.action-cell {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.action-cell form { margin: 0; }
.empty { padding: 20px 4px 4px; color: var(--muted); }
.danger {
  background: #fff3f2 !important;
  color: #b42318 !important;
  border: 1px solid #f3d2cf !important;
  box-shadow: none !important;
}

.record-images {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  min-width: 126px;
}
.record-images a {
  display: inline-flex;
  width: 40px;
  height: 40px;
  overflow: hidden;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--line-soft);
}
.record-images img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.movement-badge {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.status-badge {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.status-pending {
  background: #fffaeb;
  color: #b54708;
  border: 1px solid #fedf89;
}
.status-empty {
  color: var(--muted);
}
.receiving-form button {
  grid-column: span 2;
}

.movement-positive { background: #ecfdf3; color: #027a48; }
.movement-negative { background: #fef3f2; color: #b42318; }
.balance-positive { color: #027a48; font-weight: 700; }
.balance-negative { color: #b42318; font-weight: 700; }
.balance-zero { color: var(--muted); font-weight: 700; }

.photo-upload-label small { font-weight: 400; }
.photo-preview {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.photo-preview-item {
  width: 112px;
  padding: 6px;
  border-radius: 12px;
  border: 1px solid var(--line-soft);
  background: #fff;
}
.photo-preview-item img {
  width: 100%;
  height: 76px;
  object-fit: cover;
  border-radius: 10px;
  display: block;
}
.photo-preview-item span {
  display: block;
  margin-top: 5px;
  font-size: 11px;
  line-height: 1.25;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.login-wrap {
  min-height: calc(100vh - 150px);
  display: grid;
  place-items: center;
}
.login-shell {
  width: min(980px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, .95fr);
  gap: 18px;
}
.login-side,
.login-card { padding: 28px; }
.login-side-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 12px;
  margin-top: 18px;
}
.meta-box {
  padding: 16px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid var(--line-soft);
}
.meta-box span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}
.meta-box strong {
  display: block;
  font-size: 22px;
  font-weight: 700;
}
.login-language-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 12px 0 2px;
}
.default-box {
  margin-top: 18px;
  padding: 18px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid var(--line-soft);
}
.code-lines {
  margin-top: 12px;
  display: grid;
  gap: 8px;
  padding: 14px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid var(--line-soft);
  font-family: Consolas, Monaco, monospace;
}

.scanner-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(0,0,0,.38);
  backdrop-filter: blur(8px);
}
.scanner-modal.open { display: flex; }
.scanner-panel {
  width: min(680px, 100%);
  background: rgba(255,255,255,.98);
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 24px 60px rgba(0,0,0,.18);
}
.scanner-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}
.scanner-video-wrap {
  position: relative;
  overflow: hidden;
  border-radius: 14px;
  background: #111;
  aspect-ratio: 4 / 3;
}
.scanner-video-wrap video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.scanner-frame {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(72%, 420px);
  height: min(42%, 220px);
  transform: translate(-50%, -50%);
  border: 3px solid rgba(255,255,255,.92);
  border-radius: 16px;
  box-shadow: 0 0 0 999px rgba(0,0,0,.2);
  pointer-events: none;
}
.scanner-line {
  position: absolute;
  left: 10%;
  right: 10%;
  top: 50%;
  height: 2px;
  transform: translateY(-50%);
  background: rgba(16,185,129,.95);
  box-shadow: 0 0 8px rgba(16,185,129,.9);
  pointer-events: none;
}
.quagga-region {
  position: absolute;
  inset: 0;
  overflow: hidden;
}
.quagga-region video,
.quagga-region canvas {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
}
.native-scanner-video {
  display: none;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.scanner-video-wrap.native-mode .quagga-region { display: none; }
.scanner-video-wrap.native-mode .native-scanner-video { display: block; }
.scanner-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.scanner-actions .button-small {
  flex: 1 1 160px;
  text-align: center;
}
.scanner-status {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #f2f6fb;
  color: var(--text);
  font-weight: 600;
}
.scanner-status.error { background: var(--error-bg); color: var(--error-text); }
.scanner-status.success { background: var(--success-bg); color: var(--success-text); }

@media (max-width: 1180px) {
  :root { --sidebar-width: 220px; }
  .app-container { max-width: 100%; }
  table { min-width: 1180px; }
}

@media (max-width: 900px) {
  .app-shell {
    display: block;
  }
  .left-menu {
    position: static;
    height: auto;
    padding: 12px;
    border-right: 0;
    border-bottom: 1px solid var(--line-soft);
    background: rgba(255,255,255,.84);
  }
  .left-menu-inner {
    display: grid;
    gap: 12px;
  }
  .menu-links {
    display: grid;
    gap: 8px;
  }
  .menu-parent {
    gap: 8px;
  }
  .menu-link,
  .submenu-link {
    width: 100%;
    white-space: normal;
  }
  .menu-link {
    min-height: 40px;
    padding: 10px 12px;
    font-size: 14px;
  }
  .submenu-links {
    margin-left: 8px;
    padding-left: 10px;
    gap: 6px;
  }
  .submenu-link {
    min-height: 34px;
    padding: 8px 10px;
    font-size: 13px;
  }
  .menu-section-title { margin-bottom: 8px; }
  .summary-grid,
  .login-shell,
  .login-side-meta { grid-template-columns: 1fr; }
  .card,
  .login-side,
  .login-card { padding: 20px; }
  h2 { font-size: 24px; }
  table { min-width: 1140px; }
}

@media (max-width: 780px) {
  .topbar { position: static; }
  .topbar-inner { padding: 12px; gap: 10px; }
  .brand-mark { width: 38px; height: 38px; }
  .brand-copy h1 { font-size: 19px; }
  .top-actions { gap: 6px; }
  .top-action { min-height: 36px; padding: 8px 10px; font-size: 13px; }
  .container { margin-top: 16px; padding: 0 12px 40px; }
  .user-strip { display: grid; grid-template-columns: 1fr; }
  .user-strip span { width: 100%; justify-content: space-between; }
  .entry-form,
  .user-form { grid-template-columns: 1fr; }
  .photo-upload-label,
  .remark-field,
  .entry-form button,
  .form-actions { grid-column: span 1; }
  .receiving-form button { grid-column: span 1; }
  .card-title-row,
  .stacked-mobile,
  .search-form,
  .scanner-header,
  .login-language-row,
  .form-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .filter-field,
  .filter-field:first-child,
  .date-field,
  .filter-field input,
  .search-form input,
  .search-form button,
  .search-form a,
  .button-secondary,
  .button-small,
  .language-toggle,
  .form-actions > * {
    width: 100%;
    text-align: center;
  }
  .scan-input-row { flex-direction: column; }
  .scan-button { width: 100%; }
  .scanner-actions { flex-direction: column; }
  .scanner-actions .button-small { width: 100%; }
  .record-images { min-width: 0; }
  .photo-preview-item { width: 96px; }
  .current-movement-bar {
    flex-direction: column;
    align-items: flex-start;
  }
  table { min-width: 1080px; }
}

@media (max-width: 520px) {
  .card,
  .login-side,
  .login-card,
  .scanner-panel { padding: 16px; }
  h2 { font-size: 22px; }
  .summary-card strong,
  .meta-box strong { font-size: 22px; }
  .topbar-inner { align-items: center; }
  .brand-block { gap: 10px; }
}

@media (max-width: 420px) {
  .left-menu { padding: 10px; }
  .submenu-links {
    margin-left: 4px;
    padding-left: 8px;
  }
  .menu-link,
  .submenu-link {
    font-size: 13px;
  }
}


.image-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.image-modal.open {
  display: flex;
}
.image-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.image-modal-panel {
  position: relative;
  z-index: 1;
  width: min(980px, 96vw);
  max-height: 92vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 28px 72px rgba(0, 0, 0, .28);
  overflow: hidden;
}
.image-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line-soft);
  background: #fff;
}
.image-modal-header strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
}
.image-modal-close {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  padding: 0;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  font-size: 24px;
  line-height: 1;
  box-shadow: none;
}
.image-modal-body {
  min-height: 0;
  background: #0f172a;
  display: grid;
  place-items: center;
  padding: 12px;
}
.image-modal-body img {
  display: block;
  max-width: 100%;
  max-height: calc(92vh - 86px);
  object-fit: contain;
  border-radius: 10px;
}
body.image-modal-open {
  overflow: hidden;
}
.record-image-link {
  cursor: zoom-in;
}

@media (max-width: 780px) {
  .image-modal {
    padding: 10px;
  }
  .image-modal-panel {
    width: 100%;
    max-height: 94vh;
    border-radius: 14px;
  }
  .image-modal-header {
    padding: 12px;
  }
  .image-modal-body {
    padding: 8px;
  }
  .image-modal-body img {
    max-height: calc(94vh - 76px);
  }
}


.dashboard-summary-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}
.summary-grid-inventory {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}
.summary-card-warning {
  background: #fff8eb;
  border-color: #fde7c2;
}
.summary-card-danger {
  background: #fff1f0;
  border-color: #f7d6d2;
}
.dashboard-hero {
  margin-bottom: 18px;
}
.dashboard-grid-two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 18px;
}
.dashboard-card h3 { margin-bottom: 4px; }
.chart-list, .mini-bars, .watchlist-table {
  display: grid;
  gap: 12px;
}
.chart-row {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 12px;
  align-items: center;
}
.chart-label {
  font-weight: 700;
  color: var(--muted);
}
.chart-bars {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto;
  gap: 8px;
  align-items: center;
}
.chart-bar-track, .mini-bar-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: #eef2f7;
  overflow: hidden;
}
.chart-bar, .mini-bar-fill {
  height: 100%;
  border-radius: 999px;
}
.bar-in, .movement-positive.mini-bar-fill {
  background: linear-gradient(90deg, #34d399 0%, #10b981 100%);
}
.bar-out, .movement-negative.mini-bar-fill {
  background: linear-gradient(90deg, #fb923c 0%, #f97316 100%);
}
.chart-value {
  min-width: 56px;
  text-align: right;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.mini-bar-row {
  display: grid;
  gap: 6px;
}
.mini-bar-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  font-size: 14px;
}
.small-text {
  font-size: 12px;
}
.watchlist-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  background: #fff;
}
.watchlist-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.inventory-legend {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin: 0 0 14px;
}
.inventory-legend small {
  color: var(--muted);
}
.warning-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid transparent;
}
.warning-normal {
  background: #ecfdf3;
  color: #027a48;
  border-color: #b7ebc8;
}
.warning-low {
  background: #fff8eb;
  color: #b54708;
  border-color: #fde7c2;
}
.warning-zero {
  background: #f2f4f7;
  color: #475467;
  border-color: #dfe3ea;
}
.warning-negative {
  background: #fff1f0;
  color: #b42318;
  border-color: #f7d6d2;
}
.inventory-row-low td {
  background: #fffaf0 !important;
}
.inventory-row-negative td {
  background: #fff5f4 !important;
}
.inventory-row-zero td {
  background: #fbfbfc !important;
}
@media (max-width: 1180px) {
  .dashboard-summary-grid,
  .summary-grid-inventory {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 980px) {
  .dashboard-grid-two {
    grid-template-columns: 1fr;
  }
  .chart-bars {
    grid-template-columns: 1fr auto;
  }
}
@media (max-width: 640px) {
  .dashboard-summary-grid,
  .summary-grid-inventory {
    grid-template-columns: 1fr;
  }
  .chart-row {
    grid-template-columns: 1fr;
  }
  .watchlist-row,
  .watchlist-right,
  .mini-bar-top {
    flex-direction: column;
    align-items: flex-start;
  }
  .chart-bars {
    grid-template-columns: 1fr;
  }
  .chart-value {
    text-align: left;
    min-width: 0;
  }
}


.photo-preview-item {
  color: inherit;
  text-decoration: none;
  cursor: zoom-in;
}
.photo-preview-item:hover {
  border-color: #cfe0ff;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.10);
}
.upload-preview-link {
  display: block;
}

.entry-form textarea {
  resize: vertical;
  min-height: 86px;
  line-height: 1.45;
  font-family: inherit;
}
.remark-cell {
  max-width: 240px;
  white-space: normal;
  line-height: 1.4;
}


.pagination-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 14px 0;
  padding: 12px 14px;
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow-soft);
}
.pagination-info {
  color: var(--muted);
  font-weight: 700;
  font-size: 13px;
}
.pagination-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.button-secondary.disabled {
  opacity: .45;
  cursor: not-allowed;
  pointer-events: none;
}
.record-images img {
  background: #f2f4f7;
}
@media (max-width: 640px) {
  .pagination-bar,
  .pagination-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .pagination-actions .button-secondary {
    width: 100%;
  }
}


.export-range-panel {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-end;
  margin: 0 0 16px;
  padding: 14px 16px;
  border-radius: 16px;
  background: #f8fafc;
  border: 1px solid var(--line-soft);
}
.export-range-copy {
  display: grid;
  gap: 4px;
  min-width: 220px;
}
.export-range-copy strong {
  font-size: 15px;
}
.export-range-copy span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}
.export-range-form {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}
.export-range-form button {
  min-height: 42px;
  background: linear-gradient(180deg, #3b82f6 0%, var(--primary) 100%);
  color: #fff;
  box-shadow: 0 10px 20px rgba(37,99,235,.12);
}
.export-range-form button + button {
  background: #111827;
}
@media (max-width: 900px) {
  .export-range-panel {
    flex-direction: column;
    align-items: stretch;
  }
  .export-range-form {
    justify-content: stretch;
  }
  .export-range-form .filter-field,
  .export-range-form button {
    width: 100%;
  }
}

/* Inventory location view */
.inventory-view-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0 12px;
}

.inventory-view-tab {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 16px;
  background: rgba(248, 250, 252, 0.82);
  color: inherit;
  text-decoration: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.inventory-view-tab span {
  color: var(--muted);
  font-size: 0.88rem;
}

.inventory-view-tab:hover {
  transform: translateY(-1px);
  border-color: rgba(37, 99, 235, 0.45);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
}

.inventory-view-tab.active {
  border-color: rgba(37, 99, 235, 0.72);
  background: rgba(239, 246, 255, 0.95);
  box-shadow: 0 12px 28px rgba(37, 99, 235, 0.12);
}

.inventory-view-tab.active strong {
  color: var(--primary);
}

.inventory-view-hint {
  margin: 0 0 16px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(241, 245, 249, 0.9);
  color: var(--muted);
  font-size: 0.92rem;
}

@media (max-width: 760px) {
  .inventory-view-switch {
    grid-template-columns: 1fr;
  }
}

/* ADIMOMO application identity and access screen. */
body { background: var(--bg); }
.brand-block { text-decoration: none; }
.brand-mark { box-shadow: none; background: transparent; }
.brand-copy { display: grid; gap: 3px; }
.brand-parent { font-size: 13px; font-weight: 800; letter-spacing: .14em; }
.brand-product { font-size: 13px; color: var(--muted); }
.topbar-inner { min-height: 72px; }
.left-menu { top: 72px; height: calc(100vh - 72px); }
.top-action { box-shadow: none; font: inherit; font-size: 13px; font-weight: 600; }
.logout-form { margin: 0; }
.menu-toggle { display: none; }
.user-strip { margin-bottom: 20px; }
.user-strip span { font-size: 13px; padding: 8px 12px; box-shadow: none; }
.app-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}
.app-footer > div { display: flex; flex-wrap: wrap; gap: 18px; }
.app-footer a { text-decoration: none; }
.app-footer a:hover { color: var(--primary); text-decoration: underline; }
.footer-version { font-variant-numeric: tabular-nums; }
.dashboard-hero > div:first-child { margin-bottom: 24px; }
.dashboard-hero .summary-grid { margin-bottom: 0; }
.entry-form button,
.login-form button,
.user-form button,
.search-form button,
.export-range-form button { background: var(--primary); box-shadow: none; }
.entry-form button:hover,
.login-form button:hover,
.user-form button:hover,
.search-form button:hover { background: var(--primary-dark); }
.login-page .container { max-width: 1112px; margin: 0 auto; padding-bottom: 22px; }
.login-wrap { min-height: min(720px, calc(100svh - 150px)); padding: 42px 0 30px; }
.login-shell { width: 100%; gap: 0; grid-template-columns: 1.12fr 1fr; }
.login-side {
  display: flex;
  flex-direction: column;
  padding: 44px;
  border: 0;
  border-radius: 20px 0 0 20px;
  background: #102137;
  color: #fff;
}
.login-side .eyebrow { color: #9bb7d5; font-size: 11px; letter-spacing: .12em; margin-bottom: 34px; }
.login-side h1 { margin: 0 0 18px; font-size: clamp(30px, 3.5vw, 42px); line-height: 1.16; letter-spacing: -.035em; white-space: pre-line; font-weight: 650; }
.login-intro { max-width: 340px; margin: 0; color: #b7c9dd; line-height: 1.7; font-size: 15px; }
.login-capabilities { display: grid; gap: 16px; margin: 34px 0 38px; }
.login-capabilities > div { display: flex; align-items: center; gap: 16px; font-size: 14px; }
.capability-number { color: #7db5ff; font-size: 11px; font-variant-numeric: tabular-nums; border: 1px solid #35516f; border-radius: 7px; padding: 6px; }
.login-product-name { margin-top: auto; padding-top: 24px; border-top: 1px solid #2b3e56; color: #9bb7d5; font-size: 12px; letter-spacing: .025em; }
.login-card { display: flex; flex-direction: column; justify-content: center; padding: 44px; border-radius: 0 20px 20px 0; border-left: 0; }
.login-card h2 { font-size: 27px; margin-bottom: 10px; }
.login-card .muted { font-size: 14px; }
.login-language-row { margin: 20px 0 0; padding-bottom: 16px; border-bottom: 1px solid var(--line-soft); }
.login-language-row .language-toggle { font-size: 12px; padding: 7px 12px; }
.login-form { margin-top: 22px; gap: 18px; }
.login-form label { font-size: 13px; }
.login-form button { min-height: 46px; margin-top: 4px; }
.login-access-note { margin: 22px 0 0; font-size: 12px; line-height: 1.7; color: var(--muted); }
.login-page .app-footer { margin-top: 0; }
:focus-visible { outline: 3px solid #75a7f7; outline-offset: 3px; }
.skip-link { position: fixed; z-index: 1500; top: 10px; left: 10px; padding: 12px 16px; border-radius: 8px; background: #fff; color: var(--primary); transform: translateY(-200%); }
.skip-link:focus { transform: translateY(0); }
@media (max-width: 900px) {
  .left-menu { height: auto; }
  .navigation-ready .menu-toggle { display: inline-flex; }
  .navigation-ready .left-menu:not(.is-open) { display: none; }
  .menu-links { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .menu-parent { grid-column: 1 / -1; }
  .submenu-links { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .login-side, .login-card { padding: 32px; }
}
@media (max-width: 700px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-wrap { min-height: 0; padding: 22px 0; }
  .login-side { border-radius: 16px 16px 0 0; padding: 26px; }
  .login-side .eyebrow { margin-bottom: 18px; }
  .login-side h1 { font-size: 30px; white-space: normal; }
  .login-intro { max-width: none; font-size: 14px; }
  .login-capabilities { display: none; }
  .login-product-name { display: none; }
  .login-card { border-left: 1px solid var(--line-soft); border-top: 0; border-radius: 0 0 16px 16px; padding: 26px; }
  .login-language-row { flex-direction: row; align-items: center; }
  .login-language-row .language-toggle { width: auto; }
  .app-footer { font-size: 11px; }
  .user-strip { display: flex; gap: 8px; }
  .user-strip span { width: auto; padding: 6px 10px; font-size: 12px; }
  input, select, textarea { font-size: 16px !important; }
}
@media (max-width: 440px) {
  .topbar-inner { flex-wrap: wrap; gap: 12px; }
  .brand-parent { font-size: 12px; }
  .brand-product { font-size: 12px; }
  .brand-block { gap: 8px; }
  .brand-mark { width: 34px; height: 34px; }
  .top-actions { gap: 4px; }
  .top-action { padding: 8px; font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
}
