/* SeeRisk production overrides on top of styles.css.
   The demo's IOSDevice frame is dropped — pages are fullscreen on mobile,
   centered & narrow on desktop. */

:root {
  --max-w: 480px;
}

/* styles.css centers body via flex (display:flex; align-items:center) for the
   demo's iOSDevice frame. That setup makes content taller than the viewport
   unscrollable from the top — the top half gets pushed off-screen by
   align-items:center and the browser can't scroll into the negative space.
   Override hard back to normal block layout. */
html, body {
  height: auto !important;
  min-height: 100vh;
  overflow: visible !important;
}
body {
  display: block !important;
  align-items: initial !important;
  justify-content: initial !important;
  padding: 0 !important;
  margin: 0 !important;
  background: #f4f4f7;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  color: #1c1c1e;
  -webkit-font-smoothing: antialiased;
}
.app-root { display: block !important; align-items: initial !important; justify-content: initial !important; }
:root[data-theme="dark"] body { background: #0c0c10; color: #ececf1; }

#root { min-height: 100vh; }

.app-shell {
  max-width: var(--max-w);
  margin: 0 auto;
  background: #fff;
  min-height: 100vh;
  position: relative;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.04);
}
:root[data-theme="dark"] .app-shell { background: #16161c; }

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: #fff;
  position: sticky; top: 0; z-index: 10;
  border-bottom: 1px solid transparent;
}
:root[data-theme="dark"] .app-header { background: #16161c; }

.app-header .header-left {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}
.app-header .header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.app-header .header-action {
  width: 36px; height: 36px;
  border-radius: 10px;
  border: 1px solid #ececef;
  background: #fff;
  color: #4a4a52;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background .15s, transform .1s;
}
.app-header .header-action:hover { background: #f4f4f7; }
.app-header .header-action:active { transform: scale(0.95); }
:root[data-theme="dark"] .app-header .header-action {
  background: #16161c; border-color: #2a2a30; color: #c8c8d0;
}
.app-header .header-back {
  width: 36px; height: 36px;
  border-radius: 10px;
  border: 1px solid #ececef;
  background: #fff;
  color: #4a4a52;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background .15s, transform .1s;
  flex-shrink: 0;
}
.app-header .header-back:hover { background: #f4f4f7; }
.app-header .header-back:active { transform: scale(0.95); }
:root[data-theme="dark"] .app-header .header-back {
  background: #16161c; border-color: #2a2a30; color: #c8c8d0;
}

.app-header .brand {
  font-weight: 700;
  font-size: 18px;
  display: flex; align-items: center; gap: 10px;
  color: #1c1c1e;
  background: transparent;
  border: 0;
  padding: 4px 6px;
  margin-left: -6px;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s, transform .1s;
}
.app-header .brand:hover { background: #f4f4f7; }
.app-header .brand:active { transform: scale(0.98); }
.app-header .brand-mark {
  color: #2563eb;
  display: flex; align-items: center;
}
.app-header .menu-btn {
  width: 36px; height: 36px;
  border-radius: 10px;
  border: 1px solid #ececef;
  background: #fff;
  color: #4a4a52;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  position: relative;
}
.app-header .menu-btn:hover { background: #f4f4f7; }
.app-header .menu-pop {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: #fff;
  border: 1px solid #ececef;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  padding: 6px;
  min-width: 160px;
  z-index: 20;
  animation: menu-pop .14s ease-out;
}
@keyframes menu-pop {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: none; }
}
.app-header .menu-pop .user-info {
  padding: 8px 10px;
  font-size: 12px;
  color: #94949f;
  border-bottom: 1px solid #f0f0f4;
  margin-bottom: 4px;
}
.app-header .menu-pop button {
  display: flex; align-items: center; gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: 0; background: transparent;
  font-size: 13px; color: #1c1c1e;
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
}
.app-header .menu-pop button:hover { background: #f4f4f7; }
.app-header .menu-pop button.danger { color: #b91c1c; }

/* History page header block */
.history-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 4px 16px 14px;
  gap: 12px;
}
.history-head .titles h1 {
  margin: 0 0 4px;
  font-size: 26px; font-weight: 700;
  color: #1c1c1e;
  letter-spacing: 0.2px;
}
.history-head .titles .count {
  font-size: 13px; color: #94949f;
}
.history-head .new-btn {
  flex-shrink: 0;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 14px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  border: 0; border-radius: 10px;
  font-size: 14px; font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.22);
  transition: transform .12s, box-shadow .15s;
}
.history-head .new-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 14px rgba(37, 99, 235, 0.3); }
.history-head .new-btn:active { transform: none; }

.history-toolbar {
  display: flex; gap: 10px;
  padding: 0 16px 12px;
  position: sticky; top: 64px;
  background: #fff;
  z-index: 5;
}
.history-toolbar .search-wrap {
  flex: 1;
  display: flex; align-items: center; gap: 8px;
  background: #f4f4f7;
  border: 1px solid #ececef;
  border-radius: 12px;
  padding: 0 12px;
  height: 40px;
}
.history-toolbar .search-wrap:focus-within {
  background: #fff;
  border-color: #c7d2fe;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}
.history-toolbar .search-wrap svg { color: #94949f; flex-shrink: 0; }
.history-toolbar .search-wrap input {
  flex: 1; min-width: 0;
  border: 0; background: transparent; outline: none;
  font-size: 14px; font-family: inherit;
}
.history-toolbar .search-wrap input::-webkit-search-cancel-button { display: none; }
.history-toolbar .search-wrap .clear {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #d1d5db; color: #fff;
  font-size: 13px; line-height: 20px;
  text-align: center;
  border: 0; cursor: pointer; padding: 0;
  flex-shrink: 0;
}
.history-toolbar .filter-btn {
  position: relative;
  display: inline-flex; align-items: center; gap: 6px;
  height: 40px; padding: 0 14px;
  background: #fff;
  border: 1px solid #ececef;
  border-radius: 12px;
  font-size: 14px; color: #1c1c1e;
  cursor: pointer;
}
.history-toolbar .filter-btn:hover { background: #f4f4f7; }
.history-toolbar .filter-btn.active { color: #2563eb; border-color: #c7d2fe; background: #eef2ff; }
.history-toolbar .filter-btn .badge {
  background: #2563eb; color: #fff;
  font-size: 11px; padding: 1px 6px;
  border-radius: 999px;
}
.filter-pop {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: #fff;
  border: 1px solid #ececef;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  padding: 8px;
  min-width: 180px;
  z-index: 20;
  animation: menu-pop .14s ease-out;
}
.filter-pop .filter-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
}
.filter-pop .filter-row:hover { background: #f4f4f7; }
.filter-pop .filter-row.active { background: #eef2ff; color: #2563eb; font-weight: 600; }
.filter-pop .filter-row input {
  margin: 0;
  accent-color: #2563eb;
}
.filter-pop .actions {
  display: flex; gap: 6px;
  border-top: 1px solid #f0f0f4;
  padding: 8px 6px 4px;
  margin-top: 4px;
}
.filter-pop .actions button {
  flex: 1;
  padding: 6px;
  border-radius: 6px;
  border: 0;
  font-size: 12px;
  cursor: pointer;
}
.filter-pop .actions .clear { background: #f4f4f7; color: #4a4a52; }
.filter-pop .actions .apply { background: #2563eb; color: #fff; }

/* History list */
.history-screen { padding: 0 0 16px; }
.history-list { padding: 0 16px; }

.history-search {
  display: flex; align-items: center; gap: 8px;
  background: #f4f4f7;
  border: 1px solid #ececef;
  border-radius: 12px;
  padding: 0 12px;
  margin-bottom: 12px;
  height: 38px;
  position: sticky; top: 56px;
  z-index: 5;
}
.history-search:focus-within {
  background: #fff;
  border-color: #c7d2fe;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}
.history-search svg { color: #94949f; flex-shrink: 0; }
.history-search input {
  flex: 1; min-width: 0;
  border: 0; background: transparent;
  font-size: 14px; outline: none;
  font-family: inherit;
}
.history-search input::-webkit-search-cancel-button { display: none; }
.history-search .clear {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: #d1d5db;
  color: #fff;
  font-size: 14px; line-height: 22px;
  text-align: center;
  border: 0; cursor: pointer; padding: 0;
  flex-shrink: 0;
}

.history-card {
  position: relative;
}
.card-del {
  position: absolute;
  top: 8px; right: 8px;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: transparent;
  color: #94949f;
  border: 0; padding: 0; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  opacity: 0;
  transition: opacity .15s, background .15s, color .15s;
}
.history-card:hover .card-del { opacity: 1; }
.card-del:hover {
  background: #fef2f2;
  color: #b91c1c;
}
@media (hover: none) {
  .card-del { opacity: 0.6; }
}

.load-more {
  display: block;
  width: 100%;
  margin: 12px 0 4px;
  padding: 10px;
  border: 1px solid #ececef;
  border-radius: 10px;
  background: #fff;
  color: #2563eb;
  font-size: 13px;
  cursor: pointer;
}
.load-more:hover:not(:disabled) { background: #eef2ff; }
.load-more:disabled { color: #94949f; cursor: not-allowed; }
.list-end {
  text-align: center;
  color: #94949f;
  font-size: 12px;
  padding: 16px 0;
}

/* Modal confirm dialog ----------------------------------------------- */
.dialog-backdrop {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  padding: 16px;
  animation: dlg-fade-in .15s ease-out;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
@keyframes dlg-fade-in { from { opacity: 0; } to { opacity: 1; } }

.dialog-card {
  width: 100%; max-width: 360px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
  padding: 22px 22px 16px;
  animation: dlg-scale-in .18s ease-out;
}
@keyframes dlg-scale-in {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: none; }
}

.dialog-icon {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: #fef2f2; color: #b91c1c;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 12px;
}
.dialog-title {
  font-size: 17px; font-weight: 600;
  text-align: center;
  color: #1c1c1e;
  margin-bottom: 6px;
}
.dialog-message {
  font-size: 14px; color: #4a4a52;
  text-align: center;
  line-height: 1.5;
  margin-bottom: 18px;
}
.dialog-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.dialog-btn {
  padding: 11px 0;
  border-radius: 12px;
  font-size: 14px; font-weight: 600;
  border: 0; cursor: pointer;
  transition: transform .1s, opacity .15s, background .15s;
}
.dialog-btn:active { transform: scale(0.97); }
.dialog-btn.cancel {
  background: #f4f4f7;
  color: #4a4a52;
}
.dialog-btn.cancel:hover { background: #ececef; }
.dialog-btn.primary {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}
.dialog-btn.danger {
  background: linear-gradient(135deg, #ef4444, #b91c1c);
  color: #fff;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.28);
}
.dialog-btn.danger:hover, .dialog-btn.primary:hover { filter: brightness(1.05); }

/* Share dialog --------------------------------------------------------- */
.dialog-card.share-card {
  max-width: 440px;
  padding: 22px;
}
.share-title {
  font-size: 18px; font-weight: 700;
  color: #1c1c1e;
  margin-bottom: 4px;
}
.share-section-label {
  font-size: 12px; font-weight: 600;
  color: #6b6b74;
  letter-spacing: 0.4px;
  margin: 12px 0 8px;
  text-transform: uppercase;
}
.share-row {
  display: flex; align-items: center;
  margin-bottom: 8px;
  font-size: 13px;
}
.share-row-label {
  color: #4a4a52;
  width: 88px; flex-shrink: 0;
}
.share-row.toggle {
  justify-content: space-between;
  padding: 8px 0;
  cursor: pointer;
}
.share-row.toggle input { accent-color: #2563eb; transform: scale(1.1); }
.share-ttl {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.share-ttl-pill {
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid #ececef;
  background: #fff;
  font-size: 12px;
  cursor: pointer;
  color: #4a4a52;
}
.share-ttl-pill:hover { background: #f4f4f7; }
.share-ttl-pill.active {
  background: #eef2ff;
  border-color: #c7d2fe;
  color: #2563eb;
  font-weight: 600;
}

.share-list {
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid #ececef;
  border-radius: 10px;
}
.share-item {
  padding: 10px 12px;
  border-bottom: 1px solid #f0f0f4;
  font-size: 12px;
  transition: background .25s;
}
.share-item:last-child { border-bottom: 0; }
.share-item.highlight {
  background: #eff6ff;
  animation: share-flash 1.4s ease-out;
}
@keyframes share-flash {
  0% { background: #dbeafe; }
  100% { background: #eff6ff; }
}
.share-item.inactive {
  opacity: 0.55;
  background: #fafafa;
}
.share-url {
  font-family: ui-monospace, monospace;
  word-break: break-all;
  color: #1c1c1e;
  margin-bottom: 4px;
  font-size: 11.5px;
}
.share-meta {
  display: flex; gap: 6px;
  color: #94949f;
  font-size: 11px;
  margin-bottom: 6px;
}
.share-item-actions {
  display: flex; gap: 6px;
}
.share-mini {
  border: 1px solid #ececef;
  background: #fff;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 11px;
  color: #4a4a52;
  cursor: pointer;
}
.share-mini:hover { background: #f4f4f7; }
.share-mini.danger { color: #b91c1c; border-color: #fecaca; }
.share-mini.danger:hover { background: #fef2f2; }

/* Public share view --------------------------------------------------- */
.app-shell.public { background: #fff; }
.share-banner {
  display: flex; align-items: center; gap: 12px;
  flex-wrap: wrap; row-gap: 6px;
  background: linear-gradient(135deg, #eef2ff, #e0e7ff);
  border-bottom: 1px solid #c7d2fe;
  color: #4338ca;
  font-size: 13px;
  padding: 10px 16px;
}
.share-banner .share-brand {
  display: flex; align-items: center; gap: 6px;
  color: #2563eb; text-decoration: none;
  font-weight: 700; font-size: 14px;
  padding: 4px 6px; margin-left: -6px;
  border-radius: 6px; transition: background .15s;
}
.share-banner .share-brand:hover { background: rgba(37,99,235,0.10); }
.share-banner .share-brand:active { transform: scale(0.98); }
.share-banner .share-brand-mark { display: flex; align-items: center; }
.share-banner .share-meta {
  display: flex; align-items: center; gap: 8px;
  margin-left: auto;
}
.share-banner .dot { color: #c7d2fe; }
.share-banner strong { color: #1c1c1e; }
.public-error {
  padding: 60px 24px;
  text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.public-error-title {
  font-size: 18px; font-weight: 600;
  color: #1c1c1e;
}
.public-error-hint {
  font-size: 14px; color: #94949f;
  margin-bottom: 16px;
}

/* User management ---------------------------------------------------- */
.users-screen { padding: 0 0 16px; }
.users-list { padding: 0 16px; }

.user-card {
  display: flex; align-items: center; gap: 12px;
  background: #fff;
  border: 1px solid #ececef;
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 10px;
}
.user-avatar {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  color: #fff;
  font-size: 16px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.user-meta { flex: 1; min-width: 0; }
.user-name {
  display: flex; align-items: center; gap: 8px;
  font-size: 15px; font-weight: 600;
  color: #1c1c1e;
}
.user-sub {
  font-size: 11.5px; color: #94949f;
  margin-top: 2px;
}
.role-badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11px; font-weight: 600;
}
.role-badge.admin { background: #eef2ff; color: #4338ca; }
.role-badge.user  { background: #f4f4f7; color: #4a4a52; }
.you-tag {
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 999px;
  background: #fff7ed;
  color: #c2410c;
  font-weight: 600;
}

.user-actions {
  display: flex; gap: 6px;
  flex-shrink: 0;
}
.ghost-btn {
  border: 1px solid #ececef;
  background: #fff;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 12px;
  color: #4a4a52;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.ghost-btn:hover { background: #f4f4f7; }
.ghost-btn.danger { color: #b91c1c; border-color: #fecaca; }
.ghost-btn.danger:hover:not(:disabled) { background: #fef2f2; }
.ghost-btn:disabled { color: #c0c0c8; cursor: not-allowed; opacity: 0.6; }

.user-form-row {
  margin-bottom: 12px;
}
.user-form-row > label {
  display: block;
  font-size: 12px; color: #6b6b74;
  margin-bottom: 5px;
}
.user-form-row > input {
  width: 100%; box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid #ececef;
  border-radius: 10px;
  font-size: 14px; font-family: inherit;
  background: #fafafa;
  outline: none;
}
.user-form-row > input:focus {
  border-color: #93b5fd;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.role-segments {
  display: flex; gap: 0;
  border: 1px solid #ececef;
  border-radius: 10px;
  overflow: hidden;
  background: #fafafa;
}
.role-segments button {
  flex: 1;
  padding: 9px 0;
  border: 0;
  background: transparent;
  font-size: 13px;
  color: #4a4a52;
  cursor: pointer;
  font-weight: 500;
}
.role-segments button.active {
  background: #2563eb;
  color: #fff;
}
.role-segments button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}
.form-hint {
  font-size: 11.5px;
  color: #94949f;
  margin-top: 6px;
}
.history-empty {
  padding: 60px 24px; text-align: center; color: #94949f;
}
.history-empty .em-icon {
  width: 64px; height: 64px; border-radius: 50%;
  background: #f4f4f7; margin: 0 auto 16px;
  display: flex; align-items: center; justify-content: center;
}
.history-card {
  display: flex; gap: 12px;
  padding: 12px;
  background: #fff;
  border: 1px solid #ececef;
  border-radius: 12px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
}
.history-card:active { transform: scale(0.99); }
.history-card .thumb {
  width: 64px; height: 64px; border-radius: 8px; object-fit: cover;
  background: #f0f0f4; flex-shrink: 0;
}
.history-card .thumb.placeholder {
  display: flex; align-items: center; justify-content: center;
  color: #b0b0bc; font-size: 11px;
}
.history-card .meta { flex: 1; min-width: 0; }
.history-card .meta .row1 {
  display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600;
}
.history-card .meta .row2 {
  font-size: 12px; color: #6b6b74; margin-top: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.history-card .meta .row3 {
  font-size: 11px; color: #94949f; margin-top: 4px;
}
.status-badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 600;
}
.status-pending  { background: #fff7ed; color: #c2410c; }
.status-claimed  { background: #eff6ff; color: #2563eb; }
.status-running  { background: #eff6ff; color: #2563eb; }
.status-done     { background: #f0fdf4; color: #15803d; }
.status-failed   { background: #fef2f2; color: #b91c1c; }
.risk-high   { color: #b91c1c; }
.risk-medium { color: #c2410c; }
.risk-low    { color: #15803d; }

/* Upload screen — redesigned with bigger dropzone, accented section labels,
   icon-prefixed inputs, and a textarea with character counter. */
.upload-screen { padding: 18px 16px 28px; }
.upload-screen .file-input { display: none; }

.upload-hero {
  margin-bottom: 18px;
}
.upload-hero h1 {
  margin: 0 0 4px;
  font-size: 22px; font-weight: 700;
  color: #1c1c1e;
  letter-spacing: 0.2px;
}
.upload-hero p {
  margin: 0;
  font-size: 13px; color: #94949f;
}

.upload-screen .section-label {
  display: flex; align-items: center;
  font-size: 14px; font-weight: 600;
  color: #1c1c1e;
  margin: 18px 0 8px;
  padding-left: 10px;
  position: relative;
}
.upload-screen .section-label::before {
  content: "";
  position: absolute;
  left: 0; top: 4px; bottom: 4px;
  width: 3px;
  border-radius: 2px;
  background: #2563eb;
}

.dropzone {
  border: 1.5px dashed #c7d2fe;
  background: linear-gradient(180deg, #f5f7ff 0%, #eef2ff 100%);
  border-radius: 16px;
  padding: 30px 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .12s;
}
.dropzone:hover {
  border-color: #93b5fd;
  background: linear-gradient(180deg, #eef4ff 0%, #e0e7ff 100%);
}
.dropzone:active { transform: scale(0.995); }
.dropzone.dragging {
  border-color: #2563eb;
  background: #eef2ff;
}
.dropzone-icon {
  width: 56px; height: 56px;
  margin: 0 auto 14px;
  border-radius: 14px;
  background: #ffffff;
  border: 1px solid #dbeafe;
  display: flex; align-items: center; justify-content: center;
  color: #2563eb;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.08);
}
.dropzone-title {
  font-size: 15px; font-weight: 600;
  color: #1c1c1e;
  margin-bottom: 6px;
}
.dropzone-hint {
  font-size: 12px; color: #94949f;
}

.upload-screen .preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(86px, 1fr));
  gap: 10px;
  margin: 12px 0 0;
}
.upload-screen .preview-grid .thumb {
  position: relative;
  aspect-ratio: 1; background: #f4f4f7;
  border-radius: 10px; overflow: hidden; border: 1px solid #ececef;
}
.upload-screen .preview-grid .thumb img {
  width: 100%; height: 100%; object-fit: cover;
}
.upload-screen .preview-grid .thumb .x {
  position: absolute; top: 4px; right: 4px;
  width: 22px; height: 22px; border-radius: 50%;
  background: rgba(0,0,0,0.6); color: #fff;
  border: 0; cursor: pointer; line-height: 22px;
  font-size: 14px; padding: 0;
}
.upload-screen .preview-grid .add-more {
  aspect-ratio: 1;
  border: 1.5px dashed #c7d2fe;
  border-radius: 10px;
  background: transparent;
  color: #2563eb;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 24px;
  transition: background .15s;
}
.upload-screen .preview-grid .add-more:hover { background: #eef2ff; }

.field {
  position: relative;
  margin-bottom: 10px;
}
.field .field-icon {
  position: absolute;
  left: 14px; top: 14px;
  color: #94949f;
  pointer-events: none;
}
.field input,
.field textarea {
  width: 100%; box-sizing: border-box;
  padding: 13px 14px 13px 40px;
  border: 1px solid #ececef;
  border-radius: 12px;
  font-size: 14px; font-family: inherit;
  background: #fafafa;
  outline: none;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.field input:focus,
.field textarea:focus {
  border-color: #93b5fd;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.field textarea {
  resize: vertical;
  min-height: 80px;
  padding-top: 13px;
  line-height: 1.5;
}
.field .field-icon.top { top: 14px; }
.field .counter {
  position: absolute;
  right: 12px; bottom: 8px;
  font-size: 11px; color: #94949f;
  pointer-events: none;
}

.upload-screen .err-msg {
  color: #b91c1c; font-size: 13px; margin: 8px 0;
}

/* Primary CTA — gradient button with prominent icon + label spacing */
.cta-analyze {
  display: flex; align-items: center; justify-content: center;
  gap: 8px;
  width: 100%;
  margin-top: 18px;
  padding: 14px 18px;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  font-size: 16px; font-weight: 600;
  letter-spacing: 0.5px;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.28);
  transition: transform .12s, box-shadow .15s, opacity .15s;
}
.cta-analyze:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.36);
}
.cta-analyze:active:not(:disabled) { transform: translateY(0); }
.cta-analyze:disabled {
  background: #c7d2fe; color: #fff;
  box-shadow: none; cursor: not-allowed;
}
.cta-analyze svg { flex-shrink: 0; }

/* Report — accommodate real images */
.report-photo-real {
  position: relative;
  width: 100%;
  background: #000;
  aspect-ratio: 4/3;
}
.report-photo-real img {
  width: 100%; height: 100%; object-fit: contain;
}
.report-photo-real .indicator {
  position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,0.5); color: #fff; padding: 2px 8px;
  border-radius: 999px; font-size: 11px;
}
.report-photo-real .nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: rgba(0,0,0,0.5); color: #fff; border: 0;
  width: 32px; height: 32px; border-radius: 50%;
  font-size: 18px; cursor: pointer;
}
.report-photo-real .nav.left { left: 8px; }
.report-photo-real .nav.right { right: 8px; }

.fallback-md {
  padding: 16px;
  font-size: 14px; line-height: 1.6;
}
.fallback-md h1, .fallback-md h2, .fallback-md h3 {
  margin-top: 16px; margin-bottom: 8px;
}
.fallback-md h1 { font-size: 18px; }
.fallback-md h2 { font-size: 16px; }
.fallback-md h3 { font-size: 14px; }
.fallback-md table {
  border-collapse: collapse; width: 100%; font-size: 12px;
}
.fallback-md th, .fallback-md td {
  border: 1px solid #ececef; padding: 6px 8px; text-align: left;
}
.fallback-md pre {
  background: #f4f4f7; padding: 8px; border-radius: 6px; overflow: auto;
  font-size: 12px;
}
.fallback-md code {
  background: #f4f4f7; padding: 1px 4px; border-radius: 3px;
  font-size: 12px;
}

.processing-real {
  padding: 24px;
  display: flex; flex-direction: column; align-items: center;
  text-align: center;
  min-height: 60vh;
}
.processing-real .photo-preview {
  width: 100%; max-width: 320px;
  aspect-ratio: 4/3; background: #f4f4f7;
  border-radius: 12px; overflow: hidden;
  margin-bottom: 24px;
  position: relative;
}
.processing-real .photo-preview img {
  width: 100%; height: 100%; object-fit: cover;
}
.processing-real .photo-preview .scan-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 40%, rgba(37, 99, 235, 0.3) 50%, transparent 60%);
  animation: scan 2.5s ease-in-out infinite;
}
@keyframes scan {
  0%, 100% { transform: translateY(-100%); }
  50% { transform: translateY(100%); }
}
.processing-real .spinner {
  width: 32px; height: 32px;
  border: 3px solid #ececef; border-top-color: #2563eb;
  border-radius: 50%; animation: spin 1s linear infinite;
  margin-bottom: 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.processing-real .title { font-size: 18px; font-weight: 600; margin-bottom: 8px; }
.processing-real .sub { font-size: 13px; color: #6b6b74; margin-bottom: 4px; }
.processing-real .elapsed { font-size: 12px; color: #94949f; margin-top: 16px; }
.processing-real .err-actions { margin-top: 24px; display: flex; gap: 8px; }
/* The demo's .report-scroll is flex:1 / overflow:auto inside an IOSDevice
   fixed-height frame. We dropped the frame, so the inner scroll box locks the
   page. Force the report into normal flow — let the browser body scroll. */
.report-scroll {
  flex: none !important;
  overflow: visible !important;
  height: auto !important;
  position: static !important;
  padding-bottom: 40px;
}
.screen, .report-screen {
  height: auto !important;
  overflow: visible !important;
}

/* Live progress display: an animated thinking pill on top, plus a list of
   documents the AI is currently reading underneath. Other tool calls (Bash,
   Skill, Grep, etc.) are intentionally hidden — too noisy for the user. */
.progress-zone {
  width: 100%; max-width: 520px;
  margin: 12px 0 0;
  text-align: left;
}
.ai-status {
  font-size: 12.5px; color: #6b6b74;
  text-align: center;
  margin-bottom: 8px;
}

/* Animated "thinking" pill — separate from the read list. Visible whenever
   the latest streamed event is a thinking block; hidden as soon as a
   tool_use, error, or done event lands. */
.thinking-pill {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px; font-weight: 500;
  color: #4338ca;
  background: linear-gradient(135deg, #eef2ff, #ede9fe);
  border: 1px solid #c7d2fe;
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.15);
  margin: 6px auto 12px;
}
.thinking-pill .pill-text {
  background: linear-gradient(90deg, #4338ca, #7c3aed, #4338ca);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: pill-shimmer 2.2s ease-in-out infinite;
}
@keyframes pill-shimmer {
  0%   { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}
.thinking-dots { display: inline-flex; gap: 4px; align-items: center; }
.thinking-dots span {
  width: 5px; height: 5px; border-radius: 50%;
  background: currentColor;
  animation: dot-pulse 1.2s ease-in-out infinite;
}
.thinking-dots span:nth-child(2) { animation-delay: 0.18s; }
.thinking-dots span:nth-child(3) { animation-delay: 0.36s; }
@keyframes dot-pulse {
  0%, 70%, 100% { opacity: 0.3; transform: scale(0.7); }
  35%           { opacity: 1;   transform: scale(1.15); }
}

/* Single-line dynamic activity strip that morphs with every new event. */
.activity-line {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px; font-weight: 500;
  margin: 6px auto 0;
  min-height: 34px;
  max-width: 100%;
  box-sizing: border-box;
  background: #f4f4f7;
  color: #4a4a52;
  animation: activity-swap .35s ease-out;
}
@keyframes activity-swap {
  from { opacity: 0; transform: translateY(-3px); }
  to   { opacity: 1; transform: none; }
}
.activity-line.read {
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  border: 1px solid #bfdbfe;
  color: #1d4ed8;
}
.activity-line.start, .activity-line.done {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #15803d;
}
.activity-line.error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
}
.activity-line.waiting {
  background: #f4f4f7;
  border: 1px solid #ececef;
  color: #6b6b74;
}
.activity-line .doc-icon {
  width: 14px; height: 14px; flex-shrink: 0;
}
.activity-line .label {
  white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
  max-width: 320px;
}
.activity-zone {
  text-align: center;
  margin-top: 12px;
}

/* Feedback trigger + dialog ------------------------------------------- */
.feedback-trigger {
  margin-left: auto;
  display: inline-flex; align-items: center; gap: 4px;
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid #c7d2fe;
  background: #eef2ff;
  color: #2563eb;
  font-size: 12px; font-weight: 500;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.feedback-trigger:hover { background: #e0e7ff; }
.feedback-trigger.done {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #15803d;
}
.feedback-trigger.done:hover { background: #dcfce7; }
.sum-line .sum-mand + .feedback-trigger { margin-left: 6px; }

.dialog-card.feedback-card {
  max-width: 440px;
  padding: 22px 22px 18px;
}
.feedback-title {
  font-size: 17px; font-weight: 700;
  color: #1c1c1e;
  margin-bottom: 14px;
}
.feedback-q {
  font-size: 14px; font-weight: 600;
  color: #1c1c1e;
  margin: 14px 0 10px;
}
.feedback-q.with-sub { display: flex; align-items: baseline; gap: 6px; }
.feedback-q-sub { font-size: 12px; color: #94949f; font-weight: 400; }
.feedback-row {
  display: flex; gap: 8px;
  flex-wrap: wrap;
}
.feedback-row.wrap { row-gap: 8px; }

.feedback-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid #ececef;
  background: #fff;
  color: #4a4a52;
  font-size: 13px;
  cursor: pointer;
  transition: all .15s;
}
.feedback-pill:hover { background: #f9fafb; }
.feedback-pill.active {
  background: #eef2ff;
  border-color: #2563eb;
  color: #2563eb;
  font-weight: 600;
}
.feedback-pill-check {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #2563eb;
  color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.feedback-divider {
  height: 1px;
  background: #f0f0f4;
  margin: 18px 0 4px;
}
.feedback-textarea-wrap {
  position: relative;
}
.feedback-textarea {
  width: 100%;
  border: 1px solid #ececef;
  border-radius: 10px;
  padding: 10px 12px 22px;
  font-size: 13px;
  color: #1c1c1e;
  font-family: inherit;
  resize: vertical;
  min-height: 80px;
  box-sizing: border-box;
  background: #fafafa;
  transition: border-color .15s, background .15s;
}
.feedback-textarea:focus {
  outline: none;
  border-color: #2563eb;
  background: #fff;
}
.feedback-textarea::placeholder { color: #b1b1ba; }
.feedback-counter {
  position: absolute;
  right: 10px; bottom: 6px;
  font-size: 11px;
  color: #94949f;
  pointer-events: none;
  font-family: ui-monospace, monospace;
}
.feedback-submit {
  width: 100%;
  margin-top: 16px;
  padding: 12px 0;
  font-size: 14px;
}
.feedback-submit:disabled {
  opacity: .55;
  cursor: not-allowed;
}
.feedback-cancel {
  width: 100%;
  margin-top: 8px;
  padding: 10px 0;
  font-size: 13px;
  background: transparent;
  color: #94949f;
}
.feedback-cancel:hover { background: #f4f4f7; color: #4a4a52; }

/* Admin · 报告管理 */
.admin-checks-screen { padding-bottom: 24px; }
.admin-checks-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 4px 16px 14px; gap: 12px;
}
.admin-checks-head .titles h1 {
  margin: 0 0 4px;
  font-size: 24px; font-weight: 700; color: #1c1c1e;
}
.admin-checks-head .titles .count { font-size: 13px; color: #94949f; }

.admin-checks-filters {
  display: flex; gap: 8px; padding: 0 16px 14px;
  flex-wrap: wrap;
}
.admin-checks-filters select {
  flex: 1; min-width: 110px;
  height: 36px; padding: 0 10px;
  border: 1px solid #ececef; border-radius: 8px;
  background: #fff; color: #1c1c1e;
  font-size: 13px; font-family: inherit;
}

.admin-checks-list {
  list-style: none; margin: 0; padding: 0 16px;
  display: flex; flex-direction: column; gap: 10px;
}
.admin-check-row {
  display: flex; gap: 12px; align-items: center;
  padding: 10px;
  background: #fff;
  border: 1px solid #f0f0f4; border-radius: 12px;
  cursor: pointer;
  transition: background .12s, transform .08s;
}
.admin-check-row:hover  { background: #f8f8fb; }
.admin-check-row:active { transform: scale(0.995); }
.admin-check-row .thumb {
  width: 56px; height: 56px; flex-shrink: 0;
  border-radius: 8px; overflow: hidden;
  background: #f4f4f7;
}
.admin-check-row .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.admin-check-row .thumb-empty {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  color: #c7c7cc;
}
.admin-check-row .meta { flex: 1; min-width: 0; }
.admin-check-row .meta-line-1 {
  display: flex; align-items: center; gap: 6px;
  font-size: 14px; color: #1c1c1e; font-weight: 600;
  margin-bottom: 4px;
}
.admin-check-row .meta-line-1 .dot { color: #d1d5db; font-weight: 400; }
.admin-check-row .meta-line-1 .time { font-weight: 400; color: #6b6b74; font-size: 12px; }
.admin-check-row .meta-line-2 {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: #6b6b74;
  flex-wrap: wrap;
}
.admin-check-row .status-done    { color: #15803d; }
.admin-check-row .status-failed  { color: #b91c1c; }
.admin-check-row .status-pending,
.admin-check-row .status-claimed,
.admin-check-row .status-running { color: #2563eb; }
.admin-check-row .risk-high   { color: #b91c1c; }
.admin-check-row .risk-medium { color: #b45309; }
.admin-check-row .risk-low    { color: #15803d; }
.admin-check-row .rating { flex-shrink: 0; padding-right: 4px; }
