/* ── Reset & Variables ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f0f2f5;
  --surface: #ffffff;
  --border: #e2e8f0;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --success: #22c55e;
  --warning: #f59e0b;
  --text: #1e293b;
  --text-muted: #64748b;
  --sidebar-w: 220px;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 25px rgba(0,0,0,.12);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ───────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
}

.sidebar-logo {
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo h1 { font-size: 15px; font-weight: 700; color: var(--primary); line-height: 1.2; }
.sidebar-logo p  { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.sidebar-nav { padding: 12px 8px; flex: 1; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-muted);
  transition: all .15s;
  margin-bottom: 2px;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.nav-item:hover { background: var(--bg); color: var(--text); }
.nav-item.active { background: #ede9fe; color: var(--primary); }
.nav-item .icon { font-size: 16px; width: 20px; text-align: center; }

.sidebar-tenant {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
}
.sidebar-tenant select {
  width: 100%;
  margin-top: 6px;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  background: var(--bg);
  cursor: pointer;
}

/* ── Main ──────────────────────────────────────────────────────── */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky; top: 0; z-index: 50;
}
.topbar h2 { font-size: 17px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.topbar .actions { display: flex; gap: 8px; align-items: center; }

.content { padding: 24px 28px; }

/* ── Cards ─────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* ── Stats bar ─────────────────────────────────────────────────── */
.stats { display: flex; gap: 16px; margin-bottom: 20px; }
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  flex: 1;
  box-shadow: var(--shadow);
}
.stat-card .label { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.stat-card .value { font-size: 28px; font-weight: 700; margin-top: 4px; color: var(--text); }

/* ── Toolbar ───────────────────────────────────────────────────── */
.toolbar {
  padding: 14px 16px;
  display: flex;
  gap: 10px;
  align-items: center;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.toolbar .spacer { flex: 1; }

/* ── Table ─────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
thead th {
  background: #f8fafc;
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody tr { border-bottom: 1px solid var(--border); transition: background .1s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: #f8fafc; }
tbody td { padding: 11px 14px; vertical-align: middle; }

.empty-row td {
  text-align: center;
  color: var(--text-muted);
  padding: 40px;
  font-size: 14px;
}

/* ── Badges ────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 11.5px;
  font-weight: 600;
}
.badge-pending  { background: #fef9c3; color: #854d0e; }
.badge-processed { background: #dbeafe; color: #1e40af; }
.badge-approved { background: #dcfce7; color: #166534; }
.badge-rejected { background: #fee2e2; color: #991b1b; }
.badge-default  { background: #f1f5f9; color: var(--text-muted); }

/* ── Buttons ───────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all .15s;
  white-space: nowrap;
}
.btn-primary  { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-danger   { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-hover); }
.btn-outline  { background: #fff; color: var(--text); border: 1px solid var(--border); }
.btn-outline:hover { background: var(--bg); }
.btn-ghost    { background: transparent; color: var(--text-muted); border: none; padding: 5px 8px; }
.btn-ghost:hover { color: var(--text); background: var(--bg); }
.btn-sm       { padding: 4px 10px; font-size: 12px; }
.btn-icon     { padding: 6px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── Upload zone ───────────────────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 36px;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
  background: #fafbfd;
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--primary);
  background: #ede9fe40;
}
.upload-zone .icon { font-size: 36px; margin-bottom: 8px; }
.upload-zone p { color: var(--text-muted); font-size: 13px; }
.upload-zone p strong { color: var(--primary); }

/* ── Modal ─────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 1600;
  padding: 20px;
  opacity: 0; pointer-events: none;
  transition: opacity .2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--surface);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  width: 100%; max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(12px);
  transition: transform .2s;
}
.modal-overlay.open .modal { transform: translateY(0); }

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 16px; font-weight: 600; }
.modal-body  { padding: 20px 24px; }
.modal-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 8px;
}

/* ── Form ──────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 5px; }
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13.5px;
  transition: border-color .15s;
  background: #fff;
  color: var(--text);
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px #4f46e520;
}
.form-group textarea { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ── Invoice detail panel ──────────────────────────────────────── */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 20px; }
.detail-item .key  { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.detail-item .val  { font-size: 14px; margin-top: 2px; }
.detail-meta-row   { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 12px; margin-bottom: 12px; }
.detail-meta-label { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.detail-meta-val   { font-size: 11px; color: var(--text-muted); word-break: break-all; }
.detail-edit-grid  { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; margin-bottom: 12px; }
.detail-edit-grid .form-group { margin-bottom: 0; }
.line-items-table  { width: 100%; font-size: 13px; border-collapse: collapse; margin-top: 8px; }
.line-items-table th { padding: 6px 8px; background: #f8fafc; font-size: 11.5px; text-align: left; border: 1px solid var(--border); }
.line-items-table td { padding: 3px 4px; border: 1px solid var(--border); }
.line-items-table input[type="text"],
.line-items-table input[type="number"] {
  width: 100%; padding: 4px 6px; font-size: 12px;
  border: 1px solid var(--border); border-radius: 4px;
  background: var(--bg); color: var(--text);
}
.line-items-table input:focus { outline: none; border-color: var(--primary); }
.li-del-btn {
  display: flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; padding: 0;
  background: none; border: 1px solid var(--border); border-radius: 4px;
  color: var(--text-muted); cursor: pointer; font-size: 14px; line-height: 1;
}
.li-del-btn:hover { background: var(--danger); color: #fff; border-color: var(--danger); }

/* ── Search ────────────────────────────────────────────────────── */
.search-box {
  display: flex; align-items: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0 10px;
  gap: 6px;
}
.search-box input {
  border: none; background: transparent; padding: 7px 0;
  font-size: 13px; width: 200px; outline: none; color: var(--text);
}

/* ── Filter select ─────────────────────────────────────────────── */
.filter-select {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  background: var(--bg);
  cursor: pointer;
}

/* ── Toasts ────────────────────────────────────────────────────── */
#toast-container {
  position: fixed; bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 2000;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  font-size: 13.5px;
  min-width: 280px;
  animation: slide-in .2s ease;
}
.toast.success { border-left: 4px solid var(--success); }
.toast.error   { border-left: 4px solid var(--danger); }
.toast.info    { border-left: 4px solid var(--primary); }
@keyframes slide-in { from { transform: translateX(100%); opacity:0; } to { transform: none; opacity:1; } }

/* ── Loading spinner ───────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Page sections ─────────────────────────────────────────────── */
.page { display: none; }
.page.active { display: block; }

/* ── Pagination ────────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-muted);
  flex-wrap: wrap;
  gap: 8px;
}
.pagination-controls { display: flex; align-items: center; gap: 8px; }
.page-indicator { padding: 0 4px; color: var(--text); font-weight: 500; }

/* ── Checkbox ───────────────────────────────────────────────────── */
input[type="checkbox"] {
  width: 15px; height: 15px;
  cursor: pointer;
  accent-color: var(--primary);
}

/* ── Misc ──────────────────────────────────────────────────────── */
.text-muted { color: var(--text-muted); }
.text-right { text-align: right; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-2 { gap: 8px; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; }
.w-full { width: 100%; }

/* ── Upload progress panel ──────────────────────────────────────── */
.upload-progress-panel {
  position: fixed;
  bottom: 28px; right: 28px;
  width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 8px 32px rgba(0,0,0,.14), 0 2px 8px rgba(0,0,0,.08);
  z-index: 1500;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transform: translateY(16px) scale(.97);
  transition: opacity .22s cubic-bezier(.16,1,.3,1), transform .22s cubic-bezier(.16,1,.3,1);
}
.upload-progress-panel.visible {
  opacity: 1;
  pointer-events: auto;
  transform: none;
}

/* Header */
.progress-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  gap: 8px;
}
.progress-panel-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 13.5px; font-weight: 600;
  color: var(--text);
  flex: 1; min-width: 0;
}
.progress-panel-title span[id="progress-title"] {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Progress bar */
.progress-bar-track {
  height: 5px;
  background: var(--border);
  flex-shrink: 0;
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary) 0%, #818cf8 100%);
  transition: width .4s ease;
  width: 0%;
  border-radius: 0 3px 3px 0;
}

/* Body */
.progress-panel-body {
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Stats row */
.progress-stats {
  display: flex;
  align-items: center;
  gap: 12px;
}
.progress-stat {
  display: flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 500;
  color: var(--text-muted);
}
.progress-stat .ps-num { font-size: 15px; font-weight: 700; }
.progress-stat.ps-total  .ps-num { color: var(--text); }
.progress-stat.ps-ok     .ps-num { color: var(--success); }
.progress-stat.ps-err    .ps-num { color: var(--danger); }
.progress-stat-divider { width: 1px; height: 16px; background: var(--border); }

/* Current file */
.progress-current-wrap {
  display: flex; align-items: center; gap: 6px;
  min-height: 20px;
}
.progress-current-label {
  font-size: 11px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .04em;
  white-space: nowrap;
}
.progress-current {
  font-size: 12.5px; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  flex: 1;
}

/* Log */
.progress-log {
  max-height: 130px;
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 1px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
  padding: 6px 4px;
}
.progress-log:empty { display: none; }
.progress-log-item {
  display: flex; align-items: center; gap: 6px;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 12px;
  color: var(--text-muted);
  overflow: hidden;
}
.progress-log-item .log-icon { flex-shrink: 0; font-size: 11px; width: 14px; text-align: center; }
.progress-log-item .log-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.progress-log-item .log-detail { flex-shrink: 0; font-size: 11px; color: var(--text-muted); }
.progress-log-item.log-success { color: #166534; background: #f0fdf4; }
.progress-log-item.log-error   { color: #991b1b; background: #fef2f2; }
.progress-log-item.log-skip    { color: var(--text-muted); font-style: italic; }

/* ── Upload zone choice buttons ─────────────────────────────────── */
.upload-zone-actions {
  display: flex;
  gap: 10px;
}
.upload-btn-choice {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 20px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
}
.upload-btn-choice:hover {
  border-color: var(--primary);
  background: #ede9fe;
  color: var(--primary);
}

/* ── Company tag in invoice list ────────────────────────────────── */
.company-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11.5px;
  font-weight: 500;
  background: #ede9fe;
  color: var(--primary);
  white-space: nowrap;
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.company-tag-none {
  background: var(--bg);
  color: var(--text-muted);
  font-style: italic;
}

/* ── Company incremental search ─────────────────────────────────── */
.company-search-wrap { position: relative; }
.company-dropdown {
  position: absolute;
  top: calc(100% - 1px);
  left: 0; right: 0;
  background: var(--surface);
  border: 1px solid var(--primary);
  border-top: none;
  border-radius: 0 0 6px 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,.1);
  list-style: none;
  max-height: 180px;
  overflow-y: auto;
  z-index: 200;
  display: none;
}
.company-dropdown li {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13.5px;
  border-bottom: 1px solid var(--border);
}
.company-dropdown li:last-child { border-bottom: none; }
.company-dropdown li:hover { background: #ede9fe; color: var(--primary); }

/* ── Detail modal edit section ──────────────────────────────────── */
.modal-divider { margin: 16px 0; border: none; border-top: 1px solid var(--border); }

/* ── Manual page ────────────────────────────────────────────────── */
.manual-wrap { max-width: 860px; }

.manual-hero {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  border-radius: var(--radius);
  padding: 36px 32px;
  color: #fff;
  margin-bottom: 28px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.manual-hero-icon { opacity: .9; }
.manual-hero h2  { font-size: 20px; font-weight: 700; }
.manual-hero p   { font-size: 14px; opacity: .85; line-height: 1.6; max-width: 520px; }

.manual-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin: 28px 0 14px;
}

/* Steps */
.manual-steps { display: flex; flex-direction: column; gap: 12px; }
.manual-step {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
}
.step-num {
  width: 30px; height: 30px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700;
  flex-shrink: 0;
}
.step-title { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.step-desc  { font-size: 13px; color: var(--text-muted); line-height: 1.6; }

/* Feature cards */
.manual-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.manual-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.manual-card-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 12px;
}
.manual-card-title { font-size: 14px; font-weight: 600; margin-bottom: 10px; }
.manual-card-list {
  list-style: none;
  display: flex; flex-direction: column; gap: 6px;
}
.manual-card-list li {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  padding-left: 14px;
  position: relative;
}
.manual-card-list li::before {
  content: "·";
  position: absolute; left: 2px;
  color: var(--primary);
  font-weight: 700;
}

/* Status reference */
.manual-status-list { display: flex; flex-direction: column; gap: 14px; }
.manual-status-item {
  display: flex; align-items: center; gap: 14px;
  font-size: 13px; color: var(--text-muted); line-height: 1.5;
}
.manual-status-item .badge { flex-shrink: 0; }

/* ── Sidebar toggle button (hidden on desktop) ──────────────────── */
.sidebar-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text);
  padding: 6px;
  border-radius: 6px;
  flex-shrink: 0;
}
.sidebar-toggle:hover { background: var(--bg); }

/* ── Sidebar overlay (mobile) ───────────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 99;
}
.sidebar-overlay.open { display: block; }

/* ── Responsive: Tablet (≤ 1024px) ─────────────────────────────── */
@media (max-width: 1024px) {
  .content { padding: 20px; }
  .topbar  { padding: 12px 20px; }
}

/* ── Responsive: Mobile (≤ 767px) ──────────────────────────────── */
@media (max-width: 767px) {
  /* Sidebar becomes a slide-in drawer */
  .sidebar {
    transform: translateX(-100%);
    transition: transform .25s cubic-bezier(.16,1,.3,1);
    z-index: 200;
    box-shadow: none;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0,0,0,.15);
  }

  /* Main takes full width */
  .main { margin-left: 0; }

  /* Show hamburger */
  .sidebar-toggle { display: flex; }

  /* Topbar */
  .topbar { padding: 10px 14px; gap: 10px; }
  .topbar h2 { font-size: 15px; }

  /* Content padding */
  .content { padding: 14px; }

  /* Stats: 2-column grid */
  .stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .stat-card { padding: 12px 14px; }
  .stat-card .value { font-size: 22px; }
  .stat-card .value[style*="font-size:20px"] { font-size: 16px !important; }

  /* Upload zone */
  .upload-zone { padding: 22px 14px; }
  .upload-zone-actions { flex-direction: column; align-items: stretch; }
  .upload-btn-choice { justify-content: center; }

  /* Toolbar */
  .toolbar { padding: 10px 12px; gap: 8px; }
  .toolbar .spacer { display: none; }
  .search-box { flex: 1 1 100%; order: -1; }
  .search-box input { width: 100%; min-width: 0; }
  .filter-select { flex: 1; }

  /* Table: hide non-essential columns, no horizontal scroll */
  .col-hide-mobile { display: none; }
  .table-wrap { overflow-x: visible; }
  table { font-size: 13px; }
  thead th { padding: 9px 10px; }
  tbody td { padding: 10px 10px; }

  /* Modals: centered with side padding */
  .modal-overlay {
    padding: 16px;
    align-items: center;
  }
  .modal {
    max-width: 100%;
    border-radius: 12px;
    max-height: 90vh;
  }

  /* Progress panel: full width at bottom */
  .upload-progress-panel {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    border-radius: 14px 14px 0 0;
  }

  /* Toast */
  #toast-container {
    bottom: 12px;
    right: 12px;
    left: 12px;
  }
  .toast { min-width: unset; width: 100%; }

  /* Form row: single column */
  .form-row { grid-template-columns: 1fr; gap: 0; }

  /* Detail grid */
  .detail-grid { grid-template-columns: 1fr; }
  .detail-edit-grid { grid-template-columns: 1fr; }

  /* Manual page */
  .manual-hero { padding: 24px 20px; }
  .manual-hero h2 { font-size: 17px; }
  .manual-cards { grid-template-columns: 1fr; }
}
