:root {
  --blue: #0d82d5;
  --blue-dark: #0872bf;
  --blue-soft: #e7f3ff;
  --line: #d7e3f0;
  --text: #0f2741;
  --muted: #6b819a;
  --bg: #f3f8fe;
  --panel: #ffffff;
  --danger: #c73b3b;
  --success: #147a4a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
  font-family: Arial, "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  background: var(--blue);
  color: #fff;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.1);
}

.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  font-size: 16px;
}

.brand span {
  font-weight: 400;
  opacity: 0.95;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
}

.top-actions form {
  display: inline;
  margin: 0;
}

.top-actions button {
  padding: 0;
  border: 0;
  color: #fff;
  background: transparent;
  cursor: pointer;
}

.mobile-menu-toggle {
  display: none;
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
  border: 0;
  border-radius: 8px;
  padding: 0;
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  cursor: pointer;
}

.mobile-menu-toggle span {
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
}

.divider {
  width: 1px;
  height: 13px;
  background: rgba(255, 255, 255, 0.5);
}

.layout {
  display: grid;
  grid-template-columns: 258px minmax(0, 1fr);
  min-height: calc(100vh - 46px);
}

.sidebar {
  border-right: 1px solid var(--line);
  background: #fff;
  padding-top: 0;
}

.sidebar-backdrop {
  display: none;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  height: 46px;
  padding: 0 26px;
  border-left: 4px solid transparent;
  color: #12314f;
  font-weight: 700;
}

.nav-item.active {
  border-left-color: var(--blue);
  background: var(--blue-soft);
  color: var(--blue-dark);
}

svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}

.content {
  padding: 20px;
}

.page-head,
.panel {
  width: 100%;
  max-width: 1180px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.page-head {
  padding: 17px 16px;
  margin-bottom: 13px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

.page-head h1 {
  font-size: 20px;
  line-height: 1.35;
}

.page-head p,
.panel-title p,
.setting-box-head p,
.auth-card p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.panel {
  padding: 20px;
  box-shadow: 0 18px 34px rgba(25, 75, 120, 0.06);
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.panel-title h2 {
  font-size: 18px;
}

.search-panel {
  width: 100%;
  max-width: 1180px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.search-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 86px;
  gap: 10px;
}

.setting-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  padding-top: 18px;
}

.setting-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fbfdff;
}

.setting-box-head {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.setting-box-head h3 {
  font-size: 15px;
}

label {
  display: grid;
  gap: 7px;
  color: #153653;
  font-weight: 700;
}

label + label {
  margin-top: 13px;
}

label span {
  font-size: 12px;
}

input,
select,
textarea {
  width: 100%;
  padding: 0 12px;
  border: 1px solid #cddbeb;
  border-radius: 7px;
  color: var(--text);
  background: #fff;
  outline: none;
}

input,
select {
  height: 38px;
}

textarea {
  min-height: 120px;
  padding-top: 11px;
  padding-bottom: 11px;
  line-height: 1.55;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(13, 130, 213, 0.13);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  padding-top: 18px;
}

.form-grid.one {
  grid-template-columns: minmax(180px, 320px);
}

.posting-form-grid {
  grid-template-columns: minmax(160px, 220px) minmax(240px, 420px);
}

.toggle-field {
  width: max-content;
  display: inline-flex;
  grid-template-columns: none;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  color: #153653;
  cursor: pointer;
  user-select: none;
}

.toggle-field input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.toggle-ui {
  width: 42px;
  height: 24px;
  position: relative;
  border-radius: 999px;
  background: #cddbeb;
  transition: background 0.18s ease;
}

.toggle-ui::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(15, 39, 65, 0.25);
  transition: transform 0.18s ease;
}

.toggle-field input:checked + .toggle-ui {
  background: var(--blue);
}

.toggle-field input:checked + .toggle-ui::after {
  transform: translateX(18px);
}

.toggle-field strong {
  font-size: 13px;
}

.wide-field {
  margin-top: 16px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 18px;
}

.bot-form-panel {
  max-width: 860px;
}

.progress-preview {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfdff;
}

.progress-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.progress-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.progress-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5eef8;
}

.progress-bar {
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
  transition: width 0.2s ease;
}

.progress-log {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.progress-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 10px;
  color: #153653;
  font-size: 12px;
  font-weight: 800;
}

.bot-result {
  margin-top: 18px;
}

.bot-result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.bot-result-head h3 {
  font-size: 15px;
}

.bot-result-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.bot-result-table {
  min-width: 920px;
}

.bot-result-table th,
.bot-result-table td {
  max-width: 260px;
  height: 44px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tabs {
  width: 100%;
  max-width: 1180px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 6px 8px;
  margin-bottom: 13px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 6px;
}

.tab {
  width: 100%;
  min-width: 0;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 14px;
  color: #496681;
  background: #edf5fd;
  font-size: 13px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tab.active {
  color: var(--blue-dark);
  border-color: var(--line);
  background: #fff;
}

.posting-list-panel {
  margin-top: 14px;
}

.queue-summary-panel,
.active-work-panel,
.recent-posts-panel,
.queue-list-panel {
  max-width: 1040px;
}

.queue-summary-panel,
.active-work-panel,
.recent-posts-panel {
  margin-bottom: 22px;
}

.recent-posts-panel {
  margin-top: 4px;
}

.queue-summary-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.queue-summary-grid div {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px;
  background: #fbfdff;
}

.queue-summary-grid strong {
  display: block;
  overflow: hidden;
  color: #143653;
  font-size: 20px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.queue-summary-grid span,
.queue-subtext {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.queue-table {
  min-width: 980px;
}

.queue-table th:nth-child(1),
.queue-table td:nth-child(1) {
  width: 70px;
  text-align: center;
}

.queue-table th:nth-child(2),
.queue-table td:nth-child(2),
.queue-table th:nth-child(3),
.queue-table td:nth-child(3) {
  width: 100px;
}

.queue-table th:nth-child(4),
.queue-table td:nth-child(4) {
  width: 120px;
}

.queue-row-running td {
  background: #fff8df;
}

.queue-row-running td:first-child {
  border-left: 4px solid #e3a300;
}

.active-work-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.active-work-card {
  border: 1px solid #cbdced;
  border-radius: 8px;
  padding: 13px;
  background: #f7fbff;
}

.active-work-top,
.active-work-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.active-work-top strong {
  color: #102f4b;
  font-size: 15px;
}

.active-work-top span {
  border-radius: 999px;
  padding: 5px 9px;
  background: #e7f1fb;
  color: #17496d;
  font-size: 12px;
  font-weight: 900;
}

.active-work-current {
  margin-top: 10px;
  color: #163653;
  font-size: 16px;
  font-weight: 900;
}

.active-work-message {
  margin-top: 6px;
  color: #35536b;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.5;
}

.active-work-meta {
  justify-content: flex-start;
  flex-wrap: wrap;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.active-work-empty {
  border: 1px dashed #c8d6e2;
  border-radius: 8px;
  padding: 18px;
  color: var(--muted);
  background: #fbfdff;
  font-weight: 800;
  text-align: center;
}

.recent-posts-table {
  min-width: 900px;
}

.recent-posts-table th:nth-child(1),
.recent-posts-table td:nth-child(1),
.recent-posts-table th:nth-child(2),
.recent-posts-table td:nth-child(2),
.recent-posts-table th:nth-child(5),
.recent-posts-table td:nth-child(5) {
  width: 72px;
  text-align: center;
}

.recent-posts-table th:nth-child(3),
.recent-posts-table td:nth-child(3) {
  width: 150px;
}

.recent-posts-table th:nth-child(6),
.recent-posts-table td:nth-child(6) {
  width: 150px;
}

.queue-request-detail summary {
  overflow: hidden;
  color: #153653;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.queue-request-detail pre {
  overflow: auto;
  max-height: 180px;
  margin: 8px 0 0;
  padding: 10px;
  border-radius: 8px;
  background: #eef4fa;
  color: #244560;
  font-size: 12px;
  white-space: pre-wrap;
}

.queue-request-message {
  margin-top: 14px;
  border: 1px solid #b8d7ef;
  border-radius: 8px;
  padding: 11px 12px;
  color: #11527c;
  background: #eef8ff;
  font-weight: 800;
}

.queue-request-message.error {
  border-color: #efcaca;
  color: var(--danger);
  background: #fff7f7;
}

.image-posting-panel,
.image-prompt-result-panel,
.image-library-panel {
  max-width: 1040px;
}

.image-library-panel .panel-title {
  align-items: center;
}

.image-library-list {
  display: grid;
  gap: 10px;
  padding-top: 16px;
}

.image-library-table {
  min-width: 980px;
}

.image-library-table th:nth-child(1),
.image-library-table td:nth-child(1) {
  width: 64px;
  text-align: center;
}

.image-library-table th:nth-child(3),
.image-library-table td:nth-child(3) {
  width: 100px;
  text-align: center;
}

.image-library-table th:nth-child(5),
.image-library-table td:nth-child(5) {
  width: 160px;
}

.image-library-table th:nth-child(6),
.image-library-table td:nth-child(6) {
  width: 280px;
}

.image-library-table td {
  max-width: 340px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-library-table .row-actions {
  justify-content: flex-start;
}

.image-library-table .row-actions button {
  min-width: 70px;
  height: 32px;
  padding: 0 10px;
  font-size: 12px;
}

.image-library-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
  box-shadow: 0 8px 18px rgba(26, 63, 96, 0.04);
}

.image-library-item summary {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 116px 142px;
  align-items: center;
  gap: 14px;
  min-height: 72px;
  padding: 12px 14px;
  color: #173c5c;
  background: linear-gradient(180deg, #ffffff 0%, #f9fcff 100%);
  cursor: pointer;
  font-size: 13px;
  list-style: none;
}

.image-library-item summary::-webkit-details-marker {
  display: none;
}

.image-library-item summary::after {
  content: "펼치기";
  justify-self: end;
  grid-column: 4;
  grid-row: 1;
  align-self: end;
  color: #6b819a;
  font-size: 11px;
  font-weight: 800;
}

.image-library-item[open] summary::after {
  content: "닫기";
}

.image-library-no {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  color: #1d5d91;
  background: #eaf5ff;
  font-size: 12px;
  font-weight: 900;
}

.image-library-main {
  min-width: 0;
}

.image-library-main strong,
.image-library-main em,
.image-library-item summary time {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-library-main strong {
  color: #143653;
  font-size: 14px;
}

.image-library-main em {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.image-library-count {
  width: max-content;
  max-width: 116px;
  justify-self: start;
  border: 1px solid #cfe0ef;
  border-radius: 999px;
  padding: 5px 9px;
  color: #225579;
  background: #f4f9fe;
  font-size: 12px;
  font-weight: 900;
}

.image-library-item summary time {
  color: var(--muted);
  font-style: normal;
  font-weight: 800;
}

.image-library-detail {
  border-top: 1px solid var(--line);
  background: #fbfdff;
}

.image-library-detail-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px 0;
  color: #153653;
  font-size: 12px;
}

.image-library-detail-head span {
  color: var(--muted);
  font-weight: 800;
}

.image-library-detail pre {
  overflow: auto;
  margin: 0;
  max-height: 320px;
  padding: 12px 14px 14px;
  color: #243d56;
  background: transparent;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.image-library-modal-card {
  width: min(780px, calc(100vw - 32px));
}

.image-library-test-modal-card {
  width: min(1320px, calc(100vw - 32px));
}

.image-library-detail-modal-card {
  width: min(980px, calc(100vw - 32px));
}

.image-library-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.image-library-modal-card form {
  display: grid;
  gap: 14px;
}

.image-library-test-modal-card form {
  display: grid;
  gap: 14px;
}

.image-library-modal-card .image-drop-zone.compact {
  min-height: 136px;
  margin-top: 0;
}

.image-library-test-modal-card .image-drop-zone.compact {
  min-height: 136px;
  margin-top: 0;
}

.image-library-test-result {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.image-library-test-result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.image-library-test-result-head strong {
  color: #143653;
  font-size: 15px;
}

.image-library-test-result-head span {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-library-test-result-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 460px);
  gap: 18px;
  align-items: start;
}

.image-library-test-result-grid label {
  min-width: 0;
}

.image-library-test-result-grid textarea {
  min-height: 520px;
  font-size: 12px;
  background: #fff;
}

.image-library-test-generated {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.image-library-test-generated span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.image-library-test-generated img {
  width: 100%;
  max-height: 680px;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: contain;
  background: #edf3f8;
}

.image-library-test-raw pre {
  overflow: auto;
  max-height: 180px;
  margin: 8px 0 0;
  padding: 10px;
  border-radius: 8px;
  background: #eef4fa;
  color: #244560;
  font-size: 12px;
  white-space: pre-wrap;
}

@media (max-width: 760px) {
  .image-library-test-result-grid {
    grid-template-columns: 1fr;
  }
}

.library-detail-summary {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.library-title-edit {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 86px;
  align-items: end;
  gap: 10px;
}

.library-title-edit label {
  min-width: 0;
}

.library-title-edit .primary-btn {
  height: 38px;
}

.library-detail-summary strong {
  color: #143653;
  font-size: 16px;
}

.library-detail-summary span,
.library-detail-summary p {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

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

.library-detail-row {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.library-detail-row > div {
  min-width: 0;
}

.library-detail-row img {
  width: 132px;
  height: 132px;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: cover;
  background: #edf3f8;
}

.library-detail-row-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  margin-bottom: 8px;
  color: #173c5c;
  font-size: 13px;
}

.library-detail-row-head strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.library-detail-row-head span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.library-detail-row textarea {
  min-height: 96px;
  font-size: 12px;
  background: #fbfdff;
}

.library-detail-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

.library-detail-actions button {
  height: 32px;
  min-width: 86px;
  padding: 0 10px;
  font-size: 12px;
}

.image-posting-form-grid {
  grid-template-columns: minmax(140px, 220px) minmax(320px, 1fr);
}

.image-posting-form-grid textarea {
  min-height: 86px;
}

.image-posting-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.image-library-select-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  overflow: hidden;
}

.image-library-select-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: #f4f9fe;
}

.image-library-select-head strong {
  color: #143653;
  font-size: 14px;
}

.image-library-select-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.image-library-select-list {
  max-height: 520px;
  overflow-y: auto;
}

.image-library-select-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  background: #fff;
}

.image-library-select-table th,
.image-library-select-table td {
  height: 38px;
  border-bottom: 1px solid #e2ebf3;
  padding: 6px 8px;
  color: #173c5c;
  font-size: 12px;
  vertical-align: middle;
}

.image-library-select-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fbfe;
  color: var(--muted);
  font-weight: 900;
}

.image-library-select-table th:nth-child(1),
.image-library-select-table td:nth-child(1) {
  width: 36px;
  text-align: center;
}

.image-library-select-table th:nth-child(3),
.image-library-select-table td:nth-child(3) {
  width: 64px;
  text-align: right;
}

.image-library-select-row:has(input:checked) td {
  background: #eef7ff;
}

.image-library-select-row input[type="checkbox"] {
  width: 13px;
  height: 13px;
  margin: 0;
  vertical-align: middle;
}

.image-library-select-row strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #143653;
  font-size: 13px;
}

.image-library-select-row span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.image-library-select-row button {
  height: 28px;
  min-width: 46px;
  padding: 0 8px;
  font-size: 11px;
}

.image-posting-options {
  display: grid;
  gap: 14px;
  min-width: 0;
}

@media (max-width: 920px) {
  .image-posting-layout {
    grid-template-columns: 1fr;
  }

  .image-library-select-list {
    max-height: 320px;
  }
}

.image-prompt-result-panel {
  margin-top: 14px;
}

.image-posting-items-panel {
  margin-top: 14px;
}

.image-drop-zone {
  min-height: 188px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 18px;
  border: 2px dashed #b8cce2;
  border-radius: 8px;
  background: #f7fbff;
  color: #244560;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease;
}

.image-drop-zone.drag-over,
.image-drop-zone:focus {
  border-color: var(--blue);
  background: #eef7ff;
  outline: none;
}

.image-drop-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--blue);
  font-size: 28px;
  font-weight: 500;
  line-height: 1;
}

.image-drop-zone strong {
  font-size: 15px;
}

.image-drop-zone span {
  color: var(--muted);
  font-size: 12px;
}

.image-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.image-preview-card {
  position: relative;
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 78px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 38px 9px 9px;
  background: #fff;
}

.image-preview-card img {
  width: 58px;
  height: 58px;
  border-radius: 7px;
  object-fit: cover;
  background: #edf3f8;
}

.image-preview-card strong,
.image-preview-card span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-preview-card strong {
  color: #173c5c;
  font-size: 12px;
}

.image-preview-card span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.image-preview-card .icon-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  min-width: 24px;
  height: 24px;
  padding: 0;
  line-height: 1;
}

.image-prompt-list {
  display: grid;
  gap: 12px;
  padding-top: 14px;
}

.image-prompt-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfdff;
}

.image-prompt-item.failed {
  border-color: #f0b8b8;
  background: #fff7f7;
}

.image-prompt-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 9px;
  color: #173c5c;
  font-size: 13px;
}

.image-prompt-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.image-prompt-item textarea {
  min-height: 132px;
  font-size: 12px;
  background: #fff;
}

.image-prompt-item p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.posting-result-table {
  min-width: 980px;
}

.posting-result-table th,
.posting-result-table td {
  max-width: 260px;
  height: 44px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.posting-result-table th:nth-child(1),
.posting-result-table td:nth-child(1) {
  width: 64px;
  text-align: center;
}

.raw-output-panel {
  max-width: 1180px;
}

.raw-output-list {
  padding: 14px;
}

.raw-output-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  overflow: hidden;
}

.raw-output-item + .raw-output-item {
  margin-top: 10px;
}

.raw-output-item summary {
  min-height: 46px;
  display: grid;
  grid-template-columns: 42px minmax(220px, 1fr) minmax(120px, 160px) 58px 150px;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  cursor: pointer;
}

.raw-output-item summary strong,
.raw-output-item summary em,
.raw-output-item summary time {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.raw-output-item summary em,
.raw-output-item summary time {
  color: var(--muted);
  font-style: normal;
  font-size: 12px;
  font-weight: 700;
}

.raw-output-no,
.raw-status-success,
.raw-status-failed {
  font-size: 12px;
  font-weight: 800;
}

.raw-status-success {
  color: var(--success);
}

.raw-status-failed {
  color: var(--danger);
}

.raw-output-message {
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  color: #153653;
  background: #fff;
  font-size: 12px;
  font-weight: 800;
}

.raw-output-item pre {
  max-height: 460px;
  overflow: auto;
  margin: 0;
  padding: 14px;
  border-top: 1px solid var(--line);
  color: #243d56;
  background: #fff;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.raw-json {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.raw-json summary {
  padding: 11px 12px;
  color: #153653;
  font-weight: 800;
  cursor: pointer;
}

.raw-json pre {
  max-height: 360px;
  overflow: auto;
  margin: 0;
  padding: 12px;
  border-top: 1px solid var(--line);
  color: #243d56;
  background: #fff;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.primary-btn {
  min-width: 86px;
  height: 38px;
  border: 0;
  border-radius: 7px;
  padding: 0 16px;
  color: #fff;
  background: #2563eb;
  font-weight: 700;
  cursor: pointer;
}

.primary-btn:hover {
  background: #1d55ce;
}

.primary-btn.full {
  width: 100%;
}

.secondary-btn,
.danger-btn,
.icon-btn {
  height: 36px;
  border: 1px solid #cddbeb;
  border-radius: 7px;
  padding: 0 14px;
  color: #143653;
  background: #fff;
  font-weight: 700;
  cursor: pointer;
}

.secondary-btn:hover {
  background: #f4f8fc;
}

.danger-btn {
  color: #fff;
  border-color: #d64d4d;
  background: #d64d4d;
}

.danger-btn:hover {
  background: #bd3838;
}

.danger-btn:disabled {
  color: #8da1b5;
  border-color: #dce6f0;
  background: #f4f7fb;
  cursor: not-allowed;
}

.icon-btn {
  width: 34px;
  padding: 0;
  font-size: 22px;
  line-height: 1;
}

.alert {
  max-width: 1180px;
  margin: 0 0 13px;
  padding: 12px 14px;
  border: 1px solid;
  border-radius: 8px;
  background: #fff;
  font-weight: 700;
}

.alert.error {
  color: var(--danger);
  border-color: #efcaca;
  background: #fff7f7;
}

.alert.success {
  color: var(--success);
  border-color: #bde5cf;
  background: #f3fcf7;
}

.password-panel {
  max-width: 560px;
}

.password-panel .primary-btn {
  margin-top: 16px;
}

.state-panel {
  max-width: 560px;
  text-align: center;
}

.state-badge {
  display: inline-grid;
  place-items: center;
  min-width: 70px;
  height: 38px;
  margin-bottom: 14px;
  border: 1px solid #efcaca;
  border-radius: 7px;
  color: var(--danger);
  background: #fff7f7;
  font-weight: 800;
}

.state-panel h2 {
  font-size: 20px;
}

.state-panel p {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.6;
}

.state-actions {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
}

.link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.table-wrap {
  overflow-x: auto;
  margin-top: 18px;
}

.table-panel {
  padding: 0;
}

.image-library-panel {
  padding: 20px;
}

.table-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 14px 0;
}

.table-title-row h2 {
  font-size: 14px;
}

.table-title-row span {
  color: #6b819a;
  font-size: 12px;
  font-weight: 700;
}

.data-table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  height: 54px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.data-table th {
  height: 38px;
  color: #57708c;
  background: #f6f9fd;
  font-size: 12px;
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.actions-col {
  width: 180px;
  text-align: right;
}

.row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.row-actions form {
  margin: 0;
}

.blog-table {
  min-width: 900px;
  table-layout: fixed;
}

.blog-table th:nth-child(1),
.blog-table td:nth-child(1) {
  width: 80px;
  text-align: center;
}

.blog-table th:nth-child(2),
.blog-table td:nth-child(2) {
  width: 130px;
}

.blog-table th:nth-child(3),
.blog-table td:nth-child(3) {
  width: 150px;
}

.blog-table th:nth-child(4),
.blog-table td:nth-child(4) {
  width: 170px;
}

.blog-table td:nth-child(3),
.blog-table td:nth-child(4),
.blog-table td:nth-child(5) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.blog-table .actions-col,
.blog-table td.row-actions {
  width: 230px;
}

.blog-table .row-actions {
  flex-wrap: nowrap;
}

.blog-table .row-actions .secondary-btn {
  padding: 0 10px;
  white-space: nowrap;
}

.promo-editor-panel {
  gap: 16px;
}

.promo-list-panel {
  margin-top: 18px;
}

.promo-table {
  min-width: 720px;
}

.promo-table th:nth-child(1),
.promo-table td:nth-child(1) {
  width: 72px;
  text-align: center;
}

.promo-table th:nth-child(3),
.promo-table td:nth-child(3) {
  width: 170px;
}

.promo-table th:nth-child(4),
.promo-table td:nth-child(4) {
  width: 230px;
}

.promo-table td:nth-child(2) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-img,
.profile-placeholder {
  width: 48px;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.profile-img {
  display: block;
  object-fit: cover;
  background: #eef5fc;
}

.profile-placeholder {
  display: grid;
  place-items: center;
  color: var(--blue-dark);
  background: var(--blue-soft);
  font-weight: 800;
}

.table-link {
  color: #164f9f;
  font-weight: 700;
}

.table-link:hover {
  text-decoration: underline;
}

.empty-table {
  display: grid;
  min-height: 110px;
  place-items: center;
  color: var(--muted);
  font-weight: 700;
}

.pagination {
  width: 100%;
  max-width: 1180px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 0 0;
}

.page-btn,
.page-current {
  min-width: 44px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 800;
}

.page-btn {
  border: 1px solid #cddbeb;
  color: #4e6a88;
  background: #fff;
}

.page-btn.disabled {
  color: #9cadbf;
  background: #f5f8fb;
}

.page-current {
  min-width: 70px;
  color: #fff;
  background: var(--blue);
}

.database-layout {
  width: 100%;
  max-width: 1180px;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 14px;
}

.db-table-list {
  min-height: 360px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px 14px;
  background: #fff;
}

.db-table-list h2 {
  margin-bottom: 12px;
  font-size: 14px;
}

.db-table-link {
  display: block;
  padding: 10px 11px;
  border-radius: 7px;
  color: #254866;
  font-weight: 700;
  word-break: break-word;
}

.db-table-link + .db-table-link {
  margin-top: 4px;
}

.db-table-link.active {
  color: var(--blue-dark);
  background: var(--blue-soft);
}

.db-empty {
  padding: 12px 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.db-content {
  min-width: 0;
}

.db-panel {
  max-width: none;
  padding-bottom: 18px;
}

.db-section {
  margin-top: 16px;
  padding: 0 14px;
}

.db-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.db-section-title h3 {
  font-size: 14px;
}

.db-section-title span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.table-wrap.compact {
  margin-top: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.db-index-table,
.db-data-table {
  min-width: 720px;
}

.db-index-table th,
.db-index-table td,
.db-data-table th,
.db-data-table td {
  max-width: 260px;
  height: 42px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15, 39, 65, 0.36);
}

.modal-backdrop[hidden] {
  display: none;
}

.modal {
  width: min(440px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(15, 39, 65, 0.22);
}

.modal-card {
  width: min(520px, 100%);
  max-height: calc(100vh - 40px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(15, 39, 65, 0.22);
}

.wide-modal {
  width: min(860px, 100%);
  max-height: calc(100vh - 40px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

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

.modal-form {
  padding: 18px;
}

.modal-card form {
  overflow: auto;
  padding: 18px;
}

.modal-card.image-library-test-modal-card {
  width: min(1320px, calc(100vw - 32px));
}

.modal-card.image-library-test-modal-card form {
  overflow-x: hidden;
}

@media (max-width: 940px) {
  .image-library-test-result-grid {
    grid-template-columns: 1fr;
  }

  .image-library-test-result-grid textarea {
    min-height: 260px;
  }
}

.detail-modal-body {
  overflow: auto;
  padding: 18px;
}

.detail-hero {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.detail-profile {
  width: 72px;
  height: 72px;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: cover;
  background: #eef5fc;
}

.detail-profile.placeholder {
  display: grid;
  place-items: center;
  color: var(--blue-dark);
  background: var(--blue-soft);
  font-size: 24px;
  font-weight: 800;
}

.detail-hero h3 {
  font-size: 19px;
}

.detail-hero p {
  margin: 6px 0;
  color: var(--muted);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.detail-item {
  min-height: 64px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  background: #fbfdff;
}

.detail-item span {
  display: block;
  margin-bottom: 7px;
  color: #5f7690;
  font-size: 12px;
  font-weight: 700;
}

.detail-item strong {
  display: block;
  line-height: 1.45;
  word-break: break-word;
}

.detail-images {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.detail-image {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.detail-image img {
  width: 100%;
  aspect-ratio: 16 / 9;
  display: block;
  object-fit: cover;
  background: #eef5fc;
}

.detail-image span {
  display: block;
  padding: 9px 10px;
  color: #153653;
  font-size: 12px;
  font-weight: 800;
}

.detail-error {
  border: 1px solid #efcaca;
  border-radius: 8px;
  padding: 14px;
  color: var(--danger);
  background: #fff7f7;
  font-weight: 700;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}

.auth-page {
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, #eaf5ff 0%, #f7fbff 100%);
}

.auth-wrap {
  width: min(420px, calc(100% - 32px));
}

.auth-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
  background: #fff;
  box-shadow: 0 22px 42px rgba(25, 75, 120, 0.12);
}

.auth-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 22px;
  color: var(--blue-dark);
}

.auth-title strong {
  font-size: 18px;
}

.auth-title span {
  color: var(--muted);
  font-size: 13px;
}

.auth-card h1 {
  font-size: 20px;
}

.auth-form {
  margin-top: 20px;
}

.auth-form .primary-btn {
  margin-top: 18px;
}

@media (max-width: 900px) {
  .tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .mobile-menu-toggle {
    display: inline-flex;
    flex: 0 0 auto;
  }

  .brand {
    min-width: 0;
  }

  .brand strong,
  .brand span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .sidebar {
    position: fixed;
    top: 46px;
    left: 0;
    bottom: 0;
    z-index: 30;
    width: min(284px, calc(100vw - 54px));
    display: block;
    overflow-y: auto;
    transform: translateX(-100%);
    transition: transform 0.18s ease;
    border-right: 1px solid var(--line);
    border-bottom: 0;
    padding: 0;
    box-shadow: 18px 0 34px rgba(15, 39, 65, 0.18);
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 46px 0 0;
    z-index: 25;
    display: block;
    background: rgba(15, 39, 65, 0.35);
  }

  .sidebar-backdrop[hidden] {
    display: none;
  }

  .nav-item {
    min-width: 0;
    width: 100%;
    border-left: 4px solid transparent;
    border-bottom: 1px solid #edf3f9;
  }

  .nav-item.active {
    border-left-color: var(--blue);
    border-bottom-color: #edf3f9;
  }

  .setting-grid {
    grid-template-columns: 1fr;
  }

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

  .form-grid {
    grid-template-columns: 1fr;
  }

  .search-form {
    grid-template-columns: 1fr;
  }

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

  .image-library-item summary {
    grid-template-columns: 38px minmax(0, 1fr) 112px;
  }

  .image-library-item summary::after {
    grid-column: 3;
  }

  .image-library-item summary time {
    grid-column: 2 / 4;
  }

  .db-table-list {
    min-height: 0;
  }

  .topbar {
    padding: 0 14px;
  }

  .current-user {
    display: none;
  }
}

@media (max-width: 560px) {
  .tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tab {
    min-width: 0;
    width: 100%;
    height: 36px;
    padding: 0 10px;
    font-size: 12px;
    line-height: 1.15;
    text-align: center;
  }

  .queue-summary-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    gap: 8px;
  }

  .top-actions {
    gap: 8px;
    font-size: 11px;
  }

  .brand span {
    display: none;
  }

  .top-actions .divider:first-of-type,
  .top-actions a[href="/password"] {
    display: none;
  }

  .content {
    padding: 12px;
  }

  .panel-title {
    align-items: stretch;
    flex-direction: column;
  }

  .state-actions {
    flex-direction: column;
  }

  .detail-grid,
  .detail-images {
    grid-template-columns: 1fr;
  }

  .detail-hero {
    grid-template-columns: 1fr;
  }

  .raw-output-item summary {
    grid-template-columns: 34px minmax(0, 1fr);
  }

  .raw-output-item summary em,
  .raw-output-item summary b,
  .raw-output-item summary time {
    grid-column: 2;
  }

  .image-library-item summary {
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 10px;
  }

  .image-library-count,
  .image-library-item summary time,
  .image-library-item summary::after {
    grid-column: 2;
  }

  .image-library-count {
    margin-top: 4px;
  }
}

@media (max-width: 420px) {
  .tabs {
    grid-template-columns: 1fr;
  }

  .tab {
    justify-content: flex-start;
    height: 34px;
  }
}
