:root {
  color-scheme: light;
  --bg: #f4f7f9;
  --surface: #ffffff;
  --text: #15202b;
  --muted: #637282;
  --line: #d8e0e7;
  --primary: #0f766e;
  --primary-dark: #115e59;
  --danger: #b42318;
  --danger-dark: #8f1d14;
  --shadow: 0 18px 50px rgba(21, 32, 43, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 40px 0;
}

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

.login-panel {
  width: min(420px, 100%);
  margin: 10vh auto 0;
  padding: 32px;
}

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

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.panel {
  padding: 24px;
  margin-bottom: 22px;
}

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

h1,
h2 {
  margin: 0;
  line-height: 1.2;
}

h1 {
  font-size: 1.75rem;
}

h2 {
  margin-bottom: 18px;
  font-size: 1.1rem;
}

.form-stack,
.mapping-form,
.password-form {
  display: grid;
  gap: 16px;
}

.mapping-form {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: end;
}

.password-form {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: end;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 650;
}

.wide {
  grid-column: span 1;
}

input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  color: var(--text);
  font: inherit;
  background: #fff;
}

input:focus {
  outline: 3px solid rgba(15, 118, 110, 0.16);
  border-color: var(--primary);
}

button {
  min-height: 44px;
  border: 0;
  border-radius: 6px;
  padding: 0 16px;
  color: #fff;
  background: var(--primary);
  font: inherit;
  font-weight: 750;
  cursor: pointer;
}

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

button.secondary,
.button-link.secondary {
  color: var(--text);
  background: #e8eef2;
}

button.secondary:hover,
.button-link.secondary:hover {
  background: #dce5eb;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border-radius: 6px;
  padding: 0 16px;
  color: #fff;
  background: var(--primary);
  font: inherit;
  font-weight: 750;
  text-decoration: none;
}

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

button.danger {
  min-height: 36px;
  background: var(--danger);
}

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

.messages {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.message {
  border-radius: 6px;
  padding: 12px 14px;
  font-weight: 700;
}

.message.success {
  color: #064e3b;
  background: #d1fae5;
}

.message.error {
  color: #7f1d1d;
  background: #fee2e2;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

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

th {
  color: var(--muted);
  background: #f8fafb;
  font-size: 0.82rem;
  text-transform: uppercase;
}

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

.actions {
  width: 1%;
  white-space: nowrap;
}

.empty {
  margin: 0;
  color: var(--muted);
}

@media (max-width: 820px) {
  .shell {
    width: min(100% - 20px, 1120px);
    padding: 20px 0;
  }

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

  .topbar-actions {
    align-items: stretch;
    flex-direction: column;
  }

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

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

  .wide {
    grid-column: auto;
  }
}
