/* Dedicated iframe layout: Cocoon remains outside this document. */
html { height: auto; }
body { min-width: 320px; overflow: auto; }
.app { height: auto; min-height: 740px; min-width: 0; width: 100%; grid-template-columns: minmax(0,1fr); }
.appbar { min-width: 0; }
.shell { min-height: 650px; min-width: 0; width: 100%; }
.main { overflow: visible; min-width: 0; width: 100%; }
.table-wrap { max-width: 100%; }
.sidebar { min-width: 0; }
.main__inner { max-width: 1440px; }
.production-start { margin: 0 0 22px; }
.production-busy { position: fixed; z-index: 10000; left: 50%; bottom: 22px; transform: translateX(-50%); width: min(600px,calc(100% - 24px)); padding: 18px 22px; border: 1px solid #89c8b9; border-radius: 14px; color: #123f3a; background: #e8f8f1; box-shadow: 0 6px 30px #123f3a25; font-weight: 700; }
.generation-queue { width: min(580px, calc(100% - 32px)); max-height: calc(100dvh - 32px); overflow-y: auto; padding: 28px; border: 0; border-top: 4px solid #13837b; border-radius: 14px; color: #173f42; background: #fff; box-shadow: 0 20px 60px #123f3a35; }
.generation-queue::backdrop { background: #173f4266; }
.generation-queue h2 { margin: 0 0 18px; font-size: 20px; line-height: 1.5; }
.generation-queue p { font-size: 14px; line-height: 1.8; }
.generation-queue .generation-queue__rank { padding: 16px; border-radius: 8px; background: #eaf6f2; font-size: 20px; font-weight: 800; }
.generation-queue__ai { padding: 12px; background: #fff6df; border-radius: 8px; }
.generation-queue__actions { display: grid; gap: 10px; margin-top: 22px; }
.generation-queue__actions button { width: 100%; min-height: 44px; white-space: normal; }
/* Keep the trigger visible above every other field, including inside WordPress widths. */
#allocationBody > tr { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); }
#allocationBody > tr > td { display: flex; flex-direction: column; align-items: stretch; gap: 7px; }
#allocationBody > tr > td:nth-child(1) { grid-column: span 1; }
#allocationBody > tr > td:nth-child(2), #allocationBody > tr > td:nth-child(3) { grid-column: span 2; }
#allocationBody > tr > td:nth-child(5) { grid-column: span 7; }
#allocationBody > tr > td:nth-child(6) { grid-column: span 8; }
#allocationBody > tr > td:nth-child(7), #allocationBody > tr > td:nth-child(8) { grid-column: span 2; }
#allocationBody > tr > td:nth-child(9) { grid-column: 1 / -1; }
#allocationBody > tr > td:nth-child(4) { order: -1; grid-column: 1 / -1; display: flex; flex-direction: column; gap: 8px; width: auto; padding: 14px !important; border-right: 0; background: #edf7f3 !important; }
#allocationBody > tr > td:nth-child(4)::before { content: 'どんなとき？'; font-size: 13px; font-weight: 800; color: #20594e; }
#allocationBody > tr > td:nth-child(4) select { max-width: none; width: 100%; font-weight: 700; }
@media (max-width: 620px) {
  #allocationBody > tr { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #allocationBody > tr > td:nth-child(1), #allocationBody > tr > td:nth-child(2), #allocationBody > tr > td:nth-child(3), #allocationBody > tr > td:nth-child(5), #allocationBody > tr > td:nth-child(7), #allocationBody > tr > td:nth-child(8) { grid-column: span 1; }
  #allocationBody > tr > td:nth-child(6) { grid-column: 1 / -1; }
  .generation-queue { padding: 20px; }
}
.server-messages { margin-top: 18px; padding: 16px 20px; border-radius: 12px; background: #fff6f3; border: 1px solid #e7bfb4; overflow-wrap: anywhere; }
.server-messages--warning { background: #fff9e9; border-color: #e4cf8d; }
.server-messages h3 { margin: 0 0 10px; font-size: 16px; }
.server-messages ul { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }
.server-message-card { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 7px 16px; padding: 14px 16px; border: 1px solid rgba(177,82,61,.2); border-radius: 10px; background: rgba(255,255,255,.78); }
.server-messages--warning .server-message-card { border-color: rgba(162,124,32,.24); }
.server-message-card p { margin: 0; line-height: 1.65; }
.server-message-card__message { grid-column: 1 / -1; color: #643227; font-weight: 750; }
.server-messages--warning .server-message-card__message { color: #6d5515; }
.server-messages--error, .server-messages--conflict { background: #fff1f0; border-color: #cc4b45; }
.server-messages--error h3, .server-messages--conflict h3 { color: #a12622; }
.server-messages--error .server-message-card, .server-messages--conflict .server-message-card { border-color: #dc8e88; border-left: 4px solid #c33931; }
.server-messages--error .server-message-card__message, .server-messages--conflict .server-message-card__message { color: #a12622; }
.server-message-card__location, .server-message-card__guidance { grid-column: 1; color: #3f5f5a; font-size: 13px; }
.server-message-card__button { grid-column: 2; grid-row: 2 / span 2; align-self: center; white-space: nowrap; }
.is-correction-target { position: relative; z-index: 1; outline: 4px solid rgba(218,145,35,.42) !important; outline-offset: 4px; animation: correction-pulse 1.2s ease-in-out 2; }
@keyframes correction-pulse { 50% { outline-color: rgba(16,139,120,.58); } }
.export-card .btn + .btn { margin-top: 10px; }
.result-metrics { flex-shrink: 0; }
.shift-cell:empty::after { content: '—'; }
.shift-code:empty::after { content: '—'; color: #799490; }
.production-allocations details { margin-top: 16px; }
.production-allocations summary { cursor: pointer; font-weight: 700; padding: 8px 0; }
.production-allocations td { white-space: nowrap; }
@media (max-width: 1100px) {
  :root { --sidebar: 190px; }
  .appbar { grid-template-columns: minmax(145px, auto) minmax(0,1fr); padding: 12px 18px; }
  .app-actions { grid-column: 1 / -1; justify-content: flex-end; max-width: none; }
  .app-brand { padding-left: 0; }
  .screen-header, .card-head { flex-wrap: wrap; }
  .result-status { flex-wrap: wrap; }
}
@media (max-width: 820px) {
  .app { min-height: 650px; }
  .shell { display: block; }
  .sidebar { border-right: 0; }
  .main__inner { width: calc(100% - 24px); }
  .appbar { grid-template-columns: 1fr; gap: 10px; }
  .project-name { display: flex; width: 100%; }
  .project-name input { min-width: 0; flex: 1; }
  .app-actions { flex-wrap: wrap; justify-content: flex-start; }
  .sidebar__privacy { display: none; }
  .grid--2, .grid--3 { grid-template-columns: 1fr; }
  .screen-header h1 { font-size: 25px; }
  .screen-header > .btn { width: 100%; }
  .result-status { gap: 12px; }
  .result-metrics { width: 100%; justify-content: flex-start; }
  .export-grid { grid-template-columns: 1fr; }
  .workspace-card, .field, .grid > * { min-width: 0; }
  .workflow-footer { flex-wrap: wrap; }
  .server-message-card { grid-template-columns: 1fr; }
  .server-message-card__button { grid-column: 1; grid-row: auto; justify-self: start; }
}
@media (max-width: 480px) {
  .project-name { flex-wrap: wrap; gap: 5px; }
  .project-name label { width: 100%; }
  .project-name input { width: calc(100% - 50px); }
  .app-actions { gap: 7px; }
  .app-actions .btn { flex: 1 1 auto; }
  .nav-list { gap: 4px; }
  .nav-button { padding: 8px; }
  .nav-button__copy strong { font-size: 12px; }
  .card-head { display: block; }
  .card-head__actions { margin-top: 12px; flex-wrap: wrap; }
  .screen-header p { font-size: 13px; }
  .bottom-actions, .bottom-actions__right { flex-wrap: wrap; gap: 8px; }
  .result-status__icon { width: 32px; height: 32px; flex: 0 0 32px; }
  .result-status > div:nth-child(2) { flex: 1; min-width: 0; }
  .result-status h3 { font-size: 16px; }
  .result-metrics { gap: 18px; }
  .app-brand__product { display: inline; }
}

/* The host page already shows the Rakukai logo. Keep only the product name. */
.app-brand { min-width: 0; height: auto; cursor: default; }
.app-brand__product {
  display: inline !important;
  padding-left: 0;
  border-left: 0;
  font-size: 16px;
  line-height: 1.35;
  white-space: nowrap;
}
.app-actions .app-action {
  color: #fff;
  border-color: transparent;
  box-shadow: 0 5px 14px rgba(23, 63, 66, .16);
  font-weight: 800;
}
.app-actions .app-action--new { background: #a85d1c; }
.app-actions .app-action--load { background: #2f6f98; }
.app-actions .app-action--save { background: #0b8178; }
.app-actions .app-action--trial { background: #7451a6; }
.app-actions .app-action--new:hover { background: #88470e; }
.app-actions .app-action--load:hover { background: #245a7d; }
.app-actions .app-action--save:hover { background: #086b63; }
.app-actions .app-action--trial:hover { background: #5e3d8e; }
.app-actions .app-action:focus-visible { outline-color: rgba(31, 87, 119, .36); }
.shift-cell.is-shortened { position:relative; box-shadow:inset 0 -3px #b27718; }
.shift-shortened-mark { display:block; margin-top:2px; color:#8a5a0a; font-size:.58rem; font-weight:800; line-height:1; }
