/* Cartella Clinica Elettronica — stile ospedaliero CCE */
.ehr-chart {
  background: var(--surface);
  border: 1px solid var(--ehr-border);
  box-shadow: var(--shadow);
  margin-bottom: 1.25rem;
  font-size: 0.84rem;
}
.ehr-hosp-header {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.75rem;
  padding: 0.65rem 1rem;
  background: var(--ehr-header);
  color: var(--ehr-header-text);
  border-bottom: 3px solid var(--ehr-header-accent);
}
.ehr-hosp-name {
  display: block; font-family: var(--display); font-size: 0.78rem; font-weight: 700;
  letter-spacing: 0.04em; text-transform: uppercase;
}
.ehr-hosp-dept {
  display: block; font-size: 0.68rem; opacity: 0.9; margin-top: 0.15rem;
}
.ehr-hosp-meta {
  font-family: var(--mono); font-size: 0.62rem; text-align: right; opacity: 0.85;
}
.ehr-hosp-meta span { display: block; }

.ehr-patient-bar {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0;
  background: var(--ehr-banner);
  border-bottom: 1px solid var(--ehr-border);
}
.ehr-pv {
  padding: 0.55rem 0.85rem;
  border-right: 1px solid var(--ehr-border);
  border-bottom: 1px solid var(--ehr-border);
}
.ehr-pl {
  display: block; font-size: 0.58rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--muted); margin-bottom: 0.15rem;
}
.ehr-pd {
  display: block; font-family: var(--mono); font-size: 0.8rem; font-weight: 600;
  color: var(--text);
}
.ehr-pd.alert { color: var(--alert); }
.ehr-pd.ok { color: var(--success); }

.ehr-section-bar {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem;
  padding: 0.45rem 1rem;
  background: var(--ehr-section);
  border-bottom: 1px solid var(--ehr-border);
  font-family: var(--display); font-size: 0.72rem; font-weight: 700;
  color: var(--ehr-section-text);
  text-transform: uppercase; letter-spacing: 0.05em;
}
.ehr-section-bar .ehr-sec-code {
  font-family: var(--mono); font-size: 0.62rem; font-weight: 500;
  color: var(--muted); text-transform: none;
}

.ehr-body { padding: 1.25rem 1.35rem 1.5rem; }
.ehr-body h1 {
  font-family: var(--display); font-size: 1.35rem; font-weight: 700;
  color: var(--text); margin-bottom: 0.65rem; line-height: 1.3;
}
.ehr-body h1 em { font-style: normal; color: var(--clinical); }
.ehr-body > p { color: var(--muted); line-height: 1.65; margin-bottom: 0.85rem; font-size: 0.86rem; }

.ehr-tags { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0.75rem 0; }
.ehr-tag {
  font-family: var(--mono); font-size: 0.58rem; font-weight: 600;
  padding: 0.2rem 0.5rem; border: 1px solid var(--ehr-border);
  background: var(--surface2); color: var(--clinical-dark);
  text-transform: uppercase;
}
.ehr-note {
  margin-top: 0.85rem; padding: 0.55rem 0.75rem;
  border-left: 3px solid var(--clinical);
  background: var(--clinical-light);
  font-size: 0.76rem; color: var(--muted);
}

.ehr-modules {
  width: 100%; border-collapse: collapse; font-size: 0.8rem;
}
.ehr-modules th {
  text-align: left; padding: 0.5rem 0.75rem;
  background: var(--ehr-section); color: var(--ehr-section-text);
  border: 1px solid var(--ehr-border);
  font-size: 0.65rem; font-weight: 700; text-transform: uppercase;
}
.ehr-modules td {
  padding: 0.55rem 0.75rem; border: 1px solid var(--ehr-border);
  color: var(--text); vertical-align: top;
}
.ehr-modules tr:nth-child(even) td { background: var(--surface2); }
.ehr-mod-code { font-family: var(--mono); font-size: 0.68rem; color: var(--clinical); font-weight: 600; }

.ehr-auth-block { padding: 0; }
.ehr-auth-block .auth-head { padding: 1rem 1.25rem 0; }
.ehr-auth-block .auth-tabs { margin: 0.85rem 1.25rem 0; }
.ehr-auth-block .auth-panel { padding: 1rem 1.25rem 1.35rem; }
.ehr-auth-block .auth-msg { margin: 0 1.25rem; }
.ehr-auth-block .auth-success { margin: 0 1.25rem 0.85rem; }
.ehr-auth-block .auth-logged { margin: 0.85rem 1.25rem 0; }

/* Form clinico tabellare (Doctor) */
.med-block {
  border: 1px solid var(--ehr-border) !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin-bottom: 0 !important;
}
.med-block::before { display: none !important; }
.med-block legend {
  display: block; width: 100%;
  padding: 0.45rem 1rem !important;
  margin: 0 !important;
  background: var(--ehr-section) !important;
  color: var(--ehr-section-text) !important;
  border-bottom: 1px solid var(--ehr-border);
  font-size: 0.7rem !important;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.med-block .med-grid,
.med-block label:not(.med-grid label) {
  padding: 0.85rem 1rem;
}
.med-block label + label,
.med-block .med-grid { border-top: 1px solid var(--ehr-border); }
.med-block input,
.med-block select,
.med-block textarea {
  border-radius: 2px !important;
  border-color: var(--ehr-border) !important;
  background: var(--surface) !important;
}
.med-form { gap: 0 !important; border: 1px solid var(--ehr-border); }