* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  background: #f5f7fb;
  color: #1f2937;
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 20px 60px;
}

h1 {
  margin: 0 0 8px;
  font-size: 32px;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
}

.app-header .subtitle {
  margin-bottom: 0;
}

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  padding: 32px 28px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

.login-card h1 {
  font-size: 28px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-form .control {
  min-width: 0;
}

.login-form input[type="text"],
.login-form input[type="email"],
.login-form input[type="password"] {
  width: 100%;
  min-width: 0;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 15px;
}

.login-submit {
  width: 100%;
  margin-top: 4px;
}

.login-error {
  min-height: 20px;
  margin: 0;
  color: #dc2626;
  font-size: 14px;
}

.login-ok {
  margin: 0;
  color: #047857;
  font-size: 14px;
}

.login-dev {
  margin: 0;
  font-size: 13px;
  color: #4b5563;
  word-break: break-all;
}

.login-links {
  margin: 16px 0 0;
  font-size: 14px;
  color: #4b5563;
  line-height: 1.5;
}

.login-links a,
.ghost-link {
  color: #1d4ed8;
  font-weight: 600;
  text-decoration: none;
}

@media (max-width: 720px) {
  .login-page {
    padding: 16px;
    align-items: flex-start;
  }

  .login-card {
    padding: 22px 18px;
    border-radius: 14px;
  }

  .login-card h1 {
    font-size: 22px;
  }

  .login-form input[type="text"],
  .login-form input[type="email"],
  .login-form input[type="password"],
  .login-submit {
    padding: 10px 12px;
  }
}

a.btn-link {
  display: inline-block;
  border: none;
  border-radius: 10px;
  padding: 12px 16px;
  background: #2563eb;
  color: #fff;
  cursor: pointer;
  font-weight: 600;
  text-decoration: none;
  line-height: 1.2;
}

a.btn-link:hover {
  background: #1d4ed8;
}

[hidden] {
  display: none !important;
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.header-actions a.btn-link,
.header-actions a.ghost-link,
.header-actions button {
  box-sizing: border-box;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  padding: 10px 14px;
  border-radius: 10px;
  margin: 0;
}

.header-actions a.ghost-link {
  display: inline-block;
  background: #e5e7eb;
  color: #111827;
  text-decoration: none;
}

.header-actions a.ghost-link:hover {
  background: #d1d5db;
}

.user-chip {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  font-size: 13px;
  min-width: 0;
  max-width: min(420px, 100%);
}

.user-profile-line {
  color: #111827;
  font-weight: 600;
  text-align: right;
  word-break: break-word;
  overflow-wrap: anywhere;
  line-height: 1.35;
}

.user-chip .match-field {
  margin-top: 0;
}

@media (max-width: 720px) {
  .user-chip {
    width: 100%;
    max-width: none;
    align-items: flex-start;
  }

  .user-profile-line {
    text-align: left;
    font-size: 12px;
  }
}

.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
}

.admin-tabs button {
  background: #e5e7eb;
  color: #111827;
}

.admin-tabs button.current {
  background: #1d4ed8;
  color: #fff;
}

.admin-card {
  margin-bottom: 16px;
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
}

.admin-actions input,
.admin-actions select {
  min-width: 160px;
  flex: 1;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 10px 12px;
}

.admin-member-box {
  margin-top: 12px;
}

.notice-banner {
  margin: 0 0 16px;
  padding: 10px 14px;
  border-radius: 10px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 14px;
}

.notice-box {
  margin: 0 0 20px;
  padding: 12px 18px;
  border: 1px solid #dbeafe;
  border-radius: 12px;
  background: #eff6ff;
}

.notice-details {
  margin: 0;
}

.notice-heading {
  margin: 0;
  font-size: 18px;
  color: #1e3a8a;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}

.notice-heading::-webkit-details-marker {
  display: none;
}

.notice-heading::before {
  content: "▶ ";
  font-size: 12px;
}

.notice-details[open] > .notice-heading::before {
  content: "▼ ";
}

.notice-details[open] > .notice-heading {
  margin-bottom: 10px;
}

.notice-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.notice-item {
  padding: 10px 12px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid #e2e8f0;
}

.notice-item-title {
  display: block;
  margin: 0 0 4px;
  color: #1e40af;
  font-size: 14px;
}

.notice-item-body {
  margin: 0;
  color: #334155;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.admin-layout {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(280px, 1.2fr);
  gap: 16px;
}

.admin-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.admin-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  width: 100%;
  text-align: left;
  background: #f8fafc;
  color: #111827;
  border: 1px solid #e5e7eb;
}

.admin-item span {
  font-size: 13px;
  font-weight: 500;
  color: #6b7280;
}

.admin-item.current {
  border-color: #2563eb;
  background: #eff6ff;
}

.admin-member {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #f1f5f9;
}

.admin-member-info {
  min-width: 0;
  flex: 1 1 auto;
}

.admin-member .admin-actions {
  margin-top: 0;
}

.admin-member-actions {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex: 0 1 auto;
  margin-left: auto;
  max-width: 100%;
}

.admin-member-btns {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
}

.admin-member-btns select,
.admin-member-actions select,
.admin-member select {
  min-width: 120px;
  width: auto;
  max-width: 100%;
  flex: 0 0 auto;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
}

.admin-member span {
  display: block;
  font-size: 13px;
  color: #6b7280;
}

.monitor-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.nl-cache-settings-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}

.nl-cache-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
  user-select: none;
}

.nl-cache-toggle input {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.monitor-scope-tabs {
  margin: 0;
}

.monitor-panel-tabs {
  margin: 0 0 12px;
}

.monitor-panel-tabs button {
  font-size: 14px;
}

.monitor-entity-list {
  display: grid;
  gap: 8px;
}

.monitor-entity {
  cursor: pointer;
}

.monitor-entity:hover {
  border-color: #93c5fd;
  background: #f8fbff;
}

.monitor-selection-bar {
  margin: 0 0 10px;
}

.glossary-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.glossary-toolbar {
  margin-top: 14px;
}

.glossary-toolbar input[type="search"] {
  min-width: 180px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
}

.glossary-list {
  display: grid;
  gap: 10px;
}

.glossary-item .match-field {
  display: inline-block;
  margin-bottom: 4px;
}

@media (max-width: 720px) {
  .glossary-form-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .glossary-form-actions button {
    width: 100%;
    min-width: 0;
  }

  .glossary-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .glossary-toolbar input[type="search"] {
    width: 100%;
    min-width: 0;
  }

  .glossary-toolbar .monitor-controls {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .glossary-toolbar .monitor-controls button {
    width: 100%;
  }
}

@media (max-width: 720px) {
  .monitor-panel-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .monitor-panel-tabs button {
    width: 100%;
    padding: 8px 10px;
    font-size: 13px;
  }

  .monitor-selection-bar .ghost {
    width: 100%;
  }
}

.monitor-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.monitor-period {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #4b5563;
}

.monitor-period select {
  min-width: 110px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
}

@media (max-width: 720px) {
  .app-header {
    flex-direction: column;
    align-items: stretch;
  }

  .header-actions {
    width: 100%;
    justify-content: flex-end;
  }

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

  .admin-member {
    flex-direction: column;
    align-items: stretch;
  }

  .admin-member-actions {
    width: 100%;
    margin-left: 0;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .admin-member-actions select {
    min-width: 0;
    flex: 1 1 auto;
  }

  .admin-member-actions button {
    flex: 0 0 auto;
  }

  .monitor-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .nl-cache-settings-row {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .nl-cache-settings-row .btn {
    width: 100%;
  }

  .monitor-controls {
    margin-left: 0;
    justify-content: flex-end;
  }
}

.subtitle {
  margin: 0 0 20px;
  color: #4b5563;
}

.search-panel {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: end;
}

.nl-panel {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid #dbe3ef;
}

.nl-panel h2 {
  margin: 0 0 8px;
  font-size: 22px;
}

textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 15px;
  resize: vertical;
  background: #fff;
}

.nl-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.control {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 190px;
}

.control span {
  font-size: 13px;
  color: #4b5563;
}

select {
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 15px;
  background: #fff;
}

input[type="text"] {
  flex: 1;
  min-width: 260px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 15px;
}

button {
  border: none;
  border-radius: 10px;
  padding: 12px 16px;
  background: #2563eb;
  color: #fff;
  cursor: pointer;
  font-weight: 600;
}

button.ghost {
  background: #e5e7eb;
  color: #111827;
}

button.ghost.danger {
  background: #fee2e2;
  color: #b91c1c;
}

button.ghost.danger:hover {
  background: #fecaca;
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.result-meta {
  margin: 16px 0;
  color: #374151;
  font-size: 14px;
}

.result-list {
  display: grid;
  gap: 12px;
}

.card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 16px;
}

.card h2 {
  margin: 0 0 6px;
  font-size: 20px;
}

.profile-summary {
  margin-bottom: 14px;
}

.profile-form {
  margin-top: 4px;
}

.profile-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.profile-form .login-submit {
  align-self: flex-start;
  min-width: 7rem;
}

@media (max-width: 720px) {
  .profile-form-row {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .profile-form .login-submit {
    width: 100%;
    min-width: 0;
  }
}

.name-en {
  margin: 0 0 10px;
  color: #6b7280;
  font-size: 14px;
}

.field {
  margin: 8px 0 0;
  line-height: 1.55;
  white-space: pre-wrap;
}

.field-label {
  font-weight: 700;
}

.match-field {
  display: inline-block;
  margin-top: 8px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 700;
}

.empty {
  padding: 16px;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  background: #fff;
  color: #6b7280;
}

.empty.loading {
  display: flex;
  align-items: center;
  gap: 10px;
  border-style: solid;
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
  font-weight: 600;
}

.empty.loading::before {
  content: "";
  width: 16px;
  height: 16px;
  flex: none;
  border-radius: 50%;
  border: 2px solid #93c5fd;
  border-top-color: #1d4ed8;
  animation: nl-spin 0.8s linear infinite;
}

@keyframes nl-spin {
  to {
    transform: rotate(360deg);
  }
}

.empty.error {
  border-style: solid;
  border-color: #fecaca;
  background: #fef2f2;
  color: #b91c1c;
  font-weight: 600;
  white-space: pre-wrap;
}

.detail-toggle-btn {
  display: block;
  margin-top: 14px;
  font-size: 13px;
  padding: 8px 14px;
}

.detail-panel {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed #dbe3ef;
}

.detail-panel[hidden] {
  display: none;
}

.detail-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.detail-list li {
  display: grid;
  grid-template-columns: minmax(140px, 220px) 1fr;
  gap: 10px;
  font-size: 14px;
  line-height: 1.55;
  padding-bottom: 8px;
  border-bottom: 1px solid #f1f5f9;
}

.detail-list li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.detail-field-label {
  font-weight: 700;
  color: #374151;
}

.detail-field-value {
  color: #1f2937;
  white-space: pre-wrap;
  word-break: break-word;
}

@media (max-width: 720px) {
  .detail-list li {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .detail-field-label {
    font-size: 13px;
  }

  a.medicine-ref-link {
    word-break: break-word;
  }
}

.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 4px;
  padding: 12px 0 4px;
}

.pager-btn {
  min-width: 36px;
  padding: 7px 10px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #fff;
  color: #374151;
  font-size: 13px;
  line-height: 1.2;
  cursor: pointer;
}

.pager-btn:hover:not(:disabled):not(.current) {
  background: #f3f4f6;
  border-color: #9ca3af;
}

.pager-btn.current {
  background: #1d4ed8;
  border-color: #1d4ed8;
  color: #fff;
  font-weight: 700;
  cursor: default;
}

.pager-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.pager-ellipsis {
  color: #9ca3af;
  padding: 0 2px;
}

.scroll-top-btn {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 40;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 1px solid #c7d2fe;
  border-radius: 50%;
  background: #1d4ed8;
  color: #fff;
  box-shadow: 0 8px 20px rgba(29, 78, 216, 0.28);
  cursor: pointer;
}

.scroll-top-btn[hidden] {
  display: none;
}

.scroll-top-btn:hover {
  background: #1e40af;
}

.scroll-top-btn svg {
  display: block;
  width: 26px;
  height: 26px;
  margin: 0 auto;
  fill: currentColor;
}

.search-mode-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
}

.search-mode-tabs button {
  background: #e5e7eb;
  color: #111827;
}

.search-mode-tabs button.current {
  background: #1d4ed8;
  color: #fff;
}

.nl-panel-integrated {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.condition-summary {
  margin: 0 0 12px;
  padding: 12px 14px;
  border: 1px solid #dbeafe;
  border-radius: 12px;
  background: #eff6ff;
}

.condition-summary h3 {
  margin: 0 0 8px;
  font-size: 15px;
  color: #1e3a8a;
}

.detail-field-value mark.search-hit,
.field mark.search-hit,
.detail-list mark.search-hit {
  background: #fef08a;
  color: #713f12;
  padding: 0 2px;
  border-radius: 3px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

a.medicine-ref-link {
  color: #1d4ed8;
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 600;
}

a.medicine-ref-link:hover {
  color: #1e40af;
}

a.medicine-ref-link mark.search-hit {
  text-decoration: inherit;
}

.condition-summary .condition-meta {
  margin: 0 0 6px;
  font-size: 13px;
  color: #1e40af;
}

.condition-summary .condition-plan {
  margin: 10px 0;
  padding: 10px 12px;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  background: #f8fbff;
}

.condition-summary .condition-plan.is-applied {
  border-color: #93c5fd;
  background: #dbeafe;
}

.condition-summary .condition-plan h4,
.condition-summary .condition-applied-heading {
  margin: 0 0 8px;
  font-size: 14px;
  color: #1e3a8a;
}

.condition-summary .condition-plan ul {
  margin: 0;
  padding-left: 18px;
}

.condition-summary .condition-plan li {
  margin: 2px 0;
  font-size: 13px;
  color: #1e3a8a;
}

.condition-summary .condition-applied {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  background: #166534;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
}

.condition-summary .condition-skipped {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  background: #94a3b8;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
}

.condition-summary .condition-failed {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  background: #b91c1c;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
}

.condition-summary .condition-plan.is-failed {
  border-color: #fca5a5;
  background: #fef2f2;
}

.condition-summary .condition-error {
  margin: 0 0 6px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #fee2e2;
  color: #991b1b;
  font-size: 13px;
  line-height: 1.45;
  word-break: break-word;
}

.condition-summary .condition-hint {
  margin: 8px 0 0;
  font-size: 13px;
  color: #b45309;
}

.condition-summary .condition-gemini {
  margin-top: 10px;
}

.condition-summary .condition-gemini summary {
  cursor: pointer;
  font-size: 13px;
  color: #1e3a8a;
  font-weight: 600;
}

.condition-summary .condition-gemini pre {
  margin: 8px 0 0;
  padding: 10px 12px;
  max-height: 240px;
  overflow: auto;
  border-radius: 8px;
  background: #0f172a;
  color: #e2e8f0;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

@media (max-width: 720px) {
  .condition-summary .condition-plan {
    padding: 8px 10px;
  }

  .condition-summary .condition-gemini pre {
    max-height: 180px;
    font-size: 11px;
  }
}

.result-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 16px 0 12px;
}

.result-toolbar label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: #4b5563;
}

.result-toolbar select {
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 8px 10px;
  background: #fff;
}

.result-toolbar-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, auto));
  gap: 8px;
  align-items: stretch;
}

.result-toolbar .toolbar-action {
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
  text-align: center;
  padding: 10px 14px;
  font-size: 14px;
  white-space: nowrap;
  background: #e5e7eb;
  color: #111827;
}

.result-toolbar .toolbar-action:disabled {
  opacity: 1;
  background: #e5e7eb;
  color: #111827;
  cursor: not-allowed;
}

@media (max-width: 720px) {
  .result-toolbar-actions {
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .result-toolbar .toolbar-action {
    padding: 8px 10px;
    font-size: 13px;
  }
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.card-actions-below-detail {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed #dbe3ef;
}

.card-actions-below-detail[hidden] {
  display: none;
}

.card-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 0;
  padding: 10px 14px;
  font-size: 14px;
  line-height: 1.2;
  white-space: nowrap;
  box-sizing: border-box;
  min-height: 40px;
}

.card-actions .detail-toggle-btn {
  display: inline-flex;
  margin-top: 0;
  font-size: 14px;
  padding: 10px 14px;
}

.card-actions button.current {
  background: #dbeafe;
  color: #1d4ed8;
}

@media (max-width: 720px) {
  .card-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .card-actions button {
    width: 100%;
    min-width: 0;
    padding: 8px 10px;
    font-size: 13px;
  }
}

.suggest-wrap {
  position: relative;
  flex: 1 1 220px;
  min-width: 180px;
}

.suggest-wrap input {
  width: 100%;
}

.suggest-list {
  position: absolute;
  z-index: 20;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  margin: 0;
  padding: 6px;
  list-style: none;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  max-height: 240px;
  overflow: auto;
}

.suggest-list button {
  width: 100%;
  text-align: left;
  background: transparent;
  color: #111827;
  border: none;
  border-radius: 8px;
  padding: 8px 10px;
}

.suggest-list button:hover {
  background: #f1f5f9;
}

.suggest-list span {
  display: block;
  font-size: 12px;
  color: #6b7280;
  font-weight: 500;
}

.product-side {
  margin-top: 28px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.product-side details {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 10px 12px;
}

.product-side summary {
  cursor: pointer;
  font-weight: 700;
}

.side-list {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 220px;
  overflow: auto;
}

.side-item-wrap {
  position: relative;
}

.side-item {
  display: block;
  width: 100%;
  text-align: left;
  background: #f8fafc;
  color: #111827;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 8px 28px 8px 10px;
  font-size: 13px;
  text-decoration: none;
  cursor: pointer;
  box-sizing: border-box;
}

.side-item:hover {
  background: #eff6ff;
  border-color: #bfdbfe;
}

.side-item.static {
  cursor: default;
}

.side-item.static:hover {
  background: #f8fafc;
  border-color: #e5e7eb;
}

.side-item-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  z-index: 2;
  width: 20px;
  height: 20px;
  min-height: 0;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: #e5e7eb;
  color: #4b5563;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.side-item-remove:hover {
  background: #fecaca;
  color: #b91c1c;
}

.medicine-detail-card {
  margin-top: 8px;
}

.medicine-structure-wrap {
  margin: 12px 0 4px;
  max-width: min(100%, 720px);
  padding: 10px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #fff;
}

.medicine-structure {
  display: block;
  width: 100%;
  max-height: 220px;
  height: auto;
  object-fit: contain;
  object-position: left center;
}

.medicine-tables-wrap {
  margin: 0 0 16px;
}

.medicine-tables-heading {
  margin: 0 0 10px;
  font-size: 1.05rem;
  font-weight: 700;
  color: #1f2937;
}

.medicine-table-block {
  margin: 0 0 14px;
  padding: 10px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #fff;
}

.medicine-table-block.medicine-table-inline {
  grid-column: 1 / -1;
  margin: 4px 0 2px;
  max-width: 100%;
  min-width: 0;
}

.medicine-table-title {
  margin: 0 0 8px;
  font-size: 0.92rem;
  font-weight: 650;
  color: #334155;
}

.medicine-table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.medicine-data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
  min-width: 280px;
}

.medicine-data-table th,
.medicine-data-table td {
  border: 1px solid #e2e8f0;
  padding: 6px 8px;
  vertical-align: top;
  text-align: left;
  word-break: break-word;
}

.medicine-data-table th {
  background: #f8fafc;
  font-weight: 650;
  white-space: nowrap;
}

.medicine-table-cell-img {
  display: block;
  max-width: min(240px, 100%);
  max-height: 160px;
  width: auto;
  height: auto;
  margin-top: 4px;
  object-fit: contain;
  background: #fff;
}

@media (max-width: 720px) {
  .medicine-structure-wrap {
    margin-top: 10px;
    padding: 8px 10px;
    max-width: 100%;
  }

  .medicine-structure {
    max-height: 160px;
  }

  .medicine-table-block {
    padding: 8px 10px;
  }

  .medicine-data-table {
    font-size: 0.8rem;
  }

  .medicine-data-table th,
  .medicine-data-table td {
    padding: 5px 6px;
  }

  .medicine-table-cell-img {
    max-width: 100%;
    max-height: 140px;
  }
}

.medicine-full-list {
  max-width: 100%;
}

.side-item span {
  display: block;
  color: #6b7280;
  font-weight: 500;
  margin-top: 2px;
}

.compare-wrap {
  overflow: auto;
}

.compare-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  background: #fff;
  font-size: 13px;
}

.compare-table col.compare-label-col {
  width: 7.5rem;
}

.compare-table col.compare-product-col {
  width: auto;
}

.compare-table th,
.compare-table td {
  border: 1px solid #e5e7eb;
  padding: 10px;
  vertical-align: top;
  text-align: left;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  line-height: 1.45;
}

.compare-table thead th {
  background: #f8fafc;
}

.compare-table tbody th {
  width: 7.5rem;
  min-width: 6.5rem;
  background: #f8fafc;
  font-weight: 700;
  color: #374151;
}

.compare-empty {
  color: #9ca3af;
}
