:root {
  --primary: #5b4fa3;
  --primary-dark: #403783;
  --accent: #f3b63f;
  --bg: #f2f3f7;
  --panel: #ffffff;
  --text: #172033;
  --muted: #687386;
  --line: #dde2ea;
  --success: #0f9f64;
  --info: #2367d1;
  --purple: #714bd6;
  --danger: #dc2626;
  --warning: #b45309;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: Arial, Helvetica, sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

.hidden {
  display: none !important;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 12% 10%, rgba(243, 182, 63, 0.22), transparent 28%),
    radial-gradient(circle at 88% 90%, rgba(255, 255, 255, 0.1), transparent 30%),
    linear-gradient(145deg, #6759b2 0%, #403783 100%);
}

.login-card {
  width: min(420px, 100%);
  padding: 40px;
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 18px;
  box-shadow: 0 28px 70px rgba(24, 20, 61, 0.3);
}

.brand-block,
.sidebar-brand,
.app-header,
.panel-header,
.header-actions {
  display: flex;
  align-items: center;
}

.brand-block {
  margin-bottom: 30px;
}

.brand-block h1 {
  margin: 0;
  width: 100%;
  font-size: 2rem;
  line-height: 1.2;
  text-align: center;
  letter-spacing: -0.03em;
}

.login-form label {
  display: block;
  margin: 18px 0 8px;
  color: #4f596b;
  font-size: 0.9rem;
  font-weight: 700;
}

.login-form input,
.login-form select,
.appointment-form input,
.appointment-form select,
.appointment-form textarea,
.document-form input,
.document-form select,
.document-form textarea,
.filters input,
.filters select {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  background: #fff;
}

.appointment-form textarea,
.document-form textarea {
  min-height: 82px;
  resize: vertical;
}

.login-form input {
  min-height: 48px;
  padding: 12px 14px;
  border-color: #d6dbe5;
  border-radius: 9px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.login-form input:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 4px rgba(91, 79, 163, 0.14);
}

.login-form button,
.header-actions button,
.appointment-form button,
.document-form button,
.annotation-form button,
.user-form button,
.row-actions button,
.ghost-button {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  color: #fff;
  background: var(--primary);
  font-weight: 700;
}

.login-form button {
  width: 100%;
  min-height: 48px;
  margin-top: 26px;
  border-radius: 9px;
  box-shadow: 0 8px 18px rgba(91, 79, 163, 0.22);
  transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.login-form button:hover {
  background: var(--primary-dark);
  box-shadow: 0 10px 22px rgba(64, 55, 131, 0.28);
  transform: translateY(-1px);
}

.login-form button:focus-visible,
.login-links a:focus-visible {
  outline: 3px solid rgba(243, 182, 63, 0.65);
  outline-offset: 3px;
}

.form-message {
  min-height: 1.25rem;
  margin: 0;
  color: #b42318;
  font-size: 0.875rem;
}

.login-links {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 22px;
  color: var(--primary);
  font-size: 0.9rem;
  font-weight: 700;
}

.login-links a:hover {
  color: var(--primary-dark);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.app-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 224px minmax(0, 1fr);
}

.sidebar {
  min-height: 100vh;
  color: #fff;
  background: var(--primary);
  box-shadow: 4px 0 14px rgba(22, 32, 51, 0.14);
}

.sidebar-brand {
  height: 70px;
  padding: 0 18px;
  background: var(--primary-dark);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  justify-content: center;
}

.sidebar-logo {
  display: block;
  width: 100%;
  max-width: 180px;
  max-height: 50px;
  object-fit: contain;
}

.sidebar-profile-label {
  display: none;
}

.side-menu {
  display: grid;
  gap: 4px;
  padding: 18px 10px;
}

.side-menu button,
.sidebar-footer button {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 0;
  border-radius: 6px;
  color: #fff;
  background: transparent;
  text-align: left;
}

.side-menu button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.menu-notification-badge,
.conversation-unread-badge {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  color: #fff;
  background: #dc2626;
  font-size: 0.72rem;
  font-style: normal;
  font-weight: 800;
  line-height: 1;
}

.side-menu button:hover,
.side-menu button.active {
  background: rgba(255, 255, 255, 0.14);
}

.sidebar-footer {
  padding: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.workspace {
  min-width: 0;
}

.app-header {
  justify-content: space-between;
  gap: 20px;
  min-height: 70px;
  padding: 12px 24px;
  color: #fff;
  background: var(--primary);
  box-shadow: 0 2px 10px rgba(22, 32, 51, 0.14);
}

.app-header h1,
.app-header p {
  margin: 0;
}

.app-header h1 {
  font-size: 1.25rem;
}

.app-header p {
  margin-top: 3px;
  opacity: 0.88;
  font-size: 0.9rem;
}

.header-actions {
  gap: 12px;
}

.professional-notifications { position: relative; }

.header-actions .notification-bell {
  position: relative;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 50%;
}

.header-actions .notification-bell:hover,
.header-actions .notification-bell.has-notifications { background: rgba(243, 182, 63, 0.28); }

.notification-bell svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.header-actions .notification-count {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 20px;
  padding: 2px 5px;
  color: #fff;
  background: var(--danger);
  border: 2px solid var(--primary);
  border-radius: 999px;
  font-size: 0.7rem;
  line-height: 1;
  text-align: center;
}

.notification-panel {
  position: absolute;
  z-index: 50;
  top: calc(100% + 12px);
  right: 0;
  width: min(370px, calc(100vw - 32px));
  overflow: hidden;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 18px 45px rgba(22, 32, 51, 0.22);
}

.notification-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.header-actions .notification-panel-header button {
  height: auto;
  padding: 5px 8px;
  color: var(--primary);
  background: transparent;
  border: 0;
  font-size: 0.78rem;
  font-weight: 700;
}

.header-actions .notification-panel-header button:disabled { color: var(--muted); cursor: default; }

.notification-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.notification-item-time {
  align-self: start;
  padding: 5px 7px;
  color: var(--primary-dark);
  background: #f4f0ff;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 700;
}

.notification-item-cancellation {
  background: #fffaf0;
}

.notification-item-cancellation .notification-item-time {
  color: #92400e;
  background: #fef3c7;
}

.notification-item strong, .notification-item p { margin: 0; }
.notification-item p, .notification-empty { margin-top: 4px; color: var(--muted); font-size: 0.82rem; }
.notification-empty { padding: 8px 16px 14px; }

.appointment-alert {
  position: fixed;
  z-index: 100;
  top: 86px;
  right: 24px;
  display: flex;
  align-items: flex-start;
  gap: 18px;
  width: min(430px, calc(100vw - 32px));
  padding: 16px 18px;
  color: #573a04;
  background: #fff8df;
  border: 1px solid #f3cf72;
  border-left: 5px solid var(--accent);
  border-radius: 10px;
  box-shadow: 0 16px 36px rgba(67, 48, 12, 0.2);
}

.appointment-alert p { margin: 4px 0 0; font-size: 0.9rem; }
.appointment-alert button { margin-left: auto; padding: 0; color: #795b1b; background: transparent; border: 0; font-size: 1.35rem; line-height: 1; }

.header-actions > span {
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  font-size: 0.86rem;
  font-weight: 700;
}

.logged-user-name {
  max-width: min(280px, 35vw);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-actions button {
  padding: 0 14px;
  background: #ef4444;
}

.ghost-button {
  padding: 0 12px;
  color: var(--primary);
  background: #f4f0ff;
  border: 1px solid #ddd6fe;
}

.content-area {
  padding: 24px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}

.summary-grid article,
.panel,
.simple-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(22, 32, 51, 0.05);
}

.summary-grid article {
  padding: 18px;
}

.summary-grid span {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.summary-grid strong {
  display: block;
  margin-top: 8px;
  color: var(--primary);
  font-size: 2rem;
}

.panel {
  overflow: hidden;
}

.panel-header {
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.panel-header h2 {
  margin: 0;
  font-size: 1.05rem;
}

.filters {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 180px;
  gap: 10px;
  width: min(720px, 100%);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
}

th,
td {
  padding: 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  font-size: 0.92rem;
}

th {
  color: #111827;
  background: #f8fafc;
  font-size: 0.86rem;
}

tbody tr:hover {
  background: #fff7e8;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 8px;
  border-radius: 5px;
  font-size: 0.78rem;
  font-weight: 700;
}

.tag.blue {
  color: #164fb5;
  background: #dbeafe;
}

.tag.green {
  color: #087443;
  background: #d8f7e8;
}

.tag.purple {
  color: var(--purple);
  background: #eee7ff;
}

.tag.red {
  color: #991b1b;
  background: #fee2e2;
}

.tag.yellow {
  color: #92400e;
  background: #fef3c7;
}

.simple-card {
  padding: 22px;
}

.simple-card h2 {
  margin: 0 0 10px;
}

.simple-card p {
  margin: 0;
  color: var(--muted);
}

.appointment-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.appointment-main {
  min-width: 0;
}

.appointment-summary {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.appointment-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  padding: 18px;
}

.appointment-form label,
.document-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.appointment-form .full-field,
.document-form .full-field,
.form-actions {
  grid-column: 1 / -1;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
}

.form-actions button {
  padding: 0 16px;
}

.appointment-form-panel {
  margin-bottom: 18px;
}

.appointment-list {
  display: grid;
}

.appointment-row {
  display: grid;
  grid-template-columns: minmax(170px, 1fr) minmax(170px, 1fr) minmax(160px, 0.9fr) minmax(190px, 1fr) minmax(120px, 0.65fr) minmax(150px, 0.75fr);
  gap: 16px;
  align-items: center;
}

.appointment-header-row {
  padding: 12px 18px;
  color: #111827;
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.appointment-item {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.appointment-item:last-child {
  border-bottom: 0;
}

.appointment-item > div {
  min-width: 0;
}

.appointment-title {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.appointment-item p,
.notification-item p {
  margin: 0;
  color: var(--muted);
  line-height: 1.4;
}

.appointment-item strong,
.appointment-item p {
  overflow-wrap: anywhere;
}

.field-label {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.row-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.patient-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.row-actions button {
  min-height: 36px;
  padding: 0 10px;
  color: var(--primary);
  background: #f4f0ff;
  border: 1px solid #ddd6fe;
  font-size: 0.86rem;
}

.row-actions button[data-action="cancel"],
.row-actions button[data-request-action="cancel"] {
  color: var(--danger);
  background: #fff1f2;
  border-color: #fecdd3;
}

.row-actions button[data-action="confirm"],
.row-actions button[data-request-action="confirm"] {
  color: var(--success);
  background: #ecfdf5;
  border-color: #bbf7d0;
}

.description-button {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid #ddd6fe;
  border-radius: 6px;
  color: var(--primary);
  background: #f4f0ff;
  font-size: 0.86rem;
  font-weight: 700;
}

.description-button:hover {
  background: #ece7ff;
}

.appointment-cancellation-button {
  display: block;
  min-height: 34px;
  margin-top: 8px;
  padding: 0 10px;
  color: var(--danger);
  background: #fff1f2;
  border: 1px solid #fecdd3;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 700;
}

.cancellation-requested-label {
  display: block;
  margin-top: 8px;
  color: var(--warning);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.35;
}

.description-overlay {
  position: fixed;
  inset: 0;
  z-index: 26;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.46);
}

.description-modal {
  width: min(560px, 100%);
  max-height: min(620px, calc(100vh - 36px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 26px 70px rgba(15, 23, 42, 0.28);
}

.description-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.description-header strong,
.description-header span {
  display: block;
}

.description-header span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.9rem;
}

.description-close {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  color: var(--text);
  background: #f1f5f9;
  font-weight: 800;
}

.description-content {
  max-height: 100%;
  padding: 18px;
  overflow-y: auto;
}

.description-content p {
  margin: 0;
  color: var(--text);
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.row-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.46;
}

.appointment-sidebar {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.notification-list {
  display: grid;
}

.notification-item {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.notification-item:last-child {
  border-bottom: 0;
}

.notification-item strong,
.notification-item span {
  display: block;
}

.notification-item span {
  margin-top: 4px;
  color: var(--text);
  font-size: 0.9rem;
}

.empty-state {
  padding: 22px;
  color: var(--muted);
}

.documents-layout {
  display: grid;
  gap: 18px;
}

.document-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  padding: 18px;
}

.document-summary {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.file-upload input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.file-upload strong {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 42px;
  padding: 0 14px;
  border-radius: 6px;
  color: #fff;
  background: var(--primary);
}

.file-upload small {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 400;
}

.signature-request {
  display: flex !important;
  align-items: flex-start;
  gap: 11px !important;
  padding: 13px 14px;
  border: 1px solid #ddd6fe;
  border-radius: 6px;
  color: var(--text) !important;
  background: #faf9ff;
  cursor: pointer;
}

.signature-request input {
  width: 18px;
  height: 18px;
  min-height: 0;
  margin-top: 2px;
}

.signature-request span,
.signature-request small {
  display: block;
}

.signature-request small {
  margin-top: 4px;
  color: var(--muted);
  font-weight: 400;
  line-height: 1.4;
}

.document-list {
  display: grid;
}

.document-toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.document-toolbar button,
.document-actions button,
.document-viewer-actions button,
.document-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--primary);
  border-radius: 6px;
  color: #fff;
  background: var(--primary);
  font-weight: 700;
}

.document-toolbar .secondary {
  color: var(--primary);
  background: #fff;
}

.document-toolbar .secondary.active {
  color: #fff;
  background: var(--primary-dark);
}

.panel-description {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.document-actions {
  display: grid;
  gap: 8px;
}

.document-actions button {
  min-height: 38px;
  padding: 0 12px;
  color: var(--primary);
  background: #f4f0ff;
  font-size: 0.85rem;
}

.document-actions .sign-button {
  color: #fff;
  background: var(--success);
  border-color: var(--success);
}

.document-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.56);
}

.document-modal {
  width: min(680px, 100%);
  max-height: calc(100vh - 36px);
  overflow-y: auto;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 26px 70px rgba(15, 23, 42, 0.35);
}

.document-modal-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.document-modal-header div {
  flex: 1;
}

.document-modal-header strong,
.document-modal-header span {
  display: block;
}

.document-modal-header span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.88rem;
}

.document-modal-header button {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  color: var(--text);
  background: #f1f5f9;
  font-size: 1.35rem;
}

.document-viewer-modal {
  width: min(940px, 100%);
}

.document-preview {
  display: grid;
  place-items: center;
  min-height: 360px;
  padding: 16px;
  background: #e9edf3;
}

.document-preview img {
  display: block;
  max-width: 100%;
  max-height: 62vh;
  object-fit: contain;
}

.document-preview iframe,
.document-preview object {
  width: 100%;
  height: min(62vh, 680px);
  border: 0;
  background: #fff;
}

.document-sent-grid {
  display: grid;
  gap: 18px;
}

.compact-document-item {
  grid-template-columns: minmax(180px, 0.8fr) minmax(280px, 1.4fr) minmax(170px, 0.8fr) 150px;
}

.document-preview-unavailable {
  padding: 40px 20px;
  color: var(--muted);
  text-align: center;
}

.document-preview-unavailable strong {
  color: var(--text);
}

.document-viewer-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.document-download {
  color: var(--primary);
  background: #fff;
}

.signature-form,
.signed-document-info {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.signature-form h3 {
  margin: 0;
}

.signature-form > label:not(.signature-consent) {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.signature-form input[type="text"] {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

#signatureCanvas {
  width: 100%;
  height: 190px;
  border: 2px dashed #aeb7c6;
  border-radius: 6px;
  background: #fff;
  cursor: crosshair;
  touch-action: none;
}

.clear-signature {
  justify-self: start;
  border: 0;
  color: var(--primary);
  background: transparent;
  font-weight: 700;
}

.signature-consent {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  color: var(--text);
  line-height: 1.4;
}

.signature-consent input {
  margin-top: 3px;
}

.signed-document-info img {
  width: min(360px, 100%);
  max-height: 130px;
  object-fit: contain;
  object-position: left center;
  border-bottom: 1px solid var(--line);
}

.patient-chat-layout {
  display: grid;
  gap: 18px;
}

.conversation-type-filter {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.conversation-type-filter button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 112px;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  background: #fff;
  font-weight: 700;
}

.professional-type-badge {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  color: #fff;
  background: #dc2626;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1;
}

.conversation-type-filter button.active,
.conversation-type-filter button:hover {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
}

.professional-chat-list {
  display: grid;
}

.professional-chat-item {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto minmax(260px, auto);
  gap: 12px;
  width: 100%;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  text-align: left;
  align-items: center;
}

.professional-chat-item:hover {
  background: #f8fafc;
}

.professional-chat-item strong,
.professional-chat-item small,
.professional-chat-item em {
  display: block;
}

.professional-chat-item small {
  margin-top: 4px;
  color: var(--muted);
}

.professional-chat-item em {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.84rem;
  font-style: normal;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.professional-chat-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.professional-chat-actions button {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid #ddd6fe;
  border-radius: 6px;
  color: var(--primary);
  background: #f4f0ff;
  font-size: 0.86rem;
  font-weight: 700;
}

.professional-chat-actions button[data-professional-video] {
  color: var(--info);
  background: #eff6ff;
  border-color: #bfdbfe;
}

.document-item {
  display: grid;
  grid-template-columns: minmax(160px, 0.8fr) minmax(240px, 1.4fr) minmax(150px, 0.7fr) minmax(130px, auto);
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  align-items: center;
}

.document-item:last-child {
  border-bottom: 0;
}

.document-item p {
  margin: 4px 0 0;
  color: var(--muted);
  line-height: 1.4;
}

.attendant-layout {
  display: grid;
  gap: 18px;
}

.attendant-summary {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.admin-layout {
  display: grid;
  gap: 18px;
}

.admin-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  width: min(900px, 100%);
}

.admin-primary-button {
  min-height: 42px;
  padding: 0 14px;
  border: 0;
  border-radius: 6px;
  color: #fff;
  background: var(--primary);
  font-weight: 700;
  white-space: nowrap;
}

.user-list {
  display: grid;
}

.user-row {
  display: grid;
  grid-template-columns: minmax(220px, 1.1fr) minmax(240px, 1.2fr) minmax(150px, 0.75fr) minmax(170px, 0.85fr) 220px;
  gap: 16px;
  align-items: center;
}

.user-header-row {
  padding: 12px 18px;
  color: #111827;
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.user-item {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.user-item:last-child {
  border-bottom: 0;
}

.user-item p {
  margin: 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.user-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.user-actions button[data-user-delete] {
  color: var(--danger);
  background: #fff1f2;
  border-color: #fecdd3;
}

.user-overlay {
  position: fixed;
  inset: 0;
  z-index: 29;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.46);
}

.user-modal {
  width: min(560px, 100%);
  max-height: min(680px, calc(100vh - 36px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 26px 70px rgba(15, 23, 42, 0.28);
}

.user-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.user-modal-header strong,
.user-modal-header span {
  display: block;
}

.user-modal-header span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.9rem;
}

.user-modal-close {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  color: var(--text);
  background: #f1f5f9;
  font-weight: 800;
}

.user-form {
  display: grid;
  gap: 14px;
  padding: 18px;
  overflow-y: auto;
}

.user-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.user-form input,
.user-form select {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  background: #fff;
}

.request-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  width: min(900px, 100%);
}

.schedule-appointment-button {
  min-height: 42px;
  padding: 0 14px;
  border: 0;
  border-radius: 6px;
  color: #fff;
  background: var(--primary);
  font-weight: 700;
  white-space: nowrap;
}

.patient-list {
  display: grid;
}

.request-list {
  display: grid;
}

.request-row {
  display: grid;
  grid-template-columns: minmax(190px, 1.1fr) minmax(170px, 0.9fr) minmax(140px, 0.7fr) minmax(210px, 1.1fr) minmax(120px, 0.6fr) minmax(220px, 1fr);
  gap: 16px;
  align-items: center;
}

.request-header-row {
  padding: 12px 18px;
  color: #111827;
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.request-item {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.request-item:last-child {
  border-bottom: 0;
}

.request-item > div {
  min-width: 0;
}

.request-item p {
  margin: 4px 0 0;
  color: var(--muted);
  line-height: 1.4;
}

.request-item strong,
.request-item p {
  overflow-wrap: anywhere;
}

.request-schedule {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px;
  gap: 8px;
}

.request-schedule input,
.request-schedule select {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  background: #fff;
}

.request-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.schedule-overlay {
  position: fixed;
  inset: 0;
  z-index: 27;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.46);
}

.schedule-modal {
  width: min(840px, 100%);
  max-height: min(720px, calc(100vh - 36px));
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  overflow: hidden;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 26px 70px rgba(15, 23, 42, 0.28);
}

.schedule-patient-search {
  position: relative;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
}

.schedule-search-results {
  max-height: 260px;
  margin-top: 8px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
}

.schedule-search-results button {
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  background: #fff;
  text-align: left;
}

.schedule-search-results button:last-child {
  border-bottom: 0;
}

.schedule-search-results button:hover,
.schedule-search-results button:focus {
  background: #f1f5f9;
  outline: none;
}

.schedule-search-results strong,
.schedule-search-results span {
  display: block;
}

.schedule-search-results span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.85rem;
}

.schedule-search-results p {
  margin: 0;
  padding: 14px 12px;
  color: var(--muted);
}

.schedule-patient-search label {
  display: block;
  margin-bottom: 6px;
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 700;
}

.schedule-patient-search input {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  background: #fff;
}

.schedule-patient-search input:focus {
  border-color: var(--primary);
  outline: 2px solid rgba(91, 75, 180, 0.16);
}

.schedule-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.schedule-header strong,
.schedule-header span {
  display: block;
}

.schedule-header span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.9rem;
}

.schedule-close {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  color: var(--text);
  background: #f1f5f9;
  font-weight: 800;
}

.schedule-patient-list {
  display: grid;
  overflow-y: auto;
}

.schedule-patient-item {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(360px, 1.4fr);
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  align-items: center;
}

.schedule-patient-item:last-child {
  border-bottom: 0;
}

.schedule-patient-item p {
  margin: 4px 0 0;
  color: var(--muted);
  line-height: 1.4;
}

.doctor-schedule-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px 110px;
  gap: 8px;
}

.doctor-schedule-controls input,
.doctor-schedule-controls select {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  background: #fff;
}

.doctor-schedule-controls button {
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  color: #fff;
  background: var(--primary);
  font-weight: 700;
}

.patient-item {
  display: grid;
  grid-template-columns: minmax(240px, 1.3fr) minmax(180px, 0.8fr) minmax(280px, auto);
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  align-items: center;
}

.patient-item:last-child {
  border-bottom: 0;
}

.patient-item p {
  margin: 4px 0 0;
  color: var(--muted);
  line-height: 1.4;
}

.patient-access-actions {
  grid-template-columns: repeat(2, minmax(130px, 1fr));
}

.finish-attendance-button {
  margin-left: auto;
  padding: 9px 13px;
  border: 0;
  border-radius: 6px;
  color: #fff;
  background: #dc2626;
  font-weight: 700;
}

.attendance-history-list {
  display: grid;
}

.attendance-history-item {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr) minmax(180px, 0.6fr);
  gap: 18px;
  align-items: center;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.attendance-history-item:last-child {
  border-bottom: 0;
}

.attendance-history-item strong,
.attendance-history-item span {
  display: block;
}

.patient-details-overlay {
  position: fixed;
  inset: 0;
  z-index: 32;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.46);
}

.patient-details-modal {
  width: min(580px, 100%);
  overflow: hidden;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 26px 70px rgba(15, 23, 42, 0.28);
}

.patient-details-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.patient-details-header strong,
.patient-details-header span {
  display: block;
}

.patient-details-header span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.88rem;
}

.patient-details-header button {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: #f1f5f9;
  font-size: 1.3rem;
}

.patient-details-content {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 18px;
}

.patient-detail-field {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f8fafc;
}

.patient-detail-field > span,
.patient-detail-field > strong {
  display: block;
}

.patient-detail-field > span {
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
}

.patient-status-field {
  grid-column: 1 / -1;
}

.patient-access-actions button {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
}

.patient-access-actions .finish-patient-attendance {
  color: #fff;
  background: #dc2626;
  border-color: #dc2626;
}

.annotation-user-list {
  display: grid;
}

.annotation-user-row {
  display: grid;
  grid-template-columns: minmax(260px, 1.2fr) minmax(220px, 1fr) minmax(140px, 0.65fr) 260px;
  gap: 16px;
  align-items: center;
}

.annotation-user-header {
  padding: 12px 18px;
  color: #111827;
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.annotation-user-item {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.annotation-user-item:last-child {
  border-bottom: 0;
}

.annotation-user-name {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.annotation-user-item p {
  margin: 0;
  color: var(--muted);
  line-height: 1.4;
}

.annotation-user-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.annotation-user-actions button[data-annotation-view] {
  color: var(--info);
  background: #eff6ff;
  border-color: #bfdbfe;
}

.annotation-overlay {
  position: fixed;
  inset: 0;
  z-index: 28;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.46);
}

.annotation-modal {
  width: min(620px, 100%);
  max-height: min(720px, calc(100vh - 36px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 26px 70px rgba(15, 23, 42, 0.28);
}

.annotation-view-modal {
  width: min(760px, 100%);
}

.annotation-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.annotation-modal-header strong,
.annotation-modal-header span {
  display: block;
}

.annotation-modal-header span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.9rem;
}

.annotation-modal-close {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  color: var(--text);
  background: #f1f5f9;
  font-weight: 800;
}

.annotation-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  padding: 18px;
  overflow-y: auto;
}

.annotation-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.annotation-form input,
.annotation-form textarea {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  background: #fff;
}

.annotation-form textarea {
  min-height: 150px;
  resize: vertical;
}

.annotation-list {
  display: grid;
  overflow-y: auto;
}

.annotation-item {
  display: grid;
  gap: 10px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.annotation-item:last-child {
  border-bottom: 0;
}

.annotation-item header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.annotation-item header strong,
.annotation-item header span {
  display: block;
}

.annotation-item header span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.82rem;
}

.annotation-item p {
  margin: 0;
  color: var(--text);
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.annotation-attachment {
  display: inline-grid;
  gap: 3px;
  justify-self: start;
  padding: 9px 11px;
  border: 1px solid #ddd6fe;
  border-radius: 6px;
  color: var(--primary);
  background: #f4f0ff;
  font-size: 0.88rem;
  font-weight: 700;
}

.annotation-attachment span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 400;
}

.conversation-list {
  display: grid;
}

.conversation-item {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  gap: 12px;
  width: 100%;
  padding: 14px 18px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  text-align: left;
  align-items: center;
}

.conversation-item:hover {
  background: #f8fafc;
}

.doctor-conversation-item {
  grid-template-columns: 46px minmax(0, 1fr) auto auto auto minmax(260px, auto);
}

.doctor-conversation-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.doctor-conversation-actions.has-active-attendance {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.doctor-conversation-actions button {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid #ddd6fe;
  border-radius: 6px;
  color: var(--primary);
  background: #f4f0ff;
  font-size: 0.86rem;
  font-weight: 700;
}

.doctor-conversation-actions button[data-patient-video] {
  color: var(--info);
  background: #eff6ff;
  border-color: #bfdbfe;
}

.doctor-conversation-actions .finish-conversation-attendance {
  color: #fff;
  background: #dc2626;
  border-color: #dc2626;
}

.conversation-avatar {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  color: #fff;
  background: var(--primary);
  font-weight: 800;
}

.conversation-item strong,
.conversation-item small {
  display: block;
}

.conversation-item small {
  margin-top: 4px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-item em {
  color: var(--muted);
  font-size: 0.82rem;
  font-style: normal;
}

.chat-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.46);
}

.chat-modal {
  display: grid;
  grid-template-rows: auto minmax(260px, 1fr) auto;
  width: min(480px, 100%);
  height: min(680px, calc(100vh - 36px));
  overflow: hidden;
  border-radius: 8px;
  background: #e8f0ea;
  box-shadow: 0 26px 70px rgba(15, 23, 42, 0.35);
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  color: #fff;
  background: var(--primary-dark);
}

.chat-header .conversation-avatar {
  width: 40px;
  height: 40px;
  background: var(--primary);
}

.chat-header strong,
.chat-header span {
  display: block;
}

.chat-header span {
  margin-top: 2px;
  opacity: 0.82;
  font-size: 0.84rem;
}

.chat-close {
  margin-left: auto;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
  font-weight: 800;
}

.chat-messages {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  overflow-y: auto;
  background:
    linear-gradient(rgba(232, 240, 234, 0.92), rgba(232, 240, 234, 0.92)),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.42) 0 2px, transparent 2px 12px);
}

.chat-message {
  width: fit-content;
  max-width: min(78%, 340px);
  padding: 8px 10px 6px;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.1);
}

.chat-message.sent {
  align-self: flex-end;
  background: #dcf8c6;
}

.chat-message.received {
  align-self: flex-start;
}

.chat-message p {
  margin: 0;
  line-height: 1.35;
}

.chat-message span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.72rem;
  text-align: right;
}

.chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  padding: 10px;
  background: #f8fafc;
}

.chat-form input {
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
}

.chat-form button {
  min-height: 42px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  color: #fff;
  background: var(--primary);
  font-weight: 700;
}

.chat-form .chat-dictation-button {
  color: var(--primary);
  border: 1px solid var(--primary);
  background: #fff;
}

.chat-form .chat-dictation-button.is-listening {
  color: #fff;
  border-color: #dc2626;
  background: #dc2626;
  box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.14);
}

.chat-form .chat-dictation-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.meet-overlay {
  position: fixed;
  inset: 0;
  z-index: 24;
  display: grid;
  place-items: center;
  padding: 18px;
  background: radial-gradient(circle at 50% 10%, rgba(91, 79, 163, 0.28), transparent 42%), rgba(2, 6, 23, 0.9);
  backdrop-filter: blur(10px);
}

.meet-room {
  display: grid;
  grid-template-rows: auto minmax(320px, 1fr) auto;
  width: min(1120px, 100%);
  height: min(720px, calc(100vh - 36px));
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 22px;
  background: #0b1120;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.42);
}

.meet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 17px 22px;
  color: #fff;
  background: #0f172a;
}

.meet-heading,
.meet-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.meet-live-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 5px rgba(34, 197, 94, 0.13), 0 0 18px rgba(34, 197, 94, 0.65);
}

.meet-demo-badge {
  padding: 5px 9px;
  border: 1px solid rgba(167, 139, 250, 0.35);
  border-radius: 999px;
  color: #ddd6fe !important;
  background: rgba(91, 79, 163, 0.2);
  font-size: 0.68rem !important;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.meet-header strong,
.meet-header span {
  display: block;
}

.meet-header span {
  margin-top: 3px;
  color: #cbd5e1;
  font-size: 0.9rem;
}

.meet-close,
.meet-controls button {
  min-height: 40px;
  border: 0;
  border-radius: 999px;
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  font-weight: 700;
}

.meet-close {
  padding: 0 16px;
}

.meet-stage {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 16px;
  padding: 18px;
  min-height: 0;
}

.video-tile {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 240px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  background: #020617;
  box-shadow: inset 0 0 80px rgba(15, 23, 42, 0.45);
}

.demo-participant {
  background: radial-gradient(circle at 50% 42%, #27345a 0, #151d35 38%, #070b16 100%);
}

.demo-self {
  background: radial-gradient(circle at 50% 42%, #433b72 0, #272242 40%, #0b0c19 100%);
}

.demo-participant::after,
.demo-self::after {
  position: absolute;
  inset: auto 0 0;
  height: 40%;
  content: "";
  pointer-events: none;
  background: linear-gradient(transparent, rgba(2, 6, 23, 0.55));
}

.demo-self.camera-off .video-placeholder {
  opacity: 0.45;
  filter: grayscale(1);
}

.doctor-video {
  align-self: end;
  min-height: 220px;
}

.video-tile video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.video-placeholder {
  display: grid;
  place-items: center;
  gap: 8px;
  color: #fff;
  text-align: center;
}

.video-tile > .video-placeholder {
  position: absolute;
  inset: 0;
}

.video-placeholder .conversation-avatar {
  width: 92px;
  height: 92px;
  border: 3px solid rgba(255, 255, 255, 0.75);
  background: linear-gradient(145deg, #7668c5, var(--primary-dark));
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.28);
  font-size: 1.55rem;
}

.video-placeholder small {
  color: #cbd5e1;
}

.video-label {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 11px;
  border-radius: 999px;
  color: #fff;
  background: rgba(15, 23, 42, 0.72);
  font-size: 0.82rem;
  font-weight: 700;
}

.label-mic {
  color: #4ade80;
  font-size: 0.65rem;
}

.video-quality {
  position: absolute;
  z-index: 1;
  top: 14px;
  right: 14px;
  padding: 5px 8px;
  border-radius: 7px;
  color: #e2e8f0;
  background: rgba(15, 23, 42, 0.72);
  font-size: 0.68rem;
  font-weight: 800;
}

.meet-controls {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 16px;
  background: #0f172a;
}

.meet-controls button {
  display: grid;
  place-items: center;
  gap: 4px;
  min-width: 88px;
  min-height: 58px;
  padding: 7px 14px;
  border-radius: 14px;
  font-size: 0.74rem;
}

.meet-controls .control-icon {
  font-size: 1.05rem;
}

.meet-controls .danger-control {
  background: var(--danger);
}

.meet-controls .muted-control {
  background: #475569;
}

.meet-controls .active-control {
  background: var(--primary);
}

@media (max-width: 700px) {
  .meet-room {
    height: calc(100vh - 20px);
    border-radius: 16px;
  }

  .meet-stage {
    grid-template-columns: 1fr;
  }

  .doctor-video {
    position: absolute;
    right: 30px;
    bottom: 102px;
    width: 130px;
    min-height: 170px;
    z-index: 2;
  }

  .meet-demo-badge {
    display: none !important;
  }

  .meet-controls button {
    min-width: 64px;
    padding-inline: 8px;
  }
}

.single-filter {
  grid-template-columns: minmax(260px, 1fr);
}

@media (max-width: 900px) {
  .app-page {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
  }

  .side-menu {
    grid-template-columns: repeat(2, 1fr);
  }

  .app-header,
  .panel-header {
    align-items: stretch;
    flex-direction: column;
  }

  .summary-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .filters {
    grid-template-columns: 1fr;
  }

  .request-toolbar {
    align-items: stretch;
    flex-direction: column;
    width: 100%;
  }

  .admin-toolbar {
    align-items: stretch;
    flex-direction: column;
    width: 100%;
  }

  .schedule-patient-item,
  .doctor-schedule-controls {
    grid-template-columns: 1fr;
  }

  .user-row {
    grid-template-columns: 1fr;
  }

  .user-header-row {
    display: none;
  }

  .annotation-user-row {
    grid-template-columns: 1fr;
  }

  .annotation-user-header {
    display: none;
  }

  .appointment-layout {
    grid-template-columns: 1fr;
  }

  .appointment-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .appointment-row,
  .appointment-item,
  .document-item,
  .patient-item,
  .request-row,
  .request-item {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .appointment-header-row,
  .request-header-row {
    display: none;
  }
}

@media (max-width: 560px) {
  .login-card {
    padding: 32px 24px;
    border-radius: 14px;
  }

  .content-area {
    padding: 16px;
  }

  .summary-grid,
  .side-menu,
  .appointment-summary,
  .document-summary,
  .attendant-summary,
  .appointment-form,
  .request-schedule,
  .row-actions {
    grid-template-columns: 1fr;
  }

  .chat-overlay {
    padding: 0;
  }

  .schedule-overlay {
    padding: 0;
  }

  .annotation-overlay {
    padding: 0;
  }

  .user-overlay {
    padding: 0;
  }

  .document-overlay {
    padding: 0;
  }

  .document-modal {
    width: 100%;
    height: 100vh;
    max-height: none;
    border-radius: 0;
  }

  .document-toolbar,
  .document-viewer-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .schedule-modal {
    width: 100%;
    height: 100vh;
    max-height: none;
    border-radius: 0;
  }

  .annotation-modal {
    width: 100%;
    height: 100vh;
    max-height: none;
    border-radius: 0;
  }

  .user-modal {
    width: 100%;
    height: 100vh;
    max-height: none;
    border-radius: 0;
  }

  .chat-modal {
    width: 100%;
    height: 100vh;
    border-radius: 0;
  }

  .chat-form {
    grid-template-columns: 1fr 1fr;
  }

  .chat-form input {
    grid-column: 1 / -1;
  }

  .professional-chat-item {
    grid-template-columns: 46px minmax(0, 1fr);
  }

  .professional-chat-item .tag {
    justify-self: start;
    grid-column: 2;
  }

  .professional-chat-actions {
    grid-column: 1 / -1;
    grid-template-columns: 1fr;
  }

  .doctor-conversation-item {
    grid-template-columns: 46px minmax(0, 1fr);
  }

  .doctor-conversation-item em {
    grid-column: 2;
  }

  .doctor-conversation-actions {
    grid-column: 1 / -1;
    grid-template-columns: 1fr;
  }

  .doctor-conversation-actions.has-active-attendance {
    grid-template-columns: 1fr;
  }

  .meet-overlay {
    padding: 0;
  }

  .meet-room {
    width: 100%;
    height: 100vh;
    border-radius: 0;
  }

  .meet-stage {
    grid-template-columns: 1fr;
  }

  .meet-controls {
    flex-wrap: wrap;
  }
}

/* Layout responsivo e navegação móvel */
html {
  overflow-x: hidden;
}

body {
  min-width: 320px;
  overflow-x: hidden;
}

img,
video,
iframe {
  max-width: 100%;
}

.app-header-main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.mobile-menu-toggle {
  display: none;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 10px;
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

.mobile-menu-toggle span {
  display: block;
  width: 21px;
  height: 2px;
  margin: 2px 0;
  border-radius: 2px;
  background: currentColor;
}

.media-permission-error {
  border-color: rgba(245, 158, 11, 0.55);
}

.media-permission-error [data-media-status] {
  max-width: 300px;
  padding: 0 16px;
  color: #fde68a;
  line-height: 1.45;
}

@media (max-width: 900px) {
  body::after {
    position: fixed;
    z-index: 69;
    inset: 0;
    content: "";
    visibility: hidden;
    background: rgba(15, 23, 42, 0.48);
    opacity: 0;
    transition: opacity 0.22s ease, visibility 0.22s ease;
  }

  body.mobile-menu-open {
    overflow: hidden;
  }

  body.mobile-menu-open::after {
    visibility: visible;
    opacity: 1;
  }

  .app-page {
    display: block;
  }

  .sidebar {
    position: fixed;
    z-index: 70;
    inset: 0 auto 0 0;
    width: min(320px, 86vw);
    min-height: 100dvh;
    overflow-y: auto;
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    box-shadow: 16px 0 40px rgba(15, 23, 42, 0.3);
  }

  .mobile-menu-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-brand {
    position: sticky;
    z-index: 1;
    top: 0;
  }

  .side-menu {
    grid-template-columns: 1fr;
    padding: 14px 10px;
  }

  .side-menu button,
  .sidebar-footer button {
    min-height: 48px;
    padding: 12px 14px;
  }

  .workspace {
    width: 100%;
  }

  .app-header {
    position: sticky;
    z-index: 60;
    top: 0;
    flex-direction: row;
    align-items: center;
    min-height: 64px;
    padding: 10px 16px;
  }

  .mobile-menu-toggle {
    display: grid;
    flex: 0 0 auto;
  }

  .app-header h1 {
    overflow: hidden;
    font-size: 1.08rem;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .header-actions {
    margin-left: auto;
  }

  .logged-user-name {
    max-width: 26vw;
  }

  .content-area {
    padding: 18px;
  }

  .panel,
  .simple-card,
  .summary-grid article {
    border-radius: 12px;
  }

  .table-wrap {
    width: 100%;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
  }

  .notification-panel {
    position: fixed;
    top: 72px;
    right: 12px;
    left: 12px;
    width: auto;
    max-height: calc(100dvh - 88px);
    overflow-y: auto;
  }
}

@media (max-width: 560px) {
  .login-page {
    align-items: center;
    padding: 16px;
  }

  .login-card {
    padding: 28px 20px;
    border-radius: 18px;
  }

  .brand-block {
    margin-bottom: 18px;
  }

  .brand-block h1 {
    font-size: 1.7rem;
  }

  input,
  select,
  textarea,
  button {
    font-size: 16px;
  }

  .app-header {
    gap: 8px;
    padding-inline: 10px;
  }

  .header-actions {
    gap: 7px;
  }

  .header-actions > .logged-user-name {
    display: none;
  }

  .content-area {
    padding: 12px;
  }

  .panel-header {
    gap: 12px;
    padding: 15px;
  }

  .summary-grid {
    gap: 10px;
  }

  .summary-grid article {
    padding: 15px;
  }

  .summary-grid strong {
    font-size: 1.65rem;
  }

  .filters,
  .single-filter {
    min-width: 0;
    width: 100%;
    grid-template-columns: minmax(0, 1fr);
  }

  .row-actions button,
  .professional-chat-actions button,
  .doctor-conversation-actions button {
    width: 100%;
    min-height: 46px;
  }

  .appointment-alert {
    top: 74px;
    right: 10px;
    width: calc(100vw - 20px);
  }

  .meet-header {
    align-items: flex-start;
    padding: 13px 14px;
  }

  .meet-heading {
    min-width: 0;
  }

  .meet-heading > div {
    min-width: 0;
  }

  .meet-header span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .meet-close {
    flex: 0 0 auto;
    padding-inline: 12px;
  }

  .meet-stage {
    gap: 10px;
    padding: 10px;
  }

  .video-tile {
    min-height: 210px;
    border-radius: 14px;
  }

  .doctor-video {
    right: 18px;
    bottom: 112px;
    width: 116px;
    min-height: 150px;
  }

  .meet-controls {
    flex-wrap: nowrap;
    gap: 7px;
    padding: 10px max(8px, env(safe-area-inset-right)) calc(10px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
    overflow-x: auto;
  }

  .meet-controls button {
    flex: 1 0 68px;
    min-width: 68px;
    min-height: 54px;
    padding: 6px;
  }
}
