:root {
  color: #1b2430;
  background: #eef2f6;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  --border: #d5dde7;
  --muted: #66758a;
  --primary: #146c94;
  --primary-strong: #0f5678;
  --panel: #ffffff;
  --success-bg: #e8f6ee;
  --success-text: #167044;
  --error-bg: #faecec;
  --error-text: #a63131;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.72;
}

.app-shell {
  min-height: 100vh;
}

.login-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(20, 108, 148, 0.14), rgba(45, 139, 118, 0.12)),
    #eef2f6;
}

.login-panel,
.content-panel {
  width: min(100%, 980px);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 20px 50px rgba(33, 48, 69, 0.08);
}

.login-panel {
  display: grid;
  gap: 20px;
  max-width: 420px;
  padding: 32px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 24px clamp(16px, 4vw, 48px);
  background: #ffffff;
  border-bottom: 1px solid var(--border);
}

.topbar-title {
  min-width: 0;
}

.workspace {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 20px;
  width: min(1180px, calc(100% - 32px));
  margin: 24px auto;
}

.mobile-menu-button {
  display: none;
}

.side-nav {
  display: grid;
  align-content: start;
  gap: 8px;
}

.side-nav button {
  min-height: 42px;
  padding: 0 14px;
  color: #273547;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
}

.side-nav button:hover,
.side-nav button.active {
  color: var(--primary-strong);
  background: #ffffff;
  border-color: var(--border);
}

.content-panel {
  min-height: 560px;
  padding: clamp(20px, 3vw, 32px);
}

.tool-form {
  display: grid;
  gap: 22px;
}

.panel-heading {
  display: grid;
  gap: 6px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(26px, 3vw, 36px);
  line-height: 1.18;
}

h2 {
  font-size: 24px;
  line-height: 1.25;
}

.panel-heading p {
  color: var(--muted);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.form-grid.two-columns {
  max-width: 760px;
}

label {
  display: grid;
  gap: 8px;
  color: #334155;
  font-size: 14px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  color: #152033;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(20, 108, 148, 0.14);
}

.scan-input {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  gap: 8px;
}

.scan-button {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: var(--primary);
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
}

.scan-button:hover {
  color: var(--primary-strong);
  border-color: var(--primary);
}

.scan-button svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.primary-button,
.ghost-button {
  width: fit-content;
  min-width: 112px;
  min-height: 42px;
  padding: 0 18px;
  border-radius: 6px;
  border: 1px solid transparent;
  font-weight: 700;
}

.primary-button {
  color: #ffffff;
  background: var(--primary);
}

.primary-button:hover {
  background: var(--primary-strong);
}

.ghost-button {
  color: #273547;
  background: #ffffff;
  border-color: var(--border);
}

.ghost-button:hover {
  color: var(--primary-strong);
  border-color: var(--primary);
}

.form-error {
  color: var(--error-text);
  font-size: 14px;
}

.notice {
  margin-bottom: 20px;
  padding: 12px 14px;
  border-radius: 6px;
  font-weight: 700;
}

.notice.success {
  color: var(--success-text);
  background: var(--success-bg);
}

.notice.error {
  color: var(--error-text);
  background: var(--error-bg);
}

.result-area {
  display: grid;
  gap: 12px;
  padding-top: 6px;
}

.result-count {
  color: var(--muted);
  font-weight: 700;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  background: #ffffff;
}

th,
td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  color: #334155;
  background: #f7f9fb;
  font-size: 13px;
}

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

.empty-state {
  padding: 28px;
  color: var(--muted);
  text-align: center;
  background: #f8fafc;
  border: 1px dashed var(--border);
  border-radius: 8px;
}

.scanner-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.58);
}

.scanner-panel {
  display: grid;
  gap: 14px;
  width: min(100%, 480px);
  padding: 18px;
  background: #ffffff;
  border-radius: 8px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.25);
}

.scanner-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.scanner-heading h2 {
  font-size: 20px;
}

.scanner-close {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  color: #273547;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 24px;
  line-height: 1;
}

.scanner-view {
  position: relative;
  overflow: hidden;
  aspect-ratio: 1 / 1;
  background: #0f172a;
  border-radius: 8px;
}

.scanner-view video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scanner-frame {
  position: absolute;
  inset: 18%;
  border: 2px solid #ffffff;
  border-radius: 8px;
  box-shadow: 0 0 0 999px rgba(15, 23, 42, 0.26);
}

.scanner-status,
.scanner-error {
  min-height: 22px;
  font-weight: 700;
}

.scanner-status {
  color: var(--muted);
}

.scanner-error {
  color: var(--error-text);
}

@media (max-width: 760px) {
  .topbar {
    align-items: center;
    gap: 12px;
    padding: 16px;
  }

  .workspace {
    grid-template-columns: 1fr;
    gap: 12px;
    width: min(100% - 24px, 1180px);
    margin: 12px auto;
  }

  .mobile-menu-button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 44px;
    padding: 0 14px;
    color: #273547;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-weight: 700;
  }

  .menu-chevron {
    width: 22px;
    height: 22px;
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2.2;
    transition: transform 160ms ease;
  }

  .menu-chevron.open {
    transform: rotate(180deg);
  }

  .side-nav {
    display: none;
    grid-template-columns: 1fr;
    padding: 8px;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 8px;
  }

  .side-nav.open {
    display: grid;
  }

  .side-nav button {
    text-align: center;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .content-panel,
  .login-panel {
    padding: 20px;
  }

  .ghost-button {
    min-width: 64px;
    min-height: 36px;
    padding: 0 12px;
  }
}

@media (max-width: 480px) {
  .topbar {
    flex-direction: row;
  }

  .topbar h1 {
    font-size: 24px;
  }

  .primary-button {
    width: 100%;
  }
}
