:root {
  --bg: #f7f8fc;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --danger: #dc2626;
  --border: #e2e8f0;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", "Inter", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  height: auto;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px;
}

.container.document-editor-wide {
  max-width: 1260px;
}

.app-header {
  background: linear-gradient(120deg, #111827 0%, #1e293b 100%);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.35);
}

.app-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
}

.brand {
  font-weight: 700;
  letter-spacing: 2px;
  font-size: 16px;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.nav a {
  color: #fff;
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 600;
  transition: background 0.2s ease;
}

.nav a:hover {
  background: rgba(255, 255, 255, 0.12);
}

.nav-dropdown {
  position: relative;
}

.nav-dropdown summary {
  list-style: none;
  cursor: pointer;
  color: #fff;
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 600;
  transition: background 0.2s ease;
}

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

.nav-dropdown summary::after {
  content: "▾";
  margin-left: 6px;
  font-size: 11px;
  opacity: 0.85;
}

.nav-dropdown[open] summary,
.nav-dropdown summary:hover {
  background: rgba(255, 255, 255, 0.12);
}

.nav-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 20;
}

.nav-dropdown-menu a {
  color: var(--text);
  border-radius: 10px;
  padding: 8px 10px;
  font-weight: 600;
}

.nav-dropdown-menu a:hover {
  background: #eef2ff;
  color: var(--primary-dark);
}

.nav .link-button {
  color: #fff !important;
  padding: 6px 10px !important;
  border-radius: 999px;
  text-decoration: none;
}

.nav .link-button:hover {
  background: rgba(255, 255, 255, 0.12);
  text-decoration: none;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.page-header h1 {
  margin: 0;
  font-size: 28px;
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.card-link {
  display: block;
  color: inherit;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.card-link:hover {
  transform: translateY(-1px);
  border-color: #c7d2fe;
}

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

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

.table th {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

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

.table tbody tr:hover {
  background: #f1f5f9;
}

.card .table {
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.select-col {
  width: 40px;
  text-align: center;
}

.table .select-col input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

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

.actions form {
  display: inline-flex;
  align-items: center;
  margin: 0;
  gap: 8px;
  flex-wrap: wrap;
}

.actions form select,
.actions form input[type="password"],
.actions form input[type="text"],
.actions form input[type="email"],
.actions form input[type="number"] {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font: inherit;
  background: #fff;
  min-height: 40px;
}

.actions form input[type="password"],
.actions form input[type="text"],
.actions form input[type="email"],
.actions form input[type="number"] {
  min-width: 180px;
}

.actions form select:focus,
.actions form input[type="password"]:focus,
.actions form input[type="text"]:focus,
.actions form input[type="email"]:focus,
.actions form input[type="number"]:focus {
  outline: 2px solid rgba(79, 70, 229, 0.25);
  border-color: var(--primary);
}


.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  border: 1px solid transparent;
  padding: 10px 16px;
  min-height: 44px;
  background: var(--primary);
  color: #fff;
  font: inherit;
  font-size: 16px;
  line-height: 1.1;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.2s ease;
  box-shadow: 0 8px 18px rgba(79, 70, 229, 0.25);
}

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

.btn:disabled,
.btn[disabled] {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-secondary {
  background: #0f172a;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.25);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
  box-shadow: none;
}

.btn-ghost:hover {
  background: #f1f5f9;
}

.btn-danger {
  background: var(--danger);
  box-shadow: 0 8px 18px rgba(220, 38, 38, 0.25);
}

.link {
  color: var(--primary);
  font-weight: 600;
}

.link-danger {
  color: var(--danger);
  font-weight: 600;
}

button.link {
  background: transparent;
  border: none;
  padding: 0;
  font: inherit;
  cursor: pointer;
  color: var(--primary);
  text-decoration: none;
  -webkit-appearance: none;
  appearance: none;
}

button.link-danger {
  color: var(--danger);
}

.link-button {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  font: inherit;
  color: var(--primary);
  cursor: pointer;
  -webkit-appearance: none !important;
  appearance: none !important;
  text-decoration: none;
}

.link-button.link-danger {
  color: var(--danger);
}

.link-button:disabled,
.link-button[disabled] {
  opacity: 0.65;
  cursor: not-allowed;
}

.link-button:hover {
  text-decoration: underline;
}

.search {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.bulk-actions {
  margin-bottom: 12px;
}

.bulk-actions form {
  display: grid;
  gap: 12px;
}

.bulk-groups {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
}

.bulk-group {
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: 12px;
  display: grid;
  gap: 10px;
  background: #f8fafc;
  align-content: start;
}

.bulk-group-danger {
  background: #fff5f5;
  border-color: #fecaca;
}

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

@media (max-width: 860px) {
  .bulk-groups {
    grid-template-columns: 1fr;
  }
}

.checkbox-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-weight: 600;
}

.search input[type="search"] {
  flex: 1;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
}

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

.form-row {
  display: grid;
  gap: 8px;
}

.pro-only {
  transition: opacity 0.2s ease;
}

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

.two-cols > div {
  display: grid;
  gap: 8px;
}

.section-title {
  font-weight: 700;
  margin-top: 8px;
}

.document-editor-top {
  display: grid;
  grid-template-columns: minmax(420px, 1fr) minmax(460px, 1fr);
  gap: 22px;
  align-items: start;
}

.document-editor-left {
  min-width: 0;
}

.document-editor-right {
  min-width: 0;
}

.document-editor-right .section-title,
.document-editor-left .section-title {
  margin-top: 0;
}

.section-title-lines {
  margin-left: -2px;
}

.lines {
  display: grid;
  gap: 16px;
}

.line-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  background: #f8fafc;
}

.line-grid {
  display: grid;
  grid-template-columns: 1.1fr 2fr repeat(5, minmax(120px, 1fr));
  gap: 12px;
  align-items: end;
}

.line-grid input,
.line-grid textarea,
.line-grid select {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font: inherit;
  background: #fff;
  width: 100%;
}

.line-description-search {
  position: relative;
}

.line-description-search .results.dropdown {
  top: calc(100% + 6px);
  z-index: 6;
}

.line-description-search .result-item {
  align-items: flex-start;
  gap: 2px;
}

.line-result-main {
  font-weight: 600;
  color: var(--text);
}

.line-result-meta {
  font-size: 12px;
  color: var(--muted);
}

@media (max-width: 1100px) {
  .line-grid {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }
}

.line-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

.line-mode-hint {
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
}

.line-inline-total {
  margin-top: 8px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.line-inline-total strong {
  color: var(--text);
  min-width: 76px;
  text-align: right;
}

.totals {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
  margin-top: 16px;
  padding: 16px;
  border-radius: 12px;
  border: 1px dashed var(--border);
  background: #fff;
}

.totals span {
  color: var(--muted);
  display: block;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

input[name$='-DELETE'] {
  display: none;
}

.search-inline {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.search-inline form {
  display: flex;
  gap: 12px;
  flex: 1;
}

.search-inline input[type="text"] {
  flex: 1;
}

.input-inline {
  display: flex;
  gap: 12px;
  align-items: center;
  width: 100%;
}

.input-inline input {
  flex: 1;
}

.client-type-options {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.client-type-option {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  min-width: 132px;
  width: auto;
}

.client-type-option input[type="radio"] {
  margin: 0;
  padding: 0;
  width: 16px;
  height: 16px;
  min-height: 0;
  border: 0;
  background: transparent;
  flex: 0 0 auto;
}

.client-type-option span {
  line-height: 1.1;
}

.client-type-option.is-active {
  border-color: #4f46e5;
  background: #eef2ff;
  color: #3730a3;
}

.results {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.result-item {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #fff;
  transition: background 0.15s ease;
  width: 100%;
  cursor: pointer;
}

.search-wrapper {
  position: relative;
}

.results.dropdown {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 8px;
  z-index: 5;
  margin-top: 6px;
}

#client-results.results.dropdown {
  position: static;
  margin-top: 8px;
  box-shadow: none;
  border-style: dashed;
}

.results.hidden,
.hidden {
  display: none;
}

.result-item:hover {
  background: #f8fafc;
}

.card.soft {
  background: #f8fafc;
  border-style: dashed;
}

.form-row label {
  font-weight: 600;
  color: var(--muted);
}

.form-row input,
.form-row textarea,
.form-row select {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  font: inherit;
  background: #fff;
  width: 100%;
}

.form-row input:focus,
.form-row textarea:focus,
.form-row select:focus {
  outline: 2px solid rgba(79, 70, 229, 0.25);
  border-color: var(--primary);
}

.form-row input[type="file"] {
  padding: 8px 0;
  border: none;
}

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

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

.detail-grid dt {
  font-weight: 600;
  color: var(--muted);
}

.detail-grid dd {
  margin: 4px 0 0;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
  margin-bottom: 16px;
}

.info-grid h3 {
  margin: 0 0 8px;
}

.company-logo {
  display: block;
  max-width: 220px;
  max-height: 56px;
  object-fit: contain;
}

.status-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 16px;
}

.status-row .actions {
  justify-content: flex-end;
}

.status-row-wide {
  grid-template-columns: minmax(240px, 1fr) auto;
}

.page-header .actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

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

.dashboard-charts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.dashboard-chart-card {
  padding: 18px;
}

.dashboard-chart-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.dashboard-chart-legend {
  margin: 8px 0 0;
  font-size: 13px;
}

.revenue-chart {
  width: 100%;
  height: 260px;
  display: block;
  margin-top: 12px;
  border-radius: 10px;
  background: #fbfdff;
}

@media (max-width: 980px) {
  .dashboard-charts {
    grid-template-columns: 1fr;
  }
}

.metric-label {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.metric-value {
  font-size: 28px;
  font-weight: 700;
  margin-top: 6px;
}

.payment-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
  padding: 12px;
  border-radius: 12px;
  border: 1px dashed var(--border);
  background: #fff;
}

.payment-summary span {
  color: var(--muted);
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.payment-preview .status-badge {
  margin-left: 0;
}

.payment-progress {
  margin: 14px 0 18px;
  padding: 14px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  background: #fff;
}

.payment-progress-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 8px;
}

.payment-progress-label {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.payment-progress-value {
  font-weight: 700;
}

.progress-track {
  width: 100%;
  height: 12px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
}

.progress-fill {
  width: 0;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #4f46e5 0%, #4338ca 100%);
  transition: width 0.2s ease;
}

.payment-progress-footer {
  margin-top: 8px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.form-progress .form-stepper-fill {
  background: linear-gradient(90deg, #0ea5e9 0%, #4f46e5 100%);
}

.form-progress.is-complete .form-stepper-fill {
  background: linear-gradient(90deg, #16a34a 0%, #15803d 100%);
}

.form-stepper {
  position: relative;
  margin-top: 8px;
  padding: 2px 0 0;
}

.form-stepper-line,
.form-stepper-fill {
  position: absolute;
  top: 12px;
  left: 0;
  right: 0;
  height: 4px;
  border-radius: 999px;
}

.form-stepper-line {
  background: #e2e8f0;
}

.form-stepper-fill {
  right: auto;
  width: 0;
  background: linear-gradient(90deg, #0ea5e9 0%, #4f46e5 100%);
  transition: width 0.2s ease;
}

.form-stepper-points {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.form-progress-step {
  flex: 1 1 0;
  min-width: 0;
  display: grid;
  gap: 6px;
  justify-items: center;
  text-align: center;
}

.form-progress-step-link {
  display: grid;
  gap: 6px;
  justify-items: center;
  text-decoration: none;
  color: inherit;
}

.form-progress-step-dot {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  border: 2px solid #cbd5e1;
  background: #fff;
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
  line-height: 20px;
}

.form-progress-step-label {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
  font-weight: 600;
}

.form-progress-step.complete .form-progress-step-dot {
  border-color: #16a34a;
  background: #16a34a;
  color: #fff;
}

.form-progress-step.complete .form-progress-step-label {
  color: #166534;
}

.form-progress-step.current .form-progress-step-dot {
  border-color: #2563eb;
  background: #eff6ff;
  color: #1d4ed8;
}

.form-progress-step.current .form-progress-step-label {
  color: #1d4ed8;
}

.workflow-doc-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 14px;
}

.workflow-doc-pill {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  background: #fff;
}

.workflow-doc-pill.is-current,
.workflow-doc-pill:hover {
  border-color: #4f46e5;
  color: #4338ca;
}

.collapsible-section {
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 12px;
  background: #fff;
}

.collapsible-section > summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.collapsible-section > summary::-webkit-details-marker {
  display: none;
}

.collapsible-section > summary::before {
  content: "▸";
  color: var(--muted);
  font-size: 12px;
  transition: transform 0.2s ease;
}

.collapsible-section[open] > summary::before {
  transform: rotate(90deg);
}

.collapsible-section[open] > summary {
  margin-bottom: 10px;
}

.credit-panel {
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: 12px;
  background: #fff;
}

.credit-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

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

.credit-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: #f8fafc;
}

.credit-item.unavailable {
  opacity: 0.6;
}

.credit-item-meta {
  display: grid;
  gap: 2px;
}

.credit-item-meta .muted {
  font-size: 12px;
}

.credit-item-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.document-footer {
  margin-top: 16px;
}

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

.footer-grid h3 {
  margin: 0 0 8px;
  font-size: 14px;
}

.footer-grid p {
  margin: 0;
  color: var(--text);
}

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

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-left: 8px;
  border: 1px solid transparent;
}

.status-draft {
  background: #e2e8f0;
  color: #1f2937;
  border-color: #cbd5f5;
}

.status-sent {
  background: #dbeafe;
  color: #1d4ed8;
  border-color: #bfdbfe;
}

.status-accepted {
  background: #dcfce7;
  color: #15803d;
  border-color: #bbf7d0;
}

.status-refused {
  background: #fee2e2;
  color: #b91c1c;
  border-color: #fecaca;
}

.status-expired {
  background: #fef3c7;
  color: #b45309;
  border-color: #fde68a;
}

.status-partial {
  background: #ede9fe;
  color: #6d28d9;
  border-color: #ddd6fe;
}

.status-paid {
  background: #d1fae5;
  color: #047857;
  border-color: #a7f3d0;
}

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

.error {
  color: var(--danger);
  font-weight: 600;
  font-size: 13px;
}

.error-box {
  background: #fee2e2;
  border: 1px solid #fecaca;
  color: #991b1b;
  padding: 12px;
  border-radius: 12px;
}

.error-box ul {
  margin: 8px 0 0;
  padding-left: 18px;
}

@media (max-width: 980px) {
  .document-editor-top {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .container {
    padding: 16px;
  }

  .app-header .container {
    padding: 12px 16px;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .nav {
    width: 100%;
    justify-content: flex-start;
  }

  .nav-dropdown {
    width: 100%;
  }

  .nav-dropdown summary {
    width: fit-content;
  }

  .nav-dropdown-menu {
    position: static;
    margin-top: 6px;
    width: 100%;
  }

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

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

  .actions form {
    width: 100%;
  }

  .actions form .btn {
    width: 100%;
  }

  .actions form input[type="password"],
  .actions form input[type="text"],
  .actions form input[type="email"],
  .actions form input[type="number"],
  .actions form select {
    width: 100%;
    min-width: 0;
  }

  .form-actions {
    justify-content: stretch;
  }

  .form-actions .btn {
    width: 100%;
  }

  .status-row,
  .status-row-wide {
    grid-template-columns: 1fr;
    gap: 10px;
  }

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

  .search,
  .input-inline,
  .search-inline form {
    flex-direction: column;
    align-items: stretch;
  }

  .search-inline form .btn,
  .search .btn {
    width: 100%;
  }

  .results.dropdown {
    position: static;
    box-shadow: none;
    border-style: dashed;
    margin-top: 8px;
  }

  .table th,
  .table td {
    white-space: nowrap;
  }
}

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

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

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

  .payment-progress-header,
  .payment-progress-footer {
    flex-direction: column;
    align-items: flex-start;
  }
}
