@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@300;400;600;700&family=Playfair+Display:wght@600;700&display=swap");

:root {
  --bg: #121417;
  --bg-accent: #1a1f24;
  --ink: #f7f6f4;
  --muted: #c9c2b9;
  --border: #2b3137;
  --brand: #5b7cff;
  --brand-dark: #4a69e2;
  --highlight: #20343a;
  --danger: #ff6b6b;
  --card: #161b20;
  --input-bg: #1c2228;
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.4);
  --radius: 16px;
  --radius-sm: 10px;
}

[data-theme="light"] {
  --bg: #f7f5f2;
  --bg-accent: #eef0ed;
  --ink: #1c1b1a;
  --muted: #5e5a55;
  --border: #e2ded7;
  --brand: #2f6f61;
  --brand-dark: #25584d;
  --highlight: #dfeae6;
  --danger: #b4222e;
  --card: #ffffff;
  --input-bg: #ffffff;
  --shadow: 0 20px 50px rgba(28, 27, 26, 0.1);
}

* {
  box-sizing: border-box;
}

.i18n-pending [data-i18n],
.i18n-pending [data-i18n-placeholder] {
  visibility: hidden;
}

body {
  margin: 0;
  font-family: "Manrope", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(
      800px 300px at 20% -10%,
      rgba(91, 124, 255, 0.22),
      transparent 60%
    ),
    radial-gradient(
      900px 400px at 80% -20%,
      rgba(32, 52, 58, 0.7),
      transparent 60%
    ),
    linear-gradient(180deg, var(--bg), var(--bg-accent));
  min-height: 100vh;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 3rem;
}

.brand {
  font-family: "Playfair Display", serif;
  font-weight: 700;
  font-size: 1.6rem;
  letter-spacing: 0.02em;
  margin-bottom: 1.5rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
  animation: rise 400ms ease-out;
}

@keyframes rise {
  from {
    transform: translateY(8px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

h1 {
  font-family: "Playfair Display", serif;
  font-weight: 700;
  margin: 0 0 0.75rem;
}

h2,
h3,
h4 {
  font-family: "Playfair Display", serif;
  font-weight: 700;
  margin: 0;
}

label {
  display: block;
  margin-top: 1rem;
  font-weight: 600;
}

input,
select,
textarea {
  width: 100%;
  padding: 0.75rem 0.9rem;
  margin-top: 0.35rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  color: var(--ink);
  font-family: inherit;
  font-size: 1rem;
  background-clip: padding-box;
}

button {
  font-family: inherit;
}

input[type="date"] {
  height: 46px;
  padding-right: 1.2rem;
}

input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(83%) sepia(9%) saturate(277%) hue-rotate(359deg)
    brightness(92%) contrast(88%);
  opacity: 0.9;
}

[data-theme="light"] input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(35%) sepia(8%) saturate(383%) hue-rotate(4deg) brightness(92%)
    contrast(87%);
  opacity: 0.9;
}

.flatpickr-calendar {
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.flatpickr-day {
  color: var(--ink);
}

.flatpickr-day.today {
  border-color: var(--brand);
}

.flatpickr-day.selected,
.flatpickr-day.startRange,
.flatpickr-day.endRange {
  background: var(--brand);
  border-color: var(--brand);
}

select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 2.25rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23c9c2b9' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.9rem center;
  background-size: 16px 16px;
}

[data-theme="light"] select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235e5a55' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
}

textarea {
  min-height: 3.2rem;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(47, 111, 97, 0.25);
  border-color: var(--brand);
}

.stack {
  display: grid;
  gap: 0.75rem;
}

.auth-form-shell {
  width: min(100%, 440px);
  margin: 0 auto;
}

.auth-form-shell .btn {
  width: 100%;
}

.auth-card {
  width: min(100%, 560px);
  margin: 0 auto;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.5rem;
  font-weight: 600;
  color: var(--ink);
}

.check input[type="checkbox"] {
  width: 1.05rem;
  height: 1.05rem;
  accent-color: var(--brand);
  margin: 0;
}

.radio {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.5rem;
  font-weight: 600;
  color: var(--ink);
}

.radio input[type="radio"] {
  width: 1.05rem;
  height: 1.05rem;
  accent-color: var(--brand);
  margin: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 1.1rem;
  border-radius: 999px;
  border: 1px solid transparent;
  background: var(--brand);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition:
    transform 150ms ease,
    background 150ms ease;
}

.btn:hover {
  background: var(--brand-dark);
  transform: translateY(-1px);
}
.btn:active {
  transform: translateY(0);
}

.link {
  color: var(--brand);
  text-decoration: none;
}
.link:hover {
  text-decoration: underline;
}

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

.section-title {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 600;
}
.errorlist {
  color: var(--danger);
  margin: 0.5rem 0;
}
.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: var(--highlight);
  color: var(--brand-dark);
  font-size: 0.8rem;
  font-weight: 600;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}

.pill.type-promo,
.pill.type-promo-request,
.pill.type-promo_request,
.pill.type-new-client,
.pill.type-new_client {
  background: linear-gradient(
    135deg,
    rgba(70, 125, 255, 0.22),
    rgba(98, 158, 255, 0.12)
  );
  color: #a9c4ff;
}
.pill.type-order {
  background: linear-gradient(
    135deg,
    rgba(46, 204, 113, 0.22),
    rgba(110, 231, 183, 0.12)
  );
  color: #9ee6c3;
}
.pill.type-visit {
  background: linear-gradient(
    135deg,
    rgba(249, 115, 22, 0.22),
    rgba(255, 159, 67, 0.12)
  );
  color: #ffc18a;
}

.type-text {
  font-weight: 600;
}
.type-text.type-promo,
.type-text.type-promo-request,
.type-text.type-promo_request,
.type-text.type-new-client,
.type-text.type-new_client {
  color: #9fbaff;
}
.type-text.type-order {
  color: #8be0b3;
}
.type-text.type-visit {
  color: #ffb674;
}

[data-theme="light"] .pill.type-promo,
[data-theme="light"] .pill.type-promo-request,
[data-theme="light"] .pill.type-promo_request,
[data-theme="light"] .pill.type-new-client,
[data-theme="light"] .pill.type-new_client {
  background: linear-gradient(
    135deg,
    rgba(52, 90, 210, 0.08),
    rgba(88, 130, 255, 0.04)
  );
  color: #314a86;
}

[data-theme="light"] .pill.type-order {
  background: linear-gradient(
    135deg,
    rgba(36, 168, 90, 0.08),
    rgba(84, 210, 150, 0.04)
  );
  color: #215f44;
}

[data-theme="light"] .pill.type-visit {
  background: linear-gradient(
    135deg,
    rgba(222, 115, 38, 0.1),
    rgba(255, 170, 92, 0.04)
  );
  color: #7a4318;
}

[data-theme="light"] .type-text.type-promo,
[data-theme="light"] .type-text.type-promo-request,
[data-theme="light"] .type-text.type-promo_request,
[data-theme="light"] .type-text.type-new-client,
[data-theme="light"] .type-text.type-new_client {
  color: #314a86;
}

[data-theme="light"] .type-text.type-order {
  color: #215f44;
}

[data-theme="light"] .type-text.type-visit {
  color: #7a4318;
}

[data-theme="light"] .status-text.status-submitted {
  color: #6b7280;
}
[data-theme="light"] .status-text.status-approved {
  color: #1f6f3f;
}
[data-theme="light"] .status-text.status-declined {
  color: #a31b1b;
}
[data-theme="light"] .status-text.status-prepared {
  color: #1f4ab0;
}
[data-theme="light"] .status-text.status-delivered {
  color: #0f6a5a;
}

.pill.status-submitted {
  background: rgba(148, 163, 184, 0.18);
  color: #cbd5e1;
}
.pill.status-approved {
  background: rgba(34, 197, 94, 0.15);
  color: #7ee2a8;
}
.pill.status-declined {
  background: rgba(239, 68, 68, 0.18);
  color: #fca5a5;
}
.pill.status-prepared {
  background: rgba(59, 130, 246, 0.15);
  color: #93c5fd;
}
.pill.status-delivered {
  background: rgba(16, 185, 129, 0.18);
  color: #6ee7b7;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.pill-neutral {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.35rem 0.8rem;
  background: var(--card);
  color: var(--ink);
  font-weight: 600;
  font-size: 0.9rem;
}

.ghost {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--ink);
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card);
}

.toolbar button,
.toolbar a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.logout {
  border-color: var(--danger);
  color: var(--danger);
}

.logout:hover {
  background: rgba(180, 34, 46, 0.08);
}

.appbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
}

.menu {
  position: relative;
}

.menu summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
}

.menu summary::-webkit-details-marker {
  display: none;
}

.menu-panel {
  position: absolute;
  right: 0;
  margin-top: 0.5rem;
  min-width: 180px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 0.5rem;
  z-index: 10;
}

.menu-panel button {
  width: 100%;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.page-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.page-title h1 {
  margin: 0;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.icon-btn {
  border: none;
  background: transparent;
  color: var(--ink);
  width: 42px;
  height: 42px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  text-decoration: none;
  transition:
    background 150ms ease,
    transform 150ms ease;
}

.icon-btn svg {
  display: block;
}

.icon-btn.sm {
  width: 30px;
  height: 30px;
  border-radius: 10px;
}

.icon-btn.edit-client {
  background: rgba(91, 124, 255, 0.18);
  color: #9fbaff;
}

.icon-btn.edit-client:hover {
  background: rgba(91, 124, 255, 0.28);
}

[data-theme="light"] .icon-btn.edit-client {
  background: rgba(47, 111, 97, 0.18);
  color: #2f6f61;
}

[data-theme="light"] .icon-btn.edit-client:hover {
  background: rgba(47, 111, 97, 0.28);
}

.icon-btn:hover {
  background: rgba(91, 124, 255, 0.12);
  transform: translateY(-1px);
}

.icon-btn.sm svg {
  width: 16px;
  height: 16px;
}

.search-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.55rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  margin-bottom: 0;
}

.search-bar input {
  flex: 1 1 180px;
  min-width: 0;
  border: none;
  background: transparent;
  padding: 0.2rem 0.3rem;
  margin: 0;
}

.dropdown {
  position: relative;
  z-index: 1;
}

.dropdown:focus-within {
  z-index: 200;
}

.dropdown-panel {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 0;
  right: 0;
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  box-shadow: var(--shadow);
  padding: 0.5rem;
  gap: 0.1rem;
  z-index: 200;
  isolation: isolate;
}

.dropdown-panel .list-card {
  padding: 0.55rem 0.75rem;
}

.dropdown-panel .material-item {
  justify-content: flex-start;
  border-radius: 10px;
}

.dropdown-panel .material-item + .material-item {
  margin-top: 0.2rem;
}

.dropdown-panel .material-item:hover {
  background: rgba(91, 124, 255, 0.12);
}

.dropdown-item {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--ink);
  text-align: left;
  padding: 0.45rem 0.6rem;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
}

.dropdown-item:hover {
  background: rgba(91, 124, 255, 0.12);
}

.material-line {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 600;
  color: var(--ink);
}

.material-code {
  color: var(--muted);
  font-weight: 600;
}

.material-name {
  font-weight: 600;
}

.field {
  position: relative;
  margin-top: 0.8rem;
}

.hidden {
  display: none;
}

.field label {
  position: absolute;
  top: -1.25rem;
  left: 0.85rem;
  padding: 0 0.45rem;
  background: linear-gradient(
    to bottom,
    var(--card) 0%,
    var(--card) 40%,
    var(--input-bg) 40%,
    var(--input-bg) 100%
  );
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1;
  z-index: 2;
}

.field .dropdown {
  position: relative;
  z-index: auto;
}

.field .dropdown input {
  position: relative;
  z-index: 1;
}

.field input,
.field textarea,
.field select {
  margin-top: 0;
}

.list-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--ink);
}

.list-meta {
  display: flex;
  gap: 1rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--ink);
  text-decoration: none;
}

.btn-ghost.sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.9rem;
  border-radius: 999px;
}

.btn-ghost.xs {
  padding: 0.25rem 0.6rem;
  font-size: 0.85rem;
  border-radius: 999px;
}

.selected-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.selected-actions .btn-ghost.xs {
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 10px;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.selected-actions .btn-ghost.xs svg {
  width: 16px;
  height: 16px;
}

.selected-actions .edit-item {
  background: rgba(91, 124, 255, 0.18);
  color: #9fbaff;
}

.selected-actions .edit-item:hover {
  background: rgba(91, 124, 255, 0.28);
}

.selected-actions .remove-item {
  background: rgba(255, 107, 107, 0.18);
  color: #ffb4b4;
}

.selected-actions .remove-item:hover {
  background: rgba(255, 107, 107, 0.28);
}

[data-theme="light"] .selected-actions .edit-item {
  background: rgba(47, 111, 97, 0.18);
  color: #2f6f61;
}

[data-theme="light"] .selected-actions .edit-item:hover {
  background: rgba(47, 111, 97, 0.28);
}

[data-theme="light"] .selected-actions .remove-item {
  background: rgba(180, 34, 46, 0.18);
  color: #b4222e;
}

[data-theme="light"] .selected-actions .remove-item:hover {
  background: rgba(180, 34, 46, 0.28);
}

.search-btn,
.map-btn {
  gap: 0.4rem;
  align-items: center;
}

.map-btn {
  display: inline-flex;
}

.filters {
  gap: 0.6rem;
}

.filters-grid {
  display: grid;
  gap: 0.6rem;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

@media (min-width: 900px) {
  .filters-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }

  .filters-grid .field label {
    white-space: nowrap;
  }
}

.visit-card {
  align-items: center;
}

.visit-card-body {
  flex: 1;
  min-width: 0;
}

.visit-card-actions {
  margin-left: auto;
  text-align: right;
  flex: 0 0 auto;
}

.visit-card .list-meta {
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.visit-card-body .visit-agent-inline {
  white-space: normal;
  overflow-wrap: anywhere;
}

.visit-detail-created-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.visit-detail-created-info {
  min-width: 0;
}

.visit-detail-map-btn {
  flex: 0 0 auto;
  white-space: nowrap;
}

.visit-type-btn {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
}

.status-text {
  font-size: 0.85rem;
  font-weight: 600;
}

.status-text.status-submitted {
  color: #cbd5e1;
}
.status-text.status-approved {
  color: #7ee2a8;
}
.status-text.status-declined {
  color: #fca5a5;
}
.status-text.status-prepared {
  color: #93c5fd;
}
.status-text.status-delivered {
  color: #6ee7b7;
}

.btn-ghost:hover {
  background: rgba(91, 124, 255, 0.12);
}

.grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.photo-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(160px, 220px));
  justify-content: flex-start;
}

.photo-card {
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: 12px;
  padding: 0;
  overflow: hidden;
  cursor: pointer;
}

.photo-card:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.photo-thumb {
  width: 100%;
  height: 150px;
  object-fit: cover;
  display: block;
}

.photo-modal .modal-card {
  width: min(900px, 95vw);
  padding: 1rem;
}

.photo-full {
  width: 100%;
  max-height: 70vh;
  object-fit: contain;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-accent);
}

.modal-open {
  overflow: hidden;
}

.report-filters {
  padding: 1rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 1.25rem;
}

.actions-row {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  align-items: center;
}

.table-wrap {
  overflow: auto;
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}

.report-table {
  width: 100%;
  min-width: 900px;
  border-collapse: collapse;
}

.report-table.single-product {
  width: 100%;
  min-width: 0;
  table-layout: auto;
}

.report-table th,
.report-table td {
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.report-table thead th {
  position: sticky;
  top: 0;
  background: var(--card);
  z-index: 1;
  text-align: left;
}

.report-table th.report-product {
  max-width: 200px;
  white-space: normal;
  line-height: 1.2;
  word-break: normal;
  overflow-wrap: normal;
}

.report-table .right {
  text-align: right;
  white-space: nowrap;
}

.report-table .sticky-col {
  position: sticky;
  left: 0;
  background: var(--card);
  z-index: 2;
  text-align: left;
  white-space: nowrap;
}

.report-table tbody tr:nth-child(even) {
  background: var(--bg-accent);
}

.report-qty {
  font-weight: 700;
}

.report-value {
  font-size: 0.8rem;
  color: var(--muted);
}

.report-label {
  opacity: 0.6;
  margin-right: 0.3rem;
}

.report-total {
  font-weight: 700;
}

.report-grand {
  border-top: 2px solid var(--border);
}

.report-grand-total {
  font-weight: 800;
}

@media (max-width: 900px) {
  .report-table {
    min-width: 720px;
  }

  .report-table th,
  .report-table td {
    padding: 0.6rem 0.7rem;
  }

  .report-table .report-value {
    font-size: 0.75rem;
  }
}

@media (max-width: 720px) {
  .report-table {
    min-width: 600px;
  }

  .report-table.single-product {
    min-width: 0;
    table-layout: fixed;
  }

  .report-table thead th {
    position: static;
  }

  .report-table .sticky-col {
    position: static;
    white-space: normal;
    width: auto;
    max-width: 160px;
  }
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.4);
  padding: 1.5rem;
  z-index: 50;
}

.modal[open] {
  display: flex;
}

.modal-card {
  width: min(680px, 100%);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
}

#quantityModal .modal-card {
  width: min(420px, 100%);
}

#quantityModal .keypad {
  height: 48px;
}

#quantityModal .keypad-grid {
  margin-bottom: 0.75rem;
}

#quantityModal #toggleAmount,
#quantityModal #cancelQuantity,
#quantityModal #confirmQuantity {
  min-height: 46px;
}

.load-more {
  justify-content: center;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.client-modal-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.client-modal-actions .confirm-location-form {
  margin: 0;
}

@media (max-width: 720px) {
  .container {
    padding: 1.1rem 0.8rem 1.6rem;
  }

  .card {
    padding: 1.1rem;
  }

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

  .appbar {
    flex-direction: row;
    align-items: center;
    padding: 0.6rem 0.7rem;
    gap: 0.6rem;
  }

  .toolbar {
    justify-content: flex-start;
    width: auto;
  }

  .appbar .menu {
    margin-left: auto;
  }

  .page-header {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .page-title {
    justify-content: space-between;
  }

  .nav-right {
    width: 100%;
    justify-content: space-between;
  }

  .search-bar {
    padding: 0.45rem 0.6rem;
    gap: 0.5rem;
  }

  .list-card {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    padding: 0.9rem 1rem;
  }

  #selectedMaterials .list-card {
    flex-direction: row;
    align-items: center;
  }

  .list-card .selected-actions {
    margin-left: auto;
  }

  .client-card {
    flex-direction: row;
    align-items: center;
  }

  .client-card .map-btn {
    margin-left: auto;
  }

  .client-card-body {
    flex: 1;
    min-width: 0;
  }

  .list-meta {
    flex-direction: column;
    gap: 0.35rem;
  }

  .modal-card {
    padding: 1.1rem;
  }

  .client-modal-actions {
    grid-template-columns: 1fr;
  }

  .btn,
  .btn-ghost,
  .btn-ghost.sm,
  .btn-ghost.xs {
    width: 100%;
    justify-content: center;
  }

  .search-btn,
  .map-btn,
  .modal-close,
  .visit-card-actions .btn {
    width: auto;
  }

  .map-btn.btn,
  .map-btn .btn {
    width: auto;
  }

  .search-btn {
    padding: 0.45rem 0.6rem;
  }

  .search-btn .btn-text {
    display: none;
  }

  .search-btn svg {
    width: 18px;
    height: 18px;
  }

  .visit-card {
    flex-direction: row;
  }

  .visit-card-actions {
    margin-left: auto;
    text-align: right;
  }

  .visit-card .list-meta {
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
  }

  .visit-detail-card .visit-detail-status-row,
  .visit-detail-card .visit-detail-material-meta {
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .visit-detail-card .visit-detail-created-row {
    flex-wrap: nowrap;
    align-items: center;
  }

  .visit-detail-card .visit-detail-map-btn {
    width: auto;
  }

  .dropdown-panel {
    max-height: 220px;
  }

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

  .filters-grid .field {
    grid-column: span 2;
  }

  .filters-grid .field:nth-child(1),
  .filters-grid .field:nth-child(2) {
    grid-column: span 1;
  }

  .filters-grid .field:nth-child(3),
  .filters-grid .field:nth-child(4) {
    grid-column: span 1;
  }

  .report-filters .filters-grid .field:nth-child(3) {
    grid-column: span 2;
  }
}

.card-link {
  display: block;
  padding: 1.25rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: linear-gradient(180deg, var(--card), var(--bg-accent));
  color: inherit;
  text-decoration: none;
  transition:
    transform 150ms ease,
    box-shadow 150ms ease;
}

.card-link:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
