/* ===== VARIABLES ===== */
:root {
  --green: #1D9E75;
  --green-dark: #0F6E56;
  --green-light: #E1F5EE;
  --green-text: #085041;
  --amber: #d97706;
  --amber-light: #FFFBEB;
  --red: #dc2626;
  --red-light: #FEF2F2;
  --blue: #1a56db;
  --blue-light: #EBF4FF;
  --bg: #f8f9fa;
  --bg-card: #ffffff;
  --border: #e5e7eb;
  --border-hover: #d1d5db;
  --text: #111827;
  --text-muted: #6b7280;
  --text-light: #9ca3af;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

/* ===== TOPNAV ===== */
.topnav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: 54px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}
.topnav-left, .topnav-center, .topnav-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 16px;
  color: var(--text);
  text-decoration: none;
}
.logo-icon { font-size: 20px; }

.role-badge {
  padding: 3px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}
.badge-admin { background: #EEF2FF; color: #4338ca; }
.badge-client { background: var(--green-light); color: var(--green-text); }
.badge-interv { background: #FFFBEB; color: #92400e; }

.notif-bell {
  position: relative;
  cursor: pointer;
  font-size: 18px;
  padding: 4px 6px;
  border-radius: var(--radius);
  transition: background .15s;
}
.notif-bell:hover { background: var(--bg); }
.notif-count {
  position: absolute;
  top: -2px; right: -4px;
  background: #ef4444;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  width: 16px; height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.user-chip { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-muted); }
.avatar {
  display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px;
  border-radius: 50%;
  font-size: 11px; font-weight: 600;
}
.av-admin { background: var(--green-light); color: var(--green-text); }
.av-client { background: #FEF3C7; color: #92400e; }
.av-interv { background: var(--blue-light); color: var(--blue); }

/* ===== LAYOUT ===== */
.app-layout { display: flex; min-height: calc(100vh - 54px); }

.sidebar {
  width: 200px;
  min-width: 200px;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sidebar-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius);
  font-size: 13px;
  cursor: pointer;
  color: var(--text-muted);
  transition: all .15s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
}
.sidebar-item:hover { background: var(--bg); color: var(--text); }
.sidebar-item.active { background: var(--green-light); color: var(--green-text); font-weight: 500; }

.main-content { flex: 1; padding: 20px 24px; overflow-x: auto; }
.section { display: none; }
.section.active { display: block; }

/* ===== PAGE HEADER ===== */
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 16px; flex-wrap: wrap; gap: 10px;
}
.page-title { font-size: 18px; font-weight: 600; color: var(--text); }
.page-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.sec-title {
  font-size: 11px; font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin: 18px 0 8px;
}

/* ===== CARDS ===== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
}
.card-title { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 14px; }

/* ===== GRID ===== */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.metrics-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.catalogue-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.interv-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }

/* ===== METRIC CARDS ===== */
.metric-card {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.metric-label { font-size: 11px; color: var(--text-muted); margin-bottom: 6px; }
.metric-value { font-size: 22px; font-weight: 600; color: var(--text); }
.metric-sub { font-size: 11px; color: var(--text-muted); margin-top: 3px; }

/* ===== TABLE ===== */
.table-card { padding: 0; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left; padding: 9px 12px;
  color: var(--text-muted); font-weight: 500; font-size: 11px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--bg); }

/* ===== BADGES ===== */
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px; font-weight: 500;
  white-space: nowrap;
}
.badge-pending   { background: #FEF3C7; color: #92400e; }
.badge-confirmed { background: var(--green-light); color: var(--green-text); }
.badge-done      { background: var(--blue-light); color: #1e3a5f; }
.badge-cancelled { background: var(--red-light); color: #991b1b; }
.badge-paid      { background: #ECFDF5; color: #065f46; }
.badge-refunded  { background: var(--red-light); color: #991b1b; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: none;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  transition: all .15s;
  text-decoration: none;
}
.btn:hover { background: var(--bg); border-color: var(--border-hover); }
.btn-primary { background: var(--green); color: #fff; border-color: var(--green); font-weight: 500; }
.btn-primary:hover { background: var(--green-dark); border-color: var(--green-dark); }
.btn-outline { background: none; }
.btn-danger { color: var(--red); border-color: #fecaca; }
.btn-danger:hover { background: var(--red-light); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; }

/* ===== FORMS ===== */
.form-group { margin-bottom: 13px; }
.form-label { display: block; font-size: 11px; font-weight: 600; color: var(--text-muted); margin-bottom: 4px; text-transform: uppercase; letter-spacing: .04em; }
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  font-size: 13px; font-family: inherit;
  color: var(--text); outline: none;
  transition: border-color .15s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(29,158,117,.1);
}
.form-textarea { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-actions-right { display: flex; justify-content: flex-end; margin-top: 14px; }
.form-actions-between { display: flex; justify-content: space-between; margin-top: 14px; }

/* ===== MODAL ===== */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.45); z-index: 200;
  align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  width: 480px; max-width: 95vw;
  border: 1px solid var(--border);
  box-shadow: 0 20px 60px rgba(0,0,0,.15);
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.modal-title { font-weight: 600; font-size: 15px; }
.modal-body { padding: 18px; }
.modal-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 8px;
}

/* ===== NOTIFICATIONS ===== */
.notif-panel {
  position: fixed; top: 54px; right: 20px;
  width: 320px; background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  z-index: 150; display: none;
  box-shadow: var(--shadow);
}
.notif-panel.open { display: block; }
.notif-head {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  font-size: 13px; font-weight: 600;
}
.notif-item {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background .12s;
  display: flex; gap: 10px; align-items: flex-start;
}
.notif-item:hover { background: var(--bg); }
.notif-item:last-child { border-bottom: none; }
.notif-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 4px; flex-shrink: 0; }
.notif-text { font-size: 13px; }
.notif-time { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ===== TOAST ===== */
.toast {
  position: fixed; bottom: 20px; right: 20px;
  background: #111;
  color: #fff;
  padding: 10px 18px;
  border-radius: var(--radius);
  font-size: 13px; font-weight: 500;
  z-index: 300; display: none;
  align-items: center; gap: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,.2);
  animation: fadeIn .2s ease;
}
.toast.show { display: flex; }
@keyframes fadeIn { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:translateY(0); } }

/* ===== STEPS ===== */
.step-bar { display: flex; align-items: center; margin-bottom: 24px; }
.step { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.step-num {
  width: 22px; height: 22px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600;
  border: 1px solid var(--border);
  color: var(--text-muted); background: var(--bg);
}
.step.active .step-num { background: var(--green); color: #fff; border-color: var(--green); }
.step.done .step-num { background: var(--green-light); color: var(--green-text); border-color: var(--green); }
.step-label { color: var(--text-muted); }
.step.active .step-label { color: var(--text); font-weight: 600; }
.step-line { flex: 1; height: 1px; background: var(--border); margin: 0 8px; }

/* ===== MISC ===== */
.toggle-list { display: flex; flex-direction: column; gap: 12px; }
.toggle-item { display: flex; align-items: center; justify-content: space-between; cursor: pointer; font-size: 13px; }
.profile-header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.profile-name { font-weight: 600; font-size: 15px; }
.profile-sub { font-size: 12px; color: var(--text-muted); }
.address-list { display: flex; flex-direction: column; gap: 8px; }
.address-item { padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); }
.address-name { font-weight: 600; font-size: 13px; margin-bottom: 2px; }
.address-val { font-size: 12px; color: var(--text-muted); }
.notif-dot-indicator { width: 7px; height: 7px; border-radius: 50%; background: #ef4444; display: inline-block; margin-left: 4px; }
.success-icon { font-size: 44px; margin-bottom: 12px; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .metrics-grid { grid-template-columns: 1fr 1fr; }
  .catalogue-grid, .interv-grid { grid-template-columns: 1fr 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
}
