  :root {
    --bg: #f0f4f2;
    --sidebar-bg: #0f2419;
    --sidebar-text: #c8ddd0;
    --sidebar-active: #1e3d28;
    --sidebar-hover: #183320;
    --accent: #2d7a4f;
    --accent-light: #e8f5ed;
    --accent-dark: #1a5c38;
    --card-bg: #ffffff;
    --border: #d4e5da;
    --text: #1a2e22;
    --text-muted: #5a7a68;
    --text-light: #8aab98;
    --danger: #c0392b;
    --danger-light: #fdf0ef;
    --warning: #d68910;
    --warning-light: #fef9e7;
    --success: #1e8449;
    --shadow: 0 2px 12px rgba(15,36,25,0.08);
    --radius: 10px;
    --radius-sm: 6px;
  }

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

  body {
    font-family: 'DM Sans', sans-serif;
    background: var(--bg);
    color: var(--text);
    display: flex;
    min-height: 100vh;
    font-size: 14px;
  }

  /* SIDEBAR */
  #sidebar {
    width: 220px;
    min-width: 220px;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
  }

  .sidebar-logo {
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
  }
  .sidebar-logo h1 {
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    line-height: 1.3;
  }
  .sidebar-logo span {
    font-size: 11px;
    color: var(--sidebar-text);
    opacity: 0.6;
    font-weight: 300;
  }

  .sidebar-section {
    padding: 12px 10px 4px;
    font-size: 10px;
    font-weight: 600;
    color: rgba(200,221,208,0.4);
    text-transform: uppercase;
    letter-spacing: 0.08em;
  }

  .nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    margin: 1px 8px;
    border-radius: 7px;
    cursor: pointer;
    color: var(--sidebar-text);
    font-size: 13px;
    font-weight: 400;
    transition: all 0.15s;
    border: none;
    background: none;
    width: calc(100% - 16px);
    text-align: left;
  }
  .nav-item:hover { background: var(--sidebar-hover); color: #fff; }
  .nav-item.active { background: var(--accent); color: #fff; font-weight: 500; }
  .nav-item svg { flex-shrink: 0; opacity: 0.7; }
  .nav-item.active svg { opacity: 1; }

  .sidebar-footer {
    margin-top: auto;
    padding: 14px 16px;
    border-top: 1px solid rgba(255,255,255,0.07);
    font-size: 11px;
    color: rgba(200,221,208,0.35);
  }

  /* MAIN */
  #main {
    margin-left: 220px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
  }

  #topbar {
    background: var(--card-bg);
    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: 16px; font-weight: 600; }
  #topbar .topbar-actions { display: flex; gap: 10px; align-items: center; }

  #content { padding: 28px; flex: 1; }

  /* CARDS */
  .card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
  }
  .card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  .card-header h3 { font-size: 14px; font-weight: 600; }
  .card-body { padding: 20px; }

  /* DASHBOARD */
  .stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
  }
  .stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  .stat-icon {
    width: 36px; height: 36px;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    background: var(--accent-light);
  }
  .stat-icon svg { color: var(--accent); }
  .stat-value { font-size: 22px; font-weight: 600; color: var(--text); }
  .stat-label { font-size: 12px; color: var(--text-muted); }

  /* TABLES */
  .table-wrap { overflow-x: auto; }
  table { width: 100%; border-collapse: collapse; }
  th {
    text-align: left;
    padding: 10px 14px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    background: var(--bg);
    border-bottom: 1px solid var(--border);
  }
  td {
    padding: 11px 14px;
    font-size: 13px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
  }
  tr:last-child td { border-bottom: none; }
  tr:hover td { background: #f7fbf8; }

  /* BUTTONS */
  .btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px; font-weight: 500;
    cursor: pointer; border: none; transition: all 0.15s;
    font-family: inherit;
  }
  .btn-primary { background: var(--accent); color: #fff; }
  .btn-primary:hover { background: var(--accent-dark); }
  .btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
  .btn-ghost:hover { background: var(--bg); color: var(--text); }
  .btn-danger { background: var(--danger-light); color: var(--danger); border: 1px solid #f5c6c2; }
  .btn-danger:hover { background: #fadbd8; }
  .btn-sm { padding: 5px 10px; font-size: 12px; }
  .btn-icon { padding: 7px; border-radius: var(--radius-sm); background: transparent; border: 1px solid var(--border); cursor: pointer; color: var(--text-muted); display: inline-flex; align-items: center; transition: all 0.15s; }
  .btn-icon:hover { background: var(--bg); color: var(--text); }
  .btn-icon.danger:hover { background: var(--danger-light); color: var(--danger); border-color: #f5c6c2; }

  /* FORMS */
  .form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
  }
  .form-grid.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
  .form-grid.cols-1 { grid-template-columns: 1fr; }
  .form-group { display: flex; flex-direction: column; gap: 5px; }
  .form-group.span-2 { grid-column: span 2; }
  .form-group.span-3 { grid-column: span 3; }
  label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
  }
  input, select, textarea {
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: inherit;
    color: var(--text);
    background: var(--card-bg);
    outline: none;
    transition: border 0.15s;
    width: 100%;
  }
  input:focus, select:focus, textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(45,122,79,0.1);
  }
  textarea { resize: vertical; min-height: 80px; }

  .form-actions {
    display: flex; gap: 10px; justify-content: flex-end;
    padding-top: 16px;
    margin-top: 8px;
    border-top: 1px solid var(--border);
  }

  /* BADGES */
  .badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
  }
  .badge-green { background: #e8f5ed; color: #1e8449; }
  .badge-blue { background: #eaf2fb; color: #1a5276; }
  .badge-orange { background: #fef5e7; color: #b7770d; }
  .badge-red { background: var(--danger-light); color: var(--danger); }
  .badge-gray { background: #f2f3f4; color: #626567; }

  /* MODAL */
  .modal-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 20px;
  }
  .modal-overlay.open { display: flex; }
  .modal {
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.18);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
  }
  .modal-lg { max-width: 780px; }
  .modal-header {
    padding: 18px 22px 16px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
  }
  .modal-header h3 { font-size: 15px; font-weight: 600; }
  .modal-body { padding: 22px; }
  .modal-close {
    background: none; border: none; cursor: pointer;
    color: var(--text-muted); padding: 4px; border-radius: 4px;
    display: flex; align-items: center;
  }
  .modal-close:hover { background: var(--bg); color: var(--text); }

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

  /* AVATAR */
  .avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 600;
    flex-shrink: 0;
    background: var(--accent-light);
    color: var(--accent);
  }

  /* TOAST */
  #toast-container {
    position: fixed;
    bottom: 24px; right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  .toast {
    background: var(--sidebar-bg);
    color: #fff;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 13px;
    display: flex; align-items: center; gap: 10px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
    animation: slideIn 0.25s ease;
    max-width: 300px;
  }
  .toast.error { background: var(--danger); }
  @keyframes slideIn { from { transform: translateX(20px); opacity: 0; } to { transform: none; opacity: 1; } }

  /* SEARCH */
  .search-box {
    position: relative;
    display: inline-flex;
    align-items: center;
  }
  .search-box svg { position: absolute; left: 10px; color: var(--text-muted); }
  .search-box input { padding-left: 32px; width: 220px; }

  /* EMPTY STATE */
  .empty-state {
    padding: 48px 24px;
    text-align: center;
    color: var(--text-muted);
  }
  .empty-state svg { margin: 0 auto 12px; display: block; opacity: 0.3; }
  .empty-state p { font-size: 13px; }

  /* PEDIDO EXAME - SPECIAL */
  .exam-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    background: var(--bg);
  }
  .exam-item-info { display: flex; flex-direction: column; gap: 2px; }
  .exam-item-name { font-size: 13px; font-weight: 500; }
  .exam-item-meta { font-size: 11px; color: var(--text-muted); }

  .section-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 10px;
    margin-top: 4px;
  }

  .divider { border: none; border-top: 1px solid var(--border); margin: 18px 0; }

  .info-row {
    display: flex; justify-content: space-between;
    padding: 7px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
  }
  .info-row:last-child { border-bottom: none; }
  .info-label { color: var(--text-muted); }
  .info-value { font-weight: 500; }

  /* Responsive */
  @media (max-width: 768px) {
    #sidebar { display: none; }
    #main { margin-left: 0; }
    .form-grid { grid-template-columns: 1fr; }
    .form-group.span-2, .form-group.span-3 { grid-column: span 1; }
  }
