:root {
  color-scheme: light;
  --bg: #f5f6f8;
  --panel: #ffffff;
  --text: #172033;
  --muted: #64748b;
  --line: #dfe5ee;
  --primary: #1f6feb;
  --primary-dark: #1558c9;
  --accent: #ff6a00;
  --accent-soft: #fff3e8;
  --jd-red: #e1251b;
  --danger: #b42318;
  --ok: #147d4b;
  --warn: #9a6700;
  --surface: #fbfcfe;
  --shadow: 0 6px 20px rgba(23, 32, 51, 0.06);
  --shadow-strong: 0 10px 28px rgba(23, 32, 51, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, #f8f9fb 0%, var(--bg) 160px),
    var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.55;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 28px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 3px 14px rgba(23, 32, 51, 0.05);
}

h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 750;
  letter-spacing: 0;
}

p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.refresh,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  padding: 0 14px;
  background: var(--primary);
  color: #fff;
  text-decoration: none;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(31, 111, 235, 0.18);
}

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

button:hover,
.refresh:hover {
  background: var(--primary-dark);
  box-shadow: 0 4px 10px rgba(31, 111, 235, 0.24);
}

button.secondary {
  background: #eef4ff;
  color: #185abc;
  box-shadow: none;
}

button.secondary:hover {
  background: #d7e3f3;
}

button.danger {
  background: #fff1f0;
  color: var(--danger);
  box-shadow: none;
}

button.danger:hover {
  background: #f7d2ce;
}

.reject-submit-button {
  background: #b42318;
  color: #fff;
  box-shadow: 0 8px 18px rgba(180, 35, 24, 0.16);
}

.reject-submit-button:hover {
  background: #991b1b;
}

.login-body {
  min-height: 100vh;
  background:
    linear-gradient(120deg, rgba(225, 37, 27, 0.08), rgba(255, 106, 0, 0.08) 42%, rgba(31, 111, 235, 0.08)),
    #f6f7f9;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(300px, 1fr) minmax(400px, 480px);
  gap: 44px;
  align-items: center;
  max-width: 1120px;
  margin: 0 auto;
  padding: 56px 32px;
}

.login-brand {
  display: grid;
  gap: 12px;
}

.login-brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 62px;
  height: 62px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--jd-red), var(--accent));
  color: #fff;
  font-size: 30px;
  font-weight: 800;
  box-shadow: 0 12px 26px rgba(225, 37, 27, 0.18);
}

.login-brand h1 {
  font-size: 34px;
}

.login-brand p {
  max-width: 420px;
  font-size: 16px;
}

.login-card {
  padding: 32px;
  border: 1px solid rgba(223, 229, 238, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow-strong);
}

.login-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 24px;
}

.login-card-head h2 {
  margin: 0;
  font-size: 26px;
}

.login-card-head span,
.login-card-head .login-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 0 10px;
  background: #fff3e8;
  color: #b54708;
  font-size: 12px;
  font-weight: 700;
}

.login-form {
  display: grid;
  gap: 18px;
}

.login-form label {
  display: grid;
  gap: 9px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
}

.login-form input {
  width: 100%;
  min-height: 50px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 14px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

.login-form input:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(255, 106, 0, 0.12);
}

.login-form button {
  min-height: 50px;
  background: linear-gradient(90deg, var(--jd-red), var(--accent));
  box-shadow: 0 8px 18px rgba(225, 37, 27, 0.18);
}

.login-form button:hover {
  background: linear-gradient(90deg, #c91d14, #e85f00);
}

.login-notice {
  margin: 0 0 14px;
}

.notice-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.notice-actions .detail-button {
  margin: 0;
}

.admin-user-form {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(260px, 1.35fr) minmax(140px, 180px) minmax(180px, 1.2fr) minmax(150px, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.admin-user-form label,
.inline-reset {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.admin-user-form input,
.admin-user-form select,
.admin-user-table input,
.admin-user-table select,
.wide-filterbar input,
.wide-filterbar select,
.inline-reset input {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

.wide-filterbar form {
  display: grid;
  grid-template-columns: auto minmax(140px, 180px) auto minmax(140px, 180px) auto minmax(160px, 220px) auto minmax(90px, 120px) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
}

.operation-log-table th,
.operation-log-table td {
  vertical-align: top;
}

.log-detail {
  max-width: 420px;
  white-space: normal;
  word-break: break-word;
  color: var(--muted);
}

.empty-cell {
  padding: 24px;
  text-align: center;
  color: var(--muted);
}

.admin-user-table th,
.admin-user-table td {
  vertical-align: middle;
}

.admin-user-table input,
.admin-user-table select {
  min-width: 120px;
}

.inline-reset {
  grid-template-columns: minmax(120px, 1fr) auto;
  align-items: end;
}

.muted-row {
  opacity: 0.68;
  background: #fafafa;
}

.notice {
  margin: 16px 28px 0;
  padding: 11px 14px;
  border: 1px solid #f1d48a;
  border-radius: 6px;
  background: linear-gradient(90deg, #fff8e6 0%, #fffdf7 100%);
  color: #674b00;
  font-size: 13px;
}

.success-notice {
  border-color: #b7e3c7;
  background: linear-gradient(90deg, #ecfff3 0%, #fbfffd 100%);
  color: #0f6634;
}

.danger-notice {
  border-color: #f1b7b0;
  background: linear-gradient(90deg, #fff1f0 0%, #fffafa 100%);
  color: var(--danger);
}

.live-refresh-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 16px 28px 0;
  padding: 12px 14px;
  border: 1px solid #bfd5f2;
  border-radius: 8px;
  background: #f4f8ff;
  color: #143c74;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 8px 22px rgba(34, 97, 196, 0.08);
}

.live-refresh-notice[hidden] {
  display: none;
}

.live-refresh-notice a {
  color: var(--primary);
  text-decoration: none;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 28px 8px;
}

.filterbar {
  padding: 14px 28px 0;
}

.filterbar form {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  box-shadow: 0 1px 4px rgba(23, 32, 51, 0.04);
}

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

.inline-form,
.wide-filter-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.wide-filter-form label {
  color: var(--muted);
  font-size: 12px;
}

.wide-filter-form select {
  min-width: 150px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

.locked-filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  box-shadow: 0 1px 4px rgba(23, 32, 51, 0.04);
}

.locked-filter span {
  color: var(--muted);
}

.tabs a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  background: var(--panel);
  color: var(--text);
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(23, 32, 51, 0.04);
  font-weight: 650;
}

.tabs a.active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 3px 10px rgba(255, 106, 0, 0.12);
}

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

main {
  padding: 8px 28px 28px;
}

.input-panel {
  display: grid;
  gap: 10px;
  margin: 0 0 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.quick-add {
  display: grid;
  grid-template-columns: minmax(120px, 150px) minmax(120px, 150px) minmax(130px, 160px) minmax(120px, 150px) minmax(150px, 180px) minmax(260px, 1fr) auto;
  gap: 10px;
}

.import-form {
  display: grid;
  grid-template-columns: minmax(240px, 360px) auto;
  gap: 10px;
  justify-content: start;
}

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

.scenario-form span {
  color: var(--muted);
  font-size: 12px;
}

.bulk-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.bulk-bar span {
  color: var(--muted);
  font-size: 12px;
}

.list-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(150px, 190px) minmax(160px, 210px) auto auto;
  align-items: end;
  gap: 10px;
  margin: 0 0 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.list-toolbar label {
  display: grid;
  gap: 5px;
}

.list-toolbar span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.list-toolbar button,
.list-toolbar .detail-button {
  min-height: 36px;
  margin: 0;
}

.toolbar-summary {
  align-self: center;
  justify-self: end;
  white-space: nowrap;
}

input {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  color: var(--text);
  font: inherit;
  background: #fff;
}

input:focus {
  outline: 2px solid rgba(24, 103, 201, 0.16);
  border-color: var(--primary);
}

input[readonly] {
  background: #f3f6fa;
  color: var(--muted);
}

input[type="checkbox"] {
  width: 16px;
  min-width: 16px;
  height: 16px;
  min-height: 16px;
  padding: 0;
}

.sort-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text);
  text-decoration: none;
}

.sort-link:hover {
  color: var(--primary);
}

.sort-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 14px;
  font-size: 12px;
  line-height: 1;
  color: #94a3b8;
}

.sort-icon-active {
  color: var(--primary);
  font-weight: 800;
}

.table-wrap {
  overflow-x: auto;
  position: relative;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  min-width: 1080px;
  border-collapse: collapse;
  font-size: 13px;
}

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

th {
  position: sticky;
  top: 0;
  background: #f7f9fc;
  color: #475569;
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
}

tbody tr:hover {
  background: #fffaf5;
}

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

.mono {
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
}

.time,
.small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.title {
  max-width: 360px;
  font-weight: 750;
  line-height: 1.5;
  word-break: break-word;
  color: #111827;
}

.title-link {
  color: #111827;
  text-decoration: none;
}

.title-link:hover {
  color: var(--primary);
}

.task-title-line {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex-wrap: wrap;
}

details {
  margin-top: 8px;
}

.context-block {
  margin-top: 10px;
}

.explain-block {
  margin-top: 10px;
  border: 1px solid #e6ebf2;
  border-radius: 8px;
  padding: 10px;
  background: #fbfcfe;
}

.explain-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.context-block pre {
  max-height: 180px;
}

summary {
  color: var(--primary);
  cursor: pointer;
  font-size: 12px;
  font-weight: 650;
}

pre {
  max-width: 460px;
  margin: 8px 0 0;
  padding: 10px;
  overflow: auto;
  border-radius: 6px;
  background: #f7f8fa;
  color: #334155;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 12px;
  line-height: 1.55;
}

.badge {
  display: inline-flex;
  min-width: 70px;
  justify-content: center;
  border-radius: 999px;
  padding: 3px 8px;
  background: #eef2f7;
  color: #475569;
  font-size: 12px;
  font-weight: 700;
}

.badge.pending {
  background: #fff3e8;
  color: #b95000;
}

.badge.needs_info {
  background: #fff4d6;
  color: var(--warn);
}

.badge.processing {
  background: #fff4d6;
  color: var(--warn);
}

.badge.done {
  background: #e6f7ed;
  color: var(--ok);
}

.badge.cancelled {
  background: #f1f5f9;
  color: #64748b;
}

.badge.converted {
  background: #e6f7ed;
  color: var(--ok);
}

.followup-pill,
.priority-chip {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border-radius: 999px;
  padding: 0 8px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.followup-pill {
  background: #fff0e5;
  color: var(--accent);
  border: 1px solid #ffd0aa;
}

.muted-pill {
  background: #f1f5f9;
  color: var(--muted);
  border-color: #e2e8f0;
}

.priority-chip {
  background: #eef2f7;
  color: #475569;
}

.priority-high {
  background: #fff1f0;
  color: var(--jd-red);
}

.priority-normal {
  background: #e8f1ff;
  color: var(--primary);
}

.priority-low {
  background: #f1f5f9;
  color: var(--muted);
}

.category-chip {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  margin-top: 6px;
  border-radius: 999px;
  padding: 0 8px;
  background: #f5f7fb;
  color: #31506f;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.badge.ignored {
  background: #f1f5f9;
  color: #64748b;
}

.badge.rejected {
  background: #fee2e2;
  color: #991b1b;
}

.rejection-notice {
  background: #fff1f0;
  border-color: #ffb4ab;
  color: #991b1b;
}

.ok {
  color: var(--ok);
  font-weight: 650;
}

.error {
  color: var(--danger);
  font-weight: 650;
}

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

.reply-state {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  min-height: 22px;
  border-radius: 999px;
  padding: 0 8px;
  font-size: 12px;
  font-weight: 750;
}

.reply-ok {
  background: #e6f7ed;
  color: var(--ok);
}

.reply-config {
  background: #fff4d6;
  color: var(--warn);
}

.reply-error {
  background: #fff1f0;
  color: var(--danger);
}

.reply-muted {
  background: #f1f5f9;
  color: var(--muted);
}

.actions {
  width: 220px;
}

.actions form {
  margin: 0 0 8px;
}

.complete-form {
  display: grid;
  gap: 8px;
}

.inline-action-form {
  margin-top: 8px;
}

textarea {
  width: 100%;
  min-width: 190px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
  color: var(--text);
  font: inherit;
  font-size: 13px;
}

textarea:focus {
  outline: 2px solid rgba(24, 103, 201, 0.16);
  border-color: var(--primary);
}

.empty {
  display: grid;
  place-items: center;
  min-height: 280px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--panel);
  text-align: center;
}

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

.permission-empty {
  margin: 28px;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  font-size: 13px;
}

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

.pagination a,
.pagination .disabled {
  min-width: 66px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 10px;
  text-align: center;
  text-decoration: none;
  font-weight: 700;
}

.pagination a {
  background: #fff;
  color: var(--primary);
}

.pagination .disabled {
  background: #f3f6fa;
  color: #9aa5b1;
}

.pagination-jump {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 4px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.pagination-jump label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.pagination-jump input {
  width: 58px;
  min-height: 30px;
  padding: 0 6px;
  text-align: center;
}

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

.candidate-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 300px);
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.candidate-card:hover {
  border-color: #cfd8e6;
  box-shadow: var(--shadow-strong);
}

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

.candidate-card h2 {
  margin: 10px 0 8px;
  font-size: 17px;
  font-weight: 750;
  line-height: 1.35;
}

.candidate-content {
  margin: 0 0 12px;
  color: var(--text);
  line-height: 1.6;
  word-break: break-word;
  font-size: 13px;
}

.confidence {
  color: var(--muted);
  font-size: 12px;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px 14px;
  color: var(--muted);
  font-size: 12px;
}

.candidate-actions {
  display: grid;
  align-content: start;
  gap: 8px;
  min-width: 0;
}

.candidate-actions form {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.candidate-actions input,
.candidate-actions select,
.candidate-actions button {
  width: 100%;
  min-width: 0;
}

select {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  background: #fff;
  color: var(--text);
  font: inherit;
  text-overflow: ellipsis;
}

.inline-link {
  color: var(--primary);
  text-decoration: none;
}

.detail-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  border: 1px solid #d7e3f3;
  border-radius: 6px;
  padding: 0 10px;
  color: var(--primary);
  background: #f6f9ff;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  margin: 0 0 8px;
}

.secondary-link {
  background: #eef4ff;
  color: #185abc;
}

.detail-main {
  display: grid;
  gap: 16px;
}

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

.detail-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 20px;
  padding: 20px;
}

.detail-kicker {
  color: var(--muted);
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
}

.detail-hero h2 {
  margin: 8px 0 12px;
  font-size: 22px;
  line-height: 1.35;
  letter-spacing: 0;
}

.detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.soft-tag {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border-radius: 999px;
  padding: 0 8px;
  background: #f1f5f9;
  color: #475569;
  font-size: 12px;
  font-weight: 700;
}

.detail-side,
.info-list {
  display: grid;
  gap: 10px;
}

.detail-side div,
.info-list div {
  display: grid;
  gap: 3px;
}

.detail-side span,
.info-list span {
  color: var(--muted);
  font-size: 12px;
}

.detail-side strong,
.info-list strong {
  color: #111827;
  font-size: 13px;
  word-break: break-word;
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.65fr);
  gap: 16px;
  align-items: start;
}

.detail-panel {
  padding: 16px;
  align-self: start;
}

.detail-panel h3 {
  margin: 0 0 12px;
  font-size: 15px;
  letter-spacing: 0;
}

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

.timeline,
.message-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.timeline li,
.timeline article,
.message-list li {
  border: 1px solid #e6ebf2;
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfe;
}

.detail-grid > div {
  display: grid;
  gap: 6px;
  border: 1px solid #e6ebf2;
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfe;
}

.detail-grid > div span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.message-list .message-from-assignee {
  background: #f6f9ff;
  border-color: #d7e3f3;
}

.timeline-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}

.timeline-head strong {
  color: #334155;
}

.timeline p,
.message-list p {
  margin: 8px 0 0;
  color: #172033;
  line-height: 1.65;
  word-break: break-word;
}

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

.linked-list a {
  display: grid;
  gap: 4px;
  border: 1px solid #e6ebf2;
  border-radius: 8px;
  padding: 10px;
  background: #fbfcfe;
  color: var(--text);
  text-decoration: none;
}

.linked-list a:hover {
  border-color: #d7e3f3;
  background: #f6f9ff;
}

.linked-list .active-link {
  border-color: #ffd0aa;
  background: #fffaf5;
}

.linked-list span,
.linked-list em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.warn-text {
  color: var(--warn) !important;
}

.sync-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 16px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.stat-grid div {
  display: grid;
  gap: 5px;
  border: 1px solid #e6ebf2;
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfe;
}

.stat-grid span {
  color: var(--muted);
  font-size: 12px;
}

.stat-grid strong {
  color: #111827;
  font-size: 14px;
  word-break: break-word;
}

.queue-overview {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.compact-head {
  margin-top: 4px;
}

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

.queue-card {
  display: grid;
  gap: 8px;
  border: 1px solid #e6ebf2;
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfe;
}

.queue-card > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.queue-card strong {
  color: #111827;
  font-size: 14px;
}

.queue-card span,
.queue-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.embedded-table {
  box-shadow: none;
}

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

.message-history-table {
  min-width: 1380px !important;
}

.message-history-table th,
.message-history-table td {
  vertical-align: top;
}

.message-history-table .history-content {
  min-width: 280px;
  max-width: 420px;
  white-space: pre-wrap;
  line-height: 1.55;
}

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

.requester-tabs {
  padding: 12px 0 8px;
}

.requester-toolbar {
  margin-top: 6px;
}

.requester-items-table {
  min-width: 1120px;
}

.requester-items-table th,
.requester-items-table td {
  vertical-align: middle;
}

.requester-items-table .item-main {
  min-width: 340px;
}

.score-table {
  margin-top: 12px;
}

.score-table td {
  max-width: 360px;
  word-break: break-word;
}

.score-row-pass {
  background: #fbfffd;
}

.score-row-fail {
  background: #fff7f5;
}

.score-detail {
  margin-top: 14px;
}

.ai-missing,
.ai-ready-note {
  margin-top: 12px;
  font-weight: 650;
}

.ai-missing {
  color: var(--warn);
}

.ai-ready-note {
  color: var(--ok);
}

.ai-test-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.ai-test-form label {
  display: grid;
  gap: 6px;
}

.ai-test-form span,
.ai-result-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.ai-test-form .wide-field,
.ai-test-form button {
  grid-column: 1 / -1;
}

.ai-result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.ai-result-grid > div {
  display: grid;
  gap: 6px;
}

.ai-result-grid pre {
  max-width: none;
  max-height: 240px;
}

.setup-steps {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 22px;
}

.setup-steps li {
  padding-left: 4px;
}

.setup-steps strong {
  color: #111827;
}

.setup-steps p {
  margin-top: 4px;
}

.wide-pre {
  max-width: none;
}

.prototype-main {
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(360px, 1.1fr);
  gap: 16px;
  padding: 18px 28px 32px;
}

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

.prototype-wide {
  grid-column: 1 / -1;
}

.prototype-field {
  display: grid;
  gap: 6px;
  margin-top: 12px;
}

.prototype-field label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.prototype-field input,
.prototype-field select,
.prototype-field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

.prototype-field textarea {
  min-height: 116px;
  resize: vertical;
}

.prototype-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.prototype-compose button {
  width: 100%;
  margin-top: 14px;
}

.prototype-code {
  min-height: 356px;
  max-height: 520px;
  overflow: auto;
  margin: 12px 0 0;
  border: 1px solid #d6deea;
  border-radius: 6px;
  padding: 12px;
  background: #0f172a;
  color: #e6edf7;
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
}

.prototype-flow {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.prototype-flow > div {
  min-height: 96px;
  border: 1px solid #dce5f2;
  border-radius: 8px;
  padding: 12px 10px;
  background: linear-gradient(180deg, #ffffff 0%, #f7faff 100%);
}

.prototype-flow strong {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 13px;
}

.prototype-flow span {
  display: block;
  margin-top: 10px;
  color: #22304a;
  font-weight: 650;
}

.prototype-compare {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 12px;
}

.prototype-compare > div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--surface);
}

.prototype-compare h4 {
  margin: 0 0 8px;
  font-size: 15px;
}

.app-entry-main {
  display: grid;
  grid-template-columns: minmax(420px, 1.1fr) minmax(360px, 0.9fr);
  gap: 16px;
  padding: 18px 28px 32px;
}

.app-entry-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 16px;
}

.app-entry-primary {
  grid-row: span 2;
}

.app-entry-wide {
  grid-column: 1 / -1;
}

.app-entry-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.app-entry-form.compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.app-entry-form label {
  display: grid;
  gap: 6px;
}

.app-entry-form span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.app-entry-form input,
.app-entry-form select,
.app-entry-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

.app-entry-form textarea {
  min-height: 116px;
  resize: vertical;
}

.app-entry-form .wide-field,
.app-entry-form button {
  grid-column: 1 / -1;
}

.app-entry-examples {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
}

.app-entry-examples code {
  border: 1px solid #dce5f2;
  border-radius: 6px;
  padding: 4px 7px;
  background: #f7faff;
  color: #1f3b67;
}

.entry-help-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.entry-help-list span {
  border: 1px solid #f0cfcf;
  border-radius: 999px;
  padding: 4px 8px;
  background: #fff7f7;
  color: #8b1d1d;
  font-size: 12px;
  font-weight: 700;
}

.url-grid {
  display: grid;
  gap: 12px;
  margin-top: 10px;
}

.url-grid > div {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface);
}

.url-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.url-grid code {
  display: block;
  overflow-wrap: anywhere;
  color: #15376f;
  font-size: 13px;
}

.checkpoint-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.checkpoint-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface);
}

.checkpoint-card p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.checkpoint-ok {
  border-color: #b7e3c7;
  background: #fbfffd;
}

.checkpoint-warn {
  border-color: #f3d9a8;
  background: #fffaf0;
}

.blocker-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.blocker-list span {
  border: 1px solid #f0cfcf;
  border-radius: 999px;
  padding: 4px 8px;
  background: #fff5f5;
  color: #a11717;
  font-size: 12px;
  font-weight: 700;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.metric-grid > div {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface);
}

.metric-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.metric-grid strong {
  color: var(--text);
  font-size: 13px;
  line-height: 1.6;
}

.acceptance-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.acceptance-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface);
}

.acceptance-card p {
  margin: 8px 0;
  color: var(--text);
  font-size: 13px;
  line-height: 1.55;
}

.acceptance-ok {
  border-color: #b7e3c7;
  background: #fbfffd;
}

.acceptance-warn {
  border-color: #f3d9a8;
  background: #fffaf0;
}

.next-action-box {
  border: 1px solid #f3d9a8;
  border-radius: 8px;
  margin-top: 14px;
  padding: 12px 14px;
  background: #fffaf0;
}

.strong-note {
  color: var(--text);
  font-weight: 700;
}

.next-action-box ol {
  margin: 8px 0 0 18px;
  padding: 0;
}

.next-action-box li {
  margin: 4px 0;
}

.mini-panel {
  border: 1px solid #ead7b5;
  border-radius: 8px;
  margin-top: 10px;
  padding: 10px 12px;
  background: #fffdf8;
}

.mini-panel details {
  border-top: 1px solid #f1dfbd;
  margin-top: 8px;
  padding-top: 8px;
}

.mini-panel summary {
  color: #8a5a00;
  cursor: pointer;
  font-weight: 700;
}

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

.repair-flow-step {
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 190px;
  padding: 12px;
}

.repair-flow-step p {
  margin: 8px 0;
}

.phase-progress-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.phase-progress-row {
  display: grid;
  grid-template-columns: minmax(180px, 260px) minmax(140px, 1fr) 56px;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--surface);
}

.phase-progress-row > div:first-child {
  display: grid;
  gap: 4px;
}

.phase-progress-row span,
.phase-progress-row p {
  color: var(--muted);
  font-size: 12px;
}

.phase-progress-row p {
  grid-column: 1 / -1;
  margin: 0;
}

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

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: #1677ff;
}

.pilot-record-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.pilot-record-form label {
  display: grid;
  gap: 6px;
}

.pilot-record-form span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.pilot-record-form input,
.pilot-record-form select,
.pilot-record-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

.pilot-record-form textarea {
  resize: vertical;
}

.pilot-record-form .wide-field,
.pilot-record-form button {
  grid-column: 1 / -1;
}

.pilot-steps {
  display: grid;
  gap: 12px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.pilot-steps li {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface);
}

.pilot-steps li.step-ok {
  border-color: #b7e3c7;
  background: #fbfffd;
}

.pilot-step-no {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-weight: 750;
}

.compact-head {
  margin-bottom: 4px;
}

.compact-head h4 {
  margin: 0;
  font-size: 15px;
}

.password-once-panel {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

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

.password-once-panel code {
  padding: 6px 10px;
  border: 1px solid #fed7aa;
  border-radius: 6px;
  background: #fff7ed;
  color: #9a3412;
  font-weight: 800;
  letter-spacing: 0;
}

.password-managed-input {
  min-width: 170px;
}

.password-tool-button {
  margin-left: 6px;
  white-space: nowrap;
}

.password-inline-tools {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) auto auto;
  gap: 6px;
  align-items: center;
}

.password-inline-tools .password-managed-input {
  min-width: 0;
}

.password-inline-tools .password-tool-button {
  margin-left: 0;
}

.mini-button {
  min-height: 30px;
  padding: 6px 10px;
  font-size: 12px;
}

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

  .login-shell {
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 28px 16px;
  }

  .login-brand h1 {
    font-size: 24px;
  }

  .tabs,
  .filterbar,
  main {
    padding-left: 16px;
    padding-right: 16px;
  }

  .quick-add,
  .import-form,
  .scenario-form,
  .list-toolbar {
    grid-template-columns: 1fr;
  }

  .toolbar-summary {
    justify-self: start;
  }

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

  .pagination div,
  .pagination-jump {
    width: 100%;
  }

  .pagination-jump {
    justify-content: flex-start;
  }

  .notice {
    margin-left: 16px;
    margin-right: 16px;
  }

  .candidate-card {
    grid-template-columns: 1fr;
  }

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

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

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

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

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

  .ai-test-form,
  .ai-result-grid {
    grid-template-columns: 1fr;
  }

  .prototype-main,
  .app-entry-main,
  .prototype-grid-2,
  .prototype-flow,
  .prototype-compare,
  .checkpoint-grid,
  .metric-grid,
  .admin-user-form,
  .pilot-record-form,
  .acceptance-grid {
    grid-template-columns: 1fr;
  }

  .inline-reset {
    grid-template-columns: 1fr;
  }

  .password-inline-tools {
    grid-template-columns: 1fr;
  }

  .phase-progress-row {
    grid-template-columns: 1fr;
  }

  .prototype-main,
  .app-entry-main {
    padding: 16px;
  }

  .app-entry-primary,
  .app-entry-wide {
    grid-column: auto;
    grid-row: auto;
  }

.app-entry-form,
.app-entry-form.compact {
    grid-template-columns: 1fr;
  }
}

.attachment-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 180px));
  gap: 12px;
  margin-top: 12px;
  align-items: start;
  justify-content: start;
}

.attachment-card {
  display: grid !important;
  gap: 8px;
  width: 180px !important;
  max-width: 180px !important;
  min-height: 0 !important;
  padding: 8px;
  border: 1px solid #d8e2f0;
  border-radius: 8px;
  background: #fff;
  color: #0f172a;
  text-decoration: none;
  text-align: left;
  cursor: zoom-in;
}

.attachment-card img {
  display: block !important;
  width: 162px !important;
  height: 112px !important;
  max-width: 162px !important;
  max-height: 112px !important;
  object-fit: contain;
  border-radius: 6px;
  background: #f3f6fb;
}

.task-attachment-block {
  max-width: 540px;
}

.task-attachment-strip {
  display: grid !important;
  grid-template-columns: repeat(6, 72px);
  gap: 8px;
  margin-top: 8px;
  align-items: start;
}

.task-attachment-thumb,
button.task-attachment-thumb {
  display: grid !important;
  gap: 4px;
  width: 72px !important;
  min-width: 72px !important;
  max-width: 72px !important;
  min-height: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: #526276 !important;
  text-decoration: none;
  font-size: 11px !important;
  line-height: 1.3;
  text-align: left;
  cursor: zoom-in;
  box-shadow: none !important;
  white-space: normal !important;
}

.task-attachment-thumb img,
button.task-attachment-thumb img {
  display: block !important;
  width: 72px !important;
  height: 72px !important;
  min-width: 72px !important;
  min-height: 72px !important;
  max-width: 72px !important;
  max-height: 72px !important;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border: 1px solid #d8e2f0;
  border-radius: 7px;
  background: #f3f6fb;
}

.task-attachment-thumb span {
  display: block;
  max-width: 72px;
  overflow: hidden;
  color: #526276;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-attachment-more {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 72px;
  padding: 8px;
  border: 1px dashed #c8d7ec;
  border-radius: 8px;
  background: #f8fbff;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  text-align: center;
}

.task-attachment-block .task-attachment-strip,
.context-block .task-attachment-strip,
td .task-attachment-strip {
  max-width: 480px !important;
}

.task-attachment-block img,
.context-block .task-attachment-strip img,
td .task-attachment-strip img,
.task-list img {
  object-fit: cover;
}

.task-attachment-block .task-attachment-thumb img,
.context-block .task-attachment-thumb img,
td .task-attachment-thumb img {
  width: 72px !important;
  height: 72px !important;
  max-width: 72px !important;
  max-height: 72px !important;
}

.attachment-card span,
.file-inline {
  font-size: 12px;
  color: #526276;
}

.file-inline {
  display: grid;
  gap: 6px;
  padding: 8px 0;
}

.file-inline input {
  max-width: 100%;
}

.enhanced-file-picker {
  cursor: pointer;
}

.enhanced-file-picker input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.file-picker-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  border: 1px solid #c8d7ec;
  border-radius: 7px;
  background: #f5f8ff;
  color: var(--primary);
  font-weight: 700;
}

.file-picker-summary {
  display: block;
  color: #64748b;
  line-height: 1.5;
}

.reply-image-preview {
  display: grid;
  grid-template-columns: repeat(3, minmax(46px, 1fr));
  gap: 6px;
  margin-bottom: 8px;
}

.reply-image-preview-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-start;
  gap: 8px;
}

.reply-image-preview-item {
  display: grid;
  gap: 4px;
  width: auto;
  min-width: 0;
  padding: 4px;
  border: 1px solid #dbe5f2;
  border-radius: 8px;
  background: #fff;
  color: #475569;
  font-size: 11px;
}

.reply-image-preview-item img {
  width: 100% !important;
  height: 52px !important;
  max-width: none !important;
  max-height: 52px !important;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 6px;
  background: #edf2f8;
}

.reply-image-preview-button {
  display: block !important;
  width: 100% !important;
  min-height: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  cursor: zoom-in;
}

.reply-image-preview-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reply-image-remove {
  min-height: 24px;
  border: 0;
  border-radius: 6px;
  background: #fff1f0;
  color: #c2410c;
  font-weight: 700;
  font-size: 11px;
  cursor: pointer;
}

.reply-image-preview-more {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  border: 1px dashed #c8d7ec;
  border-radius: 8px;
  color: #64748b;
  font-size: 12px;
}

.complete-form.is-submitting {
  opacity: 0.72;
}

.complete-form.is-submitting button[type="submit"] {
  cursor: wait;
  background: #94a3b8;
  box-shadow: none;
}

.image-preview-modal[hidden],
.image-preview-modal[style*="display: none"] {
  display: none !important;
}

.image-preview-modal,
.image-preview-modal:not([hidden]) {
  position: fixed !important;
  inset: 0 !important;
  z-index: 10000 !important;
  display: grid !important;
  place-items: center !important;
  padding: 28px !important;
  overflow: hidden !important;
}

.image-preview-backdrop {
  position: absolute !important;
  inset: 0 !important;
  background: rgba(15, 23, 42, 0.68) !important;
}

.image-preview-dialog {
  position: relative !important;
  z-index: 1 !important;
  width: min(960px, calc(100vw - 64px)) !important;
  max-height: calc(100vh - 64px) !important;
  display: grid !important;
  gap: 12px;
  padding: 16px;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.28);
}

.image-preview-head,
.image-preview-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.image-preview-dialog img {
  display: block !important;
  width: auto !important;
  max-width: 100% !important;
  height: auto !important;
  max-height: calc(100vh - 190px) !important;
  justify-self: center;
  object-fit: contain !important;
  border-radius: 8px;
  background: #f1f5f9;
}

body.image-preview-open {
  overflow: hidden;
}

.quality-feedback-form {
  display: grid;
  gap: 14px;
}

.quality-feedback-form label,
.quality-review-form label,
.quality-filter-form label {
  display: grid;
  gap: 6px;
  color: #334155;
  font-size: 13px;
  font-weight: 650;
}

.quality-feedback-form input,
.quality-feedback-form select,
.quality-feedback-form textarea,
.quality-review-form select,
.quality-review-form textarea,
.quality-filter-form input,
.quality-filter-form select {
  width: 100%;
  min-height: 36px;
  border: 1px solid #d7e2f0;
  border-radius: 7px;
  padding: 8px 10px;
  background: #fff;
  color: #0f172a;
  font: inherit;
}

.quality-feedback-form textarea,
.quality-review-form textarea {
  resize: vertical;
  line-height: 1.55;
}

.form-grid.compact-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 12px;
}

.checkbox-line {
  display: flex !important;
  align-items: center;
  gap: 8px !important;
  min-height: 36px;
  color: #334155;
}

.checkbox-line input {
  width: auto !important;
  min-height: 0 !important;
}

.confirm-line {
  padding: 10px 12px;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  background: #f8fbff;
}

.quality-filter-form {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 12px;
  width: 100%;
}

.quality-filter-form .wide-field {
  grid-column: span 2;
}

.filter-actions {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.button-like {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border-radius: 7px;
  background: #eef5ff;
  color: var(--primary);
  font-weight: 700;
  text-decoration: none;
}

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

.quality-feedback-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
  padding: 16px;
  border: 1px solid #dbe5f2;
  border-radius: 8px;
  background: #fff;
}

.item-title-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.quality-feedback-main h3 {
  margin: 10px 0 8px;
  font-size: 18px;
}

.feedback-text-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0;
}

.feedback-text-grid span {
  display: block;
  margin-bottom: 4px;
  color: #64748b;
  font-size: 12px;
}

.feedback-text-grid pre,
.review-note {
  white-space: pre-wrap;
  padding: 10px;
  border-radius: 8px;
  background: #f6f8fb;
  color: #1e293b;
  line-height: 1.5;
}

.quality-review-form {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 12px;
  border-radius: 8px;
  background: #f8fbff;
}

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

  .task-attachment-strip {
    grid-template-columns: repeat(3, 72px);
  }

  .form-grid.compact-grid,
  .quality-filter-form,
  .quality-feedback-item,
  .feedback-text-grid {
    grid-template-columns: 1fr;
  }

  .quality-filter-form .wide-field {
    grid-column: auto;
  }
}

/* 20260515 UI polish: final visual pass for 50-person daily use. */
body {
  background: #f4f6f9;
}

.topbar {
  align-items: flex-start;
  min-height: 72px;
  padding: 16px 28px;
}

.topbar h1 {
  line-height: 1.25;
}

.topbar p {
  margin-top: 4px;
}

.top-actions {
  justify-content: flex-end;
  max-width: min(1120px, 72vw);
}

.top-actions .refresh,
.top-actions .secondary-link,
.top-actions button {
  min-height: 36px;
  border-radius: 7px;
  padding: 0 13px;
}

.secondary-link,
button.secondary,
.button-like {
  border: 1px solid #d8e6f8;
  background: #f2f7ff;
  box-shadow: none;
}

.filterbar,
.tabs,
main {
  max-width: 100%;
}

.filterbar form,
.locked-filter,
.list-toolbar,
.bulk-bar,
.input-panel,
.panel-card,
.detail-panel,
.detail-hero,
.table-wrap,
.pagination,
.stats-grid article {
  border-color: #d9e3f0;
  border-radius: 8px;
}

.filterbar form,
.locked-filter {
  min-height: 44px;
  padding: 9px 12px;
}

.locked-filter strong {
  color: #0f172a;
}

.tabs {
  padding-top: 16px;
}

.tabs a {
  min-height: 38px;
  padding: 0 14px;
}

.list-toolbar {
  grid-template-columns: minmax(320px, 1fr) minmax(170px, 220px) minmax(180px, 230px) 72px 72px;
  padding: 14px;
}

.list-toolbar label,
.quality-filter-form label,
.history-filterbar label,
.wide-filter-form label {
  font-weight: 650;
}

.list-toolbar input,
.list-toolbar select,
.quality-filter-form input,
.quality-filter-form select,
.history-filterbar input,
.history-filterbar select {
  min-height: 38px;
}

.list-toolbar button,
.list-toolbar .detail-button,
.filter-actions button,
.filter-actions .button-like,
.history-filterbar button,
.history-filterbar .detail-button {
  min-height: 38px;
  margin: 0;
}

.bulk-bar {
  padding: 12px 14px;
}

table {
  font-size: 13px;
}

th {
  height: 46px;
  background: #f4f7fb;
  color: #334155;
}

td {
  background: #fff;
}

tbody tr:hover td {
  background: #fffaf6;
}

.task-title-line {
  align-items: center;
}

.title,
.title-link {
  line-height: 1.45;
}

details summary {
  line-height: 1.8;
}

.actions,
td:last-child {
  min-width: 180px;
}

.complete-form {
  min-width: 180px;
}

.complete-form textarea {
  min-height: 78px;
}

.file-inline,
.reply-image-preview {
  max-width: 180px;
}

.detail-main {
  padding-top: 14px;
}

.detail-hero {
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  align-items: start;
}

.detail-hero h2 {
  max-width: 960px;
}

.detail-side {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 12px;
  border: 1px solid #e5edf7;
  border-radius: 8px;
  background: #fbfdff;
}

.detail-grid {
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.72fr);
}

.detail-panel {
  padding: 18px;
}

.detail-panel h3 {
  color: #0f172a;
}

.detail-panel pre {
  max-width: 100%;
}

.attachment-grid {
  grid-template-columns: repeat(auto-fill, minmax(138px, 154px));
  gap: 12px;
}

.attachment-card {
  width: 154px !important;
  max-width: 154px !important;
  min-height: 154px !important;
  padding: 8px;
  align-content: start;
}

.attachment-card img {
  width: 136px !important;
  height: 96px !important;
  max-width: 136px !important;
  max-height: 96px !important;
}

.attachment-card span {
  min-height: 34px;
  overflow: hidden;
  line-height: 1.35;
}

.task-attachment-strip {
  grid-template-columns: repeat(6, 72px);
  max-width: 488px;
}

.task-attachment-more {
  min-height: 72px;
}

.image-preview-dialog {
  border-radius: 8px;
}

.candidate-card {
  grid-template-columns: minmax(0, 1fr) minmax(250px, 320px);
}

.candidate-actions {
  padding: 12px;
  border: 1px solid #e5edf7;
  border-radius: 8px;
  background: #fbfdff;
}

.candidate-actions form + form {
  padding-top: 2px;
}

.quality-filter-form {
  grid-template-columns: repeat(6, minmax(140px, 1fr));
  align-items: end;
}

.quality-filter-form .wide-field {
  grid-column: span 2;
}

.filter-actions {
  align-items: end;
  min-height: 38px;
}

.quality-feedback-item {
  grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
  align-items: stretch;
  box-shadow: 0 3px 12px rgba(15, 23, 42, 0.04);
}

.quality-review-form {
  border: 1px solid #e5edf7;
}

.feedback-text-grid pre,
.review-note {
  max-width: none;
}

.history-filterbar form {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr)) minmax(120px, 150px);
  gap: 10px;
  align-items: end;
  width: 100%;
}

.history-filterbar .history-query {
  grid-column: span 2;
}

.history-filterbar button,
.history-filterbar .detail-button {
  width: 100%;
}

.message-history-table th,
.message-history-table td {
  padding-top: 12px;
  padding-bottom: 12px;
}

.message-history-table .history-content {
  min-width: 300px;
}

.stats-grid {
  gap: 12px;
}

.stats-grid article {
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
}

.empty {
  min-height: 220px;
  background: #fff;
}

.pagination {
  min-height: 52px;
}

.pagination a,
.pagination .disabled,
.pagination button {
  min-height: 34px;
}

.pagination-jump input {
  width: 64px;
}

@media (max-width: 1180px) {
  .top-actions {
    max-width: 100%;
  }

  .list-toolbar,
  .quality-filter-form,
  .history-filterbar form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .list-toolbar label:first-child,
  .quality-filter-form .wide-field,
  .history-filterbar .history-query {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .topbar {
    padding: 14px 16px;
  }

  .top-actions {
    justify-content: flex-start;
  }

  .filterbar,
  .tabs,
  main,
  .notice,
  .live-refresh-notice {
    margin-left: 16px;
    margin-right: 16px;
    padding-left: 0;
    padding-right: 0;
  }

  .notice,
  .live-refresh-notice {
    padding: 10px 12px;
  }

  .list-toolbar,
  .quality-filter-form,
  .history-filterbar form,
  .detail-side,
  .detail-hero,
  .detail-grid,
  .candidate-card,
  .quality-feedback-item {
    grid-template-columns: 1fr;
  }

  .attachment-grid {
    grid-template-columns: repeat(2, 154px);
  }
}

/* 2026-05-15: task detail layout, compact feedback and reply status polish */
.fixed-detail-grid {
  display: grid;
  gap: 14px;
  align-items: stretch;
}

.fixed-detail-grid.has-attachments {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.fixed-detail-grid.no-attachments {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.fixed-detail-card {
  min-height: 220px;
  display: flex;
  flex-direction: column;
}

.fixed-detail-grid.has-attachments .attachment-panel {
  grid-column: 1 / -1;
  grid-row: auto;
  min-height: 190px;
}

.fixed-message-preview {
  flex: 1;
  max-height: 154px;
  overflow: hidden;
  white-space: pre-wrap;
  word-break: break-word;
}

.compact-info-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.fixed-attachment-grid {
  grid-template-columns: repeat(auto-fill, minmax(132px, 152px)) !important;
  grid-auto-rows: minmax(140px, auto);
}

.fixed-attachment-grid .attachment-card {
  width: 144px !important;
  max-width: 144px !important;
  min-height: 142px !important;
  border-radius: 8px;
}

.fixed-attachment-grid .attachment-card img {
  width: 126px !important;
  height: 88px !important;
  max-width: 126px !important;
  max-height: 88px !important;
  object-fit: contain !important;
}

.extra-attachment {
  display: grid !important;
}

.plain-button {
  border: 0;
  background: transparent;
  color: #1d6fe9;
  cursor: pointer;
  padding: 0;
  font: inherit;
  font-weight: 650;
}

.plain-button:hover {
  text-decoration: underline;
}

.text-preview-modal[hidden],
.text-preview-modal[style*="display: none"] {
  display: none !important;
}

.text-preview-modal,
.text-preview-modal:not([hidden]) {
  position: fixed !important;
  inset: 0 !important;
  z-index: 10001 !important;
  display: grid !important;
  place-items: center !important;
  padding: 28px !important;
}

.text-preview-dialog {
  position: relative;
  z-index: 1;
  width: min(860px, calc(100vw - 64px));
  max-height: calc(100vh - 64px);
  display: grid;
  gap: 12px;
  padding: 16px;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.28);
}

.text-preview-dialog pre {
  max-height: calc(100vh - 160px);
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  background: #f6f8fb;
}

.feedback-compact-grid {
  grid-template-columns: minmax(180px, 240px) minmax(0, 1fr) !important;
}

.detail-panel:has(.quality-feedback-form) .section-head .muted {
  display: none;
}

.context-balanced-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
}

.context-equal-card {
  min-height: 420px;
  display: flex;
  flex-direction: column;
}

.context-scroll-pre {
  flex: 1;
  max-height: 344px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  background: #f6f8fb;
}

.context-equal-card .linked-list {
  max-height: 344px;
  overflow: auto;
  padding-right: 4px;
}

.floating-completion-notice {
  position: fixed;
  top: 12px;
  right: 24px;
  left: 24px;
  z-index: 9500;
  width: auto;
  max-width: none;
  margin: 0 !important;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.16);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.floating-completion-notice.is-hidden {
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
}

.floating-completion-notice .notice-actions {
  flex-wrap: wrap;
  margin-top: 10px;
}

.tasks-table {
  table-layout: fixed;
  min-width: 1740px;
}

.tasks-table thead th {
  position: sticky;
  top: 0;
  z-index: 28;
  background: #f6f8fb;
  box-shadow: 0 1px 0 #d9e3f0;
}

.tasks-table th:nth-child(1),
.tasks-table td:nth-child(1) {
  width: 44px;
}

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

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

.tasks-table th:nth-child(4),
.tasks-table td:nth-child(4),
.tasks-table th:nth-child(5),
.tasks-table td:nth-child(5) {
  width: 132px;
}

.tasks-table th:nth-child(6),
.tasks-table td:nth-child(6) {
  width: 430px;
}

.tasks-table th:nth-child(7),
.tasks-table td:nth-child(7) {
  width: 112px;
}

.tasks-table th:nth-child(8),
.tasks-table td:nth-child(8),
.tasks-table th:nth-child(9),
.tasks-table td:nth-child(9) {
  width: 130px;
}

.tasks-table th:nth-child(10),
.tasks-table td:nth-child(10) {
  width: 340px;
}

.tasks-table th:last-child,
.tasks-table td.actions,
.tasks-table td:last-child {
  position: sticky;
  right: 0;
  z-index: 24;
  min-width: 340px;
  background: #fff;
  box-shadow: -10px 0 18px rgba(15, 23, 42, 0.08);
}

.tasks-table th:last-child {
  z-index: 36;
  background: #f6f8fb;
}

.tasks-table-operator {
  min-width: 1660px;
}

.tasks-table-operator th:nth-child(5),
.tasks-table-operator td:nth-child(5) {
  width: 500px;
}

.tasks-table-operator th:nth-child(6),
.tasks-table-operator td:nth-child(6) {
  width: 112px;
}

.tasks-table-operator th:nth-child(7),
.tasks-table-operator td:nth-child(7),
.tasks-table-operator th:nth-child(8),
.tasks-table-operator td:nth-child(8) {
  width: 130px;
}

.tasks-table-operator th:nth-child(9),
.tasks-table-operator td:nth-child(9) {
  width: 340px;
}

.floating-table-head {
  position: fixed;
  top: 0;
  z-index: 9300;
  overflow: hidden;
  border: 1px solid #d9e3f0;
  border-top: 0;
  border-radius: 0 0 8px 8px;
  background: #f6f8fb;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.12);
}

.floating-table-head[hidden] {
  display: none;
}

.floating-table-head-scroll {
  overflow-x: auto;
  overflow-y: hidden;
}

.floating-table-head-scroll::-webkit-scrollbar {
  height: 0;
}

.floating-table-head-table {
  margin: 0;
  border-collapse: collapse;
  table-layout: fixed;
}

.floating-table-head-table thead th {
  position: static;
  white-space: nowrap;
}

.tasks-table tbody tr:nth-child(even) td:last-child {
  background: #fff;
}

.tasks-table tbody tr:hover td:last-child {
  background: #fffaf3;
}

.tasks-table .complete-form,
.tasks-table .file-inline,
.tasks-table .reply-image-preview {
  max-width: 100%;
  width: 100%;
}

.tasks-table .complete-form textarea {
  width: 100%;
}

.floating-x-scroll {
  position: fixed;
  right: 8px;
  bottom: 10px;
  z-index: 9200;
  height: 18px;
  overflow-x: auto;
  overflow-y: hidden;
  border: 1px solid #d9e3f0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.18);
}

.floating-x-scroll[hidden] {
  display: none;
}

.floating-x-scroll-inner {
  height: 1px;
}

body.has-floating-x-scroll {
  padding-bottom: 34px;
}

.message-pagination {
  margin-top: 10px;
}

.message-pagination button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.panel-card {
  margin: 16px 28px;
  padding: 18px;
  border: 1px solid #dbe5f2;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.04);
}

.empty-row {
  text-align: center;
  color: #64748b;
  padding: 28px !important;
}

@media (max-width: 960px) {
  .fixed-detail-grid.has-attachments,
  .fixed-detail-grid.no-attachments,
  .context-balanced-grid,
  .compact-info-list,
  .feedback-compact-grid {
    grid-template-columns: 1fr !important;
  }

  .fixed-detail-grid.has-attachments .attachment-panel {
    grid-column: auto;
    grid-row: auto;
  }
}

.admin-home-main {
  max-width: 1320px;
  margin: 0 auto;
  padding: 20px 18px 40px;
}

.admin-entry-section {
  background: #fff;
  border: 1px solid #dbe5f1;
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.04);
  margin-bottom: 18px;
  padding: 18px;
}

.admin-entry-section .section-head {
  margin-bottom: 14px;
}

.admin-entry-section .section-head p {
  color: #64748b;
  margin-top: 6px;
}

.admin-entry-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.admin-entry-card {
  align-items: flex-start;
  background: #f8fbff;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  color: #0f172a;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 108px;
  padding: 16px;
  text-decoration: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.admin-entry-card:hover {
  border-color: #2563eb;
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.12);
  transform: translateY(-1px);
}

.admin-entry-card strong {
  font-size: 16px;
  line-height: 1.35;
}

.admin-entry-card span {
  color: #475569;
  font-size: 13px;
  line-height: 1.6;
}

.primary-entry {
  background: #eff6ff;
  border-color: #93c5fd;
}

.quiet-entry {
  background: #fbfdff;
  border-color: #e2e8f0;
}
