:root {
  color-scheme: light;
  --ink: #1f2933;
  --muted: #5f6c7b;
  --line: #d8dee7;
  --paper: #fbfcfe;
  --panel: #ffffff;
  --navy: #153e75;
  --teal: #0f766e;
  --red: #b42318;
  --green: #146c43;
  --yellow: #fff7d6;
  --shadow: 0 10px 25px rgba(31, 41, 51, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.65;
}

a {
  color: var(--navy);
  text-decoration-thickness: 1px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 28px;
  color: #fff;
  background: linear-gradient(90deg, #12355b, #0f766e);
}

.brand {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand strong {
  font-size: 18px;
}

.brand span,
.session-note {
  font-size: 12px;
  opacity: 0.9;
}

.nav {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.nav a,
.nav form button {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 6px;
  padding: 8px 11px;
  font: inherit;
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
}

.layout {
  width: min(1180px, calc(100% - 32px));
  margin: 24px auto 48px;
}

.hero,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.hero {
  padding: 26px;
  display: grid;
  grid-template-columns: 1.3fr 0.7fr;
  gap: 24px;
  align-items: center;
}

h1,
h2,
h3 {
  line-height: 1.3;
  margin: 0 0 12px;
}

p {
  margin: 0 0 14px;
}

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

.panel {
  padding: 20px;
  margin-bottom: 18px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.problem-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  min-height: 260px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.problem-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  color: #243b53;
  background: #edf2f7;
  white-space: nowrap;
}

.badge.ok {
  color: var(--green);
  background: #dff5e8;
}

.badge.warn {
  color: #8a5a00;
  background: #fff0bf;
}

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

button,
.button {
  border: 1px solid #12355b;
  background: #12355b;
  color: #fff;
  padding: 9px 12px;
  border-radius: 6px;
  font: inherit;
  cursor: pointer;
  text-decoration: none;
}

button.secondary,
.button.secondary {
  background: #fff;
  color: #12355b;
}

button.danger {
  border-color: var(--red);
  background: var(--red);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #b9c2cf;
  border-radius: 6px;
  padding: 9px 10px;
  font: inherit;
  background: #fff;
}

textarea {
  min-height: 110px;
  resize: vertical;
}

label {
  display: block;
  font-weight: 700;
  margin: 0 0 6px;
}

.form-row {
  margin-bottom: 14px;
}

.inline-form {
  display: flex;
  gap: 8px;
  align-items: center;
}

.inline-form input {
  min-width: 0;
}

.notice {
  border-left: 4px solid var(--teal);
  background: #e7f7f4;
  padding: 12px 14px;
  margin: 0 0 16px;
}

.error {
  border-left-color: var(--red);
  background: #fff1f0;
}

.shop-shell {
  display: grid;
  grid-template-columns: 230px 1fr;
  gap: 18px;
}

.side {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  align-self: start;
}

.side a {
  display: block;
  padding: 8px 9px;
  border-radius: 6px;
  text-decoration: none;
}

.side a:hover {
  background: #edf7f6;
}

.admin-context {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 14px;
  padding: 14px 18px;
  color: #fff;
  background: #243b53;
  border-radius: 8px;
}

.admin-context span {
  font-size: 14px;
  opacity: 0.9;
}

.admin-shell .admin-side {
  border-color: #9fb3c8;
  background: #f0f4f8;
}

.admin-shell .admin-side strong {
  display: block;
  margin: 0 0 8px;
  color: #243b53;
}

.shop-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px;
  margin-bottom: 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.shop-search,
.shop-account-links {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.shop-search {
  margin-right: auto;
}

.shop-search input {
  width: min(240px, 100%);
}

.shop-account-links form {
  margin: 0;
}

.product {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

.product-links {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 14px;
}

.product-art {
  width: 96px;
  height: 96px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  background: linear-gradient(135deg, #0f766e, #12355b);
}

code,
pre {
  font-family: Consolas, "Courier New", monospace;
}

pre {
  white-space: pre-wrap;
  background: #101828;
  color: #eef4ff;
  border-radius: 8px;
  padding: 14px;
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

th,
td {
  border-bottom: 1px solid var(--line);
  text-align: left;
  padding: 9px;
  vertical-align: top;
}

th {
  background: #f2f5f9;
}

.flag-box {
  border: 1px solid #9bd4c9;
  background: #f0fffb;
  border-radius: 8px;
  padding: 16px;
  font-size: 18px;
}

#dify-chatbot-bubble-button,
.jls-dify-chatbot {
  position: fixed !important;
  right: 20px !important;
  bottom: 20px !important;
  width: 48px !important;
  height: 48px !important;
  overflow: visible !important;
  z-index: 2147483647 !important;
  background-color: #1c64f2 !important;
}

#dify-chatbot-bubble-window {
  position: fixed !important;
  width: 24rem !important;
  max-width: calc(100vw - 40px) !important;
  height: 40rem !important;
  max-height: calc(100vh - 88px) !important;
  z-index: 2147483640 !important;
}

@media (max-width: 820px) {
  .hero,
  .shop-shell {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .inline-form {
    flex-direction: column;
    align-items: stretch;
  }

  .shop-actions,
  .shop-search,
  .shop-account-links {
    align-items: stretch;
    flex-direction: column;
  }

  .shop-search input {
    width: 100%;
  }

  #dify-chatbot-bubble-button,
  .jls-dify-chatbot {
    right: 12px !important;
    bottom: 12px !important;
  }

  #dify-chatbot-bubble-window {
    right: 12px !important;
    bottom: 72px !important;
    width: calc(100vw - 24px) !important;
    max-width: calc(100vw - 24px) !important;
    height: calc(100vh - 96px) !important;
    max-height: calc(100vh - 96px) !important;
  }
}
