﻿:root {
  --navy: #08213d;
  --ink: #0a1a2f;
  --muted: #607086;
  --line: #dce6ef;
  --blue: #0f72e5;
  --teal: #0ca7a0;
  --green: #12a66b;
  --orange: #f08a00;
  --red: #ef4657;
  --purple: #7b61ff;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: #eef5f7; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid rgba(12, 167, 160, .28); outline-offset: 2px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 278px minmax(0, 1fr); }
.sidebar {
  min-height: 100vh;
  padding: 22px 14px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  color: #f2fbff;
  background: radial-gradient(circle at 18% 0%, rgba(46, 215, 197, .28), transparent 28%), linear-gradient(180deg, #0b3156, #08213d 68%, #031426);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 0 6px 8px; }
.brand-mark { width: 46px; height: 46px; border-radius: 999px; display: grid; place-items: center; color: #06233f; background: linear-gradient(135deg, #2ed7c5, #57e6a7); font-size: 25px; font-weight: 950; }
.brand strong { font-size: 31px; color: #f2fbff; }
.clinic-select { border: 1px solid rgba(226, 241, 255, .22); border-radius: 8px; padding: 11px 12px; display: grid; gap: 8px; background: rgba(255, 255, 255, .06); }
.clinic-select span { font-size: 13px; font-weight: 800; }
.clinic-select select { border: 0; outline: 0; color: #dceeff; background: transparent; }
.nav { display: grid; gap: 7px; }
.nav-item, .sub-nav { min-height: 44px; border: 0; border-radius: 8px; padding: 0 14px; display: flex; align-items: center; gap: 12px; color: #c7d7e7; background: transparent; font-weight: 740; text-align: left; }
.nav-item i { width: 24px; height: 24px; border: 1px solid rgba(220, 238, 255, .38); border-radius: 7px; display: grid; place-items: center; color: #9ddbd5; font-size: 10px; font-style: normal; }
.nav-item b { margin-left: auto; min-width: 28px; height: 23px; border-radius: 999px; display: grid; place-items: center; background: #0f72e5; color: white; font-size: 12px; }
.nav-item.active, .nav-item:hover { color: white; background: linear-gradient(135deg, #11b6a9, #0f72e5); }
.sub-nav { margin-left: 42px; min-height: 30px; border-left: 1px solid rgba(220, 238, 255, .25); color: #bfd2e5; }
.sub-nav.active { color: #2ed7c5; }
.summary-card, .user-card { border: 1px solid rgba(226, 241, 255, .2); border-radius: 8px; background: rgba(255, 255, 255, .06); }
.summary-card { margin-top: auto; padding: 16px; }
.summary-card p { margin: 0 0 8px; }
.summary-card strong { display: block; font-size: 30px; }
.summary-card small { color: #afc2d5; }
.spark { height: 58px; margin: 10px 0; border-radius: 8px; background: linear-gradient(135deg, transparent, rgba(46, 215, 197, .22)), repeating-linear-gradient(135deg, #2ed7c5 0 3px, transparent 3px 22px); }
.target { height: 8px; border-radius: 999px; background: rgba(255, 255, 255, .18); overflow: hidden; }
.target i { display: block; height: 100%; background: linear-gradient(90deg, #0f72e5, #2ed7c5); }
.summary-card button { width: 100%; height: 40px; margin-top: 14px; border: 1px solid #2ed7c5; border-radius: 8px; color: #e8f7ff; background: transparent; }
.user-card { display: flex; gap: 12px; align-items: center; padding: 12px; }
.user-card span { width: 42px; height: 42px; border-radius: 999px; display: inline-grid; place-items: center; color: #06233f; background: #d8f4f1; font-weight: 900; }
.user-card small { display: block; color: #bdd0e6; }

.workspace { min-width: 0; overflow-x: auto; }
.topbar { min-height: 76px; padding: 15px 24px; display: flex; align-items: center; gap: 16px; border-bottom: 1px solid var(--line); background: rgba(255, 255, 255, .97); position: sticky; top: 0; z-index: 20; }
.title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.demo-badge { border: 1px solid rgba(12, 167, 160, .22); border-radius: 999px; padding: 5px 10px; color: #087d76; background: #e5fbf7; font-size: 11px; font-weight: 900; letter-spacing: .04em; text-transform: uppercase; }
.demo-strip { margin: 14px 24px 0; border: 1px solid rgba(12, 167, 160, .2); border-radius: 8px; padding: 12px 14px; color: #075f59; background: linear-gradient(135deg, #e5fbf7, #f7fffd); font-weight: 750; }
.topbar h1 { margin: 0; font-size: 25px; }
.topbar p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.top-select { margin-left: auto; }
.top-select select, .date-btn, .icon-btn { height: 40px; border: 1px solid #cbd8e5; border-radius: 8px; background: #fff; color: var(--ink); }
.top-select select { min-width: 190px; padding: 0 12px; }
.date-btn { padding: 0 18px; }
.icon-btn { width: 42px; font-weight: 850; }
.alert { color: var(--red); }
.view { display: none; padding: 20px 24px; }
.view.active { display: block; }
.panel, .kpi-card, .flow-section, .metric-card { border: 1px solid var(--line); border-radius: 8px; background: rgba(255, 255, 255, .98); box-shadow: 0 14px 32px rgba(25, 46, 72, .06); }
.panel { padding: 16px; min-width: 0; }
.panel h2 { margin: 0 0 14px; font-size: 16px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.panel-head h2 { margin: 0 0 14px; }
.panel-head button { height: 30px; border: 1px solid #d5e3ef; border-radius: 7px; color: var(--blue); background: #fff; font-size: 12px; }

.kpi-grid { display: grid; grid-template-columns: repeat(5, minmax(170px, 1fr)); gap: 14px; }
.kpi-card { min-height: 98px; padding: 15px; display: flex; align-items: center; gap: 16px; }
.kpi-icon { width: 64px; height: 64px; border-radius: 15px; display: grid; place-items: center; color: #fff; font-size: 24px; font-weight: 950; }
.blue { background: linear-gradient(135deg, #1786ff, #045fd0); }
.green { background: linear-gradient(135deg, #33c388, #078a5b); }
.teal { background: linear-gradient(135deg, #28cec5, #088f87); }
.orange { background: linear-gradient(135deg, #ffbc55, #f08a00); }
.red { background: linear-gradient(135deg, #ff7d88, #ef4657); }
.kpi-card p { margin: 0; color: var(--muted); font-weight: 760; }
.kpi-card strong { display: block; color: var(--ink); font-size: 32px; line-height: 1.1; margin: 4px 0; }
.kpi-card small { color: var(--muted); font-size: 12px; }

.dashboard-grid { margin-top: 14px; display: grid; grid-template-columns: 1.35fr .95fr 1.1fr 1.25fr; gap: 14px; }
.lab-panel, .whatsapp-panel, .stock-panel, .revenue-panel { min-height: 270px; }
.timeline-list { display: grid; gap: 10px; }
.timeline-list article { min-height: 62px; display: grid; grid-template-columns: 46px 44px 1fr auto; gap: 10px; align-items: center; border: 1px solid #e7eef5; border-radius: 8px; padding: 8px; }
.timeline-list b { color: var(--muted); font-size: 12px; }
.timeline-list strong { display: block; font-size: 15px; }
.timeline-list small { display: block; color: var(--muted); }
.timeline-list em, .fleet-grid em { padding: 5px 8px; border-radius: 7px; font-style: normal; font-size: 11px; }
.pet-avatar { width: 40px; height: 40px; border-radius: 999px; display: block; background: radial-gradient(circle at 40% 34%, #fff 0 4px, transparent 5px), linear-gradient(135deg, #c99058, #f1d1a6); }
.pet-avatar.cat { background: radial-gradient(circle at 40% 34%, #fff 0 4px, transparent 5px), linear-gradient(135deg, #718092, #d9e0e8); }
.pet-avatar.dog2 { background: radial-gradient(circle at 40% 34%, #fff 0 4px, transparent 5px), linear-gradient(135deg, #b17245, #e9c096); }
.pet-avatar.gray { background: radial-gradient(circle at 40% 34%, #fff 0 4px, transparent 5px), linear-gradient(135deg, #9ea8b3, #d8dee5); }
.pet-avatar.black { background: radial-gradient(circle at 40% 34%, #fff 0 4px, transparent 5px), linear-gradient(135deg, #233040, #b48155); }
.doctor-card { border: 1px solid #e7eef5; border-radius: 8px; padding: 12px; margin-bottom: 10px; }
.doctor-card span { float: left; width: 42px; height: 42px; margin-right: 10px; border-radius: 999px; display: grid; place-items: center; background: #d8f4f1; color: #06303a; font-weight: 900; }
.doctor-card strong, .doctor-card small, .doctor-card em { display: block; }
.doctor-card small, .doctor-card em { color: var(--muted); font-size: 12px; }
.doctor-card div { clear: both; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; text-align: center; }
.doctor-card b { font-size: 18px; }
.funnel { display: grid; gap: 3px; padding: 15px 28px; text-align: center; color: #fff; font-size: 19px; font-weight: 850; }
.funnel i { height: 62px; display: grid; place-items: center; background: linear-gradient(135deg, #1786ff, #045fd0); clip-path: polygon(0 0, 100% 0, 86% 100%, 14% 100%); font-style: normal; }
.funnel i:nth-child(2) { margin: 0 18px; background: linear-gradient(135deg, #20c8d8, #07a899); }
.funnel i:nth-child(3) { margin: 0 36px; background: linear-gradient(135deg, #33c388, #078a5b); }
.funnel i:nth-child(4) { margin: 0 54px; background: linear-gradient(135deg, #ffb43f, #ff8b00); }
.funnel-panel p { display: flex; justify-content: space-between; margin: 10px 0; color: var(--muted); }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th, td { padding: 10px 8px; border-bottom: 1px solid #ebf1f6; text-align: left; vertical-align: middle; }
th { color: var(--muted); font-weight: 780; }
td small { color: var(--muted); }
.tag { padding: 4px 8px; border-radius: 7px; font-size: 11px; white-space: nowrap; }
.green-tag { color: #087545; background: #dff8e9; }
.blue-tag { color: #0a5fca; background: #e2efff; }
.orange-tag { color: #b45700; background: #fff0df; }
.red-tag { color: #d82929; background: #ffe5e5; }
.purple-tag { color: #6d35c9; background: #eee7ff; }
.link-btn { width: 100%; height: 34px; border: 0; margin-top: 10px; color: var(--blue); background: transparent; font-weight: 800; }
.whatsapp-panel h2 b { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 999px; background: #dff8e9; color: #087545; font-size: 12px; }
.revenue-panel svg { width: 100%; height: 150px; }
.revenue-panel polyline { fill: none; stroke: var(--teal); stroke-width: 4; }
.revenue-panel polygon { fill: rgba(12, 167, 160, .11); }
.revenue-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.revenue-summary span { border: 1px solid #e7eef5; border-radius: 8px; padding: 12px; color: var(--muted); }
.revenue-summary b { display: block; color: var(--ink); font-size: 18px; margin-top: 4px; }

.exam-layout { display: grid; grid-template-columns: 318px minmax(600px, 1fr) 318px; gap: 14px; }
.patient-list-panel, .exam-main, .exam-side { border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.patient-list-panel { padding: 14px; }
.search-box { height: 42px; border: 1px solid var(--line); border-radius: 8px; display: grid; grid-template-columns: 1fr 58px; align-items: center; overflow: hidden; }
.search-box input { border: 0; outline: 0; padding-left: 12px; }
.search-box span { height: 100%; display: grid; place-items: center; color: var(--muted); border-left: 1px solid var(--line); font-size: 12px; }
.patient-list { display: grid; gap: 10px; margin-top: 18px; }
.patient-card { min-height: 116px; border: 1px solid var(--line); border-radius: 8px; padding: 13px; display: grid; grid-template-columns: 1fr auto; gap: 6px; background: #fff; text-align: left; }
.patient-card.active { border-color: var(--blue); background: #f3f8ff; }
.patient-card span, .patient-card small, .patient-card b { grid-column: 1 / -1; }
.patient-card span { font-size: 17px; font-weight: 850; }
.patient-card b, .patient-card small { color: var(--muted); font-weight: 500; }
.patient-card em { padding: 4px 8px; border-radius: 7px; color: #0a5fca; background: #e2efff; font-style: normal; font-size: 11px; }
.green-status { color: #087545 !important; background: #dff8e9 !important; }
.orange-status { color: #b45700 !important; background: #fff0df !important; }
.red-status { color: #d82929 !important; background: #ffe5e5 !important; }
.new-patient { width: 100%; height: 50px; margin-top: 14px; border: 1px solid var(--line); border-radius: 8px; color: #334155; background: #fff; }
.exam-head { min-height: 76px; padding: 14px 18px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); }
.exam-head h1 { margin: 0; font-size: 25px; }
.exam-head small { color: var(--muted); }
.exam-head button { margin-left: auto; height: 40px; border: 1px solid #ccd8e5; border-radius: 8px; background: #fff; padding: 0 14px; }
.exam-head button + button { margin-left: 0; }
.green-btn { color: #fff !important; border: 0 !important; background: var(--green) !important; }
.blue-btn { color: #fff !important; border: 0 !important; background: var(--blue) !important; }
.exam-grid { padding: 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.patient-profile { grid-column: 1 / -1; display: flex; gap: 18px; align-items: center; background: #f6fffc; border-color: #bfece1; }
.profile-avatar { width: 64px; height: 64px; border-radius: 999px; display: grid; place-items: center; color: #06303a; background: #2ed7c5; font-size: 31px; font-weight: 900; }
.patient-profile h2 { margin: 0 0 8px; font-size: 25px; }
.patient-profile p { margin: 5px 0; color: var(--muted); }
.info-card p { color: var(--muted); }
.info-card b, .info-card span { display: block; color: var(--ink); margin-top: 6px; }
.treatment-card, .history-card { grid-column: 1 / -1; }
.history-card ol { margin: 0; padding-left: 28px; border-left: 2px dashed #9dddd2; }
.history-card li { margin-bottom: 18px; }
.history-card b, .history-card small { display: block; }
.history-card b { color: var(--ink); }
.history-card small { color: var(--muted); }
.exam-side { padding: 12px; display: grid; gap: 12px; align-content: start; }
.chat { min-height: 224px; padding: 18px; border-radius: 8px; background: #f5efe9; }
.chat p { width: fit-content; max-width: 88%; padding: 12px 14px; border-radius: 8px; background: #fff; line-height: 1.45; }
.chat small { display: block; margin-top: 8px; color: var(--muted); text-align: right; }
.outgoing { margin-left: auto; background: #dcf8c6 !important; }
.payment-card p { display: flex; justify-content: space-between; color: var(--muted); }
.payment-card div { border: 1px solid #bfece1; border-radius: 8px; padding: 14px; background: #f6fffc; }
.payment-card small { display: block; color: var(--muted); }
.payment-card strong { display: block; color: var(--blue); font-size: 32px; margin-top: 8px; }
.payment-card button { width: 100%; height: 48px; margin-top: 12px; border: 1px solid #ffc174; border-radius: 8px; color: #b45700; background: #fff7ea; font-weight: 850; }

.automation-layout { display: grid; grid-template-columns: minmax(870px, 1fr) 356px; gap: 14px; }
.flow-section { padding: 14px; }
.rule-head { min-height: 64px; margin-bottom: 12px; display: flex; align-items: center; gap: 12px; }
.rule-head div { margin-right: auto; }
.rule-head h1 { margin: 0 0 8px; font-size: 20px; }
.rule-head h2 { margin: 0; font-size: 18px; }
.rule-head h2 span { margin-left: 12px; padding: 4px 10px; border-radius: 999px; color: #087545; background: #dff8e9; font-size: 12px; }
.rule-head button { height: 38px; min-width: 92px; border: 1px solid #ccd8e5; border-radius: 8px; background: #fff; }
.publish-btn { color: #fff !important; border: 0 !important; background: linear-gradient(135deg, #0bb58a, #079c8f) !important; }
.flow-canvas { height: 558px; border: 1px solid var(--line); border-radius: 8px; position: relative; overflow: hidden; background-image: radial-gradient(#dce7ef 1px, transparent 1px); background-size: 14px 14px; }
.flow-canvas:before { content: ""; position: absolute; left: 155px; right: 110px; top: 118px; height: 2px; background: #0b2447; }
.flow-canvas:after { content: ""; position: absolute; left: 230px; right: 80px; top: 318px; height: 2px; background: #0b2447; }
.toolbox { position: absolute; left: 10px; top: 10px; width: 42px; display: grid; gap: 6px; padding: 6px; border: 1px solid var(--line); border-radius: 8px; background: #fff; z-index: 2; }
.toolbox button { height: 30px; border: 0; background: transparent; font-size: 10px; }
.node { position: absolute; min-width: 118px; min-height: 72px; border: 1px solid #91d8bd; border-radius: 8px; padding: 10px; display: grid; place-items: center; background: #f8fffc; color: #172033; font-weight: 800; text-align: center; box-shadow: 0 10px 24px rgba(14, 42, 70, .06); }
.node.blue { border-color: #7eb6f4; background: #f4f9ff; }
.node.purple { border-color: #b5a4f5; background: #fbf8ff; }
.node.green { border-color: #8bd8bd; background: #f6fffb; }
.node.orange { border-color: #ffc174; background: #fffaf2; }
.node.red { border-color: #ff9d9d; background: #fff8f8; }
.decision { min-width: 92px; min-height: 92px; transform: rotate(45deg); border-color: #ffa826; color: #b45700; background: #fffaf0; }
.decision span { transform: rotate(-45deg); display: block; }
.decision:hover { transform: rotate(45deg) translateY(-2px); }
.n1 { left: 48px; top: 82px; }
.n2 { left: 230px; top: 82px; }
.n3 { left: 450px; top: 82px; }
.d1 { left: 660px; top: 72px; }
.n4 { right: 70px; top: 84px; }
.n5 { right: 70px; top: 230px; }
.n6 { left: 180px; top: 280px; }
.n7 { left: 430px; top: 280px; }
.n8 { right: 70px; top: 280px; }
.n9 { left: 180px; top: 430px; }
.n10 { left: 430px; top: 430px; }
.n11 { right: 70px; top: 430px; }
.automation-side { display: grid; gap: 12px; align-content: start; }
.preview-message { border: 1px solid var(--line); border-radius: 8px; padding: 14px; color: #334155; background: #dcf8c6; line-height: 1.45; }
.preview-message small { display: block; margin-top: 8px; color: var(--muted); text-align: right; }
.variables p { display: grid; grid-template-columns: 1fr 1fr; padding: 8px 0; margin: 0; border-bottom: 1px solid #edf2f7; color: var(--teal); font-weight: 850; }
.variables span { color: var(--muted); font-weight: 500; }
.failed-wa h2 b { float: right; width: 26px; height: 26px; border-radius: 999px; display: inline-grid; place-items: center; color: var(--red); background: #ffe2e2; font-size: 12px; }
.automation-bottom { margin-top: 14px; display: grid; grid-template-columns: repeat(4, 1fr) 1.5fr; gap: 12px; }
.metric-card { min-height: 118px; padding: 16px; }
.metric-card small, .metric-card span { color: var(--muted); }
.metric-card strong { display: block; margin: 10px 0; font-size: 34px; }
.warning-card p { color: var(--muted); line-height: 1.45; }
.warning-card button { height: 40px; border: 0; border-radius: 8px; color: #fff; background: var(--blue); font-weight: 820; }

.selected { outline: 2px solid rgba(15, 116, 232, .34) !important; outline-offset: -2px; }
tbody tr, .kpi-card, .node, .metric-card, .doctor-card { cursor: pointer; }
tbody tr:hover, .kpi-card:hover, .node:hover, .metric-card:hover, .doctor-card:hover, .patient-card:hover { outline: 2px solid rgba(8, 168, 153, .22); outline-offset: -2px; }
.toast { position: fixed; right: 22px; bottom: 22px; padding: 14px 18px; border-radius: 8px; color: #fff; background: #061f3f; box-shadow: 0 18px 36px rgba(0,0,0,.22); opacity: 0; transform: translateY(18px); pointer-events: none; transition: .2s; z-index: 50; }
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 1350px) {
  .app-shell { grid-template-columns: 230px 1fr; }
  .kpi-grid, .dashboard-grid, .exam-layout, .automation-layout, .automation-bottom { grid-template-columns: 1fr; }
  .flow-canvas { min-width: 980px; }
}

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { min-height: auto; }
  .topbar { flex-wrap: wrap; }
  .top-select { margin-left: 0; width: 100%; }
  .top-select select { width: 100%; }
  .exam-grid, .revenue-summary { grid-template-columns: 1fr; }
  .patient-profile, .treatment-card, .history-card { grid-column: auto; }
}
