/* ============================================================
   GREY CORNER CAFÉ — Invoice App — style.css
   ============================================================ */

/* ── Tokens ── */
:root {
  --cream:      #fdf8f2;
  --bg:         #f5efe6;
  --card:       #ffffff;
  --border:     #e8ddd1;
  --text:       #2c1a0e;
  --text-muted: #7a6452;
  --accent:     #3d2b1f;       /* deep espresso brown */
  --accent2:    #c8a97e;       /* warm gold */
  --accent3:    #8b5e3c;       /* medium brown */
  --green:      #2e7d32;
  --green-bg:   #e8f5e9;
  --red:        #c62828;
  --red-bg:     #ffebee;
  --excel:      #1d6f42;
  --pdf:        #b71c1c;
  --shadow:     0 4px 24px rgba(61,43,31,.10);
  --shadow-lg:  0 12px 48px rgba(61,43,31,.18);
  --radius:     14px;
  --radius-sm:  8px;
  --transition: .22s cubic-bezier(.4,0,.2,1);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

/* ============================================================
   HEADER
   ============================================================ */
.app-header {
  background: linear-gradient(135deg, var(--accent) 0%, #5a3b27 100%);
  padding: 20px 40px;
  box-shadow: 0 4px 20px rgba(61,43,31,.35);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 20px;
}
.header-logo {
  width: 72px;
  height: 72px;
  object-fit: contain;
  background: white;
  border-radius: 12px;
  padding: 6px;
  box-shadow: 0 4px 14px rgba(0,0,0,.25);
  transition: transform var(--transition);
}
.header-logo:hover { transform: scale(1.06) rotate(-2deg); }
.header-text { display: flex; flex-direction: column; }
.header-title {
  font-family: 'Playfair Display', serif;
  font-size: 2rem;
  color: #fff;
  font-weight: 700;
  letter-spacing: .5px;
  line-height: 1.1;
}
.header-subtitle {
  font-size: .88rem;
  color: var(--accent2);
  font-weight: 500;
  letter-spacing: 1px;
  text-transform: uppercase;
}

/* ============================================================
   LAYOUT
   ============================================================ */
.container {
  max-width: 960px;
  margin: 36px auto;
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow: hidden;
  animation: slideUp .4s ease both;
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(22px); }
  to   { opacity: 1; transform: translateY(0); }
}
.card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 28px;
  background: linear-gradient(135deg, var(--cream) 0%, #efe7dc 100%);
  border-bottom: 1px solid var(--border);
}
.card-icon { font-size: 1.4rem; }
.card-header h2 {
  font-family: 'Playfair Display', serif;
  font-size: 1.3rem;
  color: var(--accent);
  font-weight: 600;
  flex: 1;
}
.form-card form { padding: 28px; }

/* ============================================================
   FORM ELEMENTS
   ============================================================ */
.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 18px;
}
.field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 0;
}
.field-group label {
  font-size: .82rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: .6px;
}
.field-group input,
.field-group textarea,
.field-group select {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: .95rem;
  font-family: 'Inter', sans-serif;
  color: var(--text);
  background: var(--cream);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.field-group input:focus,
.field-group textarea:focus,
.field-group select:focus {
  border-color: var(--accent2);
  box-shadow: 0 0 0 3px rgba(200,169,126,.22);
  background: #fff;
}
.field-group input.error { border-color: var(--red); background: var(--red-bg); }
.field-group textarea { resize: vertical; }

.section-title {
  font-size: .82rem;
  font-weight: 700;
  color: var(--accent3);
  text-transform: uppercase;
  letter-spacing: .8px;
  margin: 22px 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ============================================================
   ARTICLE LINES
   ============================================================ */
.line-row {
  display: grid;
  grid-template-columns: 1fr 80px 110px 120px 32px;
  gap: 10px;
  align-items: end;
  margin-bottom: 10px;
  animation: fadeIn .25s ease;
}
@keyframes fadeIn { from { opacity: 0; transform: translateX(-8px); } to { opacity: 1; transform: none; } }
.line-row input {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: .93rem;
  font-family: 'Inter', sans-serif;
  background: var(--cream);
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  width: 100%;
}
.line-row input:focus {
  border-color: var(--accent2);
  box-shadow: 0 0 0 3px rgba(200,169,126,.22);
  background: #fff;
}
.line-row .montant-cell {
  font-weight: 600;
  font-size: .9rem;
  color: var(--accent);
  background: var(--cream);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  text-align: right;
  white-space: nowrap;
}
.remove-line-btn {
  width: 32px; height: 32px;
  border: none;
  border-radius: 50%;
  background: var(--red-bg);
  color: var(--red);
  font-size: 1rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--transition), transform var(--transition);
  flex-shrink: 0;
}
.remove-line-btn:hover { background: var(--red); color: white; transform: scale(1.15); }

.lines-header {
  display: grid;
  grid-template-columns: 1fr 80px 110px 120px 32px;
  gap: 10px;
  margin-bottom: 6px;
}
.lines-header span {
  font-size: .75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
}

/* ============================================================
   TVA & TOTALS
   ============================================================ */
.tva-row {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  margin: 22px 0 18px;
}
.field-small { width: 140px; flex-shrink: 0; }
.totals-box {
  flex: 1;
  background: var(--cream);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.total-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: .92rem;
  color: var(--text-muted);
}
.total-line strong {
  font-weight: 600;
  color: var(--accent);
  font-size: .95rem;
}
.total-ttc {
  border-top: 2px solid var(--accent2);
  padding-top: 8px;
  margin-top: 4px;
  font-size: 1.05rem;
  color: var(--accent) !important;
}
.total-ttc span { font-weight: 700; color: var(--accent); }
.total-ttc strong { font-size: 1.12rem; color: var(--accent); }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  font-family: 'Inter', sans-serif;
  white-space: nowrap;
  text-decoration: none;
}
.btn:active { transform: scale(.97); }

.btn-outline {
  background: transparent;
  border: 2px dashed var(--accent2);
  color: var(--accent3);
  margin: 6px 0 0;
  width: 100%;
  justify-content: center;
}
.btn-outline:hover { background: var(--cream); border-color: var(--accent3); }

.btn-secondary {
  background: var(--accent);
  color: white;
}
.btn-secondary:hover { background: var(--accent3); box-shadow: 0 4px 14px rgba(61,43,31,.3); }

.btn-excel {
  background: var(--excel);
  color: white;
}
.btn-excel:hover { background: #155d36; box-shadow: 0 4px 14px rgba(29,111,66,.35); }

.btn-pdf {
  background: var(--pdf);
  color: white;
}
.btn-pdf:hover { background: #8e0000; box-shadow: 0 4px 14px rgba(183,28,28,.35); }

.btn-ghost {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text-muted);
}
.btn-ghost:hover { background: var(--cream); border-color: var(--accent2); color: var(--accent); }
.btn-sm { padding: 6px 12px; font-size: .8rem; }

.actions-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

/* ============================================================
   HISTORY
   ============================================================ */
.history-card .card-header { padding: 18px 28px; }
.history-list { padding: 16px 28px; display: flex; flex-direction: column; gap: 10px; }
.empty-state { color: var(--text-muted); font-size: .9rem; text-align: center; padding: 20px 0; }

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  transition: box-shadow var(--transition), transform var(--transition);
  cursor: pointer;
  animation: fadeIn .3s ease;
}
.history-item:hover { box-shadow: var(--shadow); transform: translateX(3px); }
.history-info { flex: 1; }
.history-num {
  font-weight: 700;
  color: var(--accent);
  font-size: .95rem;
}
.history-meta {
  font-size: .8rem;
  color: var(--text-muted);
  margin-top: 2px;
}
.history-amount {
  font-weight: 700;
  font-size: 1rem;
  color: var(--accent3);
  margin-right: 12px;
}
.history-actions { display: flex; gap: 6px; }
.history-btn {
  padding: 5px 10px;
  font-size: .78rem;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  transition: all var(--transition);
}
.h-btn-dup  { background: #e3f2fd; color: #1565c0; }
.h-btn-pdf  { background: var(--red-bg);   color: var(--red);   }
.h-btn-xlsx { background: var(--green-bg); color: var(--green); }
.h-btn-del  { background: #f5f5f5; color: #999; }
.h-btn-dup:hover  { background: #1565c0; color: white; }
.h-btn-pdf:hover  { background: var(--red);   color: white; }
.h-btn-xlsx:hover { background: var(--green); color: white; }
.h-btn-del:hover  { background: #e53935; color: white; }

/* ============================================================
   TOAST
   ============================================================ */
.toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  background: var(--accent);
  color: white;
  padding: 14px 22px;
  border-radius: 10px;
  font-size: .9rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 9999;
  transition: opacity .3s, transform .3s;
  display: flex;
  align-items: center;
  gap: 10px;
}
.toast.success { background: var(--green); }
.toast.error   { background: var(--red); }
.toast.hidden  { opacity: 0; pointer-events: none; transform: translateY(12px); }

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(44,26,14,.65);
  backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeOverlay .2s ease;
}
@keyframes fadeOverlay { from { opacity: 0; } to { opacity: 1; } }
.modal-overlay.hidden { display: none; }
.modal-box {
  background: white;
  border-radius: var(--radius);
  max-width: 720px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  position: relative;
  animation: scaleIn .25s ease;
}
@keyframes scaleIn { from { opacity: 0; transform: scale(.93); } to { opacity: 1; transform: scale(1); } }
.modal-close {
  position: absolute;
  top: 14px; right: 16px;
  background: #f0e8e1;
  border: none;
  font-size: 1rem;
  width: 32px; height: 32px;
  border-radius: 50%;
  cursor: pointer;
  color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  transition: background var(--transition);
  z-index: 10;
}
.modal-close:hover { background: var(--red); color: white; }
.modal-actions {
  display: flex;
  gap: 12px;
  padding: 16px 28px;
  border-top: 1px solid var(--border);
  justify-content: flex-end;
}

/* ============================================================
   INVOICE PREVIEW (inside modal & for PDF generation)
   ============================================================ */
.invoice-preview {
  padding: 32px 36px 20px;
  font-family: 'Inter', sans-serif;
  font-size: .9rem;
  color: #1a1a1a;
}
.inv-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
}
.inv-logo-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}
.inv-logo {
  width: 90px;
  height: auto;
  object-fit: contain;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 4px;
}
.inv-title-block { text-align: right; }
.inv-title {
  font-family: 'Playfair Display', serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 1px;
}
.inv-num {
  font-size: .85rem;
  color: var(--text-muted);
  margin-top: 4px;
  font-weight: 600;
}
.inv-divider {
  border: none;
  border-top: 2px solid var(--accent2);
  margin: 10px 0 22px;
}
.inv-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}
.inv-meta-block { display: flex; flex-direction: column; gap: 4px; }
.inv-meta-label {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .7px;
  color: var(--text-muted);
}
.inv-meta-value {
  font-size: .95rem;
  font-weight: 600;
  color: var(--accent);
}
.inv-ice { font-size: .82rem; color: var(--text-muted); }

/* Invoice table */
.inv-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
}
.inv-table th {
  background: var(--accent);
  color: white;
  padding: 10px 14px;
  font-size: .8rem;
  text-align: left;
  font-weight: 600;
  letter-spacing: .4px;
}
.inv-table th:last-child,
.inv-table td:last-child,
.inv-table th:nth-child(3),
.inv-table td:nth-child(3) { text-align: right; }
.inv-table td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  font-size: .88rem;
}
.inv-table tr:nth-child(even) td { background: var(--cream); }
.inv-table tr:last-child td { border-bottom: none; }

.inv-totals {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 20px;
}
.inv-totals-box {
  width: 280px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.inv-total-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 16px;
  font-size: .88rem;
}
.inv-total-row:not(:last-child) { border-bottom: 1px solid var(--border); }
.inv-total-row.ttc-row {
  background: var(--accent);
  color: white;
  font-weight: 700;
  font-size: .95rem;
}
.inv-total-row.tva-row { background: #fef9f3; }

.inv-lettres {
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-size: .82rem;
  color: var(--text-muted);
  margin-bottom: 20px;
  font-style: italic;
}

.inv-thanks {
  text-align: center;
  font-size: .85rem;
  color: var(--text-muted);
  font-style: italic;
  margin-bottom: 20px;
}

.inv-footer {
  border-top: 1px solid var(--border);
  padding-top: 14px;
  font-size: .75rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.7;
}
.inv-footer strong { color: var(--accent); }

/* ============================================================
   RESPONSIVE & EXTRA STYLES
   ============================================================ */
/* ── Mode Édition Banner ── */
.edit-banner {
  background: linear-gradient(135deg, #fff8e1 0%, #ffe082 100%);
  border-bottom: 1px solid #ffe082;
  border-left: 5px solid #ffa000;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: .9rem;
  color: #5d4037;
  animation: fadeIn .3s ease;
}
.edit-banner-info {
  display: flex;
  align-items: center;
  gap: 10px;
}
.edit-icon { font-size: 1.1rem; }

/* ── Save Button & Danger Button ── */
.btn-save {
  background: linear-gradient(135deg, #2e7d32 0%, #1b5e20 100%);
  color: white;
  font-weight: 600;
  border: none;
}
.btn-save:hover {
  background: linear-gradient(135deg, #388e3c 0%, #2e7d32 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(46,125,50,.35);
}
.btn-outline-danger {
  border: 1.5px solid var(--red);
  color: var(--red);
  background: transparent;
  padding: 6px 12px;
  font-size: .8rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
}
.btn-outline-danger:hover {
  background: var(--red);
  color: white;
}

/* ── History Toolbar & Search ── */
.history-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  background: var(--cream);
  border-bottom: 1px solid var(--border);
  gap: 16px;
  flex-wrap: wrap;
}
.search-input-wrap {
  position: relative;
  flex: 1;
  min-width: 240px;
  display: flex;
  align-items: center;
}
.search-icon {
  position: absolute;
  left: 12px;
  font-size: .9rem;
  color: var(--text-muted);
  pointer-events: none;
}
.search-input-wrap input {
  width: 100%;
  padding: 9px 34px 9px 36px;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  font-size: .88rem;
  font-family: 'Inter', sans-serif;
  background: white;
  color: var(--text);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.search-input-wrap input:focus {
  border-color: var(--accent2);
  box-shadow: 0 0 0 3px rgba(200,169,126,.25);
}
.search-clear {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: .85rem;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 50%;
}
.search-clear:hover {
  background: var(--border);
  color: var(--text);
}
.badge {
  background: var(--accent);
  color: white;
  font-size: .78rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 12px;
}
.h-btn-edit {
  background: #e3f2fd;
  color: #1565c0;
  border: 1px solid #bbdefb;
}
.h-btn-edit:hover {
  background: #1565c0;
  color: white;
}

/* ── Desktop Helpers for Mobile Containers ── */
.mobile-line-fields {
  display: contents;
}
.mobile-only-label {
  display: none;
}

/* ============================================================
   RESPONSIVE & MOBILE OPTIMIZATIONS
   ============================================================ */

/* ── Tablets & Mobile Devices (< 768px) ── */
@media (max-width: 768px) {
  .container {
    padding: 0 12px;
    margin: 16px auto;
    gap: 20px;
  }

  .app-header {
    padding: 14px 16px;
  }
  .header-inner {
    gap: 14px;
  }
  .header-logo {
    width: 56px;
    height: 56px;
    border-radius: 10px;
  }
  .header-title {
    font-size: 1.5rem;
  }
  .header-subtitle {
    font-size: .75rem;
  }

  .card-header {
    padding: 16px 20px;
  }
  .form-card form {
    padding: 18px 14px;
  }

  .form-grid-2 {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  /* Prevent automatic iOS/Android browser zoom on input focus */
  .field-group input,
  .field-group textarea,
  .line-row input {
    font-size: 16px !important;
    padding: 11px 14px;
  }

  /* TVA & Totals Box */
  .tva-row {
    flex-direction: column;
    gap: 16px;
  }
  .field-small {
    width: 100%;
  }
  .totals-box {
    width: 100%;
  }

  /* Article Lines - Mobile Card Layout */
  .lines-header {
    display: none;
  }

  .line-row {
    display: flex;
    flex-direction: column;
    background: #fdfaf6;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px;
    gap: 10px;
    position: relative;
    margin-bottom: 14px;
    box-shadow: 0 2px 8px rgba(61,43,31,.04);
  }

  .line-row .line-designation {
    width: 100%;
    padding-right: 36px;
  }

  .line-row .remove-line-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
  }

  .mobile-line-fields {
    display: grid;
    grid-template-columns: 1fr 1fr 1.2fr;
    gap: 8px;
    width: 100%;
  }

  .line-field-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
  }

  .mobile-only-label {
    display: block;
    font-size: .7rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .5px;
  }

  .line-row .montant-cell {
    font-size: .92rem;
    padding: 10px 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border-radius: var(--radius-sm);
    min-height: 44px;
  }

  /* Actions Buttons Grid on Mobile */
  .actions-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .btn-save {
    grid-column: 1 / -1;
    padding: 14px;
    font-size: 1.05rem;
  }
  .actions-row .btn {
    width: 100%;
    justify-content: center;
    padding: 12px 10px;
    font-size: .92rem;
  }
  .btn-ghost {
    grid-column: 1 / -1;
  }

  /* History Section Mobile */
  .history-toolbar {
    padding: 12px 16px;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .search-input-wrap {
    width: 100%;
    min-width: unset;
  }
  .history-meta-info {
    display: flex;
    justify-content: flex-end;
  }

  .history-item {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 16px;
  }
  .history-info {
    width: 100%;
  }
  .history-amount {
    font-size: 1.15rem;
    align-self: flex-start;
  }
  .history-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    width: 100%;
  }
  .history-btn {
    justify-content: center;
    padding: 9px 4px;
    font-size: .78rem;
    width: 100%;
    text-align: center;
  }

  /* Preview Modal Mobile */
  .modal-box {
    width: 95%;
    max-height: 92vh;
    padding: 16px;
    border-radius: 12px;
  }
  .invoice-preview {
    padding: 16px 10px;
  }
  .inv-meta {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .inv-meta-block:last-child {
    text-align: left !important;
  }
  .inv-totals-box {
    width: 100%;
  }
  .modal-actions {
    flex-direction: column;
    gap: 8px;
  }
  .modal-actions .btn {
    width: 100%;
  }
}

/* ── Small Smartphones (< 480px) ── */
@media (max-width: 480px) {
  .header-inner {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  .header-title {
    font-size: 1.35rem;
  }
  .history-actions {
    grid-template-columns: 1fr 1fr;
  }
  .mobile-line-fields {
    grid-template-columns: 1fr 1fr;
  }
  .line-field-group:last-child {
    grid-column: 1 / -1;
  }
}


