/* ===================================================
   Yam's Kitchen HACCP — Feuille de style principale
   =================================================== */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&family=Open+Sans:wght@400;600&display=swap');

:root {
  --bg:         #f6e1c4;
  --gold:       #efa22c;
  --gold-dark:  #d4891a;
  --red:        #d32f2f;
  --red-dark:   #b71c1c;
  --white:      #ffffff;
  --surface:    #fffaf3;
  --border:     #e8c99a;
  --text:       #2c2c2c;
  --text-muted: #7a6a55;
  --success:    #2e7d32;
  --warning:    #e65100;
  --radius:     14px;
  --radius-sm:  8px;
  --shadow:     0 4px 16px rgba(0,0,0,0.10);
  --shadow-lg:  0 8px 32px rgba(0,0,0,0.15);
  --sidebar-w:  260px;
  --header-h:   64px;
  --nav-h:      64px;
  --font-main:  'Poppins', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font-main);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

/* ---- Login ---- */
#login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--gold) 0%, var(--red) 100%);
  padding: 1rem;
}

.login-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.login-logo {
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, var(--gold), var(--red));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
  font-size: 2rem;
  color: var(--white);
}

.login-card h1 {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: .25rem;
}

.login-card p {
  color: var(--text-muted);
  font-size: .9rem;
  margin-bottom: 2rem;
}

/* ---- Layout ---- */
.hidden { display: none !important; }

#main-app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header */
#app-header {
  height: var(--header-h);
  background: var(--white);
  border-bottom: 2px solid var(--gold);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(239,162,44,.15);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: .75rem;
  text-decoration: none;
  color: inherit;
}

.header-icon {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, var(--gold), var(--red));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  font-size: 1.2rem;
  flex-shrink: 0;
}

.header-title {
  line-height: 1.2;
}

.header-title strong {
  display: block;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.header-title span {
  font-size: .72rem;
  color: var(--text-muted);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.header-spacer { flex: 1; }

.header-user {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .85rem;
  color: var(--text-muted);
}

.header-user button {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--red);
  font-size: 1rem;
  padding: .25rem;
}

/* App body */
#app-body {
  display: flex;
  flex: 1;
}

/* Sidebar */
#sidebar {
  width: var(--sidebar-w);
  background: var(--white);
  border-right: 1px solid var(--border);
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  position: sticky;
  top: var(--header-h);
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: .85rem;
  padding: .75rem 1rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: .9rem;
  font-weight: 500;
  color: var(--text-muted);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  transition: all .2s;
}

.nav-item:hover { background: var(--bg); color: var(--text); }

.nav-item.active {
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: var(--white);
  box-shadow: 0 3px 10px rgba(239,162,44,.35);
}

.nav-item i { width: 20px; text-align: center; font-size: 1rem; }

.nav-section-title {
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  padding: 1rem 1rem .25rem;
}

/* Main content */
#main-content {
  flex: 1;
  padding: 2rem;
  overflow-y: auto;
  padding-bottom: calc(var(--nav-h) + 2rem);
}

/* ---- Views ---- */
.view { display: none; }
.view.active { display: block; }

/* Page title */
.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: .25rem;
}

.page-subtitle {
  font-size: .85rem;
  color: var(--text-muted);
  margin-bottom: 1.75rem;
}

/* ---- Dashboard ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--gold);
  display: flex;
  flex-direction: column;
  gap: .25rem;
}

.stat-card.red   { border-color: var(--red); }
.stat-card.green { border-color: var(--success); }

.stat-number {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}

.stat-label {
  font-size: .8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.stat-icon {
  font-size: 1.4rem;
  margin-bottom: .5rem;
}

.stat-card.red   .stat-icon { color: var(--red); }
.stat-card.green .stat-icon { color: var(--success); }
.stat-card       .stat-icon { color: var(--gold); }

/* Section */
.section-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}

.section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* Quick actions */
.quick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: .85rem;
  margin-bottom: 2rem;
}

.quick-btn {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem .75rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .6rem;
  cursor: pointer;
  transition: all .2s;
  font-family: var(--font-main);
  text-align: center;
}

.quick-btn:hover {
  border-color: var(--gold);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.quick-btn i {
  font-size: 1.6rem;
  color: var(--gold);
}

.quick-btn.danger i { color: var(--red); }

.quick-btn span {
  font-size: .78rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

/* Recent records */
.recent-list {
  display: flex;
  flex-direction: column;
  gap: .6rem;
}

.recent-item {
  background: var(--white);
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: 0 2px 6px rgba(0,0,0,.06);
  cursor: pointer;
  transition: box-shadow .2s;
}

.recent-item:hover { box-shadow: var(--shadow); }

.recent-type-badge {
  padding: .25rem .65rem;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 600;
  background: rgba(239,162,44,.15);
  color: var(--gold-dark);
  white-space: nowrap;
}

.recent-info { flex: 1; min-width: 0; }

.recent-info strong {
  font-size: .88rem;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recent-info small {
  font-size: .75rem;
  color: var(--text-muted);
}

.badge-conforme    { background: rgba(46,125,50,.12); color: #2e7d32; }
.badge-non_conforme{ background: rgba(211,47,47,.12); color: var(--red); }
.badge-en_attente  { background: rgba(230,81,0,.12); color: var(--warning); }

/* ---- Forms cards ---- */
.forms-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1.25rem;
}

.form-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: all .2s;
  border-top: 4px solid var(--gold);
  display: flex;
  flex-direction: column;
  gap: .75rem;
}

.form-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.form-card.red-accent { border-color: var(--red); }

.form-card-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  color: var(--white);
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
}

.form-card.red-accent .form-card-icon {
  background: linear-gradient(135deg, var(--red), var(--red-dark));
}

.form-card h3 {
  font-size: .95rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

.form-card p {
  font-size: .8rem;
  color: var(--text-muted);
  line-height: 1.5;
  flex: 1;
}

.form-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: .75rem;
  border-top: 1px solid var(--border);
}

.form-count {
  font-size: .75rem;
  color: var(--text-muted);
}

.btn-open {
  font-size: .78rem;
  padding: .4rem .85rem;
  border-radius: 20px;
  background: var(--gold);
  color: var(--white);
  border: none;
  cursor: pointer;
  font-weight: 600;
  font-family: var(--font-main);
  transition: background .2s;
}

.btn-open:hover { background: var(--gold-dark); }

.form-card.red-accent .btn-open { background: var(--red); }
.form-card.red-accent .btn-open:hover { background: var(--red-dark); }

/* ---- Records ---- */
.filters-bar {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  margin-bottom: 1.5rem;
  align-items: flex-end;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: .3rem;
}

.filter-group label {
  font-size: .75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* ---- Generic form elements ---- */
.form-field {
  display: flex;
  flex-direction: column;
  gap: .4rem;
  margin-bottom: 1.1rem;
}

.form-field label {
  font-size: .85rem;
  font-weight: 600;
  color: var(--text);
}

.form-field label .req { color: var(--red); margin-left: 2px; }

input[type="text"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="email"],
input[type="password"],
select,
textarea {
  width: 100%;
  padding: .7rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-main);
  font-size: .9rem;
  color: var(--text);
  background: var(--white);
  transition: border-color .2s, box-shadow .2s;
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(239,162,44,.15);
}

textarea { resize: vertical; min-height: 80px; }

/* Checkbox field */
.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: .6rem;
  cursor: pointer;
  font-size: .88rem;
}

.checkbox-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--gold);
  cursor: pointer;
}

/* Radio group */
.radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
}

.radio-pill {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .4rem .85rem;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  cursor: pointer;
  font-size: .85rem;
  font-weight: 500;
  transition: all .18s;
}

.radio-pill input { display: none; }

.radio-pill:has(input:checked) {
  border-color: var(--gold);
  background: rgba(239,162,44,.1);
  color: var(--gold-dark);
}

.radio-pill.danger:has(input:checked) {
  border-color: var(--red);
  background: rgba(211,47,47,.1);
  color: var(--red);
}

/* Photo upload */
.photo-upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
  background: var(--bg);
}

.photo-upload-zone:hover,
.photo-upload-zone.drag-over {
  border-color: var(--gold);
  background: rgba(239,162,44,.06);
}

.photo-upload-zone i {
  font-size: 2rem;
  color: var(--text-muted);
  display: block;
  margin-bottom: .5rem;
}

.photo-upload-zone p {
  font-size: .82rem;
  color: var(--text-muted);
}

.photo-upload-zone input { display: none; }

.photo-previews {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: .75rem;
}

.photo-thumb {
  width: 70px;
  height: 70px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
}

/* Form 2-col grid */
.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 1.25rem;
}

/* Conformité indicator */
.conformite-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .85rem 1rem;
  border-radius: var(--radius-sm);
  background: rgba(239,162,44,.08);
  border: 1px solid var(--gold);
  margin-bottom: 1rem;
}

.conformite-bar.non-conforme {
  background: rgba(211,47,47,.08);
  border-color: var(--red);
}

.conformite-bar i { font-size: 1.4rem; color: var(--gold); }
.conformite-bar.non-conforme i { color: var(--red); }

.conformite-bar span {
  font-size: .85rem;
  font-weight: 600;
}

/* ---- Buttons ---- */
.btn {
  padding: .7rem 1.5rem;
  border-radius: var(--radius-sm);
  border: none;
  font-family: var(--font-main);
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  display: inline-flex;
  align-items: center;
  gap: .5rem;
}

.btn-primary {
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: var(--white);
  box-shadow: 0 3px 10px rgba(239,162,44,.35);
}

.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 5px 15px rgba(239,162,44,.45); }

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

.btn-danger:hover { background: var(--red-dark); }

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text-muted);
}

.btn-outline:hover { border-color: var(--gold); color: var(--gold-dark); }

.btn-sm {
  padding: .4rem .85rem;
  font-size: .8rem;
}

/* ---- Modal ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  backdrop-filter: blur(2px);
}

.modal-overlay.hidden { display: none; }

.modal-box {
  background: var(--surface);
  border-radius: var(--radius);
  width: 100%;
  max-width: 720px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: slideUp .25s ease;
}

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

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-shrink: 0;
}

.modal-header-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: var(--white);
  background: linear-gradient(135deg, var(--gold), var(--red));
  flex-shrink: 0;
}

.modal-header h2 {
  flex: 1;
  font-size: 1.05rem;
  font-weight: 700;
}

.modal-header p {
  font-size: .78rem;
  color: var(--text-muted);
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  color: var(--text-muted);
  padding: .25rem;
  line-height: 1;
  transition: color .2s;
}

.modal-close:hover { color: var(--red); }

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: .75rem;
  flex-shrink: 0;
}

/* ---- Record detail ---- */
.record-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
}

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

.record-table th {
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  background: var(--bg);
}

.record-table tr:hover td { background: rgba(239,162,44,.04); }

.record-table td:last-child {
  text-align: right;
}

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}

.empty-state i { font-size: 3rem; opacity: .3; display: block; margin-bottom: 1rem; }
.empty-state p { font-size: .9rem; }

/* Toast */
.toast-container {
  position: fixed;
  bottom: calc(var(--nav-h) + 1rem);
  right: 1rem;
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.toast {
  background: var(--text);
  color: var(--white);
  padding: .85rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: .85rem;
  box-shadow: var(--shadow);
  animation: slideIn .25s ease;
  display: flex;
  align-items: center;
  gap: .6rem;
  max-width: 320px;
}

.toast.success { background: var(--success); }
.toast.error   { background: var(--red); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ---- Bottom nav (mobile) ---- */
#bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--nav-h);
  background: var(--white);
  border-top: 1px solid var(--border);
  z-index: 100;
  padding: 0 .5rem;
  align-items: center;
  justify-content: space-around;
}

.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .2rem;
  padding: .5rem;
  cursor: pointer;
  background: none;
  border: none;
  font-family: var(--font-main);
  color: var(--text-muted);
  font-size: .68rem;
  font-weight: 500;
  transition: color .2s;
  border-radius: var(--radius-sm);
}

.bottom-nav-item i { font-size: 1.2rem; }
.bottom-nav-item.active { color: var(--gold); }

/* Loading spinner */
.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 2rem auto;
}

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

/* ---- Label Scan Banner ---- */
.label-scan-banner {
  background: linear-gradient(135deg, rgba(239,162,44,.08) 0%, rgba(211,47,47,.06) 100%);
  border: 2px solid var(--gold);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.75rem;
  position: relative;
  overflow: hidden;
}

.label-scan-banner::before {
  content: '';
  position: absolute;
  top: -30px; right: -30px;
  width: 100px; height: 100px;
  background: radial-gradient(circle, rgba(239,162,44,.15), transparent 70%);
  pointer-events: none;
}

.scan-banner-header {
  display: flex;
  align-items: center;
  gap: .85rem;
  margin-bottom: 1rem;
}

.scan-banner-icon {
  width: 44px; height: 44px;
  background: linear-gradient(135deg, var(--gold), var(--red));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: var(--white);
  font-size: 1.2rem;
  flex-shrink: 0;
}

.scan-banner-header h4 {
  font-size: .95rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: .1rem;
}

.scan-banner-header p {
  font-size: .75rem;
  color: var(--text-muted);
}

/* Drop zone inside banner */
.scan-drop-zone {
  border: 2px dashed var(--gold);
  border-radius: var(--radius-sm);
  padding: 1.1rem;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
  background: rgba(255,255,255,.5);
  position: relative;
}

.scan-drop-zone:hover, .scan-drop-zone.drag-over {
  background: rgba(239,162,44,.12);
  border-color: var(--gold-dark);
}

.scan-drop-zone i { font-size: 1.6rem; color: var(--gold); margin-bottom: .4rem; display: block; }
.scan-drop-zone p { font-size: .8rem; color: var(--text-muted); margin: 0; }
.scan-drop-zone input[type="file"] { display: none; }

/* Scan selected state */
.scan-selected {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--white);
  border-radius: var(--radius-sm);
  padding: .75rem 1rem;
  margin-top: .75rem;
}

.scan-thumb {
  width: 60px; height: 60px;
  object-fit: cover;
  border-radius: 8px;
  border: 2px solid var(--border);
  flex-shrink: 0;
}

.scan-selected-info { flex: 1; min-width: 0; }
.scan-selected-info strong { display: block; font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scan-selected-info span { font-size: .75rem; color: var(--text-muted); }

/* Analyse button */
.btn-analyze {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .65rem 1.3rem;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--gold), var(--red));
  color: var(--white);
  border: none;
  font-family: var(--font-main);
  font-size: .88rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity .2s, transform .2s;
  box-shadow: 0 3px 12px rgba(239,162,44,.35);
  flex-shrink: 0;
}

.btn-analyze:hover:not(:disabled) { transform: translateY(-1px); opacity: .95; }
.btn-analyze:disabled { opacity: .6; cursor: wait; }

.btn-analyze .spinner-inline {
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: var(--white);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  display: inline-block;
}

/* Scan results */
.scan-result {
  margin-top: .85rem;
  border-radius: var(--radius-sm);
  padding: .85rem 1rem;
  font-size: .82rem;
  display: flex;
  align-items: flex-start;
  gap: .65rem;
  animation: slideUp .25s ease;
}

.scan-result.success {
  background: rgba(46,125,50,.08);
  border: 1px solid rgba(46,125,50,.25);
  color: var(--success);
}

.scan-result.error {
  background: rgba(211,47,47,.08);
  border: 1px solid rgba(211,47,47,.25);
  color: var(--red);
}

.scan-result i { font-size: 1rem; margin-top: .1rem; flex-shrink: 0; }
.scan-result div { line-height: 1.5; }
.scan-result strong { display: block; margin-bottom: .2rem; }

/* Pre-filled field highlight */
@keyframes prefillFlash {
  0%   { background: rgba(239,162,44,.35); }
  100% { background: transparent; }
}

.field-prefilled {
  animation: prefillFlash .8s ease forwards;
  border-color: var(--gold) !important;
}

.prefill-badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-size: .68rem;
  font-weight: 600;
  color: var(--gold-dark);
  background: rgba(239,162,44,.15);
  border-radius: 20px;
  padding: .15rem .5rem;
  margin-left: .4rem;
  vertical-align: middle;
}

/* API Key modal */
.apikey-form {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.5rem;
  border: 1.5px solid var(--border);
  margin-top: .75rem;
}

.apikey-form p {
  font-size: .82rem;
  color: var(--text-muted);
  margin-bottom: .85rem;
  line-height: 1.6;
}

/* Print */
@media print {
  #app-header, #sidebar, #bottom-nav, .modal-footer, .btn, .filters-bar { display: none !important; }
  #main-content { padding: 0; }
  .modal-overlay { position: static; background: none; padding: 0; }
  .modal-box { box-shadow: none; max-height: none; }
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  #sidebar { display: none; }
  #bottom-nav { display: flex; }

  #main-content {
    padding: 1rem;
    padding-bottom: calc(var(--nav-h) + 1.5rem);
  }

  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .forms-grid { grid-template-columns: 1fr; }
  .quick-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid-2 { grid-template-columns: 1fr; }
  .filters-bar { flex-direction: column; }
  .filters-bar > * { width: 100%; }

  .modal-box { max-height: 95vh; border-radius: var(--radius) var(--radius) 0 0; }
  .modal-overlay { align-items: flex-end; }

  .toast-container { left: 1rem; right: 1rem; }
  .toast { max-width: 100%; }
}

@media (max-width: 400px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .quick-grid { grid-template-columns: repeat(2, 1fr); }
}
