500;600;700;800&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --primary: #0d9488;
  --primary-hover: #0f766e;
  --primary-light: #f0fdfa;
  --accent: #0284c7;
  --accent-light: #f0f9ff;
  --ink: #0f172a;
  --ink-secondary: #334155;
  --muted: #64748b;
  --subtle: #94a3b8;
  --line: #e2e8f0;
  --line-light: #f1f5f9;
  --bg: #f8fafc;
  --surface: #ffffff;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --shadow-xs: 0 1px 2px 0 rgba(15, 23, 42, 0.05);
  --shadow-sm: 0 1px 3px 0 rgba(15, 23, 42, 0.08), 0 1px 2px -1px rgba(15, 23, 42, 0.08);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.5 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ============================================================
   SIDEBAR CLÍNICA MODERNA
   ============================================================ */

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 256px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  z-index: 50;
  box-shadow: 2px 0 12px rgba(15, 23, 42, 0.03);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 10px 24px;
  border-bottom: 1px solid var(--line-light);
  margin-bottom: 16px;
}

.brand-icon {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, #0d9488 0%, #0284c7 100%);
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: #fff;
  box-shadow: 0 4px 12px rgba(13, 148, 136, 0.3);
  flex-shrink: 0;
}

.brand-text strong {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--ink);
  display: block;
  line-height: 1.1;
}

.brand-text strong span {
  color: var(--primary);
}

.brand-text small {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: var(--muted);
  text-transform: uppercase;
}

.side-nav {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.nav-group-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--subtle);
  margin: 0 10px 8px;
}

.nav {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  color: #475569;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.15s ease;
  position: relative;
}

.nav:hover {
  background: #f1f5f9;
  color: var(--ink);
}

.nav.active {
  background: #f0fdfa;
  color: var(--primary);
  font-weight: 700;
}

.nav-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  color: #64748b;
  transition: color 0.15s ease;
}

.nav:hover .nav-icon {
  color: var(--ink);
}

.nav.active .nav-icon {
  color: var(--primary);
}

.nav-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-indicator {
  position: absolute;
  right: 10px;
  width: 6px;
  height: 6px;
  background: var(--primary);
  border-radius: 50%;
}

/* User Account Card at Bottom */
.side-account {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--line-light);
  display: flex;
  align-items: center;
  gap: 10px;
}

.side-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #e0f2fe 0%, #ccfbf1 100%);
  color: #0f766e;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 14px;
  border: 1px solid #99f6e4;
  flex-shrink: 0;
}

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

.side-account-info strong {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.side-role-pill {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 12px;
  margin: 2px 0;
}
.role-admin { background: #e0e7ff; color: #4338ca; }
.role-enfermera { background: #dcfce7; color: #15803d; }
.role-recepcionista { background: #fef3c7; color: #b45309; }
.role-cliente { background: #f1f5f9; color: #475569; }

.side-logout-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.15s ease;
}

.side-logout-link:hover {
  color: #e11d48;
}

/* ============================================================
   MAIN CONTENT & LAYOUT
   ============================================================ */

main {
  margin-left: 256px;
  padding: 32px 40px 70px;
  max-width: 1600px;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

header small {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--muted);
  text-transform: uppercase;
}

h1 {
  font-size: 26px;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.6px;
  margin: 4px 0 0;
}

h2 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--ink);
  margin: 0 0 8px;
}

h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  margin: 20px 0 10px;
}

p {
  margin-top: 0;
  color: var(--ink-secondary);
  line-height: 1.5;
}

/* ============================================================
   PANELS & CARDS
   ============================================================ */

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.panel-head p {
  color: var(--muted);
  margin: 0;
  font-size: 13px;
}

/* ============================================================
   BUTTONS
   ============================================================ */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-md);
  color: var(--ink-secondary);
  font: 600 13px/1.2 'Plus Jakarta Sans', sans-serif;
  text-decoration: none;
  padding: 9px 16px;
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition: all 0.15s ease;
}

.button:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  color: var(--ink);
}

.button:active {
  transform: translateY(1px);
}

.button.primary {
  background: linear-gradient(135deg, #0d9488 0%, #0f766e 100%);
  border-color: #0d9488;
  color: #ffffff;
  box-shadow: 0 2px 5px rgba(13, 148, 136, 0.25);
}

.button.primary:hover {
  background: #0f766e;
  border-color: #0f766e;
  box-shadow: 0 4px 8px rgba(13, 148, 136, 0.35);
}

.button.warning {
  background: #fff1f2;
  border-color: #fecdd3;
  color: #be123c;
}

.button.warning:hover {
  background: #ffe4e6;
  border-color: #fda4af;
}

.button.small {
  padding: 5px 10px;
  font-size: 11px;
  border-radius: var(--radius-sm);
  min-height: auto;
}

/* ============================================================
   FORMS & INPUTS
   ============================================================ */

input, select, textarea {
  font: 13px/1.4 'Plus Jakarta Sans', sans-serif;
  color: var(--ink);
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-md);
  padding: 8px 12px;
  background: var(--surface);
  width: 100%;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
}

label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  margin-bottom: 14px;
}

label input, label select, label textarea {
  margin-top: 6px;
  display: block;
}

/* ============================================================
   TABLES
   ============================================================ */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
}

th {
  text-align: left;
  color: #475569;
  background: #f8fafc;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--line-light);
  font-size: 13px;
  color: var(--ink);
  vertical-align: middle;
}

tbody tr:hover td {
  background: #f8fafc;
}

tbody tr:last-child td {
  border-bottom: 0;
}

/* Status Badges */
.status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
}

/* Notices / Alerts */
.notice {
  padding: 12px 18px;
  border-radius: var(--radius-md);
  border: 1px solid #bbf7d0;
  background: #f0fdf4;
  color: #166534;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.notice.warning {
  border-color: #fde68a;
  background: #fffbeb;
  color: #92400e;
}

/* Empty states */
.empty {
  text-align: center;
  padding: 60px 20px;
}
.empty p {
  color: var(--muted);
  margin-top: 8px;
}

/* Responsive */
@media (max-width: 768px) {
  .sidebar {
    position: static;
    width: 100%;
    height: auto;
    padding: 16px;
    box-shadow: none;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .side-nav {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
  }
  .nav-group-title {
    width: 100%;
    margin: 8px 0 4px;
  }
  .side-account {
    margin-top: 16px;
  }
  main {
    margin-left: 0;
    padding: 20px 16px 50px;
  }
}
