:root {
  --bg: #eef8f6;
  --surface: rgba(255, 255, 255, 0.88);
  --surface-solid: #ffffff;
  --text: #123632;
  --muted: #66827e;
  --primary: #087f74;
  --primary-dark: #05645c;
  --primary-soft: #dff5f1;
  --accent: #17b99f;
  --danger: #c84b5d;
  --danger-soft: #fff0f2;
  --warning: #b87716;
  --border: rgba(9, 91, 82, 0.12);
  --shadow: 0 24px 70px rgba(16, 78, 71, 0.12);
  --radius: 24px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top right, #d7f5ee 0, transparent 35%), var(--bg);
  color: var(--text);
  font-family: Tahoma, Arial, sans-serif;
  overflow-x: hidden;
}
button, input, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.muted { color: var(--muted); }

.background-shape {
  position: fixed;
  z-index: -1;
  border-radius: 999px;
  filter: blur(2px);
  opacity: .55;
}
.shape-one { width: 360px; height: 360px; background: #b5eadf; top: -150px; left: -110px; }
.shape-two { width: 280px; height: 280px; background: #d8eee9; bottom: -120px; right: -80px; }

.glass-card {
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, .8);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  border-radius: var(--radius);
}

.auth-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.auth-card { width: min(460px, 100%); padding: 38px; }
.auth-card h1 { margin: 8px 0 10px; font-size: 32px; }
.auth-card form { margin-top: 28px; }

.brand-mark {
  width: 66px;
  height: 66px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 800;
  letter-spacing: -1px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  box-shadow: 0 14px 28px rgba(8, 127, 116, .25);
}
.brand-mark.small { width: 48px; height: 48px; border-radius: 15px; }
.eyebrow {
  margin: 0;
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.eyebrow.light { color: #bff8ed; }

label { display: block; margin-bottom: 9px; font-weight: 700; font-size: 14px; }
input, textarea {
  width: 100%;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, .94);
  color: var(--text);
  border-radius: 14px;
  padding: 13px 14px;
  outline: none;
  transition: border .2s, box-shadow .2s, transform .2s;
}
input:focus, textarea:focus {
  border-color: rgba(8, 127, 116, .5);
  box-shadow: 0 0 0 4px rgba(8, 127, 116, .09);
}
textarea { resize: vertical; line-height: 1.75; }
input[type="range"] { padding: 0; accent-color: var(--primary); }
.password-wrap { position: relative; }
.password-wrap input { padding-left: 52px; }
.icon-button {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  width: 38px;
  height: 38px;
  border-radius: 10px;
}
.icon-button:hover { background: var(--primary-soft); }
#confirmPasswordRow { margin-top: 18px; }
.form-error { min-height: 20px; color: var(--danger); font-size: 13px; margin: 12px 0 0; }

.primary-button, .secondary-button, .danger-button, .ghost-button {
  border: 0;
  border-radius: 13px;
  padding: 12px 18px;
  font-weight: 800;
  transition: transform .15s, box-shadow .15s, opacity .15s;
}
.primary-button { background: linear-gradient(135deg, var(--primary), #0aa28f); color: #fff; box-shadow: 0 10px 20px rgba(8, 127, 116, .2); }
.secondary-button { background: var(--primary-soft); color: var(--primary-dark); }
.danger-button { background: var(--danger-soft); color: var(--danger); }
.ghost-button { background: rgba(255,255,255,.65); color: var(--text); border: 1px solid var(--border); }
.primary-button:hover, .secondary-button:hover, .danger-button:hover, .ghost-button:hover { transform: translateY(-1px); }
button:disabled { opacity: .55; cursor: not-allowed; transform: none !important; }
.full-width { width: 100%; margin-top: 22px; }

.app-shell { width: min(1320px, calc(100% - 32px)); margin: 0 auto; padding: 26px 0 40px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.brand-area, .topbar-actions, .button-row, .section-heading { display: flex; align-items: center; }
.brand-area { gap: 13px; }
.brand-area h1 { margin: 3px 0 0; font-size: 21px; }
.topbar-actions { gap: 12px; }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 4px currentColor; opacity: .55; }
.status-pill.neutral { background: #edf2f1; color: #66827e; }
.status-pill.loading { background: #fff7e8; color: var(--warning); }
.status-pill.success { background: #e2f8f1; color: #087d63; }
.status-pill.danger { background: var(--danger-soft); color: var(--danger); }

.hero {
  min-height: 210px;
  padding: 34px 38px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 30px;
  overflow: hidden;
  position: relative;
  color: #fff;
  background: linear-gradient(120deg, #075f58, #0b9787 65%, #23bca3);
}
.hero::after {
  content: '';
  position: absolute;
  width: 360px;
  height: 360px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 50%;
  left: -80px;
  top: -160px;
}
.hero h2 { font-size: clamp(25px, 4vw, 39px); line-height: 1.35; margin: 10px 0 12px; max-width: 740px; }
.hero p { margin: 0; line-height: 1.8; max-width: 770px; color: rgba(255,255,255,.84); }
.hero-badge {
  flex: 0 0 150px;
  width: 150px;
  height: 150px;
  border-radius: 42px;
  border: 1px solid rgba(255,255,255,.25);
  background: rgba(255,255,255,.12);
  display: grid;
  place-content: center;
  text-align: center;
  transform: rotate(-5deg);
}
.hero-badge span { font-size: 54px; font-weight: 900; }
.hero-badge small { color: #c8fff4; font-weight: 700; }

.dashboard-grid { display: grid; grid-template-columns: minmax(340px, .82fr) minmax(480px, 1.35fr); gap: 22px; margin-top: 22px; align-items: start; }
.connection-card, .settings-card, .activity-card { padding: 26px; }
.section-heading { justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.section-heading h2 { margin: 5px 0 0; font-size: 23px; }

.qr-panel {
  min-height: 345px;
  display: grid;
  place-items: center;
  border-radius: 20px;
  border: 1px dashed rgba(8, 127, 116, .22);
  background: linear-gradient(145deg, #f8fffd, #edf8f5);
  padding: 24px;
}
.qr-placeholder, .loader-wrap, .account-box { text-align: center; display: grid; justify-items: center; gap: 10px; }
.qr-placeholder span, .account-box span, .account-box small { color: var(--muted); }
.phone-icon {
  width: 76px;
  height: 76px;
  border-radius: 24px;
  display: grid;
  place-items: center;
  font-size: 36px;
  color: var(--primary);
  background: var(--primary-soft);
}
.qr-image { width: min(310px, 100%); border-radius: 18px; background: #fff; padding: 10px; box-shadow: 0 18px 40px rgba(20,80,73,.14); }
.spinner { width: 50px; height: 50px; border: 5px solid #d7ede8; border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.success-icon { width: 80px; height: 80px; border-radius: 50%; display: grid; place-items: center; background: #dbf8ef; color: #0b8b6d; font-size: 42px; font-weight: 900; }
.account-box strong { font-size: 22px; }

.button-row { flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.helper-text { color: var(--muted); font-size: 12px; line-height: 1.7; margin: 10px 0 0; }
.field-group { margin-bottom: 18px; }
.two-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.value-label { color: var(--primary); font-size: 12px; margin-right: 6px; }
.textarea-footer { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 11px; margin-top: 7px; }

.switch-label { display: inline-flex; align-items: center; gap: 9px; margin: 0; font-size: 12px; }
.switch-label input { display: none; }
.switch { width: 46px; height: 26px; border-radius: 999px; background: #c8d6d3; position: relative; transition: .2s; }
.switch::after { content: ''; width: 20px; height: 20px; border-radius: 50%; background: #fff; position: absolute; top: 3px; right: 3px; box-shadow: 0 2px 6px rgba(0,0,0,.15); transition: .2s; }
.switch-label input:checked + .switch { background: var(--primary); }
.switch-label input:checked + .switch::after { transform: translateX(-20px); }

.activity-card { margin-top: 22px; }
.logs-list { display: grid; gap: 9px; max-height: 360px; overflow: auto; padding-left: 3px; }
.log-item { display: grid; grid-template-columns: 105px 1fr; gap: 14px; align-items: center; padding: 13px 14px; border-radius: 14px; background: rgba(244,250,248,.9); border: 1px solid var(--border); }
.log-item time { color: var(--muted); font-size: 11px; direction: ltr; text-align: right; }
.log-item p { margin: 0; font-size: 13px; line-height: 1.6; }
.log-item.error { border-right: 4px solid var(--danger); }
.log-item.warning { border-right: 4px solid #d59833; }
.log-item.info { border-right: 4px solid var(--primary); }
.empty-state { color: var(--muted); text-align: center; padding: 30px; }

footer { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; color: var(--muted); font-size: 11px; padding: 18px 6px 0; }
.toast {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 20;
  max-width: min(420px, calc(100% - 48px));
  padding: 13px 17px;
  border-radius: 14px;
  color: #fff;
  background: #163c37;
  box-shadow: 0 14px 40px rgba(0,0,0,.2);
  opacity: 0;
  transform: translateY(16px);
  pointer-events: none;
  transition: .25s;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: #9f3546; }
.toast.success { background: #08765f; }

@media (max-width: 980px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .hero-badge { display: none; }
}
@media (max-width: 660px) {
  .app-shell { width: min(100% - 20px, 1320px); padding-top: 12px; }
  .topbar { align-items: flex-start; }
  .topbar-actions { flex-direction: column; align-items: flex-end; }
  .hero { padding: 26px 22px; min-height: 230px; }
  .connection-card, .settings-card, .activity-card, .auth-card { padding: 21px; }
  .two-columns { grid-template-columns: 1fr; gap: 0; }
  .section-heading { align-items: flex-start; }
  .textarea-footer { flex-direction: column; }
  .log-item { grid-template-columns: 1fr; gap: 5px; }
  .log-item time { text-align: right; }
}
