* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Segoe UI", Helvetica, Arial, sans-serif;
  color: #0b2545;
  background: #f4f7f8;
}

.top {
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  padding: 28px 24px 22px;
}

.logo {
  display: block;
  height: 52px;
  width: auto;
}

h1 {
  margin: 18px 0 0;
  font-size: 1.75rem;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.lead {
  margin: 8px 0 0;
  max-width: 40rem;
  color: #475569;
  font-size: 1.02rem;
  line-height: 1.5;
}

.report-menu {
  max-width: 64rem;
  padding: 28px 24px 48px;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.tool-group h2 {
  margin: 0 0 0.55rem;
  padding: 0 0.15rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: #64748b;
}

.tools {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16.5rem, 1fr));
  gap: 0.6rem;
}

.tool-btn {
  font: inherit;
  font-size: 0.92rem;
  font-weight: 650;
  text-align: left;
  color: #0b2545;
  background: #fff;
  border: 1px solid #d6dee8;
  border-radius: 12px;
  padding: 0.7rem 0.85rem 0.7rem 0.95rem;
  min-height: 4.15rem;
  cursor: pointer;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 0.7rem;
  row-gap: 0.08rem;
  align-items: center;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

.tool-name {
  grid-column: 1;
  grid-row: 1;
  font-weight: 700;
  line-height: 1.25;
}

.tool-hint {
  grid-column: 1;
  grid-row: 2;
  font-size: 0.78rem;
  font-weight: 450;
  line-height: 1.35;
  color: #64748b;
}

.tool-btn::after {
  content: "";
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  width: 0.45rem;
  height: 0.45rem;
  margin-right: 0.2rem;
  border-right: 2px solid #1d4ed8;
  border-top: 2px solid #1d4ed8;
  transform: rotate(45deg);
}

.tool-btn:hover,
.tool-btn:focus-visible {
  border-color: #1d4ed8;
  background: #f8fbff;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.07);
  transform: translateY(-1px);
}

.hidden { display: none; }

.asap-review-add-dialog {
  border: none;
  border-radius: 18px;
  padding: 0;
  width: min(42rem, calc(100vw - 2rem));
  max-height: min(90vh, 720px);
  margin: 0;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: transparent;
  color: #0b2545;
}

.asap-review-add-dialog::backdrop {
  background: rgba(15, 23, 42, 0.48);
}

.asap-review-add-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.3rem 1.35rem 1.2rem;
  max-height: min(90vh, 720px);
  overflow: auto;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.22);
}

.asap-review-add-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.85rem;
}

.asap-review-add-title {
  margin: 0;
  font-size: 1.12rem;
  font-weight: 650;
}

.asap-review-add-hint,
.ai-panel-copy,
.ai-drop-copy,
.ai-progress {
  color: #64748b;
  font-size: 0.88rem;
  line-height: 1.45;
}

.asap-review-add-hint,
.ai-panel-copy,
.ai-progress { margin: 0; }

.asap-review-add-close-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  background: #f8fafc;
  color: #64748b;
  cursor: pointer;
}

.ai-drop {
  position: relative;
  border: 1.5px dashed #cbd5e1;
  border-radius: 12px;
  background: #f8fafc;
  padding: 1.6rem 1rem;
  text-align: center;
  cursor: pointer;
}

.ai-drop:hover,
.ai-drop.is-drag {
  border-color: #1d4ed8;
  background: #eff6ff;
}

.ai-file-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.ai-drop-title {
  font-weight: 750;
  margin: 0 0 0.2rem;
}

.ai-file-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.ai-file-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.4rem 0.55rem;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
  font-size: 0.88rem;
}

.ai-tracking-params {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.field-label {
  font-size: 0.85rem;
  font-weight: 650;
  color: #334155;
}

.field input {
  font: inherit;
  font-size: 0.95rem;
  padding: 0.7rem 0.85rem;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
}

.ai-scope-toggle {
  display: flex;
  width: 100%;
  padding: 0.22rem;
  gap: 0.2rem;
  margin: 0.35rem 0 0.85rem;
  background: #eef2f6;
  border: 1px solid #dbe3ee;
  border-radius: 12px;
}

.ai-scope-toggle-btn {
  flex: 1;
  border: none;
  background: transparent;
  color: #64748b;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 650;
  line-height: 1.2;
  padding: 0.55rem 0.8rem;
  border-radius: 9px;
  cursor: pointer;
}

.ai-scope-toggle-btn:hover {
  color: #0b2545;
}

.ai-scope-toggle-btn.is-active {
  background: #fff;
  color: #0b2545;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.14);
}

.ai-scope-toggle-btn:focus-visible {
  outline: 2px solid #93c5fd;
  outline-offset: 2px;
}

.ai-scope-toggle-btn:disabled {
  cursor: default;
  opacity: 0.55;
}

.asap-review-add-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
}

.btn-primary,
.btn-secondary {
  font: inherit;
  font-size: 0.88rem;
  font-weight: 650;
  padding: 0.55rem 1.05rem;
  border-radius: 999px;
  cursor: pointer;
}

.btn-primary {
  background: #1d4ed8;
  color: #fff;
  border: 1px solid #1d4ed8;
}

.btn-primary:disabled,
.btn-secondary:disabled {
  opacity: 0.55;
  cursor: default;
}

.btn-secondary {
  background: #fff;
  color: #334155;
  border: 1px solid #e2e8f0;
}

.form-message {
  margin: 0;
  font-size: 0.9rem;
  padding: 0.5rem 0.7rem;
  border-radius: 8px;
}

.form-message--error {
  color: #991b1b;
  background: #fee2e2;
}

.pdf-password-dialog { width: min(28rem, calc(100vw - 2rem)); }

.pdf-password-dialog .btn-secondary { order: 1; }

.pdf-password-dialog .btn-primary { order: 2; }

.ai-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.ai-patient-pick {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  padding: 0.75rem 0.85rem;
}

.ai-patient-pick.hidden { display: none; }

.ai-patient-pick-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.ai-patient-pick-title {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 650;
}

.ai-patient-pick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.ai-patient-pick-note {
  margin: 0.45rem 0 0.55rem;
  color: #64748b;
  font-size: 0.88rem;
}

.ai-patient-pick-search {
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 0.45rem;
  padding: 0.4rem 0.55rem;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  color: #0b2545;
  font: inherit;
}

.ai-patient-pick-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 240px;
  overflow: auto;
}

.ai-patient-pick-list label {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  padding: 0.28rem 0.15rem;
  cursor: pointer;
}

.ai-patient-pick-name {
  min-width: 0;
  overflow-wrap: anywhere;
}

.ai-patient-pick-count {
  color: #64748b;
  font-size: 0.82rem;
  margin-left: auto;
  white-space: nowrap;
}

.ai-patient-pick-empty {
  color: #64748b;
  padding: 0.35rem 0.15rem;
}

.ai-review-effort {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
  color: #64748b;
  font-size: 0.92rem;
}

.ai-review-effort select {
  font: inherit;
  font-size: 0.92rem;
  color: #0b2545;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 0.45rem 0.7rem;
  min-width: 12rem;
}

.ai-excel-check {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: #334155;
  font-size: 0.92rem;
}

.ai-dressing-dialog {
  width: min(58rem, calc(100vw - 1.5rem));
  max-height: min(88vh, 920px);
}

.ai-dressing-dialog .asap-review-add-form {
  max-height: min(88vh, 920px);
  gap: 0.7rem;
}

.ai-dressing-sticky {
  position: sticky;
  top: -1.3rem;
  z-index: 3;
  background: #fff;
  margin: -1.3rem -1.35rem 0;
  padding: 1.15rem 1.35rem 0.7rem;
  border-bottom: 1px solid #e2e8f0;
}

.ai-dressing-lists {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
  padding: 0.55rem 0.75rem 0.7rem;
}

.ai-dressing-lists summary {
  cursor: pointer;
  font-size: 0.86rem;
  font-weight: 700;
  color: #334155;
}

.ai-dressing-label {
  margin: 0 0 0.3rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
}

.ai-dressing-choice-block { margin: 0.7rem 0 0; }

.ai-dressing-choice-list,
.ai-dressing-choice-add,
.ai-dressing-name-list,
.ai-dressing-rules-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.ai-dressing-rules-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.ai-dressing-card {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 0.75rem 0.85rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  background: #fff;
}

.ai-dressing-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.ai-dressing-card-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 750;
}

.ai-dressing-card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem 0.85rem;
}

.ai-dressing-field-wide { grid-column: 1 / -1; }

.ai-dressing-field {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748b;
}

.ai-dressing-field input,
.ai-dressing-name-list input,
.ai-dressing-choice-edit input,
.ai-dressing-choice-add input,
.ai-dressing-pick-btn,
.ai-dressing-choice-lock {
  font: inherit;
  padding: 0.35rem 0.5rem;
  box-sizing: border-box;
  color: #0f172a;
  font-weight: 500;
  border: 1px solid #d6dee8;
  border-radius: 8px;
  background: #fff;
}

.ai-dressing-name-list {
  flex-direction: column;
  align-items: stretch;
}

.ai-dressing-name-list > div,
.ai-dressing-choice-edit {
  display: flex;
  gap: 0.35rem;
  align-items: center;
}

.ai-dressing-name-list input { flex: 1 1 auto; width: 100%; min-width: 0; }

.ai-dressing-text-btn,
.ai-dressing-icon-btn {
  font: inherit;
  cursor: pointer;
  background: transparent;
  border: 0;
}

.ai-dressing-text-btn {
  padding: 0.15rem 0;
  color: #0f766e;
  font-size: 0.82rem;
  font-weight: 700;
}

.ai-dressing-icon-btn {
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 8px;
  color: #64748b;
  font-size: 1.1rem;
  line-height: 1;
}

.ai-dressing-pick { position: relative; }

.ai-dressing-pick-btn {
  width: 100%;
  text-align: left;
  padding-right: 1.7rem;
  cursor: pointer;
}

.ai-dressing-pick-menu {
  position: absolute;
  z-index: 5;
  left: 0;
  right: 0;
  top: calc(100% + 0.2rem);
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 0.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  max-height: 14rem;
  overflow: auto;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
}

.ai-dressing-pick-menu label {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  font-weight: 500;
}

@media (max-width: 640px) {
  .ai-tracking-params { grid-template-columns: 1fr; }
  .tools { grid-template-columns: 1fr; }
  .ai-dressing-card-grid { grid-template-columns: 1fr; }
}
