/*
  AI Panel module styles.

  This file is the first extraction step for the right AI panel. It is loaded
  after styles.css, so future panel work can happen here without touching the
  global planner/bridge styles first.
*/

.app-shell {
  grid-template-columns: minmax(320px, 1fr) var(--designer-panel-width, 430px);
  transition: grid-template-columns 0.18s ease;
}

.app-shell.designer-collapsed {
  grid-template-columns: minmax(320px, 1fr) 52px;
}

.app-shell.wardrobe-library-mode:not(.designer-collapsed) {
  grid-template-columns: minmax(320px, 1fr) clamp(920px, 68vw, 1040px);
}

.designer-pane {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  overflow: hidden;
  background: var(--panel);
  position: relative;
  transition: padding 0.18s ease;
}

.panel-toggle {
  position: absolute;
  top: 50%;
  left: 0;
  z-index: 5;
  width: 30px;
  height: 82px;
  padding: 0;
  border-color: #b9c7d6;
  border-radius: 0 8px 8px 0;
  background: #fff;
  color: var(--accent);
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
  box-shadow: 0 2px 10px rgba(24, 32, 42, 0.12);
  transform: translateY(-50%);
}

.panel-toggle:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.app-shell.designer-collapsed .designer-pane {
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 0;
  overflow: hidden;
}

.app-shell.designer-collapsed .designer-pane > :not(.panel-toggle) {
  display: none !important;
}

.app-shell.designer-collapsed .panel-toggle {
  position: static;
  width: 38px;
  height: 96px;
  border-radius: 8px;
  box-shadow: none;
  transform: none;
  font-size: 12px;
  writing-mode: vertical-rl;
  text-orientation: mixed;
}

.designer-profile {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex: 0 0 auto;
  min-height: 92px;
  padding: 13px 13px 13px 15px;
  border: 1px solid #c8e0f6;
  border-bottom-color: #b7d6f0;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(234, 246, 255, 0.92) 58%, rgba(255, 246, 235, 0.92)),
    #f7fbff;
  box-shadow: 0 1px 0 rgba(18, 63, 102, 0.04);
}

.designer-profile h1 {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
  color: var(--brand-blue);
  font-weight: 800;
}

.designer-profile p {
  margin: 6px 0 0;
  color: #356f9f;
  font-weight: 500;
}

.designer-avatar {
  position: relative;
  width: 74px;
  height: 74px;
  flex: 0 0 auto;
  border: 2px solid #ffffff;
  border-radius: 50%;
  overflow: hidden;
  background: var(--brand-blue-soft);
  box-shadow:
    0 0 0 1px #9dccf3,
    0 8px 18px rgba(18, 63, 102, 0.16);
}

.designer-avatar img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.designer-avatar::after {
  content: "AI";
  position: absolute;
  right: -1px;
  bottom: 2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 18px;
  padding: 0 6px;
  border: 2px solid #ffffff;
  border-radius: 999px;
  background: var(--brand-orange);
  color: #ffffff;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}

.dialogue-stage {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  gap: 10px;
}

.assistant-question {
  padding: 12px;
  border: 1px solid #bdd7f7;
  border-radius: 8px;
  background: #edf5ff;
  color: var(--text);
  font-size: 15px;
  line-height: 1.45;
}

.assistant-question.is-typing {
  min-height: 68px;
}

.assistant-question.is-typing::after {
  content: "";
  display: inline-block;
  width: 2px;
  height: 1em;
  margin-left: 3px;
  background: var(--accent);
  vertical-align: -0.15em;
  animation: caretBlink 0.8s steps(1, end) infinite;
}

.chat-log {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  gap: 8px;
  overflow: auto;
  padding-bottom: 10px;
}

.chat-log:empty {
  display: none;
}

.message {
  padding: 9px 10px;
}

.message.user {
  align-self: flex-end;
  max-width: 88%;
  background: #edf5ff;
  border-color: #bdd7f7;
}

.message.assistant {
  align-self: flex-start;
  max-width: 92%;
}

.message.processing {
  border-color: #bdd7f7;
  background: #f6fbff;
  color: var(--muted);
}

.message.processing .message-text::after {
  content: "";
  display: inline-block;
  width: 1.6em;
  animation: loadingDots 1.2s steps(1, end) infinite;
}

.message-media {
  display: grid;
  gap: 6px;
  margin: 0 0 8px;
}

.message-thumb {
  display: block;
  width: min(150px, 100%);
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
}

.message-text {
  white-space: pre-wrap;
}

.chat-form {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
}

.chat-form input {
  min-width: 0;
  height: 38px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.inline-quick-replies {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.inline-quick-replies button {
  min-height: 38px;
  border-color: #93c5fd;
  background: #ffffff;
  color: var(--accent);
  font-weight: 600;
}

.inline-quick-replies button:hover {
  background: #eff6ff;
}

.initial-room-action {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.initial-room-action button {
  width: 100%;
  min-height: 44px;
  border-color: #0b6bcb;
  background: #0b6bcb;
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
}

.initial-room-action .room-design-button:hover {
  border-color: #07579f;
  background: #07579f;
}

.initial-room-action .room-training-button,
.initial-room-action .kitchen-prototype-button {
  border-color: #93c5fd;
  background: #ffffff;
  color: #07579f;
}

.initial-room-action .room-training-button:hover,
.initial-room-action .kitchen-prototype-button:hover {
  border-color: #60a5fa;
  background: #eff6ff;
}

.initial-room-action .kitchen-prototype-button {
  border-color: #0b6bcb;
  box-shadow: inset 0 0 0 1px rgba(11, 107, 203, 0.06);
}

.kitchen-prototype-dialog {
  position: fixed;
  inset: 0;
  z-index: 2147482000;
  display: grid;
  place-items: center;
  box-sizing: border-box;
  padding: 32px;
  font-family: Arial, sans-serif;
}

.kitchen-prototype-dialog.hidden {
  display: none;
}

.kitchen-prototype-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: rgba(15, 23, 42, 0.58);
  cursor: default;
}

.kitchen-prototype-window {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(1160px, calc(100vw - 64px));
  max-height: calc(100dvh - 64px);
  box-sizing: border-box;
  overflow: hidden;
  border: 1px solid #dbe4ee;
  border-radius: 18px;
  background: #f8fafc;
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.32);
}

.kitchen-prototype-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 24px 18px;
  border-bottom: 1px solid #e2e8f0;
  background: #ffffff;
}

.kitchen-prototype-head p {
  margin: 0 0 5px;
  color: #0b6bcb;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.kitchen-prototype-head h2 {
  margin: 0;
  color: #172033;
  font-size: 24px;
  line-height: 1.2;
}

.kitchen-prototype-head span {
  display: block;
  max-width: 760px;
  margin-top: 7px;
  color: #64748b;
  font-size: 14px;
  line-height: 1.45;
}

.kitchen-prototype-close {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  padding: 0 0 3px;
  border: 1px solid #cbd5e1;
  border-radius: 50%;
  background: #ffffff;
  color: #334155;
  font-size: 28px;
  line-height: 1;
}

.kitchen-prototype-close:hover {
  border-color: #94a3b8;
  background: #f1f5f9;
}

.kitchen-prototype-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: max-content;
  align-content: start;
  gap: 16px;
  padding: 20px 24px 24px;
  overflow: auto;
}

.kitchen-prototype-card {
  display: grid;
  align-content: start;
  min-width: 0;
  height: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid #dbe4ee;
  border-radius: 13px;
  background: #ffffff;
  color: #172033;
  text-align: left;
  box-shadow: 0 5px 16px rgba(15, 23, 42, 0.06);
  transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.kitchen-prototype-card:hover,
.kitchen-prototype-card:focus-visible {
  z-index: 1;
  border-color: #60a5fa;
  box-shadow: 0 12px 28px rgba(11, 107, 203, 0.16);
  transform: translateY(-2px);
}

.kitchen-prototype-card img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #e2e8f0;
}

.kitchen-prototype-card-copy {
  display: grid;
  gap: 5px;
  padding: 13px 14px 15px;
}

.kitchen-prototype-card-copy small {
  color: #0b6bcb;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
}

.kitchen-prototype-card-copy strong {
  font-size: 15px;
  line-height: 1.25;
}

.kitchen-prototype-card-copy span {
  color: #64748b;
  font-size: 12px;
  line-height: 1.35;
}

.kitchen-prototype-detail {
  min-height: 0;
  overflow: auto;
  padding: 20px 24px 24px;
}

.kitchen-prototype-detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.75fr);
  gap: 24px;
  align-items: start;
}

.kitchen-prototype-detail-media {
  overflow: hidden;
  border: 1px solid #dbe4ee;
  border-radius: 14px;
  background: #e2e8f0;
  box-shadow: 0 12px 34px rgba(15, 23, 42, 0.12);
}

.kitchen-prototype-detail-media img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.kitchen-prototype-detail-copy {
  display: grid;
  gap: 14px;
  padding: 4px 0;
}

.kitchen-prototype-detail-copy small {
  color: #0b6bcb;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.05em;
}

.kitchen-prototype-detail-copy h3 {
  margin: 0;
  color: #172033;
  font-size: 24px;
  line-height: 1.2;
}

.kitchen-prototype-detail-copy p {
  margin: 0;
  color: #475569;
  font-size: 14px;
  line-height: 1.5;
}

.kitchen-prototype-principles {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 13px 15px 13px 31px;
  border-radius: 10px;
  background: #eef6ff;
  color: #334155;
  font-size: 13px;
  line-height: 1.35;
}

.kitchen-prototype-room-note {
  padding: 11px 12px;
  border-left: 3px solid #0b6bcb;
  border-radius: 0 8px 8px 0;
  background: #ffffff;
  color: #475569;
  font-size: 12px;
  line-height: 1.4;
}

.kitchen-prototype-detail-actions {
  display: grid;
  gap: 8px;
}

.kitchen-prototype-design-button,
.kitchen-prototype-back-button {
  min-height: 46px;
  font-size: 14px;
  font-weight: 700;
}

.kitchen-prototype-design-button {
  border-color: #0b6bcb;
  background: #0b6bcb;
  color: #ffffff;
}

.kitchen-prototype-design-button:hover {
  border-color: #07579f;
  background: #07579f;
}

.kitchen-prototype-back-button {
  border-color: #cbd5e1;
  background: #ffffff;
  color: #334155;
}

body.kitchen-prototype-open {
  overflow: hidden;
}

@media (max-width: 900px) {
  .kitchen-prototype-dialog {
    padding: 16px;
  }

  .kitchen-prototype-window {
    width: calc(100vw - 32px);
    max-height: calc(100dvh - 32px);
  }

  .kitchen-prototype-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .kitchen-prototype-detail-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .kitchen-prototype-dialog {
    padding: 8px;
  }

  .kitchen-prototype-window {
    width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px);
    border-radius: 13px;
  }

  .kitchen-prototype-head {
    padding: 16px;
  }

  .kitchen-prototype-head h2,
  .kitchen-prototype-detail-copy h3 {
    font-size: 20px;
  }

  .kitchen-prototype-head span {
    font-size: 12px;
  }

  .kitchen-prototype-grid {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 14px 16px 18px;
  }

  .kitchen-prototype-detail {
    padding: 14px 16px 18px;
  }
}

.room-design-final-tour { position: fixed; inset: 0; z-index: 2147483000; pointer-events: none; font-family: Arial, sans-serif; }
.room-design-final-tour.hidden { display: none; }
.room-design-final-shade { position: fixed; background: rgba(15, 23, 42, 0.58); pointer-events: auto; }
.room-design-final-focus { position: fixed; border: 3px solid #0b6bcb; border-radius: 7px; box-shadow: 0 0 0 4px rgba(255,255,255,0.92), 0 0 0 9px rgba(11,107,203,0.32); animation: roomDesignFinalPulse 1.15s ease-in-out infinite; }
.room-design-final-pointer { position: fixed; color: #ef4444; font-size: 30px; line-height: 1; font-weight: 800; animation: roomDesignFinalPoint 0.7s ease-in-out infinite alternate; }
.room-design-final-card { position: fixed; width: min(330px, calc(100vw - 24px)); box-sizing: border-box; padding: 14px; border: 1px solid #8dc5f2; border-radius: 8px; background: #fff; color: #172033; box-shadow: 0 16px 42px rgba(15,23,42,0.3); }
.room-design-final-card strong { display: block; margin-bottom: 6px; color: #356f9f; font-size: 12px; }
.room-design-final-card p { margin: 0; font-size: 14px; line-height: 1.4; }
@keyframes roomDesignFinalPulse { 0%,100% { box-shadow: 0 0 0 4px rgba(255,255,255,0.92), 0 0 0 7px rgba(11,107,203,0.2); } 50% { box-shadow: 0 0 0 4px rgba(255,255,255,0.96), 0 0 0 12px rgba(11,107,203,0.38); } }
@keyframes roomDesignFinalPoint { from { transform: translateX(0); } to { transform: translateX(-7px); } }
@media (prefers-reduced-motion: reduce) { .room-design-final-focus, .room-design-final-pointer { animation: none; } }

.quick-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

.quick-actions button,
.voice-button {
  padding: 0 8px;
  font-size: 12px;
}

#imageInputBtn {
  grid-column: 1 / -1;
}

.image-analysis-button {
  min-height: 30px;
  padding: 5px 8px;
  font-size: 11px;
  line-height: 1.15;
  white-space: normal;
}

.paid-image-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

.image-action-paid {
  white-space: nowrap;
}

.quick-actions button.is-processing {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  opacity: 1;
}

.quick-actions button.is-processing::before {
  content: "";
  width: 14px;
  height: 14px;
  border: 2px solid #bdd7f7;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.voice-button.recording {
  border-color: var(--bad);
  background: #fff1f0;
  color: var(--bad);
}

.room-validation-actions {
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
}

.room-validation-actions button {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.room-validation-actions p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.wardrobe-library-mode .dialogue-stage,
.wardrobe-library-mode .panel-bottom-stack {
  display: none;
}

.wardrobe-library {
  display: grid;
  grid-template-columns: 164px minmax(0, 1fr);
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  border: 1px solid #cfd8e4;
  border-radius: 8px;
  background: #ffffff;
}

.wardrobe-library-nav {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 12px;
  gap: 10px;
  border-right: 1px solid #dbe3ed;
  background: #f7f9fb;
}

.wardrobe-library-back {
  width: 100%;
  min-height: 32px;
  border-color: #b8c7d9;
  background: #ffffff;
  color: var(--accent-strong);
  font-weight: 700;
}

.wardrobe-library-kicker,
.wardrobe-library-head p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.wardrobe-library-nav h2,
.wardrobe-library-head h2 {
  margin: 0;
  color: var(--brand-blue);
  line-height: 1.15;
}

.wardrobe-library-nav h2 {
  font-size: 19px;
}

.wardrobe-library-filter-list {
  display: grid;
  gap: 7px;
  margin-top: 2px;
}

.wardrobe-library-filter-list button {
  justify-content: flex-start;
  width: 100%;
  height: auto;
  min-height: 32px;
  padding: 6px 9px;
  border-color: #d3dce8;
  background: #ffffff;
  color: #3b4a5c;
  font-size: 12px;
  font-weight: 700;
  text-align: left;
}

.wardrobe-library-filter-list button.active {
  border-color: #8ab8e8;
  background: #edf5ff;
  color: var(--accent-strong);
}

.wardrobe-library-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.wardrobe-library-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 12px;
  border-bottom: 1px solid #e1e7ef;
}

.wardrobe-library-head h2 {
  margin-top: 2px;
  font-size: 22px;
}

.wardrobe-library-head span {
  flex: 0 0 auto;
  min-height: 26px;
  padding: 4px 9px;
  border: 1px solid #b7dfc9;
  border-radius: 999px;
  background: #f0fbf5;
  color: var(--good);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.wardrobe-library-status {
  margin: 12px 16px 0;
  padding: 9px 11px;
  border: 1px solid #cdd9e7;
  border-radius: 8px;
  background: #f5f8fc;
  color: #304156;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
}

.wardrobe-library-status.good {
  border-color: #9bd4b7;
  background: #effbf5;
  color: #17683d;
}

.wardrobe-library-status.warn {
  border-color: #f0d184;
  background: #fff8e6;
  color: #7a5600;
}

.wardrobe-library-status.error {
  border-color: #efaaa6;
  background: #fff2f1;
  color: #9e2f28;
}

.wardrobe-library-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  min-height: 0;
  padding: 16px;
  overflow: auto;
  background: #f8fafc;
}

.wardrobe-card {
  display: grid;
  grid-template-rows: auto 1fr;
  width: 100%;
  height: auto;
  min-height: 324px;
  padding: 0;
  overflow: hidden;
  border: 1px solid #d2dbe7;
  border-radius: 8px;
  background: #ffffff;
  text-align: left;
  box-shadow: 0 1px 2px rgba(24, 32, 42, 0.04);
}

.wardrobe-card:hover {
  border-color: #8ab8e8;
  box-shadow: 0 8px 22px rgba(24, 32, 42, 0.1);
}

.wardrobe-card:focus-visible {
  outline: 3px solid rgba(11, 107, 203, 0.22);
  outline-offset: 2px;
}

.wardrobe-card-image {
  display: block;
  aspect-ratio: 4 / 3;
  background: #e7edf4;
}

.wardrobe-card-image.fit-contain {
  background: #ede7df;
}

.wardrobe-card-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.wardrobe-card-image.fit-contain img {
  object-fit: contain;
}

.wardrobe-card-body {
  display: grid;
  align-content: start;
  gap: 4px;
  min-width: 0;
  padding: 10px;
}

.wardrobe-card-body strong,
.wardrobe-card-body span,
.wardrobe-card-body small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wardrobe-card-body strong {
  color: var(--text);
  font-size: 14px;
  line-height: 1.25;
}

.wardrobe-card-body span {
  color: #3b4a5c;
  font-size: 12px;
}

.wardrobe-card-body small {
  color: var(--muted);
  font-size: 11px;
}

.wardrobe-detail {
  min-height: 0;
  padding: 16px;
  overflow: auto;
  background: #f8fafc;
}

.wardrobe-detail-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.wardrobe-detail-toolbar button {
  min-height: 34px;
  border-color: #b8c7d9;
  color: var(--accent-strong);
  font-weight: 800;
}

.wardrobe-detail-toolbar span {
  min-width: 0;
  overflow: hidden;
  color: var(--brand-blue);
  font-size: 16px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wardrobe-detail-hero {
  display: grid;
  place-items: center;
  min-height: 500px;
  border: 1px solid #d2dbe7;
  border-radius: 8px;
  overflow: hidden;
  background: #ede7df;
}

.wardrobe-detail-hero img {
  display: block;
  width: 100%;
  max-height: 720px;
  object-fit: contain;
}

.wardrobe-detail-menu {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.wardrobe-detail-block {
  display: grid;
  align-content: start;
  gap: 10px;
  min-width: 0;
  padding: 12px;
  border: 1px solid #d2dbe7;
  border-radius: 8px;
  background: #ffffff;
}

.wardrobe-detail-block h3,
.wardrobe-detail-block p {
  margin: 0;
}

.wardrobe-detail-block h3 {
  color: var(--brand-blue);
  font-size: 15px;
  line-height: 1.2;
}

.wardrobe-detail-block p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.wardrobe-size-grid {
  display: grid;
  gap: 7px;
}

.wardrobe-size-grid label {
  display: grid;
  gap: 4px;
  color: #3b4a5c;
  font-size: 12px;
  font-weight: 800;
}

.wardrobe-size-grid input {
  width: 100%;
  min-width: 0;
  height: 34px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.wardrobe-detail-block button {
  width: 100%;
  min-height: 38px;
  margin-top: auto;
  font-weight: 800;
}

.wardrobe-detail-submit {
  border-color: #9bd4b7;
  background: #f4fbf7;
}

.wardrobe-detail-submit button {
  border-color: var(--good);
  background: var(--good);
  color: #ffffff;
}

.wardrobe-detail-submit .wardrobe-detail-secondary {
  margin-top: 0;
  border-color: #b9c8da;
  background: #ffffff;
  color: var(--brand-blue);
}

.wardrobe-filling-editor {
  display: grid;
  gap: 12px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid #c7d6e8;
  border-radius: 8px;
  background: #ffffff;
}

.wardrobe-filling-editor.hidden {
  display: none;
}

.wardrobe-filling-editor-head,
.wardrobe-filling-section-head,
.wardrobe-filling-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.wardrobe-filling-editor h3,
.wardrobe-filling-editor h4,
.wardrobe-filling-editor p {
  margin: 0;
}

.wardrobe-filling-editor h3 {
  color: var(--brand-blue);
  font-size: 16px;
  line-height: 1.2;
}

.wardrobe-filling-editor h4 {
  color: #16283d;
  font-size: 14px;
  line-height: 1.2;
}

.wardrobe-filling-editor p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.wardrobe-filling-editor button {
  min-height: 34px;
  border-color: #b8c7d9;
  font-weight: 800;
}

.wardrobe-filling-sections {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.wardrobe-filling-section {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 10px;
  border: 1px solid #d8e1ec;
  border-radius: 8px;
  background: #f8fafc;
}

.wardrobe-filling-section-head span {
  flex: 0 1 auto;
  min-width: 0;
  padding: 4px 8px;
  border: 1px solid #cbd8e6;
  border-radius: 999px;
  color: #3b4a5c;
  font-size: 11px;
  font-weight: 800;
  text-align: center;
}

.wardrobe-filling-section ul {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.wardrobe-filling-section li {
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #ffffff;
  color: #1f3148;
  font-size: 12px;
  font-weight: 750;
}

.wardrobe-filling-guidance {
  display: grid;
  gap: 8px;
  padding: 11px;
  border: 1px solid #d8e1ec;
  border-radius: 8px;
  background: #f8fafc;
}

.wardrobe-filling-guidance p {
  color: #30445c;
  font-size: 13px;
}

.wardrobe-edit-scope {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.wardrobe-edit-scope > div {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 10px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #ffffff;
}

.wardrobe-edit-scope ul {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 18px;
  color: #30445c;
  font-size: 12px;
  line-height: 1.35;
}

.wardrobe-filling-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.wardrobe-filling-phrase {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr) 150px;
  gap: 8px;
}

.wardrobe-filling-dictate {
  align-self: stretch;
  border-color: #9bb7d6;
  color: var(--accent-strong);
}

.wardrobe-filling-dictate.recording {
  border-color: var(--bad);
  background: #fff1f0;
  color: var(--bad);
}

.wardrobe-filling-phrase textarea {
  width: 100%;
  min-width: 0;
  resize: vertical;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #16283d;
  font: inherit;
  font-size: 13px;
}

.wardrobe-filling-result {
  display: grid;
  gap: 6px;
  padding: 9px;
  border: 1px solid #f2d08d;
  border-radius: 8px;
  background: #fff8e8;
}

.wardrobe-filling-result p {
  color: #704b08;
  font-weight: 750;
}

.wardrobe-filling-footer button {
  margin-left: auto;
  border-color: var(--good);
  background: var(--good);
  color: #ffffff;
}

.panel-bottom-stack {
  display: grid;
  flex: 0 0 auto;
  gap: 8px;
  margin-top: auto;
}

.account-panel {
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.bottom-account-panel {
  display: grid;
  gap: 8px;
}

.account-billing {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 30px;
}

.account-plan-badge,
.account-balance-button {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  white-space: nowrap;
}

.account-plan-badge {
  padding: 0 10px;
  border: 1px solid #b7dfc9;
  border-radius: 999px;
  background: #f0fbf5;
  color: var(--good);
  font-weight: 700;
  font-size: 12px;
}

.account-balance-button {
  height: 30px;
  border-color: #b8c7d9;
  background: #f8fafc;
  color: var(--text);
  font-weight: 700;
}

.account-panel .section-title {
  display: grid;
  grid-template-columns: 1fr;
  align-items: start;
}

.account-card {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.account-card p {
  margin: 0;
  color: var(--muted);
}

.account-summary {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  min-height: 38px;
}

.account-user-line {
  display: flex;
  align-items: baseline;
  min-width: 0;
  gap: 8px;
}

.account-user-line strong {
  min-width: 0;
  color: var(--good);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-prefix {
  color: var(--muted);
  font-weight: 700;
}

#accountLogoutBtn {
  height: 30px;
  padding: 0 12px;
}

.account-mode-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 6px;
}

.account-mode-actions button {
  min-height: 30px;
  height: auto;
  padding: 0 9px;
  font-size: 12px;
  white-space: normal;
}

.account-mode-actions button.active {
  border-color: #9ec5f2;
  background: #edf5ff;
  color: var(--accent-strong);
}

.account-form,
.account-verify,
.account-actions,
.account-flow {
  display: grid;
  gap: 8px;
}

.account-form input,
.account-verify input {
  width: 100%;
  min-width: 0;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.account-status {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.account-status:empty {
  display: none;
}

#accountBadge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.admin-panel {
  border-color: #e2c56f;
  background: #fffaf0;
}

.admin-panel summary {
  color: #6d5210;
}

#adminPanelBadge {
  color: #8a6a12;
  font-size: 12px;
  font-weight: 700;
}

.admin-panel button {
  width: 100%;
  min-height: 34px;
  border-color: #d8b94e;
  background: #fff4cf;
  color: #5f4606;
  font-weight: 700;
  white-space: normal;
}

.admin-status {
  color: #6f5a1b;
  font-size: 12px;
  line-height: 1.4;
}

.admin-status:empty {
  display: none;
}

.utility-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.utility-panel summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 42px;
  padding: 0 10px;
  cursor: pointer;
  font-weight: 600;
}

.utility-panel[open] {
  padding-bottom: 10px;
}

.utility-panel[open] summary {
  border-bottom: 1px solid var(--line);
  margin-bottom: 10px;
}

.utility-panel > button,
.utility-panel > .panel-section,
.utility-panel > .orders-list {
  margin-left: 10px;
  margin-right: 10px;
}

.orders-list.compact {
  max-height: 260px;
  overflow: auto;
  margin-top: 8px;
}

.order-card,
.current-project,
.message {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.order-card {
  display: grid;
  gap: 8px;
  padding: 10px;
}

.order-card header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.order-card strong {
  display: block;
}

.order-card small,
.order-card .meta {
  color: var(--muted);
}

.order-card .actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.order-card .primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.order-card .primary:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

.current-project {
  padding: 10px;
  color: var(--muted);
  word-break: break-word;
}

.current-project:not(.empty) {
  color: var(--text);
}

.current-project a {
  color: var(--accent);
}

@media (max-width: 980px) {
  .app-shell {
    display: block;
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
  }

  .app-shell.designer-collapsed {
    display: block;
  }

  .planner-pane,
  #plannerFrame {
    width: 100%;
    height: 100dvh;
  }

  .planner-pane {
    border: 0;
  }

  .designer-pane {
    position: fixed;
    right: 10px;
    bottom: 10px;
    left: 10px;
    z-index: 20;
    height: min(54dvh, 500px);
    min-height: 0;
    padding: 10px;
    gap: 8px;
    border: 1px solid rgba(174, 184, 197, 0.9);
    border-radius: 16px;
    box-shadow: 0 14px 42px rgba(24, 32, 42, 0.24);
    transition: height 0.18s ease, padding 0.18s ease, border-radius 0.18s ease;
  }

  .app-shell.wardrobe-library-mode:not(.designer-collapsed) .designer-pane {
    height: min(76dvh, 680px);
  }

  .panel-toggle {
    top: -17px;
    left: 50%;
    right: auto;
    width: 86px;
    height: 34px;
    border-radius: 999px;
    transform: translateX(-50%);
    writing-mode: horizontal-tb;
    font-size: 13px;
    box-shadow: 0 4px 14px rgba(24, 32, 42, 0.16);
  }

  .app-shell.designer-collapsed .designer-pane {
    right: 50%;
    bottom: 12px;
    left: auto;
    width: 88px;
    height: 44px;
    padding: 0;
    border-radius: 999px;
    transform: translateX(50%);
    box-shadow: 0 10px 28px rgba(24, 32, 42, 0.2);
  }

  .app-shell.designer-collapsed .panel-toggle {
    position: static;
    width: 88px;
    height: 44px;
    border-radius: 999px;
    transform: none;
    writing-mode: horizontal-tb;
    font-size: 13px;
  }

  .designer-profile {
    min-height: 48px;
    padding: 10px;
  }

  .designer-profile h1 {
    font-size: 17px;
  }

  .designer-profile p {
    margin-top: 2px;
    font-size: 12px;
  }

  .designer-avatar {
    width: 46px;
    height: 46px;
    border-radius: 50%;
  }

  .designer-avatar::after {
    min-width: 22px;
    height: 15px;
    padding: 0 5px;
    font-size: 9px;
  }

  .dialogue-stage {
    gap: 8px;
  }

  .wardrobe-library {
    grid-template-columns: 138px minmax(0, 1fr);
  }

  .wardrobe-library-nav {
    padding: 10px;
  }

  .wardrobe-library-filter-list button {
    min-height: 30px;
    padding: 5px 8px;
  }

  .wardrobe-library-head {
    padding: 12px;
  }

  .wardrobe-library-head h2 {
    font-size: 18px;
  }

  .wardrobe-library-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    padding: 10px;
  }

  .wardrobe-card {
    min-height: 188px;
  }

  .wardrobe-detail {
    padding: 10px;
  }

  .wardrobe-detail-hero {
    min-height: 360px;
  }

  .wardrobe-detail-menu {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .wardrobe-filling-sections,
  .wardrobe-filling-actions,
  .wardrobe-edit-scope,
  .wardrobe-filling-phrase {
    grid-template-columns: 1fr;
  }

  .assistant-question {
    max-height: 96px;
    padding: 10px;
    overflow: auto;
    font-size: 14px;
  }

  .assistant-question.is-typing {
    min-height: 64px;
  }

  .chat-log {
    gap: 7px;
    padding-bottom: 4px;
  }

  .message {
    padding: 8px 9px;
    font-size: 13px;
  }

  .message.user,
  .message.assistant {
    max-width: 96%;
  }

  .chat-form {
    grid-template-columns: 70px minmax(0, 1fr) 76px;
    gap: 6px;
  }

  .chat-form input {
    height: 40px;
    padding: 0 9px;
  }

  .chat-form button,
  .voice-button {
    height: 40px;
    padding: 0 8px;
    font-size: 12px;
  }

  .inline-quick-replies {
    gap: 6px;
  }

  .inline-quick-replies button {
    min-height: 36px;
  }

  .panel-bottom-stack {
    gap: 6px;
  }

  .utility-panel summary {
    min-height: 36px;
  }

  .account-card {
    padding: 8px;
  }

  .account-form input,
  .account-verify input {
    height: 34px;
  }

  .quick-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .paid-image-actions {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .designer-pane {
    right: 8px;
    bottom: 8px;
    left: 8px;
    height: min(52dvh, 460px);
    border-radius: 14px;
  }

  .wardrobe-library {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .wardrobe-library-nav {
    border-right: 0;
    border-bottom: 1px solid #dbe3ed;
  }

  .wardrobe-library-filter-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .wardrobe-library-filter-list button {
    justify-content: center;
    text-align: center;
  }

  .wardrobe-library-grid {
    grid-template-columns: 1fr;
  }

  .wardrobe-card {
    min-height: 0;
  }

  .wardrobe-detail-hero {
    min-height: 260px;
  }

  .chat-form {
    grid-template-columns: 64px minmax(0, 1fr) 68px;
  }

  .chat-form button,
  .voice-button {
    padding: 0 6px;
    font-size: 11px;
  }

  .account-mode-actions {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 380px) {
  .designer-pane {
    right: 6px;
    bottom: 6px;
    left: 6px;
    height: 54dvh;
  }

  .designer-profile {
    gap: 8px;
  }

  .designer-avatar {
    width: 40px;
    height: 40px;
  }

  .designer-profile h1 {
    font-size: 16px;
  }

  .chat-form {
    grid-template-columns: 58px minmax(0, 1fr) 62px;
    gap: 5px;
  }
}
