:root {
  --blue: #08acda;
  --blue-dark: #078fb5;
  --ink: #181c48;
  --muted: #525252;
  --subtle: #8d8d8d;
  --canvas: #ffffff;
  --surface: #f4f4f4;
  --surface-2: #e0e0e0;
  --line: #e0e0e0;
  --success: #198038;
  --warning: #f1c21b;
  --danger: #da1e28;
  --info: #08acda;
  --sidebar: 256px;
}

* { box-sizing: border-box; }
html { font-family: "IBM Plex Sans", Arial, sans-serif; color: var(--ink); background: var(--canvas); }
body { margin: 0; min-height: 100vh; background: var(--surface); }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; background: var(--ink); color: #fff; display: flex; flex-direction: column; border-right: 1px solid rgba(255,255,255,.14); z-index: 20; }
.brand { min-height: 80px; padding: 16px 20px; display: flex; gap: 10px; align-items: center; border-bottom: 1px solid rgba(255,255,255,.14); }
.brand-logo-box { display: flex; align-items: center; background: #fff; padding: 8px 10px; flex: 0 0 auto; }
.brand-logo { display: block; width: 142px; max-width: 100%; height: auto; }
.brand small { display: block; color: #c6c6c6; font-size: 11px; line-height: 1.25; }
.brand-sidebar { min-height: 108px; flex-direction: column; align-items: flex-start; justify-content: center; }
.brand-sidebar .brand-logo-box { width: 100%; }
.brand-sidebar .brand-logo { width: 100%; }
.brand-login { padding: 0; border: 0; min-height: auto; flex-direction: column; align-items: flex-start; }
.brand-login .brand-logo-box { padding: 10px 14px; }
.brand-login .brand-logo { width: 190px; }
.brand-login small { margin-top: 6px; }
.main-nav { padding: 16px 0; flex: 1; }
.nav-link { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 20px; color: #c6c6c6; border-left: 3px solid transparent; }
.nav-link:hover { background: #262626; color: #fff; }
.nav-link.active { background: #262626; color: #fff; border-left-color: var(--blue); }
.nav-icon { width: 24px; color: #fff; text-align: center; }
.sidebar-user { display: grid; grid-template-columns: 36px 1fr 24px; gap: 10px; align-items: center; padding: 16px; border-top: 1px solid #393939; }
.sidebar-user strong, .sidebar-user small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user strong { font-size: 14px; font-weight: 500; }
.sidebar-user small { color: #c6c6c6; font-size: 12px; }
.avatar { width: 36px; height: 36px; display: grid; place-items: center; background: var(--blue); }
.logout-link { color: #c6c6c6; font-size: 20px; }

.main-content { min-width: 0; }
.topbar { min-height: 96px; padding: 20px 32px; display: flex; align-items: center; gap: 18px; justify-content: space-between; background: #fff; border-bottom: 1px solid var(--line); }
.topbar h1 { margin: 3px 0 0; font-weight: 300; font-size: 32px; line-height: 1.1; }
.eyebrow { display: block; color: var(--muted); font-size: 13px; letter-spacing: .16px; }
.eyebrow.inverse { color: #c6c6c6; }
.menu-button { display: none; border: 0; background: transparent; font-size: 24px; padding: 8px; }
.page-content { padding: 32px; max-width: 1584px; margin: 0 auto; }

.alert { padding: 14px 16px; margin-bottom: 20px; border-left: 4px solid; background: #fff; }
.alert-success { border-color: var(--success); }
.alert-warning { border-color: #b28600; }
.alert-danger { border-color: var(--danger); }
.auth-alert { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 100; min-width: 320px; }

.metrics-grid, .card-grid, .detail-grid, .dashboard-grid, .tabs-grid { display: grid; gap: 16px; }
.metrics-grid { margin-bottom: 24px; }
.metrics-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.metrics-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.metric-card { background: #fff; border: 1px solid var(--line); padding: 20px; min-height: 142px; display: flex; flex-direction: column; justify-content: space-between; }
.metric-card span { color: var(--muted); }
.metric-card strong { font-size: 42px; font-weight: 300; line-height: 1; }
.metric-card small { color: var(--subtle); }
.dashboard-grid { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); }
.tabs-grid { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); margin-top: 16px; }
.detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 16px; }
.detail-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.panel { background: #fff; border: 1px solid var(--line); padding: 24px; margin-bottom: 16px; }
.panel.compact { padding: 20px; }
.panel h3 { margin-top: 0; font-weight: 500; }
.table-panel { padding: 0; overflow: hidden; }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.section-heading h2 { margin: 0; font-size: 24px; font-weight: 400; }
.section-heading p { margin: 6px 0 0; color: var(--muted); }

.button { min-height: 42px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; border: 1px solid transparent; background: transparent; font-size: 14px; transition: .15s ease; }
.button.primary { background: var(--blue); color: #fff; }
.button.primary:hover { background: var(--blue-dark); }
.button.secondary { background: var(--ink); color: #fff; }
.button.tertiary { border-color: var(--blue); color: var(--blue); background: #fff; }
.button.ghost { color: var(--blue); }
.button.large { min-height: 50px; padding: 13px 20px; }
.button.small { min-height: 34px; padding: 6px 10px; }
.button.full { width: 100%; margin-top: 16px; }
.button-group { display: flex; gap: 8px; flex-wrap: wrap; }
.text-link { color: var(--blue); font-weight: 500; }

.search-bar { display: flex; gap: 8px; margin-bottom: 16px; }
.search-bar input { flex: 1; }
.search-bar.narrow { max-width: 520px; }

input, select, textarea { width: 100%; border: 0; border-bottom: 1px solid #8d8d8d; background: var(--surface); color: var(--ink); padding: 12px 14px; outline: none; min-height: 46px; border-radius: 0; }
input:focus, select:focus, textarea:focus { border-bottom: 2px solid var(--blue); }
textarea { resize: vertical; }
label { display: grid; gap: 7px; color: var(--muted); font-size: 14px; }
.form-panel { max-width: 960px; }
.form-grid { display: grid; gap: 18px 16px; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--line); }
.form-divider { border-top: 1px solid var(--line); margin: 28px 0 18px; padding-top: 20px; }
.form-divider h3 { margin: 0; }
.form-divider p { color: var(--muted); margin: 6px 0 0; }
.checkbox-label { display: flex; align-items: center; gap: 10px; min-height: 46px; }
.checkbox-label input { width: 18px; height: 18px; min-height: auto; }
.stack-form { display: grid; gap: 18px; margin-top: 28px; }

.data-table-wrap { width: 100%; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; min-width: 760px; }
.data-table th, .data-table td { padding: 15px 18px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.data-table th { background: var(--surface); color: var(--muted); font-size: 13px; font-weight: 500; }
.data-table td { font-size: 14px; }
.data-table td strong, .data-table td small { display: block; }
.data-table td small { color: var(--subtle); margin-top: 3px; }
.inline-form { display: flex; gap: 8px; align-items: center; }
.inline-form select { min-width: 150px; min-height: 36px; padding: 6px 10px; }

.list-table { display: grid; }
.list-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(150px, auto) auto; gap: 20px; align-items: center; padding: 16px 0; border-bottom: 1px solid var(--line); }
.list-row:first-child { padding-top: 0; }
.list-row:last-child { border-bottom: 0; padding-bottom: 0; }
.list-row strong, .list-row span { display: block; }
.list-row span { color: var(--muted); font-size: 14px; margin-top: 3px; }
.badge { display: inline-flex !important; width: fit-content; padding: 5px 8px; font-size: 12px !important; margin: 0 !important; background: var(--surface); color: var(--ink) !important; border-left: 3px solid; }
.badge.success { border-color: var(--success); }
.badge.warning { border-color: #b28600; }
.badge.danger { border-color: var(--danger); }
.badge.info { border-color: var(--info); }

.mini-list { display: grid; }
.mini-list > a, .mini-list > div { display: grid; grid-template-columns: 40px 1fr 16px; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.mini-list > a:last-child, .mini-list > div:last-child { border-bottom: 0; }
.mini-list strong, .mini-list small { display: block; }
.mini-list small { color: var(--muted); margin-top: 2px; }
.mini-list.static > div { grid-template-columns: 40px 1fr; }
.pet-avatar, .vaccine-icon { width: 40px; height: 40px; background: var(--surface); display: grid; place-items: center; color: var(--blue); font-weight: 600; border: 1px solid var(--line); }
.pet-avatar.large { width: 54px; height: 54px; font-size: 20px; }
.pet-avatar.xlarge { width: 76px; height: 76px; font-size: 28px; background: var(--blue); color: #fff; border: 0; }

.entity-card { min-height: 128px; background: #fff; border: 1px solid var(--line); padding: 20px; display: grid; grid-template-columns: 56px 1fr 18px; gap: 16px; align-items: center; }
.entity-card:hover { border-color: var(--blue); }
.entity-card h3 { margin: 0; font-weight: 500; }
.entity-card p { margin: 4px 0; color: var(--muted); }
.entity-card small { color: var(--subtle); }

.empty-state { min-height: 230px; display: grid; place-items: center; align-content: center; text-align: center; padding: 32px; }
.empty-state h2, .empty-state h3 { margin: 10px 0 6px; font-weight: 400; }
.empty-state p { max-width: 480px; color: var(--muted); margin: 0 0 18px; }
.empty-icon { font-size: 36px; color: var(--blue); }

.detail-list { margin: 0; }
.detail-list > div { padding: 10px 0; border-bottom: 1px solid var(--line); }
.detail-list > div:last-child { border-bottom: 0; }
.detail-list dt { color: var(--muted); font-size: 13px; }
.detail-list dd { margin: 4px 0 0; }
.long-text { color: var(--muted); line-height: 1.6; }
.pet-profile { display: flex; align-items: center; gap: 18px; }
.pet-profile h3 { margin: 4px 0; font-size: 22px; }
.pet-profile p { margin: 0; color: var(--muted); }
.timeline { border-left: 1px solid var(--line); margin-left: 8px; padding-left: 24px; }
.timeline article { position: relative; padding-bottom: 24px; }
.timeline article:last-child { padding-bottom: 0; }
.timeline-dot { position: absolute; left: -30px; top: 4px; width: 11px; height: 11px; background: var(--blue); }
.timeline small { color: var(--muted); }
.timeline h3 { margin: 6px 0; }
.timeline p { color: var(--muted); line-height: 1.55; }
.note-box { background: var(--surface); border-left: 3px solid var(--blue); padding: 12px 14px; margin-top: 10px; }

.auth-body { background: var(--ink); }
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: 1.1fr .9fr; }
.auth-intro { background: var(--ink); color: #fff; padding: 48px 64px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-intro .brand { padding: 0; border: 0; min-height: auto; }
.auth-intro h1 { font-size: clamp(42px, 5vw, 72px); line-height: 1.07; max-width: 760px; margin: 12px 0 24px; font-weight: 300; }
.auth-intro p { max-width: 620px; color: #c6c6c6; font-size: 18px; line-height: 1.55; }
.auth-intro > small { color: #8d8d8d; }
.auth-card { background: #fff; display: grid; place-items: center; padding: 32px; }
.auth-card-inner { width: 100%; max-width: 460px; }
.auth-card h2 { font-size: 42px; font-weight: 300; margin: 8px 0; }
.auth-card p { color: var(--muted); }

.install-body { background: var(--surface); }
.install-shell { max-width: 1040px; margin: 0 auto; padding: 48px 24px; }
.install-header { display: grid; grid-template-columns: 220px 1fr; gap: 28px; align-items: center; margin-bottom: 28px; }
.install-logo { background: #fff; border: 1px solid var(--line); padding: 16px; }
.install-logo img { display: block; width: 100%; height: auto; }
.install-header h1 { font-size: 42px; font-weight: 300; margin: 4px 0 8px; }
.install-header p { color: var(--muted); margin: 0; max-width: 720px; }
.install-grid { display: grid; gap: 16px; }
.panel-heading { display: flex; gap: 14px; margin-bottom: 22px; }
.panel-heading > span { width: 32px; height: 32px; display: grid; place-items: center; background: var(--blue); color: #fff; }
.panel-heading h2 { margin: 0; font-weight: 400; }
.panel-heading p { margin: 4px 0 0; color: var(--muted); }

@media (max-width: 1100px) {
  .metrics-grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card-grid.three, .detail-grid.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid, .tabs-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  :root { --sidebar: 280px; }
  .app-shell { display: block; }
  .sidebar { position: fixed; left: calc(-1 * var(--sidebar)); width: var(--sidebar); transition: left .2s ease; }
  .sidebar.open { left: 0; }
  .menu-button { display: block; }
  .topbar { padding: 16px; min-height: 80px; justify-content: flex-start; }
  .topbar h1 { font-size: 26px; }
  .topbar-actions { margin-left: auto; }
  .page-content { padding: 16px; }
  .metrics-grid.four, .metrics-grid.three, .card-grid.three, .detail-grid, .detail-grid.three { grid-template-columns: 1fr; }
  .form-grid.two { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 1; }
  .section-heading { flex-direction: column; }
  .section-heading .button, .section-heading .button-group { width: 100%; }
  .section-heading .button-group .button { flex: 1; }
  .list-row { grid-template-columns: 1fr auto; gap: 10px; }
  .list-row > div:nth-child(2) { grid-column: 1; }
  .search-bar { flex-wrap: wrap; }
  .search-bar input { flex-basis: 100%; }
  .auth-shell { grid-template-columns: 1fr; }
  .auth-intro { min-height: 42vh; padding: 28px 24px; }
  .auth-intro h1 { font-size: 40px; }
  .auth-intro > small { display: none; }
  .auth-card { padding: 40px 24px; }
  .install-shell { padding: 28px 16px; }
  .install-header { grid-template-columns: 1fr; }
  .install-logo { max-width: 220px; }
  .install-header h1 { font-size: 32px; }
}

/* Experiência mobile do tutor e do veterinário */
.mobile-bottom-nav, .mobile-only, .emergency-fab { display: none; }
.mobile-hero { min-height: 190px; margin-bottom: 18px; padding: 28px; background: var(--ink); color: #fff; display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; overflow: hidden; position: relative; }
.mobile-hero::after { content: ""; position: absolute; width: 240px; height: 240px; right: -90px; top: -110px; border: 1px solid rgba(255,255,255,.16); border-radius: 50%; }
.mobile-hero h2 { margin: 8px 0; max-width: 720px; font-size: clamp(30px, 4vw, 48px); font-weight: 300; line-height: 1.12; }
.mobile-hero p { margin: 0; color: #d8d8e6; font-size: 16px; }
.hero-mark { min-width: 64px; height: 64px; display: grid; place-items: center; background: var(--blue); color: #fff; font-size: 34px; font-weight: 300; position: relative; z-index: 1; }
.vet-hero { background: linear-gradient(135deg, var(--ink), #252b69); }
.tutor-hero { background: linear-gradient(135deg, var(--ink), #24285f); }

.quick-actions-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.quick-action { min-height: 150px; padding: 20px; background: #fff; border: 1px solid var(--line); display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; }
.quick-action:hover { border-color: var(--blue); }
.quick-action.primary-action { background: var(--blue); border-color: var(--blue); color: #fff; }
.quick-action strong { font-size: 17px; font-weight: 500; }
.quick-action small { color: var(--muted); line-height: 1.35; }
.quick-action.primary-action small { color: rgba(255,255,255,.86); }
.action-icon { width: 38px; height: 38px; display: grid; place-items: center; background: var(--surface); color: var(--blue); font-size: 21px; }
.primary-action .action-icon { background: rgba(255,255,255,.18); color: #fff; }

.emergency-card { min-height: 88px; display: grid; grid-template-columns: 46px 1fr 20px; align-items: center; gap: 14px; margin-bottom: 24px; padding: 16px 18px; background: #fff; border: 1px solid #f1b8bc; border-left: 5px solid var(--danger); }
.emergency-card:hover { background: #fff7f7; }
.emergency-card strong, .emergency-card small { display: block; }
.emergency-card small { margin-top: 4px; color: var(--muted); }
.emergency-card.unavailable { opacity: .72; }
.emergency-icon { width: 42px; height: 42px; display: grid; place-items: center; background: var(--danger); color: #fff; font-size: 22px; font-weight: 600; border-radius: 50%; }

.content-section { background: #fff; border: 1px solid var(--line); padding: 22px; margin-bottom: 18px; }
.soft-empty { display: grid; grid-template-columns: 46px 1fr auto; gap: 14px; align-items: center; padding: 18px; background: var(--surface); }
.soft-empty > span { width: 42px; height: 42px; display: grid; place-items: center; background: #fff; color: var(--blue); font-size: 22px; }
.soft-empty strong, .soft-empty small { display: block; }
.soft-empty small { color: var(--muted); margin-top: 4px; }

.appointment-cards, .consultation-stack, .history-stack, .document-grid, .agenda-card-list { display: grid; gap: 12px; }
.appointment-card { display: grid; grid-template-columns: 58px minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.appointment-card:last-child { border-bottom: 0; }
.date-block { width: 56px; min-height: 58px; display: grid; place-items: center; align-content: center; background: var(--surface); border-left: 3px solid var(--blue); }
.date-block strong { font-size: 22px; line-height: 1; font-weight: 500; }
.date-block small { margin-top: 5px; color: var(--muted); font-size: 11px; }
.appointment-main strong, .appointment-main span { display: block; }
.appointment-main span { margin-top: 5px; color: var(--muted); font-size: 14px; }

.pet-scroll { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; }
.pet-chip-card { min-width: 132px; padding: 16px; background: var(--surface); border: 1px solid var(--line); display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.pet-chip-card strong, .pet-chip-card small { display: block; }
.pet-chip-card small { color: var(--muted); }

.consultation-card { display: grid; grid-template-columns: 76px minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 18px; background: #fff; border: 1px solid var(--line); }
.consultation-card:hover { border-color: var(--blue); }
.consultation-time { align-self: stretch; display: flex; flex-direction: column; justify-content: center; border-right: 1px solid var(--line); }
.consultation-time strong { font-size: 24px; font-weight: 400; }
.consultation-time small { color: var(--muted); margin-top: 5px; }
.consultation-patient strong, .consultation-patient span, .consultation-patient small { display: block; }
.consultation-patient strong { font-size: 18px; }
.consultation-patient span { color: var(--muted); margin-top: 4px; }
.consultation-patient small { color: var(--subtle); margin-top: 6px; }
.consultation-patient .badge { margin-top: 9px !important; }
.consultation-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.consultation-price-form { flex-basis: 100%; display: flex; justify-content: flex-end; align-items: flex-end; gap: 8px; margin-bottom: 2px; }
.consultation-price-form label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; text-align: left; }
.currency-input { min-width: 152px; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; background: #fff; border: 1px solid var(--line); }
.currency-input:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(8, 172, 218, .12); }
.currency-input > span { padding-left: 11px; color: var(--muted); font-size: 13px; }
.currency-input input { width: 112px; min-height: 36px; padding: 8px 10px 8px 6px; border: 0; box-shadow: none; }
.currency-input input:focus { box-shadow: none; }

.date-filter-card { max-width: 520px; display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: end; padding: 14px; margin-bottom: 16px; background: #fff; border: 1px solid var(--line); }
.patient-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.patient-card { min-height: 126px; padding: 18px; background: #fff; border: 1px solid var(--line); display: grid; grid-template-columns: 56px minmax(0, 1fr) 18px; gap: 14px; align-items: center; }
.patient-card:hover { border-color: var(--blue); }
.patient-card h3 { margin: 0; font-weight: 500; }
.patient-card p { margin: 4px 0; color: var(--muted); }
.patient-card small { color: var(--subtle); }

.history-card { background: #fff; border: 1px solid var(--line); padding: 20px; }
.history-card header { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.history-card h3 { margin: 5px 0 0; font-weight: 500; }
.history-icon { width: 36px; height: 36px; display: grid; place-items: center; background: var(--blue); color: #fff; }
.history-field { padding-top: 15px; }
.history-field strong { font-size: 14px; }
.history-field p { margin: 6px 0 0; color: var(--muted); line-height: 1.55; }
.history-card footer { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }

.document-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.document-card { min-height: 130px; display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 14px; align-items: center; background: #fff; border: 1px solid var(--line); padding: 18px; }
.document-card:hover { border-color: var(--blue); }
.document-icon { width: 44px; height: 44px; display: grid; place-items: center; background: var(--surface); color: var(--blue); font-size: 21px; }
.document-card h3 { margin: 4px 0; font-weight: 500; }
.document-card p { margin: 0; color: var(--muted); }
.document-card small { display: block; margin-top: 7px; color: var(--subtle); }
.compact-documents { grid-template-columns: 1fr; }
.upload-field small { color: var(--subtle); }

.agenda-card { display: grid; grid-template-columns: 58px minmax(0, 1fr); gap: 14px; background: #fff; border: 1px solid var(--line); padding: 16px; }
.agenda-card-main h3 { margin: 4px 0; font-weight: 500; }
.agenda-card-main p { margin: 0 0 8px; color: var(--muted); }
.agenda-card-actions { grid-column: 1 / -1; display: flex; gap: 8px; justify-content: flex-end; padding-top: 12px; border-top: 1px solid var(--line); }

@media (max-width: 1100px) {
  .quick-actions-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .patient-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .document-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  body.role-tutor, body.role-vet { background: #f5f6fa; }
  body.role-tutor .page-content, body.role-vet .page-content { padding: 14px 14px calc(94px + env(safe-area-inset-bottom)); }
  body.role-tutor .topbar, body.role-vet .topbar { min-height: 70px; padding: 12px 14px; position: sticky; top: 0; z-index: 12; }
  body.role-tutor .topbar h1, body.role-vet .topbar h1 { font-size: 22px; }
  body.role-tutor .topbar .eyebrow, body.role-vet .topbar .eyebrow { font-size: 11px; }
  body.role-tutor .menu-button, body.role-vet .menu-button { display: block; }

  .desktop-only { display: none !important; }
  .mobile-only { display: grid; }
  .mobile-hero { min-height: 162px; margin: -14px -14px 14px; padding: 22px 18px; align-items: flex-end; }
  .mobile-hero h2 { font-size: 28px; }
  .mobile-hero p { font-size: 14px; max-width: 270px; }
  .hero-mark { width: 50px; min-width: 50px; height: 50px; font-size: 26px; }

  .quick-actions-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .quick-action { min-height: 142px; padding: 15px; }
  .quick-action strong { font-size: 15px; }
  .quick-action small { font-size: 12px; }
  .action-icon { width: 34px; height: 34px; }

  .content-section { padding: 16px; margin-bottom: 12px; }
  .content-section .section-heading { flex-direction: row; align-items: center; }
  .content-section .section-heading h2 { font-size: 19px; }
  .content-section .section-heading p { font-size: 13px; }
  .content-section .section-heading .text-link { width: auto; white-space: nowrap; }
  .emergency-card { grid-template-columns: 44px 1fr 16px; padding: 14px; margin-bottom: 14px; }

  .appointment-card { grid-template-columns: 52px minmax(0, 1fr); }
  .appointment-card > .badge { grid-column: 2; }
  .date-block { width: 50px; min-height: 54px; }
  .soft-empty { grid-template-columns: 42px 1fr; }
  .soft-empty .button { grid-column: 1 / -1; width: 100%; }

  .consultation-card, .consultation-card.detailed { grid-template-columns: 64px minmax(0, 1fr); padding: 14px; gap: 12px; }
  .consultation-time strong { font-size: 21px; }
  .consultation-actions { grid-column: 1 / -1; justify-content: stretch; padding-top: 12px; border-top: 1px solid var(--line); }
  .consultation-actions .button { flex: 1; }
  .consultation-price-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; }
  .consultation-price-form label, .currency-input { width: 100%; }
  .currency-input input { width: 100%; }
  .patient-grid { grid-template-columns: 1fr; }
  .patient-card { min-height: 108px; padding: 14px; }
  .date-filter-card { grid-template-columns: 1fr; max-width: none; }
  .date-filter-card .button { width: 100%; }

  .history-card { padding: 16px; }
  .document-card { min-height: 116px; grid-template-columns: 42px minmax(0, 1fr); padding: 14px; }
  .document-card > .button, .document-card > .badge { grid-column: 2; justify-self: start; }
  .document-icon { width: 40px; height: 40px; }
  .mobile-form { padding: 16px; }
  .mobile-form .form-actions { position: sticky; bottom: 74px; margin: 20px -16px -16px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: #fff; box-shadow: 0 -1px 0 var(--line); z-index: 4; }
  .mobile-form .form-actions .button { flex: 1; }

  .mobile-bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; min-height: 68px; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: #fff; border-top: 1px solid var(--line); }
  .mobile-nav-link { min-width: 0; min-height: 54px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); border-top: 2px solid transparent; }
  .mobile-nav-link > span { font-size: 21px; line-height: 1; }
  .mobile-nav-link small { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }
  .mobile-nav-link.active { color: var(--blue); border-top-color: var(--blue); }

  .emergency-fab { position: fixed; right: 14px; bottom: calc(78px + env(safe-area-inset-bottom)); z-index: 31; min-height: 48px; padding: 8px 14px 8px 8px; display: flex; align-items: center; gap: 8px; background: var(--danger); color: #fff; box-shadow: 0 8px 24px rgba(91,15,22,.25); }
  .emergency-fab span { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; background: rgba(255,255,255,.18); font-weight: 600; }
  .emergency-fab strong { font-size: 13px; }

  .role-vet .mobile-bottom-nav { grid-template-columns: repeat(5, minmax(0, 1fr)); grid-auto-flow: unset; }
  .role-vet .mobile-nav-link small { font-size: 9px; }
}

@media (max-width: 390px) {
  .quick-action { min-height: 132px; padding: 13px; }
  .quick-action strong { font-size: 14px; }
  .mobile-hero h2 { font-size: 25px; }
  .emergency-fab strong { display: none; }
  .emergency-fab { padding-right: 8px; }
}


/* Font Awesome */
.nav-icon i, .mobile-nav-link i, .action-icon i, .document-icon i,
.emergency-icon i, .history-icon i, .vaccine-icon i, .empty-icon i,
.hero-mark i, .menu-button i, .logout-link i, .emergency-fab i {
  line-height: 1;
}
.button i { margin-right: 8px; }
.mobile-nav-link > span { display: grid; place-items: center; min-height: 24px; }
.mobile-nav-link i { font-size: 18px; }
.nav-icon { display: grid; place-items: center; width: 24px; }
.emergency-fab i { font-size: 18px; }


/* Busca automática de CEP */
.field-status { display: block; margin-top: 6px; color: var(--subtle); font-size: 12px; line-height: 1.35; }
.field-status.loading { color: var(--blue); }
.field-status.success { color: var(--success); }
.field-status.error { color: var(--danger); }
input[aria-busy="true"] { background-image: linear-gradient(90deg, transparent, rgba(15,98,254,.08), transparent); background-size: 200% 100%; animation: cep-loading 1.2s linear infinite; }
@keyframes cep-loading { from { background-position: 200% 0; } to { background-position: -200% 0; } }
