/* ═══════════════════════════════════════════════════════════════
   FOURRIÈRE RP — Main Stylesheet v1.0.0
   Color palette: Black, Orange, Yellow
   ═══════════════════════════════════════════════════════════════ */

/* ── CSS Variables (set by PHP via getThemeVars()) ─────────────── */
:root {
  --color-primary:     #f97316;
  --color-secondary:   #fbbf24;
  --color-bg:          #0f0f0f;
  --color-surface:     #1a1a1a;
  --color-surface2:    #242424;
  --color-border:      #2e2e2e;
  --color-text:        #f5f5f5;
  --color-text-muted:  #9ca3af;
  --color-success:     #22c55e;
  --color-warning:     #f59e0b;
  --color-error:       #ef4444;
  --color-info:        #3b82f6;
  --sidebar-width:     260px;
  --topbar-height:     64px;
  --radius:            8px;
  --radius-lg:         12px;
  --shadow:            0 4px 24px rgba(0,0,0,.4);
  --shadow-sm:         0 2px 8px rgba(0,0,0,.3);
  --transition:        .2s ease;
}
[data-theme="light"] {
  --color-primary:     #f97316;
  --color-secondary:   #e69500;
  --color-bg:          #f8f7f4;
  --color-surface:     #ffffff;
  --color-surface2:    #f3f2ef;
  --color-border:      #e5e3df;
  --color-text:        #1a1a1a;
  --color-text-muted:  #6b7280;
  --shadow:            0 4px 24px rgba(0,0,0,.1);
  --shadow-sm:         0 2px 8px rgba(0,0,0,.08);
}

/* ── Reset ──────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100vh;
  transition: background var(--transition), color var(--transition);
}
a { color: var(--color-primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--color-secondary); }
img { max-width: 100%; height: auto; }
ul { list-style: none; }

/* ── Layout ─────────────────────────────────────────────────────── */
.layout {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 200;
  transition: transform var(--transition), box-shadow var(--transition);
}
.sidebar-header {
  padding: 20px 16px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-logo {
  max-height: 48px;
  max-width: 180px;
  object-fit: contain;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-primary);
}
.brand-icon { font-size: 1.5rem; }

.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius);
  color: var(--color-text-muted);
  font-size: .9rem;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
  cursor: pointer;
  text-decoration: none;
}
.nav-item:hover {
  background: var(--color-surface2);
  color: var(--color-text);
}
.nav-item.active {
  background: linear-gradient(135deg, rgba(249,115,22,.2), rgba(251,191,36,.1));
  color: var(--color-primary);
  border-left: 3px solid var(--color-primary);
}
.nav-icon { font-size: 1.1rem; min-width: 22px; text-align: center; }

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--color-border);
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-avatar {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .9rem;
  color: #fff;
  flex-shrink: 0;
}
.user-avatar-sm {
  width: 30px; height: 30px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .8rem;
  color: #fff;
  flex-shrink: 0;
}
.user-info { display: flex; flex-direction: column; overflow: hidden; }
.user-name {
  font-size: .85rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-role {
  font-size: .75rem;
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

/* ── Topbar ─────────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-height);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar-title {
  flex: 1;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-text);
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.sidebar-toggle { display: none; }

/* ── Main Content ───────────────────────────────────────────────── */
.main-content {
  flex: 1;
  padding: 24px;
  max-width: 1400px;
  width: 100%;
}

/* ── Buttons ────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius);
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary {
  background: var(--color-primary);
  color: #fff;
}
.btn-primary:hover:not(:disabled) {
  background: #ea6a0a;
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(249,115,22,.4);
}
.btn-secondary {
  background: var(--color-surface2);
  color: var(--color-text);
  border: 1px solid var(--color-border);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--color-border);
  color: var(--color-text);
}
.btn-success {
  background: var(--color-success);
  color: #fff;
}
.btn-success:hover:not(:disabled) {
  background: #16a34a;
  color: #fff;
}
.btn-danger {
  background: var(--color-error);
  color: #fff;
}
.btn-danger:hover:not(:disabled) {
  background: #dc2626;
  color: #fff;
}
.btn-warning {
  background: var(--color-warning);
  color: #fff;
}
.btn-warning:hover:not(:disabled) { background: #d97706; color: #fff; }
.btn-outline {
  background: transparent;
  border: 1px solid var(--color-primary);
  color: var(--color-primary);
}
.btn-outline:hover:not(:disabled) {
  background: var(--color-primary);
  color: #fff;
}
.btn-sm { padding: 5px 12px; font-size: .8rem; }
.btn-lg { padding: 12px 24px; font-size: 1rem; }
.btn-icon {
  background: transparent;
  border: none;
  color: var(--color-text-muted);
  width: 36px; height: 36px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
  font-size: 1rem;
}
.btn-icon:hover {
  background: var(--color-surface2);
  color: var(--color-text);
}
.btn-info-trigger .icon-question {
  width: 20px; height: 20px;
  background: var(--color-surface2);
  border: 2px solid var(--color-border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .75rem;
  color: var(--color-text-muted);
}

/* ── Cards ──────────────────────────────────────────────────────── */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-text);
}
.card-body { padding: 20px; }
.card-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--color-border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ── Stat Cards ─────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: transform var(--transition), box-shadow var(--transition);
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.stat-icon {
  width: 52px; height: 52px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}
.stat-icon.orange { background: rgba(249,115,22,.15); }
.stat-icon.yellow { background: rgba(251,191,36,.15); }
.stat-icon.green  { background: rgba(34,197,94,.15); }
.stat-icon.blue   { background: rgba(59,130,246,.15); }
.stat-icon.red    { background: rgba(239,68,68,.15); }
.stat-body { flex: 1; min-width: 0; }
.stat-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--color-primary);
  line-height: 1;
}
.stat-label {
  font-size: .8rem;
  color: var(--color-text-muted);
  margin-top: 4px;
}

/* ── Forms ──────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: .85rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 6px;
}
.form-label .required { color: var(--color-error); margin-left: 2px; }
.form-control, .form-select {
  width: 100%;
  padding: 9px 14px;
  background: var(--color-surface2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  color: var(--color-text);
  font-size: .9rem;
  font-family: inherit;
  transition: border-color var(--transition), box-shadow var(--transition);
  appearance: none;
}
.form-control:focus, .form-select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(249,115,22,.2);
}
.form-control::placeholder { color: var(--color-text-muted); }
.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239ca3af' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}
textarea.form-control { resize: vertical; min-height: 100px; }
textarea.html-editor { font-family: 'Courier New', Courier, monospace; font-size: .85rem; line-height: 1.6; min-height: 160px; }
.form-hint {
  font-size: .78rem;
  color: var(--color-text-muted);
  margin-top: 4px;
}
.form-error {
  font-size: .78rem;
  color: var(--color-error);
  margin-top: 4px;
}
.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}
.form-check {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.form-check input[type="checkbox"] {
  width: 18px; height: 18px;
  accent-color: var(--color-primary);
  cursor: pointer;
}
.form-check-label {
  font-size: .875rem;
  color: var(--color-text);
  cursor: pointer;
}
.input-group {
  display: flex;
  align-items: stretch;
}
.input-group .form-control { border-radius: var(--radius) 0 0 var(--radius); }
.input-group .input-addon {
  padding: 9px 14px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left: none;
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--color-text-muted);
  font-size: .9rem;
  display: flex;
  align-items: center;
}

/* ── Tables ─────────────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
thead th {
  padding: 12px 14px;
  text-align: left;
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}
tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--color-surface2); }
.table-actions { display: flex; gap: 6px; align-items: center; }

/* ── Badges ─────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
}
.badge-primary { background: rgba(249,115,22,.15); color: var(--color-primary); }
.badge-success { background: rgba(34,197,94,.15);  color: var(--color-success); }
.badge-warning { background: rgba(245,158,11,.15); color: var(--color-warning); }
.badge-error   { background: rgba(239,68,68,.15);  color: var(--color-error); }
.badge-info    { background: rgba(59,130,246,.15);  color: var(--color-info); }
.badge-muted   { background: var(--color-surface2); color: var(--color-text-muted); }

/* ── Modals ─────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}
.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}
.modal {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
  transform: translateY(20px);
  transition: transform var(--transition);
}
.modal-overlay.active .modal { transform: translateY(0); }
.modal-lg  { max-width: 800px; }
.modal-xl  { max-width: 1100px; }
.modal-sm  { max-width: 380px; }
.modal-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: var(--color-surface);
  z-index: 10;
}
.modal-title { font-size: 1.05rem; font-weight: 700; }
.modal-body { padding: 20px; }
.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--color-border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  position: sticky;
  bottom: 0;
  background: var(--color-surface);
}

/* ── Tabs ───────────────────────────────────────────────────────── */
.tab-group { display: flex; flex-direction: column; }
.tab-nav {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 0;
  flex-wrap: wrap;
}
.tab-btn {
  padding: 10px 18px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--color-text-muted);
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  margin-bottom: -1px;
  font-family: inherit;
}
.tab-btn:hover { color: var(--color-text); }
.tab-btn.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}
.tab-content { display: none; padding-top: 20px; }
.tab-content.active { display: block; }

/* ── Alerts/Flash ───────────────────────────────────────────────── */
.flash-message {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 20px;
  font-size: .875rem;
  font-weight: 500;
}
.flash-success { background: rgba(34,197,94,.15); color: var(--color-success); border-bottom: 1px solid rgba(34,197,94,.3); }
.flash-error   { background: rgba(239,68,68,.15);  color: var(--color-error);   border-bottom: 1px solid rgba(239,68,68,.3); }
.flash-warning { background: rgba(245,158,11,.15); color: var(--color-warning); border-bottom: 1px solid rgba(245,158,11,.3); }
.flash-info    { background: rgba(59,130,246,.15);  color: var(--color-info);    border-bottom: 1px solid rgba(59,130,246,.3); }
.flash-message button { background: none; border: none; cursor: pointer; color: inherit; font-size: 1rem; }

.alert {
  padding: 14px 16px;
  border-radius: var(--radius);
  font-size: .875rem;
  margin-bottom: 16px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.alert-success { background: rgba(34,197,94,.1);  color: var(--color-success); border: 1px solid rgba(34,197,94,.3); }
.alert-error   { background: rgba(239,68,68,.1);  color: var(--color-error);   border: 1px solid rgba(239,68,68,.3); }
.alert-warning { background: rgba(245,158,11,.1); color: var(--color-warning); border: 1px solid rgba(245,158,11,.3); }
.alert-info    { background: rgba(59,130,246,.1);  color: var(--color-info);    border: 1px solid rgba(59,130,246,.3); }

/* ── Dropdown ───────────────────────────────────────────────────── */
.user-dropdown { position: relative; }
.btn-user-menu {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--color-surface2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  color: var(--color-text);
  font-size: .875rem;
  cursor: pointer;
  font-family: inherit;
  transition: all var(--transition);
}
.btn-user-menu:hover { background: var(--color-border); }
.chevron { font-size: .7rem; color: var(--color-text-muted); }
.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  min-width: 160px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px);
  transition: all var(--transition);
  z-index: 300;
}
.dropdown-menu.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  font-size: .875rem;
  color: var(--color-text);
  transition: background var(--transition);
  cursor: pointer;
  text-decoration: none;
}
.dropdown-item:hover { background: var(--color-surface2); color: var(--color-text); }
.dropdown-item.text-danger { color: var(--color-error); }
.dropdown-divider { height: 1px; background: var(--color-border); margin: 4px 0; }

/* ── Searchable Select (Custom Dropdown) ────────────────────────── */
.search-select {
  position: relative;
}
.search-select-input {
  width: 100%;
}
.search-select-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-primary);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  max-height: 250px;
  overflow-y: auto;
  z-index: 500;
  box-shadow: var(--shadow);
  display: none;
}
.search-select-dropdown.open { display: block; }
.search-select-option {
  padding: 10px 14px;
  cursor: pointer;
  font-size: .875rem;
  transition: background var(--transition);
  border-bottom: 1px solid var(--color-border);
}
.search-select-option:last-child { border-bottom: none; }
.search-select-option:hover,
.search-select-option.highlighted { background: var(--color-surface2); }
.search-select-option .option-ref {
  font-size: .75rem;
  color: var(--color-text-muted);
  margin-left: 8px;
}
.search-select-empty {
  padding: 12px 14px;
  color: var(--color-text-muted);
  font-size: .875rem;
  text-align: center;
}

/* ── Pagination ─────────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 20px;
  justify-content: center;
  flex-wrap: wrap;
}
.page-btn {
  padding: 6px 12px;
  border-radius: var(--radius);
  background: var(--color-surface2);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  font-size: .8rem;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}
.page-btn:hover { background: var(--color-border); }
.page-btn.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}
.page-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ── Section Headers ────────────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}
.section-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-text);
}
.section-subtitle {
  font-size: .875rem;
  color: var(--color-text-muted);
  margin-top: 4px;
}

/* ── Divider ────────────────────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--color-border);
  margin: 20px 0;
}

/* ── Empty state ────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--color-text-muted);
}
.empty-state-icon { font-size: 3rem; margin-bottom: 12px; }
.empty-state-title { font-size: 1.1rem; font-weight: 600; color: var(--color-text); margin-bottom: 8px; }
.empty-state-desc { font-size: .875rem; }

/* ── Vault Display ──────────────────────────────────────────────── */
.vault-display {
  background: linear-gradient(135deg, #1a1a1a 0%, #2a1a0a 100%);
  border: 1px solid rgba(249,115,22,.3);
  border-radius: var(--radius-lg);
  padding: 24px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
[data-theme="light"] .vault-display {
  background: linear-gradient(135deg, #fff7f0 0%, #fff3e0 100%);
}
.vault-display::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at top, rgba(249,115,22,.1), transparent 70%);
}
.vault-amount {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--color-primary);
  position: relative;
}
.vault-label {
  font-size: .875rem;
  color: var(--color-text-muted);
  margin-top: 4px;
  position: relative;
}

/* ── Progress bar ───────────────────────────────────────────────── */
.progress-bar {
  height: 6px;
  background: var(--color-surface2);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 8px;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
  border-radius: 999px;
  transition: width .3s ease;
}

/* ── Copy box ───────────────────────────────────────────────────── */
.copy-box {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 14px;
  font-family: 'Courier New', monospace;
  font-size: .82rem;
  color: var(--color-text);
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.8;
  position: relative;
}
.copy-box-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

/* ── Info box ───────────────────────────────────────────────────── */
.info-radio {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--color-surface2);
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: .9rem;
}

/* ── Quill content display ──────────────────────────────────────── */
.ql-content { font-size: .9rem; line-height: 1.7; }
.ql-content p { margin-bottom: 10px; }
.ql-content h1, .ql-content h2, .ql-content h3 { margin-bottom: 10px; font-weight: 700; }
.ql-content ul, .ql-content ol { padding-left: 20px; margin-bottom: 10px; }
.ql-content li { margin-bottom: 4px; }
.ql-content a { color: var(--color-primary); }
.ql-content img { max-width: 100%; border-radius: var(--radius); }

/* ── Quill editor theming ───────────────────────────────────────── */
.ql-toolbar {
  border-color: var(--color-border) !important;
  border-radius: var(--radius) var(--radius) 0 0 !important;
  background: var(--color-surface2) !important;
}
.ql-container {
  border-color: var(--color-border) !important;
  border-radius: 0 0 var(--radius) var(--radius) !important;
  background: var(--color-surface2) !important;
  color: var(--color-text) !important;
  font-size: .9rem;
  min-height: 200px;
}
.ql-editor { min-height: 200px; }
.ql-toolbar button, .ql-toolbar .ql-picker-label { color: var(--color-text-muted) !important; }
.ql-toolbar button:hover { color: var(--color-text) !important; }

/* ── Charts ─────────────────────────────────────────────────────── */
.chart-wrapper {
  position: relative;
  padding: 20px;
}

/* ── Login page ─────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  background: var(--color-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
  overflow: hidden;
}
.login-page::before {
  content: '';
  position: absolute;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(249,115,22,.15), transparent 60%);
  top: -100px; left: -100px;
  pointer-events: none;
}
.login-page::after {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(251,191,36,.1), transparent 60%);
  bottom: -50px; right: -50px;
  pointer-events: none;
}
.login-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow);
  position: relative;
  z-index: 1;
}
.login-logo {
  text-align: center;
  margin-bottom: 32px;
}
.login-logo img { max-height: 80px; }
.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.login-brand-icon { font-size: 3rem; }
.login-brand-name {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--color-primary);
}
.login-brand-sub {
  font-size: .875rem;
  color: var(--color-text-muted);
}
.login-theme-toggle {
  position: absolute;
  top: 20px;
  right: 20px;
}

/* ── Install page ───────────────────────────────────────────────── */
.install-page {
  min-height: 100vh;
  background: var(--color-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.install-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 640px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.install-header {
  background: linear-gradient(135deg, #1a0a00, #2e1500);
  padding: 32px;
  text-align: center;
  border-bottom: 1px solid rgba(249,115,22,.3);
}
.install-logo { font-size: 3rem; margin-bottom: 12px; }
.install-title { font-size: 1.5rem; font-weight: 800; color: var(--color-primary); }
.install-subtitle { font-size: .875rem; color: var(--color-text-muted); margin-top: 4px; }
.install-body { padding: 32px; }
.install-steps {
  display: flex;
  gap: 8px;
  margin-bottom: 28px;
  justify-content: center;
}
.step-dot {
  width: 32px; height: 8px;
  border-radius: 999px;
  background: var(--color-border);
  transition: all var(--transition);
}
.step-dot.active { background: var(--color-primary); }
.step-dot.done   { background: var(--color-success); }

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

/* ── Text utilities ─────────────────────────────────────────────── */
.text-primary   { color: var(--color-primary) !important; }
.text-success   { color: var(--color-success) !important; }
.text-warning   { color: var(--color-warning) !important; }
.text-danger    { color: var(--color-error) !important; }
.text-muted     { color: var(--color-text-muted) !important; }
.text-center    { text-align: center; }
.text-right     { text-align: right; }
.text-bold      { font-weight: 700; }
.text-sm        { font-size: .8rem; }
.text-lg        { font-size: 1.1rem; }
.fw-bold        { font-weight: 700; }
.fw-800         { font-weight: 800; }
.d-flex         { display: flex; }
.align-center   { align-items: center; }
.justify-between{ justify-content: space-between; }
.gap-8          { gap: 8px; }
.gap-12         { gap: 12px; }
.gap-16         { gap: 16px; }
.mt-8           { margin-top: 8px; }
.mt-16          { margin-top: 16px; }
.mt-24          { margin-top: 24px; }
.mb-8           { margin-bottom: 8px; }
.mb-16          { margin-bottom: 16px; }
.mb-24          { margin-bottom: 24px; }

/* ── Color picker ───────────────────────────────────────────────── */
.color-picker-group {
  display: flex;
  align-items: center;
  gap: 10px;
}
.color-picker-preview {
  width: 36px; height: 36px;
  border-radius: var(--radius);
  border: 2px solid var(--color-border);
  cursor: pointer;
  flex-shrink: 0;
}
input[type="color"] {
  width: 36px; height: 36px;
  padding: 2px;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: var(--radius);
}

/* ── File input ─────────────────────────────────────────────────── */
.file-input-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
}
.file-preview {
  max-height: 60px;
  border-radius: var(--radius);
}

/* ── Contract template tags list ───────────────────────────────── */
.tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.tag-item {
  padding: 3px 10px;
  background: var(--color-surface2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: .78rem;
  font-family: monospace;
  cursor: pointer;
  transition: all var(--transition);
  color: var(--color-secondary);
}
.tag-item:hover {
  border-color: var(--color-primary);
  background: rgba(249,115,22,.1);
}

/* ── History entry type colors ──────────────────────────────────── */
.type-sale         { color: var(--color-primary); }
.type-repair       { color: var(--color-warning); }
.type-transport    { color: var(--color-success); }
.type-intervention { color: var(--color-info); }

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  :root { --sidebar-width: 240px; }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    box-shadow: none;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow);
  }
  .main-wrapper { margin-left: 0; }
  .sidebar-toggle { display: flex; }
  .main-content { padding: 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .vault-amount { font-size: 2rem; }
  .topbar { padding: 0 16px; }
  .login-card { padding: 28px 20px; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .modal { margin: 10px; max-height: calc(100vh - 20px); }
  .tab-nav { gap: 0; }
  .tab-btn { padding: 8px 12px; font-size: .8rem; }
}

/* ── Animations ─────────────────────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeIn .3s ease both; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .6; }
}
.pulse { animation: pulse 2s ease infinite; }

/* ── Scrollbar ──────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover { background: var(--color-text-muted); }
