:root {
  --app-bg: #f3f6f8;
  --app-surface: #ffffff;
  --app-surface-muted: #f8fafc;
  --app-border: #d9e2ec;
  --app-text: #17202a;
  --app-muted: #64748b;
  --app-primary: #0f766e;
  --app-primary-hover: #115e59;
  --app-action: #2563eb;
  --app-action-hover: #1d4ed8;
  --app-secondary: #475569;
  --app-secondary-hover: #334155;
  --app-danger: #b91c1c;
  --app-radius: 8px;
  --app-shadow: 0 2px 8px rgba(15, 23, 42, .08);
}

html {
  background: var(--app-bg);
}

body {
  background: var(--app-bg) !important;
  color: var(--app-text) !important;
  font-family: Arial, Helvetica, sans-serif !important;
  top: 0 !important;
  padding-top: 64px !important;
}

.app-shell-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 3000;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 16px;
  min-height: 64px;
  width: 100vw;
  margin: 0;
  padding: 10px 22px;
  background: rgba(255, 255, 255, .96);
  border-bottom: 1px solid rgba(203, 213, 225, .9);
  box-shadow: 0 8px 24px rgba(15, 23, 42, .08);
  backdrop-filter: blur(12px);
}

.app-shell-topbar,
.app-shell-topbar *,
.app-shell-menu,
.app-shell-menu * {
  font-family: Arial, Helvetica, sans-serif !important;
  font-size: 11px !important;
  font-weight: 400 !important;
}

.app-shell-brand,
.app-shell-user,
.app-shell-logo {
  display: flex !important;
  align-items: center !important;
}

.app-shell-brand {
  gap: 14px;
  min-width: 0;
}

.app-shell-logo {
  gap: 10px;
  color: #0f172a;
  font-size: 21px;
  font-weight: 800;
  text-decoration: none;
  letter-spacing: 0;
}

.app-shell-logo:hover {
  color: #0f172a;
  text-decoration: none;
}

.app-shell-logo img {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.app-shell-menu-button,
.app-shell-menu-close {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 40px;
  height: 40px;
  min-width: 40px;
  margin: 0 !important;
  padding: 0 !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 10px !important;
  background: linear-gradient(180deg, #ffffff, #f8fafc) !important;
  color: var(--app-text) !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .06) !important;
  transition: background .16s ease, border-color .16s ease, box-shadow .16s ease;
}

.app-shell-menu-button:hover,
.app-shell-menu-close:hover {
  background: #f1f5f9 !important;
  border-color: #94a3b8 !important;
  box-shadow: 0 2px 8px rgba(15, 23, 42, .08) !important;
}

.app-shell-menu-button {
  flex-direction: column;
  gap: 4px;
}

.app-shell-menu-button span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--app-text);
  border-radius: 2px;
}

.app-shell-user {
  gap: 10px;
  min-width: 0;
}

.app-shell-user-chip {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 38px;
  max-width: min(360px, 42vw);
  overflow: hidden;
  padding: 4px 10px 4px 5px;
  border: 1px solid #dbe4ef;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .05);
}

.app-shell-user-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  border-radius: 999px;
  background: #0f766e;
  color: #ffffff;
  font-size: 10px;
  font-weight: 800;
}

.app-shell-user-name {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: #0f172a;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-shell-logout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  width: 40px;
  min-width: 40px;
  padding: 0;
  border-radius: 10px;
  background: #334155;
  color: #ffffff !important;
  font-weight: 700;
  text-decoration: none !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .12);
  transition: background .16s ease, transform .16s ease, box-shadow .16s ease;
}

.app-shell-logout:hover {
  background: #1e293b;
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(15, 23, 42, .18);
  transform: translateY(-1px);
}

.app-shell-logout span {
  position: relative;
  display: block;
  width: 20px;
  height: 20px;
}

.app-shell-logout span::before {
  content: "";
  position: absolute;
  left: 1px;
  top: 3px;
  width: 9px;
  height: 14px;
  border: 2px solid currentColor;
  border-right: 0;
  border-radius: 2px 0 0 2px;
}

.app-shell-logout span::after {
  content: "";
  position: absolute;
  top: 9px;
  right: 2px;
  width: 12px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
}

.app-shell-logout span i {
  position: absolute;
  top: 6px;
  right: 1px;
  width: 8px;
  height: 8px;
  border-top: 2px solid currentColor;
  border-right: 2px solid currentColor;
  transform: rotate(45deg);
}

.app-shell-menu {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 3020;
  width: min(340px, 88vw);
  height: 100vh;
  transform: translateX(-105%);
  transition: transform .18s ease;
  background: #ffffff;
  border-right: 1px solid #dbe4ef;
  box-shadow: 12px 0 34px rgba(15, 23, 42, .22);
  pointer-events: none;
  visibility: hidden;
}

.app-shell-menu.open {
  transform: translateX(0);
  pointer-events: auto;
  visibility: visible;
}

.app-shell-menu-header {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  min-height: 72px;
  padding: 14px 16px;
  border-bottom: 1px solid #e2e8f0;
  background: linear-gradient(180deg, #ffffff, #f8fafc);
  color: #0f172a;
  font-weight: 800;
}

.app-shell-menu-header div {
  display: grid;
  gap: 3px;
}

.app-shell-menu-header small {
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.app-shell-menu-nav {
  display: grid;
  gap: 6px;
  padding: 14px;
}

.app-shell-menu-nav a {
  display: block;
  padding: 12px 13px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: #1e293b;
  font-weight: 700;
  text-decoration: none;
  transition: background .16s ease, border-color .16s ease, color .16s ease;
}

.app-shell-menu-nav a:hover {
  background: #f1f5f9;
  border-color: #e2e8f0;
  color: #0f172a;
  text-decoration: none;
}

.app-shell-menu-backdrop {
  position: fixed;
  inset: 0;
  z-index: 3010;
  background: rgba(15, 23, 42, .36);
}

.app-shell-menu-backdrop[hidden] {
  display: none !important;
  pointer-events: none !important;
}

body.app-shell-menu-open {
  overflow: hidden;
}

.skiptranslate,
.goog-te-banner-frame,
.goog-te-balloon-frame,
.goog-tooltip,
.goog-tooltip:hover,
#goog-gt-tt,
iframe.skiptranslate {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  width: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

body > :not(script):not(style):not(.app-shell-topbar):not(.app-shell-menu):not(.app-shell-menu-backdrop):not(#custom-alert) {
  display: block !important;
  align-items: initial !important;
  justify-content: initial !important;
}

script,
style {
  display: none !important;
}

.container,
main {
  max-width: 1180px;
  margin-left: auto !important;
  margin-right: auto !important;
}

.container {
  padding-left: 14px;
  padding-right: 14px;
}

.card,
article {
  background: var(--app-surface) !important;
  border: 1px solid var(--app-border) !important;
  border-radius: var(--app-radius) !important;
  box-shadow: var(--app-shadow) !important;
}

.main_header,
.header,
.topbar.app-header {
  background: var(--app-primary) !important;
  color: #fff !important;
  border-radius: var(--app-radius) !important;
  box-shadow: var(--app-shadow) !important;
}

.main_header h1,
.main_header h2,
.header h1,
.header h2,
.header-title {
  color: #fff !important;
}

.btn,
button,
input[type="submit"],
#submit,
#btnInvoice,
#btnLogout,
#btnPrint,
#btnBack {
  border: 0 !important;
  border-radius: var(--app-radius) !important;
  box-shadow: none !important;
  cursor: pointer;
  font-weight: 700 !important;
  text-decoration: none !important;
}

.btn,
button,
input[type="submit"] {
  margin: 10px !important;
  padding: 10px 14px !important;
}

.btn:not(.secondary):not(.btn-secondary):not(.btn-danger),
a.btn:not(.secondary):not(.btn-secondary):not(.btn-danger) {
  background: var(--app-action) !important;
  color: #fff !important;
}

.btn:not(.secondary):not(.btn-secondary):not(.btn-danger):hover,
a.btn:not(.secondary):not(.btn-secondary):not(.btn-danger):hover {
  background: var(--app-action-hover) !important;
  color: #fff !important;
}

.btn-primary,
.btn.primary,
button[type="submit"],
input[type="submit"],
#submit,
#btnInvoice {
  background: var(--app-action) !important;
  color: #fff !important;
}

.btn-primary:hover,
.btn.primary:hover,
button[type="submit"]:hover,
input[type="submit"]:hover,
#submit:hover,
#btnInvoice:hover {
  background: var(--app-action-hover) !important;
  color: #fff !important;
}

.btn-secondary,
.btn.secondary,
#btnLogout,
#btnBack {
  background: var(--app-secondary) !important;
  color: #fff !important;
}

.btn-secondary:hover,
.btn.secondary:hover,
#btnLogout:hover,
#btnBack:hover {
  background: var(--app-secondary-hover) !important;
  color: #fff !important;
}

.btn-danger,
button.btn-danger {
  background: var(--app-danger) !important;
  color: #fff !important;
}

input,
select,
textarea,
.input,
.select {
  border: 1px solid var(--app-border) !important;
  border-radius: var(--app-radius) !important;
  background: #fff !important;
  color: var(--app-text) !important;
}

input:focus,
select:focus,
textarea:focus,
.input:focus,
.select:focus {
  border-color: var(--app-primary) !important;
  outline: 2px solid rgba(15, 118, 110, .14) !important;
}

table {
  background: var(--app-surface) !important;
}

th,
thead th {
  background: var(--app-surface-muted) !important;
  color: var(--app-text) !important;
  border-bottom: 1px solid var(--app-border) !important;
}

td {
  border-color: var(--app-border) !important;
}

.empty,
.field,
.patient-box {
  background: var(--app-surface-muted) !important;
  border-radius: var(--app-radius) !important;
}

.actions,
.topbar,
.header-actions {
  gap: 10px;
}

a {
  color: inherit;
}

@media (max-width: 700px) {
  body {
    margin: 0 !important;
    padding-top: 54px !important;
  }

  .app-shell-topbar {
    gap: 10px;
    min-height: 54px;
    padding: 7px 10px;
  }

  .app-shell-logo span {
    font-size: 18px;
  }

  .app-shell-user-chip {
    max-width: 48vw;
    padding-right: 8px;
  }

  .app-shell-user-avatar {
    width: 22px;
    height: 22px;
    flex-basis: 22px;
  }

  .app-shell-user-name {
    font-size: 10px;
  }

  .app-shell-logout {
    width: 38px;
    min-width: 38px;
    min-height: 36px;
  }

  .container,
  main,
  .page {
    padding-left: 10px !important;
    padding-right: 10px !important;
  }

  .btn,
  button,
  input[type="submit"],
  #btnInvoice,
  #btnLogout,
  #btnPrint,
  #btnBack {
    min-height: 42px;
  }
}
