:root {
  color-scheme: light;
  --ink: #172026;
  --muted: #60707a;
  --line: #d8e0e3;
  --panel: #ffffff;
  --page: #f4f7f6;
  --accent: #146c72;
  --accent-dark: #0d5055;
  --warm: #d98737;
  --danger: #bd3e31;
  --ok: #2d7b52;
  --soft-teal: #e5f2f1;
  --soft-amber: #fbf0df;
  --shadow: 0 18px 45px rgba(30, 48, 55, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--page);
}

.login-card {
  width: min(420px, 100%);
  display: grid;
  gap: 16px;
  padding: 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.login-brand {
  margin-bottom: 4px;
}

.login-card label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.9rem;
}

.login-message {
  min-height: 1.2em;
  margin: 0;
  color: var(--danger);
  font-size: 0.9rem;
}

.app-shell {
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: #12272b;
  color: #f8fbfa;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: #e5f2f1;
  color: #12272b;
  font-weight: 800;
}

.brand h1,
.brand p,
.topbar h2,
.metric p,
.panel-head h3,
.panel-head span,
.shift-panel p {
  margin: 0;
}

.brand h1 {
  font-size: 1rem;
}

.brand p,
.shift-panel p {
  color: rgba(248, 251, 250, 0.72);
  font-size: 0.86rem;
}

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-item {
  width: 100%;
  min-height: 42px;
  border: 0;
  background: transparent;
  color: rgba(248, 251, 250, 0.76);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  text-align: left;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.shift-panel {
  margin-top: auto;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
}

.eyebrow {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.main {
  padding: 26px;
  display: grid;
  gap: 20px;
  align-content: start;
}

.topbar,
.panel-head,
.topbar-actions,
.detail-actions,
menu {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.topbar h2 {
  margin-top: 4px;
  font-size: clamp(1.55rem, 2vw, 2.25rem);
  line-height: 1.12;
}

.topbar-actions {
  flex-wrap: wrap;
}

.search-box {
  min-width: min(390px, 100%);
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  background: #ffffff;
  border: 1px solid var(--line);
}

.search-box input {
  width: 100%;
  border: 0;
  outline: 0;
  min-width: 0;
}

.primary-btn,
.secondary-btn,
.danger-btn,
.icon-btn,
.tab {
  min-height: 40px;
  border: 1px solid transparent;
  padding: 0 14px;
  font-weight: 750;
}

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

.primary-btn:hover {
  background: var(--accent-dark);
}

.secondary-btn,
.tab {
  background: #ffffff;
  border-color: var(--line);
  color: var(--ink);
}

.secondary-btn:hover,
.tab:hover,
.tab.active {
  border-color: var(--accent);
  color: var(--accent);
}

.danger-btn {
  background: #ffffff;
  border-color: #efc3bd;
  color: var(--danger);
}

.danger-btn:hover {
  background: #fde8e4;
  border-color: var(--danger);
}

.icon-btn {
  width: 38px;
  padding: 0;
  background: transparent;
  border-color: var(--line);
  font-size: 1.2rem;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 10px;
}

.metric {
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 12px;
  min-height: 96px;
}

.clickable-metric {
  cursor: pointer;
}

.clickable-metric:hover,
.clickable-metric:focus-visible {
  border-color: var(--accent);
  outline: none;
}

.metric span {
  color: var(--muted);
  font-weight: 700;
  font-size: 0.78rem;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 1.55rem;
  line-height: 1;
}

.metric p {
  margin-top: 7px;
  color: var(--muted);
  font-size: 0.76rem;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
  align-items: start;
}

.inventory-panel,
.detail-panel,
.intake-panel,
.map-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.panel-head {
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.panel-head h3 {
  margin-top: 3px;
  font-size: 1rem;
}

.filter-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: nowrap;
  overflow-x: auto;
}

.tab {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 10px;
  font-size: 0.84rem;
  white-space: nowrap;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1120px;
}

th,
td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  font-size: 0.92rem;
}

th {
  color: var(--muted);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0;
}

tr.selectable {
  cursor: pointer;
}

tr.selectable:hover,
tr.selected {
  background: #f0f7f7;
}

.claim {
  font-weight: 850;
}

.subtle {
  color: var(--muted);
  font-size: 0.82rem;
}

.claim-ticket-line {
  margin-bottom: 4px;
}

.bag-id-value {
  margin-left: 4px;
}

.phone-link {
  color: var(--accent);
  font-weight: 750;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.phone-link:hover {
  color: var(--accent-dark);
}

.address-link {
  color: var(--accent);
  font-weight: 750;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.address-link:hover {
  color: var(--accent-dark);
}

.address-row {
  align-self: end;
  min-height: 42px;
  display: flex;
  align-items: center;
  color: var(--muted);
  font-size: 0.86rem;
}

.status-pill {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  justify-content: center;
  padding: 0 9px;
  font-size: 0.78rem;
  font-weight: 850;
  white-space: nowrap;
}

.status-pill.stored,
.status-pill.neutral {
  background: var(--soft-teal);
  color: var(--accent-dark);
}

.status-pill.due {
  background: var(--soft-amber);
  color: #895617;
}

.status-pill.confirmed {
  background: #e8f3ea;
  color: var(--ok);
}

.status-pill.overdue {
  background: #fde8e4;
  color: var(--danger);
}

.status-pill.released {
  background: #eef1f1;
  color: #60707a;
}

.row-action {
  min-height: 32px;
  border: 1px solid var(--line);
  background: #ffffff;
  padding: 0 10px;
  font-weight: 750;
}

.row-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.row-action.danger {
  border-color: #efc3bd;
  color: var(--danger);
}

.row-action.danger:hover {
  background: #fde8e4;
  border-color: var(--danger);
}

.detail-panel {
  position: sticky;
  top: 20px;
}

.bag-visual {
  min-height: 178px;
  margin: 16px;
  display: grid;
  place-items: center;
  background:
    linear-gradient(90deg, rgba(20, 108, 114, 0.08) 1px, transparent 1px),
    linear-gradient(rgba(20, 108, 114, 0.08) 1px, transparent 1px), #f7faf9;
  background-size: 18px 18px;
  border: 1px solid var(--line);
  position: relative;
  overflow: hidden;
}

.bag-shape {
  width: 116px;
  height: 124px;
  border: 8px solid #21383d;
  border-top-width: 20px;
  background: linear-gradient(135deg, #146c72, #d98737);
  position: relative;
  display: grid;
  place-items: center;
  color: #ffffff;
  font-weight: 900;
}

.bag-shape::before {
  content: "";
  position: absolute;
  top: -44px;
  left: 28px;
  width: 42px;
  height: 26px;
  border: 7px solid #21383d;
  border-bottom: 0;
}

.scan-lines {
  position: absolute;
  inset: auto 0 20px;
  height: 32px;
  opacity: 0.65;
  background: repeating-linear-gradient(
    90deg,
    #172026 0 3px,
    transparent 3px 7px,
    #172026 7px 9px,
    transparent 9px 15px
  );
  margin: 0 46px;
}

.detail-list {
  display: grid;
  gap: 10px;
  padding: 0 16px 16px;
  margin: 0;
}

.detail-list div {
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr);
  gap: 12px;
}

.detail-list dt {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.detail-list dd {
  margin: 0;
  min-width: 0;
}

.detail-actions {
  padding: 16px;
  border-top: 1px solid var(--line);
}

.workspace-views {
  display: grid;
}

.hidden {
  display: none !important;
}

.intake-panel,
.map-panel {
  max-width: 100%;
}

.form-grid {
  padding: 16px;
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  min-height: 42px;
  padding: 9px 11px;
  outline-color: var(--accent);
}

textarea {
  resize: vertical;
}

.full-width {
  grid-column: 1 / -1;
}

.field-label {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.tag-capture {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.scan-btn {
  min-width: 132px;
}

.photo-capture {
  display: grid;
  grid-template-columns: minmax(220px, 340px) minmax(240px, 1fr);
  gap: 14px;
  align-items: end;
}

.photo-preview {
  width: 100%;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--line);
  background: #f7faf9;
  overflow: hidden;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 750;
}

.photo-preview img,
.bag-photo {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.photo-preview.empty {
  background:
    linear-gradient(90deg, rgba(20, 108, 114, 0.08) 1px, transparent 1px),
    linear-gradient(rgba(20, 108, 114, 0.08) 1px, transparent 1px), #f7faf9;
  background-size: 18px 18px;
}

.photo-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.upload-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  font-size: 1rem;
}

.upload-btn input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.submit-btn {
  margin: 0 16px 16px;
  width: calc(100% - 32px);
}

.zone-grid {
  padding: 16px;
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 14px;
}

.zone {
  min-height: 148px;
  border: 1px solid var(--line);
  background: #f9fbfb;
  padding: 14px;
  display: grid;
  gap: 12px;
}

.zone-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 850;
}

.slot-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
}

.slot {
  aspect-ratio: 1;
  min-width: 0;
  border: 1px solid #cbd7da;
  background: #ffffff;
}

.slot.filled {
  background: var(--accent);
  border-color: var(--accent);
}

dialog {
  border: 0;
  padding: 0;
  background: transparent;
}

dialog::backdrop {
  background: rgba(18, 39, 43, 0.4);
}

.dialog-card {
  width: min(420px, calc(100vw - 28px));
  background: #ffffff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.scanner-card {
  width: min(620px, calc(100vw - 28px));
}

.ticket-card {
  width: min(760px, calc(100vw - 28px));
}

.ticket-body {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  gap: 16px;
  padding: 16px;
}

.ticket-photo {
  aspect-ratio: 4 / 3;
  border: 1px solid var(--line);
  background: #f7faf9;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: var(--muted);
  font-weight: 750;
}

.ticket-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ticket-details {
  display: grid;
  gap: 10px;
  margin: 0;
}

.ticket-details div {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  gap: 12px;
}

.ticket-details dt {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.ticket-details dd {
  margin: 0;
  min-width: 0;
}

.ticket-edit {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 12px;
}

.ticket-edit label {
  padding: 0;
}

.ticket-status-row,
.ticket-address,
.ticket-notes,
.ticket-history {
  grid-column: 1 / -1;
}

.ticket-status-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.dialog-card label {
  padding: 16px;
}

.scanner-body {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.scanner-body label {
  padding: 0;
}

.scanner-frame {
  position: relative;
  min-height: 300px;
  overflow: hidden;
  border: 1px solid var(--line);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px), #102225;
  background-size: 20px 20px;
}

.scanner-frame video {
  width: 100%;
  height: 100%;
  min-height: 300px;
  display: block;
  object-fit: cover;
}

.photo-frame video {
  min-height: 360px;
}

.scanner-reticle {
  position: absolute;
  inset: 28% 10%;
  border: 2px solid #ffffff;
  box-shadow: 0 0 0 999px rgba(18, 39, 43, 0.28);
}

.scanner-reticle::after {
  content: "";
  position: absolute;
  left: 8%;
  right: 8%;
  top: 50%;
  height: 2px;
  background: var(--warm);
}

.scanner-status {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

menu {
  margin: 0;
  padding: 16px;
  border-top: 1px solid var(--line);
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  transform: translateY(120px);
  transition: transform 180ms ease;
  background: #12272b;
  color: #ffffff;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  max-width: min(360px, calc(100vw - 30px));
  font-weight: 750;
}

.toast.show {
  transform: translateY(0);
}

@media (max-width: 1040px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    display: grid;
    grid-template-columns: 1fr;
  }

  .nav-list {
    display: flex;
    overflow-x: auto;
  }

  .nav-item {
    width: auto;
    white-space: nowrap;
  }

  .shift-panel {
    margin-top: 0;
  }

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

  .detail-panel {
    position: static;
  }
}

@media (max-width: 760px) {
  body {
    overflow-x: hidden;
  }

  input,
  select,
  textarea,
  label,
  .workspace-views,
  .intake-panel {
    min-width: 0;
  }

  .main,
  .sidebar {
    padding: 12px;
  }

  .main {
    gap: 12px;
  }

  .brand {
    align-items: flex-start;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
  }

  .topbar,
  .topbar-actions,
  .panel-head,
  .detail-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .search-box,
  .primary-btn,
  .secondary-btn,
  .danger-btn {
    width: 100%;
  }

  .metric-grid,
  .form-grid,
  .zone-grid,
  .tag-capture,
  .photo-capture,
  .ticket-body {
    grid-template-columns: 1fr;
  }

  .form-grid {
    gap: 10px;
    padding: 12px;
  }

  .intake-panel .panel-head {
    gap: 10px;
    padding: 12px;
  }

  .scan-btn {
    width: 100%;
  }

  .photo-actions {
    display: grid;
    gap: 8px;
  }

  .photo-preview {
    max-height: 220px;
  }

  .address-row {
    align-items: flex-start;
    min-height: 0;
  }

  .submit-btn {
    margin: 0 12px 12px;
    width: calc(100% - 24px);
  }

  .ticket-edit {
    grid-template-columns: 1fr;
  }

  .filter-tabs {
    width: 100%;
  }

  .tab {
    flex: 0 0 auto;
  }

  .table-wrap {
    overflow-x: visible;
  }

  table {
    min-width: 0;
  }

  thead {
    display: none;
  }

  tbody {
    display: grid;
    gap: 10px;
    padding: 10px;
  }

  tr.selectable {
    display: grid;
    border: 1px solid var(--line);
    background: #ffffff;
  }

  tr.selectable:hover,
  tr.selected {
    background: #f8fbfb;
  }

  td {
    display: grid;
    grid-template-columns: 98px minmax(0, 1fr);
    gap: 10px;
    padding: 9px 10px;
    border-bottom: 1px solid var(--line);
    font-size: 0.86rem;
    word-break: break-word;
  }

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

  td::before {
    color: var(--muted);
    content: "";
    font-size: 0.72rem;
    font-weight: 800;
    line-height: 1.35;
    text-transform: uppercase;
  }

  td:nth-child(1)::before {
    content: "Bag ID";
  }

  td:nth-child(2)::before {
    content: "Guest";
  }

  td:nth-child(3)::before {
    content: "Hotel/Condo";
  }

  td:nth-child(4)::before {
    content: "Bag Info";
  }

  td:nth-child(5)::before {
    content: "Location";
  }

  td:nth-child(6)::before {
    content: "Picked Up";
  }

  td:nth-child(7)::before {
    content: "Drop-off";
  }

  td:nth-child(8)::before {
    content: "Status";
  }

  td:nth-child(9)::before {
    content: "Action";
  }

  .row-actions {
    display: grid;
    grid-template-columns: 1fr;
  }
}

@media (max-width: 420px) {
  .main,
  .sidebar {
    padding: 10px;
  }

  .form-grid {
    padding: 10px;
  }

  input,
  select,
  textarea {
    min-height: 40px;
    padding: 8px 10px;
  }

  .photo-preview {
    max-height: 190px;
  }

  .submit-btn {
    margin: 0 10px 10px;
    width: calc(100% - 20px);
  }
}
