:root {
  --bg: #eef4fb;
  --surface: #ffffff;
  --surface-soft: #f6f9fd;
  --ink: #18304a;
  --muted: #6c7f95;
  --line: #d7e4f2;
  --brand: #0f65b7;
  --brand-dark: #094b89;
  --brand-soft: #dcecff;
  --accent: #16a3d8;
  --success: #15936b;
  --warning: #e59b23;
  --danger: #d94b4b;
  --shadow: 0 18px 45px rgba(23, 58, 94, 0.12);
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: var(--bg);
}

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

.app-frame {
  display: grid;
  grid-template-columns: 270px 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 22px;
  color: #fff;
  background: linear-gradient(180deg, #075aa6 0%, #073d73 100%);
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding-bottom: 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 12px;
  color: #0a4e90;
  background: #fff;
  font-weight: 800;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.84rem;
}

.nav-list {
  display: grid;
  gap: 8px;
  margin-top: 26px;
}

.nav-list a,
.ghost-button {
  border: 0;
  border-radius: 12px;
  color: rgba(255, 255, 255, 0.82);
  background: transparent;
  padding: 12px 14px;
  text-align: left;
  text-decoration: none;
}

.nav-list a.active,
.nav-list a:hover,
.ghost-button:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
}

.ghost-button {
  margin-top: auto;
  cursor: pointer;
}

.sidebar-user {
  margin-top: auto;
  margin-bottom: 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.12);
  padding: 12px 14px;
}

.sidebar-user small,
.sidebar-user strong {
  display: block;
}

.sidebar-user small {
  color: rgba(255, 255, 255, 0.68);
}

.sidebar-user strong {
  color: #fff;
}

.sidebar-user + .ghost-button {
  margin-top: 0;
}

.content {
  padding: 28px;
}

.topbar {
  display: flex;
  gap: 20px;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--brand);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
}

h1 {
  color: var(--ink);
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 750;
}

h2 {
  color: var(--ink);
  font-size: 1.25rem;
  font-weight: 750;
}

.lede {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.panel,
.progress-panel,
.status-card,
.login-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel,
.progress-panel {
  margin-bottom: 18px;
  padding: 22px;
}

.view-screen {
  display: none;
}

.view-screen.is-active {
  display: block;
  animation: view-enter 0.18s ease-out;
}

@keyframes view-enter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.panel-title,
.progress-head {
  display: flex;
  gap: 14px;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 18px;
}

.panel-badge,
.pill {
  border-radius: 999px;
  color: var(--brand-dark);
  background: var(--brand-soft);
  padding: 7px 11px;
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.status-card {
  min-width: 260px;
  padding: 16px;
}

.status-card.compact strong,
.status-card.compact small {
  display: block;
}

.status-card small {
  color: var(--muted);
}

.status-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--warning);
}

.status-dot.ok {
  background: var(--success);
}

.status-dot.error {
  background: var(--danger);
}

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

label {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
  color: #31516f;
  font-size: 0.82rem;
  font-weight: 750;
  text-transform: uppercase;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  background: #fff;
  color: var(--ink);
  padding: 12px 13px;
  font-size: 0.95rem;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(22, 163, 216, 0.16);
}

button {
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  padding: 12px 16px;
  color: #fff;
  background: var(--brand);
  font-weight: 800;
}

.button-link {
  display: inline-block;
  border-radius: 10px;
  color: #fff;
  background: var(--brand);
  padding: 12px 16px;
  font-weight: 800;
  text-decoration: none;
}

.button-link:hover {
  background: var(--brand-dark);
}

button:hover {
  background: var(--brand-dark);
}

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

.small-button {
  padding: 8px 10px;
  font-size: 0.8rem;
}

.danger-button {
  background: var(--danger);
}

.danger-button:hover {
  background: #b93434;
}

.file-actions,
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.pagination {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: flex-end;
  margin-top: 14px;
}

.pagination span {
  color: var(--muted);
  font-weight: 800;
}

.file-actions {
  margin: -2px 0 16px;
}

.file-actions button,
.actions button:nth-child(1),
.actions button:nth-child(2) {
  color: var(--brand-dark);
  background: var(--brand-soft);
}

.file-actions button:hover,
.actions button:nth-child(1):hover,
.actions button:nth-child(2):hover {
  background: #c9e2ff;
}

#cancelButton {
  background: var(--danger);
}

.file-actions small {
  color: var(--muted);
}

.hint,
.summary,
.preview-panel {
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 12px;
  background: var(--surface-soft);
  color: var(--muted);
  margin: 0 0 16px;
  padding: 13px 14px;
  line-height: 1.45;
}

.hint strong,
.summary strong,
.preview-panel strong {
  color: var(--brand-dark);
}

code {
  border-radius: 6px;
  background: #eaf4ff;
  color: var(--brand-dark);
  padding: 2px 5px;
}

pre {
  overflow: auto;
  min-height: 112px;
  margin: 16px 0 0;
  border-radius: 12px;
  background: #0e2238;
  color: #dcecff;
  padding: 14px;
  white-space: pre-wrap;
}

.progress-bar {
  overflow: hidden;
  height: 12px;
  margin: 20px 0;
  border-radius: 999px;
  background: #dce8f5;
}

.progress-bar span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), var(--accent));
  transition: width 0.35s ease;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}

.metrics div {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
  padding: 14px;
}

.metrics strong,
.metrics small {
  display: block;
}

.metrics strong {
  color: var(--brand-dark);
  font-size: 1.8rem;
}

.metrics small {
  color: var(--muted);
  font-weight: 700;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

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

th {
  color: #31516f;
  background: var(--surface-soft);
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

td {
  color: var(--ink);
  font-size: 0.92rem;
}

.status-badge {
  display: inline-block;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  padding: 5px 9px;
  font-size: 0.76rem;
  font-weight: 800;
}

.status-badge.sent {
  background: #ddf5ed;
  color: var(--success);
}

.status-badge.failed {
  background: #ffe5e5;
  color: var(--danger);
}

.checkbox-label {
  align-content: center;
  grid-template-columns: auto 1fr;
  text-transform: none;
}

.checkbox-label input {
  width: auto;
}

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

.login-body {
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 18% 20%, rgba(22, 163, 216, 0.22), transparent 24rem),
    linear-gradient(135deg, #0a4e90, #062d55);
}

.login-shell {
  width: min(430px, calc(100% - 32px));
}

.login-card {
  padding: 30px;
}

.login-card .brand-mark {
  margin-bottom: 18px;
  color: #fff;
  background: var(--brand);
}

.login-card button {
  width: 100%;
}

@media (max-width: 900px) {
  .app-frame {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .topbar,
  .grid,
  .metrics {
    grid-template-columns: 1fr;
  }

  .topbar,
  .panel-title,
  .progress-head {
    flex-direction: column;
    align-items: stretch;
  }
}
