:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --surface-tint: #eff6ff;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --text: #1c2830;
  --text-muted: #64727a;
  --text-soft: #7a878c;
  --accent: #2563eb;
  --accent-strong: #1d4ed8;
  --accent-soft: #eff6ff;
  --accent-border: #bfdbfe;
  --info: #315f7d;
  --info-soft: #eff6ff;
  --success: #2563eb;
  --success-soft: #eff6ff;
  --warning: #846324;
  --warning-soft: #fbf3df;
  --danger: #b84a4a;
  --shadow: 0 8px 28px rgba(15, 23, 42, 0.06);
  font-family: "Pretendard", "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", Inter, "Segoe UI", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.55;
}

body {
  margin: 0;
  background: var(--bg);
}

.vet-head {
  min-height: 64px;
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.02);
}

.site-logo {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  text-decoration: none;
  line-height: 1;
}

.site-logo img {
  display: block;
  width: 170px;
  height: 38px;
  object-fit: contain;
}

.vet-head strong {
  color: var(--accent-strong);
  font-size: 21px;
  letter-spacing: 0;
}

.vet-head span {
  margin-left: 10px;
  color: var(--text-muted);
}

.vet-head nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

a,
button {
  font: inherit;
}

a,
.download-link {
  color: var(--accent-strong);
  text-decoration: none;
}

a:hover,
.download-link:hover {
  color: #1f4d49;
  text-decoration: underline;
}

.primary.small,
.ghost.small {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  border-radius: 6px;
  padding: 0 12px;
  font-weight: 650;
  line-height: 1.35;
  text-decoration: none;
}

.primary.small {
  color: #ffffff;
  background: var(--accent-strong);
}

.ghost.small {
  color: var(--accent-strong);
  border: 1px solid var(--line-strong);
  background: var(--surface);
}

button {
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  min-height: 38px;
  padding: 0 14px;
  cursor: pointer;
  color: var(--text);
}

button:hover {
  border-color: var(--accent-border);
  background: var(--surface-tint);
}

.notice-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-color: var(--accent-border);
  font-weight: 700;
}

.notice-button b {
  min-width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  color: #ffffff;
  background: var(--accent);
  border-radius: 999px;
  font-size: 12px;
}

.notice-button b[hidden] {
  display: none;
}

.inbox-link {
  min-height: 38px;
  padding: 0 14px;
  text-decoration: none;
}

main {
  width: min(1500px, calc(100% - 44px));
  margin: 30px auto 44px;
}

.hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.compact-hero {
  align-items: center;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-strong);
  font-weight: 700;
  font-size: 13px;
}

h1 {
  margin: 0;
  color: #16232b;
  font-size: clamp(30px, 3.2vw, 42px);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: 0;
}

h2 {
  margin: 0 0 18px;
  color: #1b2a32;
  font-size: 19px;
  line-height: 1.35;
  letter-spacing: 0;
}

.hero p:last-child {
  margin: 12px 0 0;
  color: var(--text-muted);
}

.status-badge,
.notice {
  border-radius: 8px;
  padding: 12px 14px;
  background: var(--warning-soft);
  border: 1px solid #e9d49f;
  color: var(--warning);
  font-weight: 700;
}

.status-badge.verified {
  color: var(--success);
  background: var(--success-soft);
  border-color: #b8d3c3;
}

.notice {
  margin-top: 22px;
  font-weight: 500;
}

.followup-notice-panel {
  margin-top: 22px;
}

.metrics {
  margin: 24px 0;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
}

.metric,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metric {
  padding: 17px 18px;
}

.metric span {
  display: block;
  color: var(--text-muted);
  font-size: 13px;
}

.metric strong {
  display: block;
  margin-top: 8px;
  color: #1a262d;
  font-size: 26px;
  line-height: 1.1;
}

.workspace-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.patient-timeline-panel {
  margin-bottom: 16px;
}

.timeline-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  align-items: center;
}

.timeline-tools input,
.timeline-tools select {
  min-height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 8px 11px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.timeline-tools input:focus,
.timeline-tools select:focus,
.quick-action-panel input:focus,
.quick-action-panel textarea:focus,
.guidance-field textarea:focus {
  outline: 3px solid rgba(47, 111, 104, 0.16);
  outline-offset: 1px;
  border-color: var(--accent);
}

.timeline-tools input {
  width: min(360px, 42vw);
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
}

.today-table-scroll {
  max-height: 430px;
  overflow: auto;
  border-bottom: 1px solid var(--line);
}

.patient-timeline-table {
  width: 100%;
  min-width: 920px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14.5px;
}

.patient-timeline-table th:nth-child(1),
.patient-timeline-table td:nth-child(1) {
  width: 210px;
}

.patient-timeline-table th:nth-child(2),
.patient-timeline-table td:nth-child(2) {
  width: 150px;
}

.patient-timeline-table th:nth-child(3),
.patient-timeline-table td:nth-child(3) {
  width: 230px;
  white-space: nowrap;
}

.patient-timeline-table th:nth-child(4),
.patient-timeline-table td:nth-child(4),
.patient-timeline-table th:nth-child(5),
.patient-timeline-table td:nth-child(5) {
  width: 160px;
  white-space: nowrap;
}

.patient-timeline-table th,
.patient-timeline-table td {
  border-bottom: 1px solid var(--line);
  padding: 13px 12px;
  text-align: left;
  vertical-align: top;
}

.patient-timeline-table tbody tr:nth-child(even) {
  background: #fbfcfc;
}

.patient-timeline-table tbody tr:hover {
  background: #f1f6f5;
}

.patient-timeline-table tbody tr[data-patient-row-key] {
  cursor: pointer;
}

.patient-timeline-table tbody tr[data-patient-row-key]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.patient-timeline-table tbody tr.is-selected {
  background: #eff6ff;
  box-shadow: inset 3px 0 0 var(--accent);
}

.patient-timeline-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: #203947;
  background: var(--info-soft);
  font-weight: 800;
}

.past-timeline-details {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.past-timeline-details summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 46px;
  padding: 0 14px;
  cursor: pointer;
  font-weight: 900;
}

.past-timeline-details summary b {
  min-width: 48px;
  border-radius: 999px;
  padding: 5px 10px;
  color: var(--accent-strong);
  background: var(--accent-soft);
  text-align: center;
  font-size: 12px;
}

.past-timeline-details > .empty {
  margin: 0;
  padding: 0 14px 12px;
}

.past-timeline-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: end;
  padding: 0 14px 12px;
}

.past-timeline-search {
  flex: 1 0 100%;
}

.past-timeline-tools label {
  display: grid;
  gap: 4px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}

.past-timeline-tools select,
.past-timeline-tools input {
  box-sizing: border-box;
  width: 100%;
  min-height: 34px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 0 10px;
  background: #fff;
  color: #0f172a;
  font-size: 13px;
}

.past-timeline-tools > select {
  flex: 0 0 136px;
}

.past-timeline-tools > label:not(.past-timeline-search) {
  flex: 0 0 150px;
}

.past-timeline-tools button {
  flex: 0 0 74px;
  min-height: 34px;
  padding-inline: 8px;
  white-space: nowrap;
}

.patient-history-panel {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  overflow: hidden;
}

.patient-history-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  background: #fbfdff;
}

.patient-history-title h3 {
  margin: 0;
  color: #0f172a;
  font-size: 16px;
}

.patient-history-title span {
  display: block;
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 13px;
}

.patient-history-title b {
  min-width: 52px;
  border-radius: 999px;
  padding: 5px 10px;
  color: var(--accent-strong);
  background: var(--accent-soft);
  text-align: center;
  font-size: 12px;
}

.patient-history-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: end;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.patient-history-tools[hidden] {
  display: none !important;
}

.patient-history-tools label {
  display: grid;
  gap: 4px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}

.patient-history-tools select,
.patient-history-tools input {
  box-sizing: border-box;
  width: 100%;
  min-height: 34px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 0 10px;
  background: #fff;
  color: #0f172a;
  font-size: 13px;
}

.patient-history-tools > select {
  flex: 0 0 128px;
}

.patient-history-tools > label {
  flex: 0 0 150px;
}

.patient-history-tools button {
  flex: 0 0 74px;
  min-height: 34px;
  padding-inline: 8px;
  white-space: nowrap;
}

.patient-history-table {
  min-width: 820px;
}

.patient-history-table th:nth-child(1),
.patient-history-table td:nth-child(1) {
  width: 132px;
}

.patient-history-table th:nth-child(2),
.patient-history-table td:nth-child(2) {
  width: 72px;
}

.patient-history-table th:nth-child(4),
.patient-history-table td:nth-child(4) {
  width: 88px;
}

.patient-history-table th:nth-child(3),
.patient-history-table td:nth-child(3) {
  width: auto;
  white-space: normal;
}

.patient-history-table td:nth-child(3) .ghost.small,
.patient-history-table td:nth-child(3) .primary.small {
  display: inline-flex;
  justify-content: flex-start;
  width: min(100%, 420px);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timeline-patient-link {
  display: grid;
  gap: 3px;
  width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.timeline-patient-link:hover strong,
.timeline-patient-link:focus-visible strong {
  color: var(--accent-strong);
  text-decoration: underline;
}

.prescription-summary-panel .case-list {
  max-height: 260px;
  overflow: auto;
}

.table-scroll,
.prescription-summary-panel .case-list,
.timeline-modal-body {
  scrollbar-color: #98a7a7 #eef3f2;
  scrollbar-width: thin;
}

.table-scroll::-webkit-scrollbar,
.prescription-summary-panel .case-list::-webkit-scrollbar,
.timeline-modal-body::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.table-scroll::-webkit-scrollbar-track,
.prescription-summary-panel .case-list::-webkit-scrollbar-track,
.timeline-modal-body::-webkit-scrollbar-track {
  background: #eef3f2;
}

.table-scroll::-webkit-scrollbar-thumb,
.prescription-summary-panel .case-list::-webkit-scrollbar-thumb,
.timeline-modal-body::-webkit-scrollbar-thumb {
  border: 2px solid #eef3f2;
  border-radius: 999px;
  background: #98a7a7;
}

.patient-timeline-table td:first-child {
  white-space: nowrap;
  color: var(--text-muted);
}

.patient-timeline-table td strong,
.patient-timeline-table td span {
  display: block;
}

.patient-timeline-table td span {
  margin-top: 4px;
  color: var(--text-muted);
}

.timeline-link-stack {
  display: grid;
  gap: 6px;
}

.timeline-link {
  width: 100%;
  min-height: 32px;
  padding: 6px 8px;
  border-color: var(--line-strong);
  background: var(--surface);
  color: var(--accent-strong);
  text-align: left;
  font-size: 13px;
  font-weight: 700;
}

.timeline-link.is-new {
  border-color: var(--accent-border);
  background: var(--accent-soft);
}

.timeline-new-badge {
  display: inline-flex;
  align-items: center;
  margin-right: 6px;
  border-radius: 999px;
  padding: 2px 7px;
  background: var(--danger);
  color: #ffffff;
  font-size: 10px;
  font-weight: 900;
}

.timeline-link:hover {
  border-color: var(--accent-border);
  background: var(--surface-tint);
}

.timeline-link.grouped {
  border-color: var(--accent-border);
  background: var(--accent-soft);
}

.timeline-group-list {
  display: grid;
  gap: 10px;
}

.timeline-group-item {
  width: 100%;
  text-align: left;
}

.empty-cell {
  color: #9aa5a0;
}

.panel {
  padding: 22px;
}

.panel.wide {
  grid-column: span 2;
}

.panel-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.panel-title h2 {
  margin: 0;
}

.panel-title span {
  color: var(--text-muted);
  font-size: 13px;
  text-align: right;
}

.stack-form {
  display: grid;
  gap: 12px;
}

.stack-form label {
  display: grid;
  gap: 6px;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.stack-form input,
.stack-form textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

.stack-form input:disabled,
.stack-form textarea:disabled {
  background: #f1f5f9;
  color: #64748b;
  cursor: not-allowed;
}

.compact-form .form-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 4px;
}

.stack-form textarea {
  resize: vertical;
}

.stack-form button {
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 10px 14px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

.stack-form button.btn-outline {
  border-color: var(--line);
  background: #fff;
  color: var(--accent-strong);
}

.stack-form button.profile-edit-button,
.stack-form button.profile-save-button {
  min-width: 108px;
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.16);
}

.stack-form button.profile-edit-button {
  border-color: var(--accent);
  background: #eff6ff;
  color: var(--accent-strong);
}

.stack-form button.profile-save-button {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.stack-form.is-editing {
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  padding: 12px;
  background: #f8fbff;
}

.stack-form button.danger {
  border-color: #dc2626;
  background: #dc2626;
}

.stack-form button:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.stack-form .check-row {
  grid-template-columns: 18px 1fr;
  align-items: start;
  font-weight: 600;
}

.stack-form .check-row input {
  width: 16px;
  height: 16px;
  margin-top: 2px;
}

.form-status {
  min-height: 18px;
  margin: 0;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 700;
}

.form-status.error {
  color: #b91c1c;
}

.danger-panel {
  border-color: #fecaca;
}

.muted {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
}

dl {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 10px 16px;
  margin: 0;
}

dt {
  color: var(--text-muted);
}

dd {
  margin: 0;
  font-weight: 700;
}

.list,
.case-list {
  display: grid;
  gap: 10px;
}

.item,
.case-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
}

button.item {
  width: 100%;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

button.item:hover,
button.item:focus-visible {
  border-color: var(--accent-border);
  background: var(--surface-tint);
}

button.item.active {
  border-color: var(--accent-strong);
  background: var(--accent-soft);
  box-shadow: inset 3px 0 0 var(--accent-strong);
}

.invite-detail-panel {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.invite-detail-panel[hidden] {
  display: none;
}

.invite-detail {
  display: grid;
  gap: 12px;
}

.compact-title {
  align-items: center;
}

.compact-title h3 {
  margin: 0;
  color: var(--text);
  font-size: 17px;
  line-height: 1.35;
}

.compact-title div > span {
  display: block;
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 13px;
  text-align: left;
}

.icon-close-button {
  width: 34px;
  min-height: 34px;
  padding: 0;
  border-radius: 999px;
  color: var(--text-muted);
  background: var(--surface);
  font-size: 20px;
  line-height: 1;
}

.icon-close-button:hover,
.icon-close-button:focus-visible {
  color: var(--text);
  border-color: var(--line-strong);
  background: var(--surface-tint);
}

.compact-grid div {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
}

.compact-grid b {
  color: var(--accent-strong);
  font-size: 13px;
}

.compact-grid span {
  color: var(--text);
}

.case-button {
  width: 100%;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.case-button:hover,
.case-button.active {
  border-color: var(--accent-border);
  background: var(--surface-tint);
}

.item span,
.case-item span,
.empty {
  color: var(--text-muted);
}

.case-item strong,
.case-item span {
  display: block;
}

.case-item .meta-row {
  margin-top: 6px;
  color: var(--info);
  font-weight: 700;
}

.vet-message-panel {
  display: none;
}

.vet-message-panel .case-list {
  gap: 8px;
}

.message-preview {
  min-height: 72px;
  padding: 12px 14px;
  color: inherit;
  text-decoration: none;
}

.message-preview strong {
  margin-top: 5px;
}

.message-preview span {
  margin-top: 4px;
}

.message-preview.unread {
  border-color: var(--accent-border);
  background: var(--accent-soft);
}

.message-more-link {
  display: inline-flex;
  width: fit-content;
  margin-top: 4px;
  color: var(--accent-strong);
  font-weight: 800;
  text-decoration: none;
}

.message-more-link:hover {
  text-decoration: underline;
}

.chip {
  display: inline-block;
  width: fit-content;
  margin-bottom: 6px;
  padding: 3px 9px;
  color: #0f6a3f;
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.actions {
  display: grid;
  gap: 10px;
}

.actions button {
  min-height: 44px;
  color: #ffffff;
  border: 0;
  background: var(--accent-strong);
  font-weight: 650;
  line-height: 1.35;
}

.actions button:hover,
.management-actions button:hover,
.case-item button:hover,
.download-link:hover,
.primary.small:hover {
  color: #ffffff;
  background: var(--accent-strong);
  text-decoration: none;
}

.quick-action-panel {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.quick-action-panel form {
  display: grid;
  gap: 10px;
}

.quick-action-panel h3 {
  margin: 0;
}

.quick-action-panel label {
  display: grid;
  gap: 6px;
  color: var(--text);
  font-size: 14px;
}

.quick-action-panel input,
.quick-action-panel textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 9px 10px;
  font: inherit;
  box-sizing: border-box;
}

.two-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.case-item button,
.download-link {
  align-self: center;
  border-radius: 6px;
  padding: 9px 13px;
  white-space: nowrap;
  color: #ffffff;
  background: var(--accent-strong);
  border: 0;
  font-weight: 650;
  line-height: 1.35;
}

.management-toolbar {
  margin: 24px 0 16px;
}

.management-toolbar .timeline-tools {
  justify-content: flex-start;
}

.management-toolbar .timeline-tools input {
  width: min(520px, 100%);
}

.management-list {
  gap: 12px;
}

.management-loading {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 78px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
  color: var(--text-muted);
  font-weight: 700;
}

.management-spinner {
  width: 22px;
  height: 22px;
  border: 3px solid #d8e6e3;
  border-top-color: var(--accent-strong);
  border-radius: 999px;
  animation: management-spin 0.8s linear infinite;
}

.management-progress {
  position: relative;
  overflow: hidden;
  height: 4px;
  margin-top: 10px;
  border-radius: 999px;
  background: #e1ebe8;
}

.management-progress::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 38%;
  border-radius: inherit;
  background: var(--accent-strong);
  animation: management-progress 1.1s ease-in-out infinite;
}

@keyframes management-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes management-progress {
  0% {
    transform: translateX(-110%);
  }
  100% {
    transform: translateX(265%);
  }
}

.management-item {
  align-items: center;
}

.management-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.management-actions button {
  min-height: 36px;
  color: #ffffff;
  background: var(--accent-strong);
  border: 0;
  font-weight: 650;
  line-height: 1.35;
}

.management-actions button.flow-busy {
  color: #ffffff;
  background: #c98512;
}

.management-actions button.flow-done {
  color: #ffffff;
  background: #17884a;
}

.management-actions button.flow-error {
  color: #ffffff;
  background: #c2413a;
}

.selected-prescription-panel {
  display: grid;
  gap: 18px;
}

.selected-prescription-panel[hidden] {
  display: none;
}

.selected-prescription-panel .detail-grid > div {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
}

.selected-prescription-panel .detail-grid b {
  color: var(--accent-strong);
  font-size: 13px;
}

.selected-prescription-panel .detail-grid span {
  color: var(--text);
  line-height: 1.45;
}

.ingredient-photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 18px;
  align-items: start;
}

.ingredient-photo-grid figure {
  margin: 0;
  display: grid;
  justify-items: center;
  gap: 8px;
  text-align: center;
}

.ingredient-photo-grid img {
  width: 74px;
  height: 74px;
  border-radius: 999px;
  object-fit: cover;
  background: #f4f8f7;
  box-shadow: 0 8px 18px rgba(22, 44, 40, 0.08);
}

.ingredient-photo-grid figcaption {
  display: grid;
  gap: 3px;
  font-size: 13px;
}

.ingredient-photo-grid b {
  color: var(--text);
  line-height: 1.35;
}

.ingredient-photo-grid a {
  color: var(--accent-strong);
  font-weight: 700;
  text-decoration: none;
}

.daily-feed-card {
  margin: 10px 0 18px;
  padding: 18px;
  border-radius: 8px;
  background: var(--surface-soft);
  text-align: center;
}

.daily-feed-card strong {
  display: block;
  color: var(--accent-strong);
}

.daily-feed-card b {
  display: block;
  margin-top: 8px;
  font-size: 18px;
}

.daily-feed-card p {
  margin: 10px 0 0;
  color: var(--text-muted);
  font-size: 13px;
}

.macro-stack {
  display: flex;
  width: 100%;
  height: 74px;
  overflow: hidden;
  margin: 10px 0 12px;
  background: #eef2f7;
}

.macro-stack span {
  display: grid;
  place-items: center;
  min-width: 28px;
  flex: 0 0 auto;
  color: #0f172a;
  font-size: 13px;
  font-weight: 800;
}

.macro-legend,
.nutrient-status-legend {
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  color: var(--text-muted);
  font-size: 12px;
}

.macro-legend span,
.nutrient-status-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.macro-legend i,
.nutrient-status-legend i {
  display: inline-block;
  width: 22px;
  height: 9px;
}

.macro-caption {
  margin: 0 0 18px;
  text-align: center;
  font-size: 14px;
}

.nutrient-comparison {
  margin-top: 20px;
}

.nutrient-comparison-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 28px;
  margin-top: 14px;
}

.nutrient-comparison-grid h5 {
  margin: 0 0 12px;
  color: var(--accent-strong);
  font-size: 15px;
}

.nutrient-table {
  display: grid;
  gap: 8px;
}

.nutrient-row {
  display: grid;
  grid-template-columns: minmax(92px, 130px) minmax(120px, 1fr) minmax(78px, max-content);
  gap: 12px;
  align-items: center;
  font-size: 13px;
}

.nutrient-row span {
  min-width: 0;
  line-height: 1.35;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.nutrient-row > div {
  height: 8px;
  border-radius: 999px;
  background: #e2e6ea;
  overflow: hidden;
}

.nutrient-row i {
  display: block;
  height: 100%;
  border-radius: 999px;
}

.nutrient-row b {
  text-align: right;
  white-space: nowrap;
  font-size: 12px;
}

.nutrient-status-low {
  background: #e98989;
}

.nutrient-status-ok {
  background: #60a5fa;
}

.nutrient-status-high {
  background: #f0b429;
}

.nutrient-status-unknown {
  background: #9aa6b2;
}

.selected-prescription-panel ol {
  line-height: 1.65;
}

.detail-actions {
  justify-content: flex-end;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.case-detail-panel {
  margin-top: 14px;
  padding: 18px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
}

.followup-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 14px 0;
}

.followup-detail-grid div,
.followup-summary {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
}

.followup-detail-grid span {
  display: block;
  color: var(--text-muted);
  font-size: 13px;
}

.followup-detail-grid strong {
  display: block;
  margin-top: 4px;
}

.followup-prescription-preview {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.followup-prescription-preview > p {
  margin: 0 0 14px;
  color: var(--text-muted);
}

.followup-prescription-block + .followup-prescription-block {
  margin-top: 18px;
}

.followup-prescription-block > strong {
  display: block;
  margin-bottom: 10px;
}

.followup-macro-stack {
  height: 52px;
  border-radius: 8px;
}

.followup-prescription-preview .macro-caption {
  margin: 8px 0 0;
  color: var(--text);
  font-size: 13px;
  text-align: center;
}

.warning-list {
  margin: 8px 0 0;
  color: var(--warning);
}

.detail-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.detail-head h3 {
  margin: 4px 0 0;
  font-size: 20px;
}

.detail-head span {
  color: var(--accent-strong);
  font-weight: 700;
}

.detail-head a {
  color: #ffffff;
  background: var(--accent-strong);
  border-radius: 6px;
  padding: 9px 12px;
  text-decoration: none;
  font-weight: 650;
  line-height: 1.35;
  white-space: nowrap;
}

.detail-grid,
.detail-ingredient-grid,
.nutrient-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.case-detail-panel section {
  margin-top: 16px;
}

.case-detail-panel h4 {
  margin: 0 0 10px;
}

.detail-ingredient,
.nutrient-grid div {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
}

.nutrient-grid span,
.detail-ingredient span {
  color: var(--text-muted);
  font-size: 13px;
}

.case-detail-panel ol {
  margin: 0;
  padding-left: 20px;
}

.case-detail-panel li + li {
  margin-top: 7px;
}

.timeline-modal[hidden] {
  display: none;
}

.timeline-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  padding: 24px;
}

.timeline-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(21, 32, 38, 0.46);
}

.timeline-modal-card {
  position: relative;
  z-index: 1;
  width: min(980px, 100%);
  max-height: min(860px, calc(100vh - 48px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 22px 80px rgba(21, 32, 38, 0.22);
}

.timeline-modal-card header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px;
  border-bottom: 1px solid var(--line);
}

.timeline-modal-card header span {
  color: var(--accent-strong);
  font-weight: 800;
  font-size: 13px;
}

.timeline-modal-card header h2 {
  margin-top: 4px;
}

.timeline-modal-card header button {
  width: 38px;
  min-height: 38px;
  padding: 0;
  border-radius: 999px;
  font-size: 22px;
}

.timeline-modal-body {
  overflow: auto;
  padding: 22px;
}

.course-guidance-card {
  width: min(720px, 100%);
}

.patient-registration-card {
  width: min(1040px, calc(100vw - 32px));
}

.registration-description {
  margin: 0 0 14px;
  color: var(--text-muted);
}

.patient-registration-form {
  display: grid;
  gap: 12px;
}

.patient-registration-form *,
.patient-registration-form *::before,
.patient-registration-form *::after {
  box-sizing: border-box;
}

.registration-grid {
  display: grid;
  gap: 10px;
  align-items: start;
}

.registration-grid.three {
  grid-template-columns: repeat(3, minmax(180px, 1fr));
}

.registration-grid.five {
  grid-template-columns: repeat(5, minmax(110px, 1fr));
}

.registration-grid.pet-basic-grid {
  grid-template-columns: minmax(150px, 1fr) 96px minmax(190px, 1.25fr) 110px;
}

.registration-grid.condition-grid {
  grid-template-columns: 130px 130px minmax(280px, 1fr);
}

.patient-registration-form label {
  display: grid;
  gap: 6px;
  align-content: start;
  margin: 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
}

.patient-registration-form input,
.patient-registration-form select {
  width: 100%;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background-color: #ffffff;
  color: var(--text);
  font: inherit;
  font-weight: 650;
}

.patient-registration-form select {
  appearance: none;
  padding-right: 32px;
}

.patient-registration-form select[data-supplement-select] {
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='7' viewBox='0 0 10 7' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.25 5 5.25 9 1.25' fill='none' stroke='%2354656e' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-position: calc(100% - 14px) 50%;
  background-repeat: no-repeat;
  background-size: 10px 7px;
}

.patient-registration-form .birth-input-row {
  display: grid;
  grid-template-columns: minmax(72px, 1fr) minmax(78px, max-content);
  gap: 6px;
}

.patient-registration-form .birth-input-row input,
.patient-registration-form .birth-input-row select {
  min-width: 0;
  padding-left: 8px;
  padding-right: 8px;
}

.patient-registration-form .birth-input-row select {
  padding-right: 28px;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='7' viewBox='0 0 10 7' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.25 5 5.25 9 1.25' fill='none' stroke='%2354656e' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-position: calc(100% - 10px) 50%;
  background-repeat: no-repeat;
  background-size: 10px 7px;
}

.multi-select-field {
  min-width: 0;
}

.select-field,
.selectable-input-field,
.multi-select-box {
  position: relative;
}

.select-field::after,
.selectable-input-field::after,
.multi-select-box::after {
  content: "";
  position: absolute;
  right: 14px;
  top: 50%;
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid #54656e;
  pointer-events: none;
}

.select-field::after,
.selectable-input-field::after {
  transform: translateY(4px);
}

.multi-select-box::after {
  transform: translateY(-50%);
}

.selectable-input-field input,
.multi-select-box input {
  padding-right: 32px;
}

.multi-select-box input {
  min-width: 100%;
}

.autocomplete-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 20;
  display: grid;
  max-height: 190px;
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.14);
}

.autocomplete-menu[hidden] {
  display: none;
}

.autocomplete-menu button {
  min-height: 34px;
  padding: 0 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 750;
  text-align: left;
}

.autocomplete-menu button:hover,
.autocomplete-menu button:focus {
  background: var(--accent-soft);
}

.autocomplete-empty {
  padding: 10px 12px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.45;
}

.multi-selected-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 28px;
}

.multi-selected-tags span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 5px 8px;
  border: 1px solid var(--accent-border);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
}

.multi-selected-tags button {
  min-height: 0;
  width: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  line-height: 1;
}

.registration-actions {
  justify-content: flex-start;
}

.invite-result {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--text-muted);
}

.invite-result strong,
.invite-result span {
  display: block;
}

.invite-result strong {
  color: var(--text);
}

.invite-result label {
  display: grid;
  gap: 6px;
  margin-top: 10px;
  font-weight: 800;
}

.invite-result input {
  width: 100%;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
}

.invite-result.error {
  border-color: #efb6b6;
  background: #fff3f3;
  color: var(--danger);
}

.guidance-description {
  margin: 0 0 14px;
  color: var(--text-muted);
  line-height: 1.65;
}

.guidance-field {
  display: grid;
  gap: 8px;
  color: var(--text);
  font-weight: 800;
}

.guidance-field textarea {
  width: 100%;
  min-height: 220px;
  box-sizing: border-box;
  padding: 14px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  line-height: 1.65;
  resize: vertical;
}

.guidance-actions {
  justify-content: flex-end;
}

.modal-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0;
}

.timeline-pdf-frame {
  width: 100%;
  min-height: min(680px, 66vh);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.record-analysis-status {
  margin: 12px 0;
}

.record-analysis-result {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface-soft);
}

.record-analysis-result h4,
.record-analysis-result p {
  margin: 0;
}

@media (max-width: 780px) {
  .vet-head,
  .hero {
    display: grid;
  }

  .metrics,
  .workspace-grid {
    grid-template-columns: 1fr;
  }

  .registration-grid.three,
  .registration-grid.five,
  .registration-grid.pet-basic-grid,
  .registration-grid.condition-grid {
    grid-template-columns: 1fr;
  }

  .panel.wide {
    grid-column: auto;
  }

  dl {
    grid-template-columns: 1fr;
  }

  .two-fields {
    grid-template-columns: 1fr;
  }

  .detail-grid,
  .detail-ingredient-grid,
  .nutrient-grid {
    grid-template-columns: 1fr;
  }

  .detail-head {
    display: grid;
  }

  .timeline-modal {
    padding: 12px;
  }
}

/* Vet home reference layout */
body {
  background: #f8fafc;
  color: #0f172a;
  font-size: 14px;
}

.vet-head {
  position: sticky;
  top: 0;
  z-index: 100;
  min-height: 56px;
  padding: 0 24px;
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  box-shadow: none;
}

.vet-head strong {
  color: #2563eb;
  font-size: 18px;
}

.vet-head nav {
  align-items: center;
  gap: 16px;
}

.vet-head nav a,
.vet-head nav button {
  box-sizing: border-box;
  min-height: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 2px;
  border: 0;
  background: transparent;
  color: #64748b;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
}

.vet-head nav a[aria-current="page"] {
  color: #2563eb;
  font-weight: 800;
}

.vet-head nav button:hover,
.vet-head nav a:hover {
  color: #2563eb;
  background: transparent;
  text-decoration: none;
}

.vet-head nav .notice-button {
  gap: 8px;
  padding: 0 12px;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  font-weight: 800;
}

.vet-head nav .notice-button:hover {
  border-color: #93c5fd;
  background: #dbeafe;
}

.vet-head nav .notice-button b {
  min-width: 20px;
  height: 20px;
  background: #2563eb;
  font-size: 11px;
}

.vet-home-container {
  width: min(1840px, calc(100% - 20px));
  margin: 18px auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.hospital-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 20px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
  color: #1e40af;
}

.hospital-banner strong,
.hospital-banner span {
  display: inline;
}

.hospital-banner strong {
  margin-right: 8px;
  font-size: 15px;
}

.home-subtitle,
#verificationBadge {
  display: none;
}

.primary.small {
  min-height: 36px;
  padding: 0 16px;
  border-radius: 6px;
  background: #2563eb;
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
}

.ghost.small {
  min-height: 34px;
  padding: 0 12px;
  border-color: #cbd5e1;
  color: #334155;
  font-size: 13px;
  font-weight: 700;
}

.metrics {
  margin: 0;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.metric,
.panel {
  border-color: #e2e8f0;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: none;
}

.metric {
  padding: 20px;
}

.metric span {
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
}

.metric strong {
  margin-top: 6px;
  color: #0f172a;
  font-size: 28px;
  font-weight: 800;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(520px, var(--timeline-list-width, 1fr)) 10px minmax(420px, 1fr);
  gap: 10px;
  align-items: start;
  min-width: 0;
}

.timeline-split-handle {
  position: sticky;
  top: 82px;
  align-self: stretch;
  min-height: 360px;
  border-radius: 999px;
  cursor: col-resize;
  background: linear-gradient(90deg, transparent 0 3px, #cbd5e1 3px 7px, transparent 7px 10px);
  opacity: 0.75;
}

.timeline-split-handle:hover,
.timeline-split-handle:focus-visible,
body.timeline-resizing .timeline-split-handle {
  background: linear-gradient(90deg, transparent 0 3px, #2563eb 3px 7px, transparent 7px 10px);
  outline: none;
  opacity: 1;
}

.patient-timeline-panel,
.patient-history-panel,
.vet-message-panel,
.secondary-workspace-grid .panel {
  padding: 20px;
}

.patient-timeline-panel {
  margin-bottom: 0;
  min-width: 520px;
  overflow: visible;
}

.patient-history-panel {
  position: sticky;
  top: 82px;
  min-width: 420px;
  max-height: calc(100dvh - 104px);
  overflow: auto;
}

.panel-title {
  align-items: center;
  margin-bottom: 16px;
}

.patient-timeline-panel .panel-title {
  align-items: flex-start;
  flex-wrap: wrap;
}

.patient-timeline-panel .panel-title > div:first-child {
  flex: 1 1 220px;
  min-width: 220px;
}

.panel-title h2 {
  color: #0f172a;
  font-size: 16px;
  white-space: nowrap;
}

.panel-title span {
  color: #64748b;
  text-align: left;
  word-break: keep-all;
}

.timeline-tools {
  flex: 1 1 360px;
  flex-wrap: nowrap;
  justify-content: flex-end;
  min-width: 0;
}

.timeline-tools input,
.timeline-tools select {
  min-height: 36px;
  border-color: #cbd5e1;
  border-radius: 6px;
  font-size: 13px;
}

.timeline-tools input {
  width: min(230px, 22vw);
}

.timeline-tools #openPatientRegistrationModal {
  min-width: 130px;
  padding-inline: 16px;
}

.today-table-scroll {
  max-height: none;
  overflow-x: auto;
  overflow-y: visible;
  border-bottom: 0;
}

.patient-timeline-table {
  min-width: 0;
  border-collapse: collapse;
  border-spacing: 0;
  font-size: 13px;
}

.patient-history-panel .table-scroll {
  overflow-x: auto;
}

.patient-history-table {
  width: 100%;
  min-width: 760px;
  table-layout: fixed;
}

.patient-history-table th:nth-child(1),
.patient-history-table td:nth-child(1) {
  width: 116px;
}

.patient-history-table th:nth-child(2),
.patient-history-table td:nth-child(2) {
  width: 72px;
}

.patient-history-table th:nth-child(4),
.patient-history-table td:nth-child(4) {
  width: 112px;
}

.patient-history-table th:nth-child(3),
.patient-history-table td:nth-child(3) {
  width: auto;
  min-width: 260px;
}

.patient-timeline-table th,
.patient-timeline-table td {
  padding: 12px;
  border-bottom: 1px solid #f1f5f9;
}

.patient-timeline-table th {
  background: #f8fafc;
  color: #64748b;
  font-weight: 700;
}

.patient-timeline-table td:nth-child(1),
.patient-timeline-table th:nth-child(1),
.patient-timeline-table td:nth-child(2),
.patient-timeline-table th:nth-child(2),
.patient-timeline-table td:nth-child(3),
.patient-timeline-table th:nth-child(3),
.patient-timeline-table td:nth-child(4),
.patient-timeline-table th:nth-child(4),
.patient-timeline-table td:nth-child(5),
.patient-timeline-table th:nth-child(5) {
  width: auto;
  white-space: normal;
}

.patient-history-table th:nth-child(1),
.patient-history-table td:nth-child(1) {
  width: 116px;
}

.patient-history-table th:nth-child(2),
.patient-history-table td:nth-child(2) {
  width: 72px;
}

.patient-history-table th:nth-child(4),
.patient-history-table td:nth-child(4) {
  width: 112px;
}

.patient-history-table th:nth-child(3),
.patient-history-table td:nth-child(3) {
  width: auto;
  min-width: 260px;
}

.timeline-date {
  display: block;
  margin-top: 3px;
  color: #64748b;
  font-size: 12px;
  font-weight: 500;
}

.timeline-link {
  max-width: 100%;
  min-height: 30px;
  padding: 0 10px;
  border-color: #cbd5e1;
  border-radius: 6px;
  background: #ffffff;
  color: #334155;
  font-size: 12px;
  font-weight: 700;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: left;
}

.timeline-link.is-new,
.timeline-link:hover {
  border-color: #2563eb;
  background: #eff6ff;
  color: #1d4ed8;
}

.timeline-pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 0 0;
  color: #475569;
  font-size: 13px;
  font-weight: 800;
}

.timeline-pager-sticky {
  position: sticky;
  top: 56px;
  z-index: 90;
  margin: -4px -2px 8px;
  padding: 8px 2px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.05);
}

.patient-timeline-panel .patient-timeline-table th {
  position: static;
  top: auto;
  z-index: auto;
}

.timeline-pager button {
  min-height: 32px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #ffffff;
  color: #1d4ed8;
  padding: 0 12px;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.timeline-pager button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.vet-message-panel {
  display: flex;
}

.vet-message-panel[hidden] {
  display: none;
}

.message-preview {
  min-height: 86px;
  border-color: #e2e8f0;
  background: #fafafa;
}

.message-preview.unread {
  border-color: #bfdbfe;
  background: #eff6ff;
}

.chip {
  color: #1d4ed8;
  background: #eff6ff;
  border-color: #bfdbfe;
}

.secondary-workspace-grid {
  grid-template-columns: minmax(0, 1fr);
}

@media (max-width: 980px) {
  .content-grid,
  .secondary-workspace-grid,
  .metrics {
    grid-template-columns: 1fr;
  }

  .timeline-tools {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .timeline-tools input {
    width: 100%;
  }

  .timeline-split-handle {
    display: none;
  }

  .patient-history-panel {
    position: static;
    min-width: 0;
    max-height: none;
  }

  .patient-timeline-panel {
    min-width: 0;
  }
}

@media (max-width: 780px) {
  .vet-home-container {
    width: min(100% - 20px, 1840px);
  }

  .hospital-banner,
  .vet-head {
    display: grid;
  }

}

.ai-agent-page {
  display: grid;
  gap: 18px;
}

.ai-agent-page .ai-agent-hero {
  margin-bottom: 0;
}

.assistant-overview {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.assistant-overview article {
  display: grid;
  gap: 8px;
  min-height: 104px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.assistant-overview strong {
  color: var(--accent-strong);
  font-size: 16px;
  font-weight: 900;
}

.assistant-overview span {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.55;
}

.ai-command-panel,
.ai-result-main,
.ai-draft-panel {
  padding: 22px;
}

.ai-command-panel,
.ai-result-main,
.ai-work-plan,
.ai-work-items,
.ai-actions,
.ai-item-list,
.ai-draft-list,
#aiActionList {
  display: grid;
  gap: 12px;
}

/* ---------------------------------------------------------------- 컴포저
 * 입력창 하나에 첨부·음성·전송을 모두 담는다. 이전에는 텍스트영역과 버튼이
 * 격자로 나뉘어 있었고 첨부와 음성이 없었다. */
.ai-composer {
  display: grid;
  gap: 8px;
}

.composer-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 26px;
  background: var(--surface);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.composer-shell:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.ai-composer textarea {
  width: 100%;
  min-width: 0;
  min-height: 26px;
  max-height: 220px;
  padding: 8px 2px;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  line-height: 1.55;
  resize: none;
  overflow-y: auto;
}

.ai-composer textarea:focus {
  outline: none;
}

.ai-composer textarea.is-example-value {
  color: #64748b;
}

.composer-tools {
  display: flex;
  align-items: center;
  gap: 6px;
}

.composer-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.composer-icon svg {
  width: 20px;
  height: 20px;
}

.composer-icon:hover:not(:disabled) {
  background: var(--surface-tint);
  color: var(--accent-strong);
}

.composer-icon:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* 녹음 중에는 색과 맥박으로 상태를 분명히 한다. 녹음이 도는 줄 모르는 것이
   이 UI에서 가장 위험한 오해다. */
.composer-mic.is-recording {
  background: #fee2e2;
  color: #b42318;
  animation: composer-pulse 1.4s ease-in-out infinite;
}

@keyframes composer-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(180, 35, 24, 0.35); }
  50% { box-shadow: 0 0 0 6px rgba(180, 35, 24, 0); }
}

.composer-send {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  transition: background 0.15s ease, opacity 0.15s ease;
}

.composer-send svg {
  width: 20px;
  height: 20px;
}

.composer-send:hover:not(:disabled) {
  background: var(--accent-strong);
}

.composer-send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.composer-send[aria-busy="true"] {
  cursor: progress;
}

/* 녹음 바 — 컴포저 안에서 상태를 보여준다. 화면 아래 상태줄은 입력창에서 멀어
   눌러도 반응이 없는 것처럼 보였다. */
/* display를 지정한 요소는 hidden 속성이 무력화된다(작성자 규칙이 UA 규칙을 이긴다).
   숨김을 hidden 속성으로 제어하므로 명시적으로 되돌려 준다. */
.composer-recorder[hidden],
.composer-tray[hidden] {
  display: none;
}

.composer-recorder {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 14px;
  border: 1px solid #fecaca;
  border-radius: 18px;
  background: #fef2f2;
}

.composer-recorder .rec-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #dc2626;
  flex: none;
  animation: composer-pulse 1.4s ease-in-out infinite;
}

.composer-recorder .rec-label {
  font-weight: 750;
  color: #b42318;
}

.composer-recorder .rec-time {
  font-variant-numeric: tabular-nums;
  color: #7f1d1d;
}

/* 입력 레벨. 소리가 실제로 들어오는지 눈으로 확인할 수 있어야 한다. */
.composer-recorder .rec-meter {
  flex: 1 1 120px;
  min-width: 80px;
  height: 6px;
  border-radius: 999px;
  background: #fecaca;
  overflow: hidden;
}

.composer-recorder .rec-meter b {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: 999px;
  background: #dc2626;
  transition: width 0.08s linear;
}

.composer-recorder button {
  min-height: 34px;
}

.composer-shell.is-dimmed {
  opacity: 0.5;
}

.composer-notice {
  margin: 0;
  padding-inline: 14px;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 650;
}

.composer-notice.is-error {
  color: #b42318;
}

.composer-hint {
  margin: 0;
  padding-inline: 14px;
  color: var(--text-soft);
  font-size: 12px;
}

/* 첨부 칩 */
.composer-tray {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-inline: 4px;
}

.composer-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 320px;
  padding: 6px 8px 6px 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  font-size: 12px;
}

.composer-chip img {
  width: 34px;
  height: 34px;
  object-fit: cover;
  border-radius: 8px;
  flex: none;
}

.composer-chip .chip-doc {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--surface-tint);
  color: var(--accent-strong);
  font-size: 10px;
  font-weight: 700;
  flex: none;
}

.composer-chip .chip-body {
  display: grid;
  min-width: 0;
}

.composer-chip .chip-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 650;
  color: var(--text);
}

.composer-chip .chip-state {
  color: var(--text-soft);
  font-size: 11px;
}

.composer-chip.is-failed {
  border-color: #fecaca;
  background: #fef2f2;
}

.composer-chip.is-failed .chip-state {
  color: #b42318;
}

.composer-chip .chip-remove {
  min-height: 0;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-soft);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  flex: none;
}

.composer-chip .chip-remove:hover {
  background: var(--surface-soft);
  color: var(--text);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.ai-prompt-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.ai-prompt-grid button {
  min-height: 48px;
  text-align: left;
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-color: var(--accent-border);
  font-weight: 750;
}

.assistant-kg-upload {
  display: grid;
  grid-template-columns: minmax(180px, 1.2fr) minmax(160px, 1fr) minmax(160px, 0.8fr) minmax(220px, 1.2fr);
  gap: 12px;
  align-items: end;
  margin-top: 4px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.assistant-kg-upload[hidden] {
  display: none;
}

.assistant-kg-upload h3,
.assistant-kg-upload p {
  margin: 0;
}

.assistant-kg-upload h3 {
  color: var(--accent-strong);
  font-size: 16px;
}

.assistant-kg-upload p {
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.5;
}

.assistant-kg-upload label {
  display: grid;
  gap: 6px;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
}

.assistant-kg-upload label small {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.45;
}

.assistant-kg-upload label small span {
  display: inline-block;
  margin-left: 6px;
  color: var(--text-muted);
}

.assistant-kg-upload label small span.valid {
  color: var(--success);
}

.assistant-kg-upload label small span.invalid {
  color: var(--danger);
}

.assistant-kg-upload input,
.assistant-kg-upload select,
.assistant-kg-upload textarea {
  width: 100%;
  min-height: 42px;
  box-sizing: border-box;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.assistant-kg-upload input,
.assistant-kg-upload select {
  padding: 0 12px;
}

.assistant-kg-upload input[type="file"] {
  display: flex;
  align-items: center;
  padding: 8px 12px;
}

.assistant-kg-upload textarea {
  padding: 11px 12px;
  resize: vertical;
}

.assistant-kg-upload-wide {
  grid-column: span 3;
}

.assistant-email-advanced {
  grid-column: span 3;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.assistant-email-advanced summary {
  cursor: pointer;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 800;
}

.assistant-email-advanced label {
  margin-top: 10px;
}

.assistant-email-advanced > button {
  margin-top: 10px;
}

.assistant-kg-upload-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  align-items: center;
}

.ai-result-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  gap: 18px;
  align-items: start;
}

.ai-work-plan h3,
.ai-work-items h3,
.ai-actions h3 {
  margin: 0;
  color: #16232b;
  font-size: 15px;
}

.ai-work-plan ol {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 22px;
}

.ai-ax-panel,
.ai-approval-panel,
.ax-tool-plan-list,
.ax-audit-preview {
  display: grid;
  gap: 12px;
}

#axApprovalList {
  display: block;
}

#axApprovalList .approval-work-table {
  height: auto;
  table-layout: fixed;
}

#axApprovalList .approval-work-table tbody tr {
  height: auto;
}

#axApprovalList .approval-work-table tbody td {
  vertical-align: middle;
}

#axApprovalList .approval-work-table td:last-child {
  min-width: 148px;
  overflow: visible;
  text-align: right;
  text-overflow: clip;
}

#axApprovalList .approval-work-table td:last-child a,
#axApprovalList .approval-work-table td:last-child button {
  min-width: 116px;
  max-width: 100%;
  justify-content: center;
  white-space: nowrap;
}

.ai-ax-panel {
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  padding: 0;
  background: #f8fbff;
}

.ai-ax-panel summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  padding: 0 16px;
  cursor: pointer;
  color: #172554;
  font-weight: 800;
  list-style: none;
}

.ai-ax-panel summary::-webkit-details-marker {
  display: none;
}

.ai-ax-panel summary::before {
  content: "▸";
  color: #2563eb;
  transition: transform 0.15s ease;
}

.ai-ax-panel[open] summary::before {
  transform: rotate(90deg);
}

.ai-ax-panel summary span {
  flex: 1;
}

.ai-ax-panel summary b {
  min-width: 72px;
  color: #2563eb;
  font-size: 0;
  text-align: right;
}

.ai-ax-panel summary b::after {
  content: "펼쳐보기";
  font-size: 0.85rem;
}

.ai-ax-panel[open] summary b::after {
  content: "접기";
}

.ai-ax-panel[open] {
  padding-bottom: 16px;
}

.ai-ax-panel[open] > div {
  margin: 0 16px;
}

.ai-ax-panel h3,
.ai-approval-panel h3 {
  margin: 0;
  color: #172554;
  font-size: 15px;
}

.ax-domain-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  margin: 0 6px 6px 0;
  padding: 0 10px;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 850;
}

.ax-tool-card,
.ax-approval-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 12px;
}

.ax-tool-card strong,
.ax-tool-card span,
.ax-approval-card strong,
.ax-approval-card span {
  display: block;
}

.ax-tool-card strong,
.ax-approval-card strong {
  color: #0f172a;
  font-weight: 900;
}

.ax-tool-card span,
.ax-approval-card span {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 12px;
}

.ax-tool-card b {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: #dcfce7;
  color: #166534;
  font-size: 12px;
}

.ax-tool-card.approval-required b {
  background: #fef3c7;
  color: #92400e;
}

.ax-audit-preview dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.ax-audit-preview div {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #ffffff;
}

.ax-audit-preview dt {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 800;
}

.ax-audit-preview dd {
  overflow: hidden;
  margin: 4px 0 0;
  color: #0f172a;
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ax-approval-card button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.ax-approval-card .primary,
.ai-item-card .ai-item-action {
  justify-self: end;
  white-space: nowrap;
}

.ai-item-card,
.ai-draft-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 14px;
}

.ai-item-card strong,
.ai-item-card span,
.ai-draft-card strong,
.ai-draft-card span {
  display: block;
}

.ai-item-card strong,
.ai-draft-card strong {
  color: #16232b;
  font-weight: 850;
}

.ai-item-card span {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 13px;
}

.ai-workflow-pill {
  display: inline-flex;
  width: max-content;
  align-items: center;
  margin-top: 10px;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  background: #eff6ff;
  color: var(--accent-strong);
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 900;
}

.ai-workflow-pill.auto_recipe_ready {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #15803d;
}

.ai-workflow-pill.exception_case {
  border-color: #fed7aa;
  background: #fff7ed;
  color: #c2410c;
}

.ai-workflow-pill.context_required {
  border-color: #fde68a;
  background: #fffbeb;
  color: #a16207;
}

.ai-item-card dl {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0 0;
}

.ai-item-card dl div {
  border-radius: 8px;
  background: var(--surface);
  padding: 8px 10px;
}

.ai-item-card dt,
.ai-item-card dd {
  margin: 0;
}

.ai-item-card dt {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 800;
}

.ai-item-card dd {
  margin-top: 3px;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 850;
}

.ai-item-card p,
.ai-draft-card p {
  margin: 10px 0 0;
  color: var(--text);
  line-height: 1.6;
}

.ai-item-card .ai-mini-list {
  border-top: 1px solid var(--line);
  padding-top: 9px;
  font-size: 13px;
}

.ai-item-card .ai-mini-list b {
  display: inline;
  margin-right: 8px;
  color: var(--accent-strong);
}

.ai-item-card .ai-item-action {
  margin-top: 12px;
}

.ai-followup-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.ai-followup-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  font-size: 13px;
}

.ai-followup-table th,
.ai-followup-table td {
  border-bottom: 1px solid var(--line);
  padding: 9px 10px;
  text-align: left;
  vertical-align: top;
}

.ai-followup-table th:last-child,
.ai-followup-table td:last-child {
  width: 58px;
  text-align: center;
}

.ai-followup-table .warning-summary {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-followup-table th {
  background: #f6f9ff;
  color: var(--text-muted);
  font-weight: 850;
}

.ai-followup-table td strong,
.ai-followup-table td span {
  display: block;
}

.ai-followup-table td span {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 12px;
}

.ai-followup-table tr.followup-level-high {
  background: #fff5f5;
}

.ai-followup-table tr.followup-level-medium {
  background: #fffaf0;
}

.followup-level-pill {
  display: inline-flex;
  min-width: 48px;
  justify-content: center;
  border-radius: 999px;
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 900;
}

.followup-level-pill.high {
  background: #fee2e2;
  color: #b91c1c;
}

.followup-level-pill.medium {
  background: #fef3c7;
  color: #92400e;
}

.followup-level-pill.normal {
  background: #dbeafe;
  color: var(--accent-strong);
}

.ai-followup-workbench {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 14px;
}

.followup-workbench-head {
  display: grid;
  gap: 6px;
}

.followup-workbench-head strong {
  color: var(--text);
  font-size: 17px;
  font-weight: 900;
}

.followup-workbench-head small {
  color: var(--text-muted);
  font-size: 12px;
}

.ai-followup-workbench label {
  display: grid;
  gap: 6px;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
}

.ai-followup-workbench input,
.ai-followup-workbench textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.ai-followup-workbench input {
  min-height: 40px;
  padding: 0 12px;
}

.ai-followup-workbench textarea {
  min-height: 160px;
  padding: 11px 12px;
  resize: vertical;
  line-height: 1.55;
}

.followup-template-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.followup-template-actions button,
.ghost.xsmall {
  min-height: 30px;
  border: 1px solid var(--accent-border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--accent-strong);
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.followup-template-actions button.is-selected {
  border-color: #1d4ed8;
  background: #2563eb;
  color: #fff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.followup-send-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr);
  gap: 8px;
}

.followup-send-row span {
  min-height: 20px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.45;
}

.followup-send-row span.is-busy {
  color: #1d4ed8;
  font-weight: 800;
}

.followup-send-row span.is-success {
  color: #15803d;
  font-weight: 800;
}

.followup-send-row span.is-error {
  color: #b91c1c;
  font-weight: 800;
}

.followup-sent-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid #86efac;
  border-radius: 6px;
  background: #dcfce7;
  color: #166534;
  font-size: 13px;
  font-weight: 800;
}

.ai-followup-workbench.is-highlighted {
  border-color: #2563eb;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.14);
}

.ai-followup-workbench[data-sent="true"] {
  border-color: #86efac;
  background: #f0fdf4;
}

.ai-followup-controls {
  display: grid;
  grid-template-columns: minmax(120px, 0.7fr) minmax(180px, 1.2fr) minmax(150px, 0.8fr) auto;
  gap: 10px;
  align-items: end;
  padding: 12px;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  background: #f8fafc;
}

.ai-followup-controls label {
  display: grid;
  gap: 5px;
}

.ai-followup-controls span {
  color: #475569;
  font-size: 0.8rem;
  font-weight: 800;
}

.ai-followup-controls select,
.ai-followup-controls input {
  min-height: 38px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 0 10px;
  background: #fff;
  color: #0f172a;
  font: inherit;
}

.ai-followup-controls button {
  min-height: 38px;
  white-space: nowrap;
}

.ai-followup-controls button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.primary.xsmall {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  border-radius: 8px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 850;
  text-decoration: none;
}

.ai-prescription-table {
  min-width: 760px;
}

.ai-prescription-table .ai-workflow-pill {
  margin-top: 0;
}

.followup-original-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 12px;
}

.followup-original-panel summary {
  cursor: pointer;
  color: var(--accent-strong);
  font-weight: 900;
}

.guardian-reply-review-panel {
  border-color: #bfdbfe;
  background: #f8fbff;
}

.followup-analysis-panel {
  display: grid;
  gap: 12px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #f8fbff;
  padding: 12px;
}

.followup-analysis-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.followup-analysis-head h3 {
  margin: 0;
  color: var(--text);
  font-size: 15px;
  line-height: 1.35;
}

.followup-analysis-panel .answer-section,
.followup-analysis-panel .answer-table-section {
  background: var(--surface);
}

.followup-original-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.followup-original-grid div {
  display: grid;
  gap: 4px;
  border-radius: 8px;
  background: #f8fbff;
  padding: 10px;
}

.followup-original-grid span,
.followup-original-checks span {
  color: var(--text-muted);
  font-size: 12px;
}

.followup-original-grid strong,
.followup-original-checks strong,
.followup-original-note strong {
  color: var(--text);
  font-weight: 850;
}

.followup-original-checks,
.followup-original-note {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.followup-original-checks ul,
.followup-original-note p {
  margin: 0;
  color: var(--text);
  line-height: 1.55;
}

@media (max-width: 720px) {
  .followup-original-grid {
    grid-template-columns: 1fr;
  }
}

.ai-draft-card span {
  width: max-content;
  margin-top: 10px;
  border-radius: 999px;
  background: var(--warning-soft);
  color: var(--warning);
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 900;
}

.ai-draft-card label {
  display: grid;
  gap: 6px;
  margin-top: 10px;
  color: var(--text);
  font-size: 12px;
  font-weight: 850;
}

.ai-draft-card label span {
  width: auto;
  margin-top: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text-muted);
  padding: 0;
  font-size: 12px;
}

.ai-draft-card input,
.ai-draft-card textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.ai-draft-card input {
  min-height: 38px;
  padding: 0 10px;
}

.ai-draft-card textarea {
  padding: 10px;
  resize: vertical;
  line-height: 1.5;
}

.ai-draft-card[data-sent="true"] {
  border-color: var(--accent-border);
  background: var(--accent-soft);
}

.ai-draft-card div {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 12px;
}

.ai-safety-note {
  margin: 16px 0 0;
  border-top: 1px solid var(--line);
  padding-top: 14px;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.55;
}

@media (max-width: 980px) {
  .ai-result-layout,
  .assistant-kg-upload,
  .ax-audit-preview dl {
    grid-template-columns: 1fr;
  }

  .composer-hint {
    padding-inline: 10px;
  }

  .ai-prompt-grid,
  .ai-item-card dl,
  .assistant-overview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .assistant-kg-upload-wide {
    grid-column: auto;
  }
}

@media (max-width: 640px) {
  .ai-prompt-grid,
  .ai-item-card dl,
  .assistant-overview {
    grid-template-columns: 1fr;
  }

  .ax-tool-card,
  .ax-approval-card {
    grid-template-columns: 1fr;
  }
}


/* ---------------------------------------------------------------- 도우미 처리 중 표시
 * 요청이 수 초 걸릴 수 있어(서버 조회 + 처음 보는 표현일 때의 의도 해석) 진행 중임을
 * 버튼과 상태줄 양쪽에서 보여준다. */
@keyframes ai-agent-spin {
  to { transform: rotate(360deg); }
}

.btn-spinner,
.status-spinner {
  display: inline-block;
  width: 0.9em;
  height: 0.9em;
  margin-inline-end: 0.45em;
  vertical-align: -0.1em;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-top-color: transparent;
  opacity: 0.85;
  animation: ai-agent-spin 0.7s linear infinite;
}

#aiAgentStatus.is-busy {
  display: flex;
  align-items: center;
  color: #1f2937;
}

#aiAgentStatus.is-error {
  color: #b42318;
}

.ai-analytics-result {
  display: grid;
  gap: 16px;
}

.ai-analytics-lead {
  margin: 0;
  color: #1f2937;
  line-height: 1.6;
}

.ai-analytics-section {
  display: grid;
  gap: 10px;
  padding-block: 14px;
  border-top: 1px solid #dbe3ef;
}

.ai-analytics-section:first-child {
  border-top: 0;
  padding-top: 0;
}

.ai-analytics-section h4 {
  margin: 0;
  font-size: 0.98rem;
  color: #0f172a;
}

.ai-analytics-section p,
.ai-analytics-section ul {
  margin: 0;
  color: #475569;
}

.ai-analytics-risk-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.ai-analytics-risk-list article {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid #f6c5a8;
  border-radius: 8px;
  background: #fff7ed;
}

.ai-analytics-risk-list strong {
  color: #9a3412;
}

.ai-analytics-risk-list span {
  font-weight: 800;
  color: #c2410c;
}

.ai-analytics-risk-list p {
  font-size: 0.85rem;
}

.ai-analytics-bars {
  display: grid;
  gap: 8px;
}

.ai-analytics-bar-row {
  display: grid;
  grid-template-columns: minmax(96px, 160px) minmax(120px, 1fr) minmax(56px, auto) auto;
  align-items: center;
  gap: 10px;
  min-height: 32px;
}

.ai-analytics-bar-row span {
  color: #334155;
  font-weight: 700;
}

.ai-analytics-bar-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5eaf3;
}

.ai-analytics-bar-track b {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #2563eb;
}

.ai-analytics-bar-row strong {
  color: #0f172a;
  text-align: right;
}

.ai-analytics-bar-row em {
  color: #64748b;
  font-style: normal;
  font-size: 0.82rem;
}

.ai-analytics-section.warning {
  color: #92400e;
}

.ai-command-panel.is-busy textarea,
.ai-command-panel.is-busy [data-ai-prompt] {
  opacity: 0.6;
  cursor: not-allowed;
}

@media (prefers-reduced-motion: reduce) {
  .btn-spinner,
  .status-spinner {
    animation-duration: 2.4s;
  }
}

@media (max-width: 640px) {
  .ai-analytics-bar-row {
    grid-template-columns: 1fr auto;
  }

  .ai-analytics-bar-track {
    grid-column: 1 / -1;
  }

  .ai-followup-controls {
    grid-template-columns: 1fr;
  }
}

/* ---------------------------------------------------------------- 질의 답변
 * record_lookup 인텐트의 답변 블록. 답을 얻은 항목과 기록이 없어 답하지 못한
 * 항목을 시각적으로 구분한다. 못 얻은 항목을 감추면 수의사가 값이 있다고
 * 오해할 수 있으므로 사유와 함께 그대로 노출한다. */
.ai-answer-panel {
  margin: 0 0 18px;
  padding: 16px 18px;
  border: 1px solid #dbe3f0;
  border-radius: 12px;
  background: #f7faff;
}

.ai-answer-panel h3 {
  margin: 0 0 12px;
  font-size: 15px;
}

.ai-answer-list {
  display: grid;
  gap: 12px;
}

.answer-row {
  padding: 12px 14px;
  border-radius: 10px;
  border-inline-start: 3px solid #2563eb;
  background: #fff;
}

.answer-row.is-unknown {
  border-inline-start-color: #b0b7c3;
  background: #f4f5f7;
}

.answer-row .answer-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.answer-row p,
.answer-text {
  margin: 0;
  line-height: 1.6;
  color: #1f2937;
}

.answer-row.is-unknown p {
  color: #5b6472;
}

.answer-badge {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.answer-badge.unknown {
  background: #e5e7eb;
  color: #4b5563;
}

.answer-badge.needs-vet {
  background: #fef3c7;
  color: #92400e;
}

.answer-basis {
  display: block;
  margin-top: 6px;
  color: #6b7280;
  font-size: 12px;
}

.answer-section,
.answer-table-section {
  margin-top: 10px;
}

.answer-section h4,
.answer-table-section h4 {
  margin: 0 0 6px;
  color: #0f172a;
  font-size: 13px;
  font-weight: 800;
}

.answer-section p {
  margin: 0;
}

.answer-table-wrap {
  overflow-x: auto;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}

.answer-table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  background: #ffffff;
  font-size: 12px;
}

.answer-table th,
.answer-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #e2e8f0;
  text-align: left;
  vertical-align: top;
  line-height: 1.45;
}

.answer-table th {
  background: #f8fafc;
  color: #334155;
  font-weight: 800;
  white-space: nowrap;
}

.answer-table tr:last-child td {
  border-bottom: 0;
}
