:root {
  color-scheme: light;
  --ink: #172033;
  --muted: #64748b;
  --line: #d9e2ef;
  --panel: #ffffff;
  --page: #f6f8fb;
  --brand: #176b87;
  --brand-strong: #0f4c64;
  --green: #2f855a;
  --red: #b42318;
  --orange: #c05621;
  --shadow: 0 18px 50px rgba(32, 45, 68, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    linear-gradient(180deg, rgba(23, 107, 135, 0.12), transparent 340px),
    var(--page);
  color: var(--ink);
}

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

button {
  border: 0;
  cursor: pointer;
}

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

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  background:
    linear-gradient(155deg, rgba(74, 221, 241, 0.1), transparent 28%),
    linear-gradient(0deg, rgba(5, 11, 20, 0.34), rgba(5, 11, 20, 0)),
    #111c2e;
  color: white;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  border-right: 1px solid rgba(148, 163, 184, 0.14);
}

.brand {
  display: grid;
  gap: 14px;
}

.brand-logo {
  display: block;
  width: 100%;
  height: auto;
}

.sidebar-logo-frame {
  width: 100%;
  min-height: 82px;
  display: grid;
  place-items: center;
  padding: 14px 18px;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(7, 18, 30, 0.98), rgba(7, 18, 30, 0.82)),
    #050b14;
  border: 1px solid rgba(74, 221, 241, 0.24);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 18px 38px rgba(2, 8, 23, 0.24);
}

.sidebar-logo {
  max-height: 48px;
  object-fit: contain;
}

.workspace-card {
  display: grid;
  gap: 4px;
  padding: 2px 2px 4px;
}

.workspace-card span {
  width: max-content;
  padding: 3px 8px;
  border-radius: 999px;
  color: #75e6f4;
  background: rgba(74, 221, 241, 0.1);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.brand h1 {
  font-size: 1.32rem;
  line-height: 1.15;
  margin: 2px 0 0;
  letter-spacing: 0;
}

.brand p,
.user-card p,
.hint {
  color: rgba(226, 232, 240, 0.72);
  margin: 0;
  line-height: 1.45;
}

.nav {
  display: grid;
  gap: 6px;
  padding: 6px;
  border-radius: 8px;
  background: rgba(5, 11, 20, 0.22);
  border: 1px solid rgba(148, 163, 184, 0.1);
}

.nav button {
  position: relative;
  min-height: 44px;
  border-radius: 8px;
  padding: 0 12px 0 14px;
  text-align: left;
  color: rgba(226, 232, 240, 0.78);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 800;
  transition: background 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.nav button i {
  width: 8px;
  height: 8px;
  border-top: 2px solid currentColor;
  border-right: 2px solid currentColor;
  opacity: 0;
  transform: rotate(45deg) translateX(-3px);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.nav button.active,
.nav button:hover {
  color: white;
  background: rgba(255, 255, 255, 0.1);
}

.nav button:hover {
  transform: translateX(2px);
}

.nav button.active {
  box-shadow:
    inset 3px 0 0 #4addf1,
    0 10px 22px rgba(2, 8, 23, 0.18);
}

.nav button.active i,
.nav button:hover i {
  opacity: 0.74;
  transform: rotate(45deg) translateX(0);
}

.sidebar-businesses {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.035)),
    rgba(15, 23, 42, 0.3);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07);
}

.sidebar-businesses h2 {
  margin: 0;
  font-size: 1rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-businesses h2::after {
  content: "Manage";
  padding: 4px 7px;
  border-radius: 999px;
  color: #75e6f4;
  background: rgba(74, 221, 241, 0.1);
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}

.sidebar-businesses .form {
  gap: 10px;
}

.sidebar-businesses .field label {
  color: rgba(226, 232, 240, 0.76);
  font-size: 0.78rem;
  letter-spacing: 0;
}

.sidebar-businesses .field input {
  min-height: 44px;
  color: white;
  border-color: rgba(148, 163, 184, 0.18);
  background: rgba(5, 11, 20, 0.56);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.sidebar-businesses .field input:focus {
  outline: 2px solid rgba(74, 221, 241, 0.32);
  border-color: rgba(74, 221, 241, 0.44);
}

.sidebar-businesses .field input::placeholder {
  color: rgba(226, 232, 240, 0.48);
}

.sidebar-businesses .btn {
  width: 100%;
  background: linear-gradient(135deg, #2183a2, #36bfd6);
  box-shadow: 0 12px 24px rgba(23, 107, 135, 0.26);
}

.sidebar-businesses .category-list {
  margin-top: 2px;
  padding-top: 12px;
  border-top: 1px solid rgba(148, 163, 184, 0.16);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.sidebar-businesses .tag {
  min-height: 28px;
  color: rgba(255, 255, 255, 0.84);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.business-tag {
  gap: 8px;
  padding-right: 5px;
}

.business-tag button {
  border: 0;
  border-radius: 999px;
  padding: 4px 7px;
  color: #06111d;
  background: rgba(117, 230, 244, 0.92);
  font-size: 0.68rem;
  font-weight: 900;
  cursor: pointer;
}

.business-tag button:hover {
  background: white;
}

.sidebar-businesses .tag.active {
  color: #06111d;
  background: #75e6f4;
  border-color: rgba(117, 230, 244, 0.65);
}

.business-tag.active button {
  background: rgba(6, 17, 29, 0.12);
  color: #06111d;
}

.sidebar-businesses .category-empty {
  color: rgba(255, 255, 255, 0.62);
}

.user-card {
  margin-top: auto;
  padding: 14px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 8px;
  background: rgba(5, 11, 20, 0.24);
}

.user-card strong {
  display: block;
  margin-bottom: 3px;
}

.main {
  min-width: 0;
  padding: 30px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 24px;
}

.topbar h2 {
  margin: 0 0 6px;
  font-size: clamp(1.6rem, 4vw, 2.4rem);
}

.topbar p {
  margin: 0;
  color: var(--muted);
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel-pad {
  padding: 20px;
}

.grid {
  display: grid;
  gap: 18px;
}

.grid.two {
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
}

.stats {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.stat {
  padding: 18px;
}

.stat span {
  color: var(--muted);
  font-size: 0.9rem;
}

.stat strong {
  display: block;
  font-size: 2rem;
  margin-top: 8px;
}

.login-wrap {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px 20px 72px;
}

.login-card {
  width: min(440px, 100%);
  padding: 28px;
}

.login-logo {
  max-width: 300px;
  margin: 0 auto 22px;
}

.login-footer {
  position: absolute;
  right: 20px;
  bottom: 18px;
  left: 20px;
  color: #53657c;
  font-size: 0.86rem;
  font-weight: 800;
  text-align: center;
}

.login-card h1 {
  margin: 0 0 8px;
  font-size: 2rem;
}

.login-card p {
  margin: 0 0 24px;
  color: var(--muted);
  line-height: 1.5;
}

.privacy-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 18px;
}

.privacy-card {
  width: min(860px, 100%);
  padding: 34px;
}

.privacy-logo {
  width: 230px;
  max-width: 75vw;
  margin-bottom: 26px;
}

.privacy-card h1 {
  margin: 0 0 8px;
  font-size: clamp(2rem, 5vw, 3.25rem);
}

.privacy-card h2 {
  margin: 28px 0 8px;
  font-size: 1.15rem;
}

.privacy-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.privacy-updated {
  margin-bottom: 22px !important;
}

.privacy-home {
  display: inline-flex;
  margin-top: 28px;
}

.form {
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 7px;
}

.field label {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 700;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 44px;
  padding: 10px 12px;
  background: white;
  color: var(--ink);
}

.field textarea {
  min-height: 92px;
  resize: vertical;
}

.scan-preview {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.scan-preview strong {
  font-size: 0.85rem;
  color: var(--muted);
}

.scan-preview img {
  width: 100%;
  max-height: 240px;
  object-fit: contain;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: white;
}

.pdf-copy-list {
  display: grid;
  gap: 10px;
}

.pdf-copy-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.pdf-copy-item strong,
.pdf-copy-item span {
  display: block;
}

.pdf-copy-item span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.86rem;
}

.pdf-copy-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.pdf-copy-actions a {
  text-decoration: none;
}

.filter-panel {
  padding: 16px;
  margin-bottom: 18px;
}

.filter-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(160px, 220px)) auto;
  gap: 14px;
  align-items: end;
}

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

.business-filter-panel {
  margin-bottom: 12px;
}

.business-filter-form {
  grid-template-columns: minmax(220px, 360px);
}

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

.business-edit-btn {
  min-height: 40px;
  white-space: nowrap;
}

.btn {
  min-height: 42px;
  border-radius: 8px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 800;
}

.btn.compact {
  min-height: 34px;
  padding: 0 10px;
  font-size: 0.82rem;
}

.btn.primary {
  background: var(--brand);
  color: white;
}

.btn.secondary {
  background: #e7eef6;
  color: var(--ink);
}

.btn.text-link {
  min-height: auto;
  padding: 4px 8px;
  background: transparent;
  color: var(--brand);
}

.btn.danger {
  background: #fee4e2;
  color: var(--red);
}

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

.icon-btn {
  border-radius: 8px;
  min-height: 32px;
  padding: 0 10px;
  color: var(--brand);
  background: #e7eef6;
  font-weight: 800;
}

.icon-btn.small {
  min-height: 26px;
  padding: 0 8px;
  font-size: 0.72rem;
}

.icon-btn.danger {
  color: var(--red);
  background: #fee4e2;
}

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

.table-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.table-heading h3 {
  margin: 0;
}

.table-heading span {
  color: var(--muted);
  font-weight: 800;
  white-space: nowrap;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-top: 1px solid var(--line);
  background: #fbfdff;
}

.pagination > span {
  color: var(--muted);
  font-weight: 800;
}

.pagination-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.pagination-actions strong {
  color: var(--ink);
  font-size: 0.88rem;
}

table {
  width: 100%;
  border-collapse: collapse;
}

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

th {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  background: #f8fafc;
}

.amount {
  font-weight: 900;
  white-space: nowrap;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 9px;
  border-radius: 999px;
  background: #edf2f7;
  font-weight: 800;
  font-size: 0.82rem;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 99px;
  background: var(--brand);
}

.summary-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: transparent;
  text-align: left;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.summary-row:last-child {
  border-bottom: 0;
}

.summary-row-button:hover {
  background: #ffffff;
  box-shadow:
    0 18px 40px rgba(15, 23, 42, 0.18),
    0 2px 0 rgba(23, 107, 135, 0.12);
  transform: translateY(-2px);
}

.summary-row-button:focus-visible {
  outline: 3px solid rgba(23, 107, 135, 0.32);
  outline-offset: 3px;
  background: #ffffff;
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.16);
}

.active-filter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  margin-bottom: 18px;
}

.category-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.category-chip {
  padding-right: 5px;
}

.category-empty {
  margin: 14px 0 0;
  color: var(--muted);
}

.bar {
  height: 8px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 8px;
}

.bar span {
  display: block;
  height: 100%;
  background: var(--brand);
}

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

.notice.error {
  color: var(--red);
  background: #fee4e2;
}

.notice.success {
  color: var(--green);
  background: #dcfce7;
}

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

.modal {
  width: min(760px, 100%);
  max-height: min(820px, 92vh);
  overflow: auto;
  padding: 22px;
}

.scan-review-modal {
  width: min(680px, 100%);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.modal-head h3 {
  margin: 0 0 4px;
  font-size: 1.35rem;
}

.modal-head p,
.detail-block p {
  margin: 0;
  color: var(--muted);
}

.scan-review-status {
  display: grid;
  gap: 4px;
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid rgba(23, 107, 135, 0.22);
  background: #eef9fc;
}

.scan-review-status strong {
  color: var(--teal);
}

.scan-review-status span {
  color: var(--muted);
  font-size: 0.9rem;
}

.scan-review-status.success {
  border-color: rgba(47, 133, 90, 0.28);
  background: #dcfce7;
}

.scan-review-status.success strong {
  color: var(--green);
}

.scan-review-status.error {
  border-color: rgba(180, 35, 24, 0.24);
  background: #fee4e2;
}

.scan-review-status.error strong,
.scan-review-status.error span {
  color: var(--red);
}

.scan-loading {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 4px;
}

.scan-loading h3 {
  margin: 0 0 4px;
  font-size: 1.35rem;
}

.scan-loading p {
  margin: 0;
  color: var(--muted);
}

.spinner {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border: 4px solid rgba(23, 107, 135, 0.16);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

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

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

.receipt-edit-form {
  margin-top: 8px;
}

.detail-grid div,
.detail-block {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.detail-grid strong,
.detail-grid span,
.detail-block strong {
  display: block;
}

.detail-grid strong,
.detail-block strong {
  margin-bottom: 5px;
}

.detail-block {
  margin-top: 12px;
}

.attachment-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}

.image-thumb {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  cursor: zoom-in;
}

.image-thumb img {
  display: block;
  width: 100%;
}

.attachment-grid img {
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.receipt-photo {
  display: block;
  width: 100%;
  max-height: 520px;
  object-fit: contain;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: white;
}

.photo-backdrop {
  z-index: 30;
  background: rgba(5, 11, 20, 0.82);
}

.photo-modal {
  width: min(1080px, 96vw);
  max-height: 94vh;
}

.photo-preview-img {
  display: block;
  width: 100%;
  max-height: calc(94vh - 110px);
  object-fit: contain;
  border-radius: 8px;
  background: #050b14;
}

.accident-modal {
  width: min(980px, 100%);
}

.accident-upload-modal {
  width: min(560px, 94vw);
}

.accident-upload-modal .modal-head {
  align-items: center;
}

.upload-progress-wrap {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
}

.upload-progress-wrap.success {
  border-color: rgba(47, 133, 90, 0.24);
  background: #dcfce7;
}

.upload-progress-wrap.error {
  border-color: rgba(180, 35, 24, 0.24);
  background: #fee4e2;
}

.upload-progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  color: var(--muted);
  font-weight: 800;
}

.upload-progress-meta strong {
  color: var(--ink);
}

.upload-progress-bar {
  overflow: hidden;
  height: 10px;
  border-radius: 999px;
  background: #dde7f1;
}

.upload-progress-bar i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), #4dd8ef);
  transition: width 180ms ease;
}

.upload-progress-wrap.error .upload-progress-bar i {
  background: var(--red);
}

.upload-file-list {
  display: grid;
  gap: 8px;
  max-height: 230px;
  overflow: auto;
}

.upload-file-list div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #eef4fa;
}

.upload-file-list strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-file-list span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
}

.accident-media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.accident-media-card {
  margin: 0;
  display: grid;
  gap: 8px;
}

.accident-media-card img,
.accident-media-card video {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #050b14;
}

.accident-media-card figcaption {
  color: var(--muted);
  font-size: 0.86rem;
  overflow-wrap: anywhere;
}

.detail-block pre {
  white-space: pre-wrap;
  word-break: break-word;
  margin: 10px 0 0;
  color: var(--ink);
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

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

  .sidebar {
    position: static;
    height: auto;
    overflow: visible;
    padding: 18px;
  }

  .nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .user-card {
    margin-top: 0;
  }

  .main {
    padding: 20px;
  }

  .grid.two,
  .stats,
  .filter-form {
    grid-template-columns: 1fr;
  }

  .topbar {
    flex-direction: column;
  }

  .pagination {
    align-items: flex-start;
    flex-direction: column;
  }

  .pagination-actions {
    justify-content: flex-start;
  }

  .actions {
    justify-content: flex-start;
  }

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

@media (max-width: 560px) {
  .login-logo {
    max-width: 250px;
  }

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

  th,
  td {
    padding: 11px 12px;
  }
}
