:root {
  color-scheme: light;
  --bg: #eef2f7;
  --ink: #1d2430;
  --muted: #667085;
  --line: #d8dee8;
  --panel: #ffffff;
  --accent: #2176ff;
  --accent-strong: #155ad1;
  --danger: #d92d20;
  --shadow: 0 18px 50px rgba(24, 33, 53, 0.18);
}

* { box-sizing: border-box; }

[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  min-width: 320px;
  overflow: hidden;
  background:
    radial-gradient(circle at 15% 8%, rgba(33, 118, 255, 0.14), transparent 28%),
    linear-gradient(135deg, #f8fafc 0%, #e9eef6 58%, #dde6f2 100%);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  min-height: 100%;
}

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

.login-box {
  width: min(420px, 100%);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow);
  padding: 28px;
  border-radius: 8px;
}

.brand-mark {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  margin-bottom: 18px;
  border-radius: 8px;
  background: #1d2430;
  color: #fff;
  font-weight: 800;
  letter-spacing: 0;
}

.login h1 {
  margin: 0 0 8px;
  font-size: 30px;
  line-height: 1.05;
  letter-spacing: 0;
}

.login p {
  margin: 0 0 24px;
  color: var(--muted);
}

.login label {
  display: block;
  margin-bottom: 8px;
  color: #344054;
  font-size: 14px;
  font-weight: 700;
}

.password-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.captcha-slot {
  min-height: 0;
  margin-top: 14px;
}

.captcha-slot.active {
  min-height: 70px;
}

.password-row input,
.address-form input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

.password-row input {
  min-width: 0;
  height: 44px;
  padding: 0 12px;
}

.password-row button,
.toolbar-button {
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
}

.password-row button {
  height: 44px;
  padding: 0 18px;
}

.password-row button:hover,
.toolbar-button:hover {
  background: var(--accent-strong);
}

[data-login-error] {
  display: block;
  min-height: 20px;
  margin-top: 10px;
  color: var(--danger);
  font-weight: 700;
}

.browser {
  height: 100vh;
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto auto 1fr;
  background: var(--bg);
}

.browser-top {
  min-height: 48px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: end;
  gap: 12px;
  padding: 8px 12px 0;
  background: #dfe6f0;
  border-bottom: 1px solid #cbd5e1;
}

.window-buttons {
  display: flex;
  gap: 7px;
  align-self: center;
  padding: 0 4px 7px;
}

.window-buttons span {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.window-buttons span:nth-child(1) { background: #ff5f57; }
.window-buttons span:nth-child(2) { background: #ffbd2e; }
.window-buttons span:nth-child(3) { background: #28c840; }

.tabs {
  min-width: 0;
  display: flex;
  align-items: end;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.tab {
  width: min(220px, 30vw);
  min-width: 120px;
  height: 38px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 0 8px 0 12px;
  border: 1px solid transparent;
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background: #cfd8e5;
  color: #2f3b4c;
}

.tab.active {
  background: var(--bg);
  border-color: #cbd5e1;
}

.tab-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 700;
}

.tab-close {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #475467;
}

.tab-close:hover {
  background: rgba(16, 24, 40, 0.1);
}

.toolbar {
  display: grid;
  grid-template-columns: auto auto auto 1fr auto auto auto;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.icon-button {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #344054;
  font-size: 20px;
  font-weight: 800;
}

.icon-button:hover {
  border-color: #aeb9c8;
  background: #f8fafc;
}

.address-form input {
  height: 40px;
  padding: 0 14px;
  border-radius: 20px;
  background: #fff;
}

.toolbar-button {
  min-width: 72px;
  height: 38px;
  padding: 0 13px;
  font-size: 13px;
}

.toolbar-button.secondary {
  border: 1px solid var(--line);
  background: #fff;
  color: #344054;
}

.toolbar-button.secondary:hover {
  border-color: #aeb9c8;
  background: #f8fafc;
}

.bookmarks {
  min-height: 40px;
  display: flex;
  gap: 8px;
  align-items: center;
  overflow-x: auto;
  padding: 7px 12px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.bookmark {
  max-width: 180px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #344054;
  padding: 7px 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 700;
}

.content {
  min-height: 0;
  display: grid;
  grid-template-columns: 280px 1fr;
  overflow: hidden;
}

.side {
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(160px, 1fr) minmax(160px, 1fr) auto;
  gap: 12px;
  padding: 12px;
  background: #f8fafc;
  border-right: 1px solid var(--line);
}

.side-block {
  min-height: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 8px;
}

.side-title {
  color: #344054;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

textarea {
  min-height: 130px;
  resize: none;
  padding: 12px;
  line-height: 1.45;
}

.history {
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.history button {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #344054;
  padding: 8px 10px;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sync {
  min-height: 28px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.page-frame {
  position: relative;
  min-width: 0;
  min-height: 0;
  background: #fff;
}

iframe {
  width: 100%;
  height: 100%;
  min-height: calc(100vh - 128px);
  border: 0;
  background: #fff;
}

.frame-fallback {
  position: absolute;
  left: 24px;
  bottom: 24px;
  width: min(420px, calc(100% - 48px));
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  border: 1px solid #f2d07d;
  border-radius: 8px;
  background: #fff8e6;
  color: #4e3412;
  box-shadow: 0 10px 30px rgba(24, 33, 53, 0.16);
}

.frame-fallback span {
  color: #6b4f1d;
  line-height: 1.4;
}

@media (max-width: 760px) {
  .browser {
    grid-template-rows: auto auto auto auto;
  }

  .browser-top {
    grid-template-columns: 1fr auto;
  }

  .window-buttons {
    display: none;
  }

  .tab {
    width: 170px;
    min-width: 110px;
  }

  .toolbar {
    grid-template-columns: auto auto auto 1fr;
  }

  .toolbar-button {
    display: none;
  }

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

  .side {
    grid-row: 2;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  textarea {
    min-height: 90px;
  }

  iframe {
    min-height: 68vh;
  }
}
