* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #eef2f6;
  color: #172033;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: #222222;
  border-bottom: 1px solid #343434;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
}

.navbar {
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: 62px;
  padding: 0 24px;
  position: relative;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
  z-index: 3;
  color: #ffffff;
  font-size: 18px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.navbar-logo {
  /* width: 34px; */
  height: 74px;
  object-fit: contain;
  flex: 0 0 auto;
}

.navbar-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.navbar-menu {
  display: flex;
  align-items: center;
  flex: 1;
  gap: 16px;
}

.navbar-toggler {
  display: none;
  position: relative;
  z-index: 3;
  width: 42px;
  min-height: 38px;
  margin-left: auto;
  border: 1px solid #555555;
  border-radius: 8px;
  padding: 8px;
  background: transparent;
}

.navbar-toggler span {
  display: block;
  width: 100%;
  height: 2px;
  border-radius: 999px;
  background: #ffffff;
}

.navbar-toggler span + span {
  margin-top: 5px;
}

.nav-link {
  display: grid;
  place-items: center;
  min-height: 38px;
  border-radius: 8px;
  padding: 0 12px;
  color: #d6d6d6;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.nav-link:hover,
.nav-link.active {
  background: #3a3a3a;
  color: #ffffff;
}

.nav-logout {
  min-height: 38px;
  margin-left: auto;
  border-radius: 8px;
  padding: 0 14px;
  background: #f4f4f4;
  color: #222222;
}

.page {
  display: grid;
  grid-template-columns: 390px minmax(0, 1fr);
  gap: 24px;
  min-height: calc(100vh - 62px);
  padding: 24px;
}

.panel,
.logs {
  background: #ffffff;
  border: 1px solid #dfe5ee;
  border-radius: 14px;
  box-shadow: 0 18px 45px rgba(23, 32, 51, 0.08);
}

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

h1 {
  margin: 0 0 18px;
  font-size: 26px;
  line-height: 1.15;
  letter-spacing: 0;
}

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 15px;
  color: #344054;
  font-size: 13px;
  font-weight: 700;
}

.compact-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.settings {
  border-top: 1px solid #e5eaf1;
  border-bottom: 1px solid #e5eaf1;
  margin: 18px 0;
  padding: 12px 0;
}

.settings summary {
  cursor: pointer;
  font-weight: 700;
}

.settings .field:first-of-type {
  margin-top: 14px;
}

.credential-actions {
  display: flex;
  gap: 8px;
}

.credential-actions button {
  flex: 1;
}

.credential-actions button.secondary {
  margin-bottom: 0;
}

.credentials-hint {
  margin-top: 10px;
  color: #667085;
  font-size: 12px;
  line-height: 1.4;
}

.check-field {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  font-size: 14px;
  font-weight: 700;
}

.check-field input {
  width: 18px;
  height: 18px;
}

input,
select {
  width: 100%;
  height: 42px;
  border: 1px solid #cfd7e3;
  border-radius: 9px;
  padding: 0 12px;
  font: inherit;
  background: #ffffff;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus,
select:focus {
  border-color: #2f6fed;
  box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.14);
}

.profile-block {
  border-top: 1px solid #e5eaf1;
  margin-top: 4px;
  padding-top: 14px;
}

.profile-create {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.profile-create button {
  min-width: 96px;
  margin: 0;
  padding: 0 12px;
}

.actions {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

button {
  min-height: 42px;
  border: 0;
  border-radius: 9px;
  background: #2f6fed;
  color: #ffffff;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

button:hover:not(:disabled),
.button-link:hover {
  box-shadow: 0 10px 24px rgba(47, 111, 237, 0.2);
  transform: translateY(-1px);
}

.button-link {
  display: grid;
  place-items: center;
  min-height: 42px;
  border-radius: 9px;
  padding: 0 16px;
  color: #ffffff;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

button:disabled {
  background: #b9c2cf;
  cursor: default;
}

button.danger {
  background: #d14343;
}

button.danger:disabled {
  background: #aab3bf;
}

button.secondary {
  background: #5f6b7a;
  margin-bottom: 18px;
}

.button-link.secondary {
  background: #5f6b7a;
}

.status {
  margin-top: 18px;
  padding: 12px;
  border: 1px solid #dbe6f4;
  border-radius: 10px;
  background: #f4f8fd;
  font-size: 14px;
}

.status.success {
  border-color: #bfe7cc;
  background: #ebf8ef;
  color: #176b32;
}

.status.error {
  border-color: #f3c6c6;
  background: #fff1f1;
  color: #9f2323;
}

.screenshots,
.history-screenshots {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.screenshot-card {
  display: block;
  overflow: hidden;
  border: 1px solid #dfe5ee;
  border-radius: 12px;
  background: #ffffff;
}

.screenshot-card img {
  display: block;
  width: 100%;
  max-height: 420px;
  object-fit: contain;
  background: #f8fafc;
}

.screenshot-card span {
  display: block;
  border-top: 1px solid #dfe5ee;
  padding: 9px 11px;
  color: #344054;
  font-size: 13px;
  font-weight: 700;
}

.logs {
  display: grid;
  grid-template-rows: auto 1fr;
  min-width: 0;
  max-height: calc(100vh - 48px);
}

.logs-header {
  border-bottom: 1px solid #e5eaf1;
  padding: 16px 18px;
  color: #344054;
  font-weight: 700;
}

.log-feed {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 16px;
  overflow: auto;
  background: #f8fafc;
}

.log-group {
  display: grid;
  gap: 7px;
  border: 1px solid #e1e7ef;
  border-radius: 12px;
  background: #ffffff;
  padding: 12px;
}

.log-group.attempt {
  border-left: 4px solid #2f6fed;
}

.log-group-title {
  color: #172033;
  font-size: 14px;
  font-weight: 800;
}

.log-line {
  border-radius: 8px;
  background: #f6f8fb;
  padding: 7px 9px;
  color: #475467;
  overflow-wrap: anywhere;
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 12px;
  line-height: 1.45;
}

.log-screenshot {
  display: block;
  overflow: hidden;
  width: min(360px, 100%);
  border: 1px solid #dfe5ee;
  border-radius: 10px;
  padding: 0;
  background: #ffffff;
  color: #344054;
  text-align: left;
}

.log-screenshot img {
  display: block;
  width: 100%;
  max-height: 220px;
  object-fit: contain;
  background: #f8fafc;
}

.log-screenshot span {
  display: block;
  border-top: 1px solid #dfe5ee;
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 700;
}

.image-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 56px 18px 18px;
  background: rgba(0, 0, 0, 0.78);
}

.image-modal[hidden] {
  display: none;
}

.image-modal img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 10px;
  background: #ffffff;
  object-fit: contain;
}

.image-modal-close {
  position: fixed;
  top: 14px;
  right: 14px;
  min-height: 38px;
  background: #ffffff;
  color: #222222;
}

pre {
  margin: 0;
  padding: 16px;
  overflow: auto;
  white-space: pre-wrap;
  font-family: Consolas, monospace;
  font-size: 13px;
  line-height: 1.5;
}

.sms-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(12, 19, 28, 0.88);
  z-index: 50;
}

.sms-overlay[hidden] {
  display: none;
}

.sms-box {
  display: grid;
  gap: 18px;
  width: min(420px, calc(100vw - 32px));
  background: #ffffff;
  border-radius: 14px;
  padding: 24px;
}

.sms-box h2 {
  margin: 0;
  font-size: 24px;
}

.sms-box input {
  height: 56px;
  text-align: center;
  font-size: 28px;
  letter-spacing: 4px;
}

.login-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 20px;
}

.login-box {
  display: grid;
  gap: 14px;
  width: min(380px, 100%);
  background: #ffffff;
  border: 1px solid #dfe5ee;
  border-radius: 14px;
  padding: 24px;
  box-shadow: 0 18px 45px rgba(23, 32, 51, 0.08);
}

.login-box h1 {
  margin-bottom: 6px;
}

.history-page {
  min-height: calc(100vh - 62px);
  padding: 24px;
}

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

.history-item {
  display: grid;
  gap: 10px;
  background: #ffffff;
  border: 1px solid #dfe5ee;
  border-left: 6px solid #667085;
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 12px 30px rgba(23, 32, 51, 0.06);
}

.history-item.success {
  border-left-color: #218545;
}

.history-item.error {
  border-left-color: #b42318;
}

.history-item.cancelled {
  border-left-color: #667085;
}

.history-item h2 {
  margin: 0;
  font-size: 18px;
}

.history-meta,
.history-message,
.history-screenshot {
  font-size: 14px;
}

.history-meta {
  color: #667085;
}

.history-screenshot {
  font-family: Consolas, monospace;
  overflow-wrap: anywhere;
}

.history-item pre {
  max-height: 360px;
  border: 1px solid #d8dde5;
  border-radius: 6px;
  background: #f8fafc;
}

@media (max-width: 800px) {
  .navbar {
    min-height: 62px;
    gap: 12px;
    padding: 0 16px;
  }

  .navbar-toggler {
    display: block;
  }

  .navbar-menu {
    display: flex;
    position: fixed;
    top: 62px;
    right: 0;
    bottom: 0;
    left: auto;
    width: min(320px, calc(100vw - 48px));
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    border-left: 1px solid #3a3a3a;
    background: #222222;
    padding: 16px;
    box-shadow: 0 18px 36px rgba(0, 0, 0, 0.28);
    transform: translateX(100%);
    transition: transform 0.2s ease;
    pointer-events: none;
    z-index: 2;
  }

  .navbar.open .navbar-menu {
    transform: translateX(0);
    pointer-events: auto;
  }

  .navbar::before {
    content: "";
    position: fixed;
    inset: 62px 0 0;
    background: rgba(0, 0, 0, 0.42);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }

  .navbar.open::before {
    opacity: 1;
    pointer-events: auto;
  }

  .navbar-nav {
    display: grid;
    gap: 6px;
  }

  .nav-link {
    justify-content: start;
    width: 100%;
  }

  .nav-logout {
    width: 100%;
    margin-left: 0;
  }

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