:root {
  --primary: #003a5d;
  --secondary: #ed1c24;
  --navy: #082f49;
  --ink: #162235;
  --muted: #64748b;
  --line: #d9e2ec;
  --surface: #ffffff;
  --page: #f3f6fa;
  --soft: #eef4f8;
  --shadow: 0 18px 45px rgba(8, 47, 73, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

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

button {
  border: 0;
}

.view[hidden] {
  display: none;
}

.welcome-view,
.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
  background:
    linear-gradient(135deg, rgba(0, 58, 93, 0.94), rgba(8, 47, 73, 0.9)),
    radial-gradient(circle at 80% 15%, rgba(237, 28, 36, 0.18), transparent 32%);
}

.welcome-panel,
.login-card {
  width: min(760px, 100%);
  background: white;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 42px;
}

.welcome-panel {
  display: grid;
  gap: 16px;
}

.brand-logo {
  width: min(440px, 100%);
  height: auto;
  object-fit: contain;
}

.login-logo {
  width: min(320px, 100%);
  height: auto;
  margin-bottom: 20px;
}

.welcome-panel h1,
.login-card h1,
.app-header h1,
.section-heading h2,
.settings-form h2 {
  margin: 0;
  letter-spacing: 0;
}

.welcome-panel h1 {
  font-size: clamp(38px, 6vw, 72px);
  line-height: 0.95;
  color: var(--primary);
}

.lede,
.login-card p {
  max-width: 620px;
  margin: 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.55;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--secondary);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.app-shell {
  min-height: 100vh;
}

.app-header {
  min-height: 96px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 32px;
  background: white;
  border-top: 5px solid var(--secondary);
  border-bottom: 1px solid var(--line);
}

.compact-header {
  min-height: 82px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
}

.brand-lockup img {
  width: 168px;
  height: 54px;
  object-fit: contain;
  object-position: left center;
  cursor: pointer;
}

.brand-lockup img:focus-visible {
  outline: 3px solid rgba(237, 28, 36, 0.55);
  outline-offset: 4px;
}

.brand-lockup h1 {
  font-size: 28px;
  color: var(--primary);
}

.user-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px 8px 8px;
  background: var(--soft);
  color: var(--primary);
  cursor: pointer;
  text-align: left;
}

.user-pill span {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  color: white;
  background: var(--secondary);
  font-weight: 800;
}

.user-pill:hover,
.user-pill:focus-visible {
  border-color: rgba(237, 28, 36, 0.45);
  box-shadow: 0 8px 20px rgba(8, 47, 73, 0.1);
  outline: none;
}

.dashboard-layout,
.client-layout,
.tool-workspace {
  width: min(1480px, calc(100% - 48px));
  margin: 0 auto;
  padding: 28px 0;
}

.dashboard-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 22px;
}

.dashboard-main,
.dashboard-side,
.client-profile-card,
.tool-launcher,
.tool-workspace {
  min-width: 0;
}

.dashboard-main,
.history-panel,
.metric-panel,
.client-profile-card,
.tool-launcher,
.tool-workspace {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(8, 47, 73, 0.06);
}

.dashboard-main,
.client-profile-card,
.tool-launcher,
.tool-workspace {
  padding: 22px;
}

.dashboard-side {
  display: grid;
  align-content: start;
  gap: 16px;
}

.section-heading,
.form-actions,
.review-tools,
.client-card-top,
.tool-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.tool-launcher .section-heading {
  margin-bottom: 20px;
}

.dashboard-controls {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 220px;
  gap: 14px;
  margin: 20px 0;
}

label {
  display: grid;
  gap: 7px;
  color: #334155;
  font-size: 13px;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  background: white;
  color: var(--ink);
}

textarea {
  resize: vertical;
}

.client-grid,
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.client-card,
.tool-card {
  display: grid;
  gap: 14px;
  min-height: 176px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 16px;
  text-align: left;
  cursor: pointer;
}

.client-card:hover,
.tool-card:hover {
  border-color: rgba(237, 28, 36, 0.45);
  box-shadow: 0 12px 28px rgba(8, 47, 73, 0.1);
}

.client-logo {
  width: 56px;
  height: 56px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.client-avatar,
.tool-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  color: white;
  background: var(--primary);
  font-weight: 900;
}

.tool-icon {
  background: var(--secondary);
}

.client-card h3,
.tool-card h3 {
  margin: 0;
  color: var(--primary);
  font-size: 18px;
}

.meta-line,
.client-card p,
.tool-card p,
.history-list,
.message,
.upload-box small,
.empty-state,
.client-detail-text {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.pod-pill,
.status-pill {
  display: inline-flex;
  align-items: center;
  width: max-content;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  color: var(--primary);
  background: var(--soft);
  font-size: 12px;
  font-weight: 800;
}

.metric-panel {
  display: grid;
  gap: 4px;
  padding: 18px;
  text-align: left;
}

.metric-panel span {
  color: var(--primary);
  font-size: 34px;
  font-weight: 900;
}

.metric-panel small {
  color: var(--muted);
  font-size: 12px;
}

.metric-button {
  cursor: pointer;
}

.metric-button:hover {
  border-color: rgba(237, 28, 36, 0.45);
  box-shadow: 0 12px 28px rgba(8, 47, 73, 0.1);
}

.history-panel {
  padding: 18px;
}

.history-panel h2 {
  margin: 0 0 12px;
  font-size: 17px;
}

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

.history-list button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 10px;
  text-align: left;
  cursor: pointer;
}

.client-layout {
  display: grid;
  grid-template-columns: 380px minmax(0, 1fr);
  gap: 22px;
}

.client-detail-logo {
  width: 100%;
  max-height: 150px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 12px;
  margin-bottom: 16px;
}

.detail-list {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.detail-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  color: var(--primary);
  padding: 8px 12px;
  font-weight: 800;
  text-decoration: none;
}

.detail-action:hover {
  border-color: rgba(237, 28, 36, 0.45);
  background: white;
}

.primary-button,
.secondary-button,
.ghost-button,
.google-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  min-height: 42px;
  padding: 10px 15px;
  cursor: pointer;
  font-weight: 900;
  text-decoration: none;
}

.primary-button {
  color: white;
  background: var(--secondary);
}

.secondary-button {
  color: var(--primary);
  background: var(--soft);
}

.ghost-button {
  color: var(--primary);
  background: white;
  border: 1px solid var(--line);
}

.google-button {
  gap: 12px;
  width: 100%;
  margin-top: 24px;
  border: 1px solid var(--line);
  color: var(--primary);
  background: white;
}

.google-button span {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  color: white;
  background: var(--secondary);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.run-form {
  display: grid;
  gap: 16px;
}

.ai-toggle {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  padding: 14px;
}

.ai-toggle input {
  width: auto;
  margin-top: 3px;
}

.ai-toggle span {
  display: grid;
  gap: 4px;
}

.ai-toggle small {
  color: var(--muted);
  font-weight: 400;
}

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

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

.upload-box {
  min-height: 118px;
  align-content: start;
  border: 1px dashed rgba(0, 58, 93, 0.4);
  border-radius: 8px;
  background: #fbfdff;
  padding: 16px;
}

.message {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--secondary);
  border-radius: 8px;
  padding: 12px;
  background: #fbfdff;
}

.message.error {
  border-left-color: #b91c1c;
}

.export-panel {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  padding: 12px;
}

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

.export-panel textarea {
  min-height: 140px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
}

.review-tools {
  margin-top: 18px;
  justify-content: flex-start;
}

.review-tools input {
  max-width: 360px;
}

.review-tools select {
  max-width: 220px;
}

.table-wrap {
  margin-top: 14px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 300px;
  background: white;
}

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

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--soft);
  color: #334155;
  text-align: left;
}

th,
td {
  min-width: 150px;
  border-bottom: 1px solid var(--line);
  padding: 8px;
  vertical-align: top;
}

td[contenteditable="true"] {
  background: #fffef7;
  outline-color: var(--secondary);
}

.image-preview {
  display: block;
  width: 96px;
  height: 72px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
}

.review-check {
  display: inline-flex;
  grid-template-columns: none;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.review-check input {
  width: auto;
}

dialog {
  width: min(760px, calc(100% - 32px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
}

.settings-form {
  display: grid;
  gap: 14px;
  padding: 22px;
}

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

menu {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin: 0;
  padding: 0;
}

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

.management-list {
  display: grid;
  gap: 10px;
  max-height: 340px;
  overflow: auto;
}

.management-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 12px;
}

.management-item div {
  display: grid;
  gap: 3px;
}

.management-item strong {
  color: var(--primary);
}

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

@media (max-width: 1050px) {
  .dashboard-layout,
  .client-layout,
  .field-grid,
  .upload-grid,
  .dashboard-controls {
    grid-template-columns: 1fr;
  }

  .app-header,
  .section-heading,
  .form-actions,
  .review-tools {
    align-items: stretch;
    flex-direction: column;
  }

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