/* Charte ESMV Pharma + signature SAMGB */
:root {
  --esmv-blue: #1b4b9c;
  --esmv-blue-dark: #143a7a;
  --esmv-blue-soft: #e8f0fb;
  --esmv-green: #4caf50;
  --esmv-green-dark: #3d8f41;
  --esmv-orange: #f0a030;
  --esmv-orange-soft: #fff4e3;
  --ink: #1a2744;
  --muted: #5a6b85;
  --line: #d5e0ef;
  --line-soft: #e8eef7;
  --surface: #ffffff;
  --page: #f4f7fc;
  --danger: #b42318;
  --danger-bg: #fff1f0;
  --radius: 12px;
  font-family: "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--page);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1200px 420px at 0% -10%, rgba(240, 160, 48, 0.12), transparent 55%),
    radial-gradient(900px 380px at 100% 0%, rgba(27, 75, 156, 0.1), transparent 50%),
    linear-gradient(180deg, #eef4fb 0%, var(--page) 38%, #f7fafc 100%);
}

header.site-header {
  background: linear-gradient(135deg, var(--esmv-blue-dark) 0%, var(--esmv-blue) 55%, #2a6bb8 100%);
  color: white;
  padding: 16px max(20px, calc((100vw - 1080px) / 2));
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  border-bottom: 4px solid var(--esmv-orange);
  box-shadow: 0 8px 24px rgba(20, 58, 122, 0.18);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-logo {
  height: 64px;
  width: auto;
  max-width: min(220px, 46vw);
  object-fit: contain;
  background: white;
  border-radius: 10px;
  padding: 6px 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
}

.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.brand-copy strong {
  font-size: 1.15rem;
  letter-spacing: 0.02em;
}

.brand-copy span {
  font-size: 0.92rem;
  color: rgba(255, 255, 255, 0.88);
}

.partner {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  text-align: right;
}

.partner-label {
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.75);
}

.partner-logo {
  height: 44px;
  width: auto;
  max-width: min(180px, 40vw);
  object-fit: contain;
  background: white;
  border-radius: 8px;
  padding: 4px 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

main {
  max-width: 1080px;
  margin: 30px auto;
  padding: 0 20px;
}

h1 {
  font-size: 28px;
  margin: 0 0 8px;
  color: var(--esmv-blue-dark);
}

h2 {
  font-size: 19px;
  margin-top: 0;
  color: var(--esmv-blue);
}

p {
  color: var(--muted);
  line-height: 1.6;
}

.top,
.tools,
.stats {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.top {
  justify-content: space-between;
}

.card,
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-top: 20px;
  box-shadow: 0 1px 0 rgba(27, 75, 156, 0.04);
}

.stats .stat {
  flex: 1;
  min-width: 130px;
}

.stat b {
  font-size: 27px;
  display: block;
  color: var(--esmv-blue);
}

.stat small {
  color: var(--muted);
}

button,
input,
select {
  font: inherit;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: white;
  color: var(--ink);
}

button {
  cursor: pointer;
  font-weight: 600;
}

button.primary {
  background: var(--esmv-blue);
  border-color: var(--esmv-blue);
  color: white;
}

button.primary:hover:not(:disabled) {
  background: var(--esmv-blue-dark);
  border-color: var(--esmv-blue-dark);
}

button:disabled {
  opacity: 0.5;
  cursor: wait;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(240, 160, 48, 0.55);
  outline-offset: 2px;
}

#search {
  flex: 1;
  min-width: 180px;
}

.entry {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line-soft);
}

.thumb {
  width: 112px;
  height: 112px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--esmv-blue-soft);
  display: grid;
  place-items: center;
  color: #7a8eae;
  flex-shrink: 0;
}

.detail {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.detail strong,
.detail small {
  display: block;
}

.detail small {
  color: var(--muted);
  margin-top: 5px;
}

.tag {
  font-size: 12px;
  color: #9a6b16;
  margin-top: 7px;
}

.ok {
  color: var(--esmv-green-dark);
}

.empty {
  text-align: center;
  padding: 40px;
  color: var(--muted);
}

#message {
  padding: 14px;
  background: var(--esmv-blue-soft);
  border-radius: 8px;
  margin-top: 18px;
  border: 1px solid #c9daf2;
}

#message.error {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: #f0c2bd;
}

[hidden] {
  display: none !important;
}

label {
  display: block;
  font-size: 14px;
  margin: 12px 0 6px;
}

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 14px;
}

td,
th {
  text-align: left;
  border-bottom: 1px solid var(--line-soft);
  padding: 9px;
  overflow-wrap: anywhere;
}

footer.site-footer {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  padding: 28px 20px 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.footer-logos {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  flex-wrap: wrap;
}

.footer-logos img {
  height: 36px;
  width: auto;
  object-fit: contain;
}

.footer-logos .divider {
  width: 1px;
  height: 28px;
  background: var(--line);
}

.hint {
  font-size: 13px;
}

.pager {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  margin-top: 18px;
}

@media (max-width: 600px) {
  header.site-header {
    flex-wrap: wrap;
    padding: 14px 16px;
  }

  .brand-logo {
    height: 52px;
  }

  .partner-logo {
    height: 36px;
  }

  .brand-copy strong {
    font-size: 1rem;
  }

  .entry {
    gap: 10px;
  }

  .thumb {
    width: 76px;
    height: 90px;
  }

  .entry button {
    font-size: 12px;
    padding: 9px;
  }

  h1 {
    font-size: 23px;
  }
}

.login-card {
  max-width: 440px;
  margin: 48px auto;
  padding: 28px;
}

.login-card input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin: 8px 0 20px;
}

.login-card button {
  width: 100%;
}

.login-card h1 {
  color: var(--esmv-blue);
}

.entry-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 190px;
}

.web-review {
  color: #b56a00;
}

.detail a {
  font-size: 12px;
  color: var(--esmv-blue);
}

#webLimit {
  width: 85px;
}

@media (max-width: 600px) {
  .entry {
    flex-wrap: wrap;
  }

  .entry-actions {
    flex-direction: row;
    max-width: 100%;
    margin-left: auto;
  }
}

.web-pick-dialog {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0;
  max-width: min(720px, 94vw);
  width: 100%;
  color: var(--ink);
  background: #f8fafc;
  box-shadow: 0 12px 40px rgba(20, 58, 122, 0.2);
}

.web-pick-dialog::backdrop {
  background: rgba(20, 58, 122, 0.4);
}

.web-pick-dialog form {
  margin: 0;
  padding: 20px 22px 24px;
}

.web-pick-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.web-pick-header h2 {
  margin: 0;
  font-size: 1.15rem;
  color: var(--esmv-blue);
}

.web-pick-close {
  background: var(--esmv-blue-soft);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px 12px;
  cursor: pointer;
}

.web-pick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.web-pick-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  text-align: left;
  font: inherit;
  color: inherit;
}

.web-pick-card:hover {
  border-color: var(--esmv-blue);
}

.web-pick-card.selected {
  border-color: var(--esmv-blue);
  box-shadow: 0 0 0 2px rgba(27, 75, 156, 0.25);
}

.web-pick-card.is-busy {
  opacity: 0.6;
}

.web-pick-card.is-busy button {
  cursor: wait;
}

.web-pick-card img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: contain;
  background: var(--esmv-blue-soft);
  border-radius: 6px;
  cursor: zoom-in;
}

.web-pick-card img:focus-visible {
  outline: 2px solid var(--esmv-blue);
  outline-offset: 2px;
}

.web-pick-card .rank {
  font-size: 12px;
  font-weight: 700;
  color: var(--esmv-blue);
}

.web-pick-card .score {
  font-size: 11px;
  color: var(--muted);
}

.web-pick-card .title {
  font-size: 11px;
  line-height: 1.3;
  max-height: 2.6em;
  overflow: hidden;
}

.web-pick-card .choose {
  margin-top: 2px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--esmv-blue-soft);
  color: var(--esmv-blue);
  padding: 6px 8px;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.web-pick-card .choose:hover {
  border-color: var(--esmv-blue);
}

.web-pick-card .choose:disabled {
  opacity: 0.6;
  cursor: wait;
}

.web-pick-zoom-dialog {
  z-index: 30;
}

.web-pick-zoom-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.web-pick-zoom-actions button {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px 12px;
  font: inherit;
  cursor: pointer;
  background: #fff;
}

.web-pick-zoom-actions .primary {
  background: var(--esmv-blue);
  border-color: var(--esmv-blue);
  color: #fff;
}

.web-pick-zoom-actions .primary:disabled {
  opacity: 0.6;
  cursor: wait;
}

.web-pick-section {
  margin-top: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.web-pick-section:first-of-type {
  margin-top: 8px;
}

.web-pick-section h3 {
  margin: 0 0 4px;
  font-size: 0.98rem;
  color: var(--esmv-blue);
}

.web-pick-section .hint {
  margin-top: 0;
}

.web-pick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 4px;
}

.web-pick-actions button {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px 12px;
  font: inherit;
  cursor: pointer;
  background: #fff;
}

.web-pick-actions .primary {
  background: var(--esmv-blue);
  border-color: var(--esmv-blue);
  color: #fff;
}

.web-pick-actions button:disabled {
  opacity: 0.6;
  cursor: wait;
}

.thumb.zoomable {
  cursor: zoom-in;
}

.thumb.zoomable:focus-visible {
  outline: 2px solid var(--esmv-blue);
  outline-offset: 2px;
}

.photo-zoom-dialog {
  border: none;
  border-radius: 14px;
  padding: 0;
  max-width: min(960px, 96vw);
  width: 100%;
  color: var(--ink);
  background: #f8fafc;
  box-shadow: 0 16px 48px rgba(20, 58, 122, 0.28);
}

.photo-zoom-dialog::backdrop {
  background: rgba(20, 58, 122, 0.45);
}

.photo-zoom-form {
  margin: 0;
  padding: 18px 20px 22px;
}

.photo-zoom-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.photo-zoom-header h2 {
  margin: 0;
  font-size: 1.2rem;
  color: var(--esmv-blue);
  line-height: 1.3;
}

.photo-zoom-body {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(200px, 0.9fr);
  gap: 18px;
  align-items: start;
}

.photo-zoom-body img {
  width: 100%;
  max-height: min(78vh, 720px);
  object-fit: contain;
  background: var(--esmv-blue-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.photo-zoom-meta {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.photo-zoom-meta p {
  margin: 0;
  font-size: 14px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.photo-zoom-meta .label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.photo-zoom-meta strong {
  font-size: 16px;
  color: var(--esmv-blue);
}

@media (max-width: 700px) {
  .photo-zoom-body {
    grid-template-columns: 1fr;
  }

  .photo-zoom-body img {
    max-height: 55vh;
  }
}
