:root {
  --bg: #f8fafc;
  --panel: #ffffff;
  --line: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --accent: #0f766e;
  --accent-dark: #115e59;
  --warning: #b45309;
  --danger: #b91c1c;
  --surface: #f8fafc;
  --shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}

a {
  color: inherit;
  text-decoration: none;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 32px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand-mark {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo-image {
  display: block;
  width: auto;
  height: 40px;
  object-fit: contain;
}

.brand-mark strong {
  display: block;
  font-size: 16px;
}

.brand-mark p {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.brand-mark-large {
  margin-bottom: 32px;
}

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

.topbar-link {
  padding: 10px 14px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

.topbar-link.active {
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 14px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar {
  display: inline-flex;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #d1fae5;
  color: var(--accent-dark);
  font-weight: 700;
}

.user-chip strong {
  display: block;
  font-size: 14px;
}

.user-chip p {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.dashboard-layout,
.layout {
  max-width: 1240px;
  margin: 0 auto;
  padding: 32px;
}

.page-intro {
  margin-bottom: 24px;
}

.card,
.flash,
.login-card,
.illustration-card,
.empty-card,
.error-panel {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.meta-label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 800;
}

h1,
h2,
h3 {
  margin: 0 0 10px;
  line-height: 1.15;
}

h1 {
  font-size: clamp(36px, 4.8vw, 52px);
}

h2 {
  font-size: clamp(26px, 3vw, 34px);
}

h3 {
  font-size: 18px;
}

.muted {
  color: var(--muted);
}

.connection-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

.send-section {
  margin-top: 28px;
}

.message-card {
  max-width: 860px;
  margin: 0 auto;
}

.card {
  padding: 28px;
}

.card-large {
  min-height: 420px;
}

.card-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.detail-grid {
  display: grid;
  gap: 14px;
  margin-top: 22px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}

.button-row {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: transform 140ms ease, opacity 140ms ease, border-color 140ms ease, background 140ms ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  color: #fff;
  background: var(--accent);
}

.btn-secondary {
  color: var(--text);
  background: #fff;
  border-color: var(--line);
}

.btn-small {
  min-height: 38px;
  padding: 0 14px;
  font-size: 14px;
}

.btn-block {
  width: 100%;
  min-height: 54px;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 110px;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.badge-success {
  color: #fff;
  background: var(--accent);
}

.badge-warn {
  color: #fff;
  background: var(--warning);
}

.badge-danger {
  color: #fff;
  background: var(--danger);
}

.badge-neutral {
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
}

.badge-outline {
  color: var(--accent);
  background: #f0fdfa;
  border: 1px solid #ccfbf1;
}

.qr-display,
.empty-card {
  min-height: 300px;
  margin-top: 24px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
}

.qr-display img {
  width: min(320px, 100%);
  margin-bottom: 16px;
  padding: 12px;
  border-radius: 18px;
  background: #fff;
  border: 1px solid var(--line);
}

.empty-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: #ecfeff;
  color: var(--accent);
  font-weight: 800;
  margin-bottom: 16px;
}

.message-form {
  display: grid;
  gap: 20px;
  margin-top: 20px;
}

.form-grid {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 16px;
}

.field > span {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  font-size: 14px;
}

input[type="text"],
input[type="email"],
input[type="password"],
select {
  width: 100%;
  min-height: 50px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  font-size: 15px;
  color: var(--text);
  background: #fff;
}

textarea {
  width: 100%;
  min-height: 120px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  font: inherit;
  color: var(--text);
  resize: vertical;
  background: #fff;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  padding: 8px 10px;
  border-radius: 999px;
  background: #f0fdfa;
  color: var(--accent-dark);
  border: 1px solid #ccfbf1;
  font-size: 13px;
  font-weight: 600;
}

.info-grid {
  display: flex;
  justify-content: space-between;
  gap: 18px;
}

.inline-note {
  flex: 1;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}

.api-preview {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
}

.api-preview-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.api-method {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.api-preview pre {
  margin: 0;
  padding: 16px;
  border-radius: 14px;
  background: #0f172a;
  color: #e2e8f0;
  font-size: 13px;
  line-height: 1.6;
  overflow: auto;
}

.flash {
  margin-bottom: 20px;
  padding: 16px 18px;
}

.flash-success {
  border-color: rgba(10, 108, 88, 0.25);
  color: var(--accent-dark);
}

.flash-error {
  border-color: rgba(176, 58, 46, 0.24);
  color: var(--danger);
}

.error-panel {
  max-width: 720px;
  margin: 64px auto 0;
  padding: 28px;
}

.login-page {
  background: #f5f7fb;
}

.login-stage {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
}

.login-shell {
  width: min(100%, 624px);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.login-brand-centered {
  justify-content: center;
  margin-bottom: 34px;
}

.login-logo-image {
  display: block;
  width: auto;
  height: 58px;
  object-fit: contain;
}

.login-brand-name {
  font-size: 20px;
  font-weight: 700;
  color: #1e293b;
  letter-spacing: -0.02em;
}

.login-copy {
  position: relative;
  z-index: 2;
  margin-top: 34px;
}

.login-copy h1 {
  font-size: clamp(38px, 5vw, 56px);
  font-weight: 700;
  letter-spacing: -0.04em;
  margin-bottom: 0;
}

.login-card {
  width: 100%;
  padding: 44px 48px 36px;
}

.login-card-centered {
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid #d9e1eb;
  border-radius: 22px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
}

.login-card-head h2 {
  font-size: 44px;
  letter-spacing: -0.03em;
  margin-bottom: 12px;
  color: #222b33;
}

.login-card-head p {
  margin: 0;
  color: #74839b;
  font-size: 18px;
  line-height: 1.5;
}

.login-form {
  display: grid;
  gap: 24px;
  margin-top: 28px;
}

.login-form .field > span {
  font-size: 16px;
  margin-bottom: 12px;
  color: #2f3841;
  font-weight: 500;
}

.login-form input[type="email"],
.login-form input[type="password"] {
  min-height: 66px;
  padding: 0 20px;
  border-radius: 16px;
  border-color: #d9e1eb;
  background: #ffffff;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.03);
  font-size: 18px;
  color: #2b3440;
}

.login-form input[type="email"]:focus,
.login-form input[type="password"]:focus {
  outline: none;
  border-color: rgba(15, 118, 110, 0.45);
  box-shadow:
    0 0 0 4px rgba(15, 118, 110, 0.08),
    inset 0 1px 2px rgba(15, 23, 42, 0.03);
}

.login-submit {
  min-height: 72px;
  margin-top: 6px;
  border-radius: 16px;
  background: linear-gradient(180deg, #3c9497 0%, #2f7d84 100%);
  font-size: 22px;
}

.login-help-link {
  display: inline-flex;
  justify-content: center;
  color: #7b8aa2;
  font-size: 18px;
  margin-top: -2px;
}

.hidden {
  display: none;
}

@media (max-width: 960px) {
  .connection-grid,
  .form-grid,
  .info-grid,
  .topbar,
  .topbar-user,
  .topbar-nav,
  .button-row,
  .detail-row,
  .api-preview-head {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: stretch;
  }

  .dashboard-layout {
    padding: 24px;
  }

  .topbar {
    padding: 18px 24px;
  }

  .login-stage {
    padding: 16px;
  }

  .login-shell {
    width: min(100%, 520px);
  }

  .login-logo-image {
    height: 48px;
  }

  .login-card {
    padding: 34px 24px 28px;
  }

  .login-card-head h2 {
    font-size: 36px;
  }

  .login-card-head p,
  .login-form .field > span,
  .login-help-link {
    font-size: 16px;
  }

  .login-form input[type="email"],
  .login-form input[type="password"] {
    min-height: 58px;
    font-size: 16px;
  }

  .login-submit {
    min-height: 60px;
    font-size: 20px;
  }
}


/* Background */
.login-page {
  margin: 0;
  font-family: 'Inter', sans-serif;
  background: linear-gradient(135deg, #eef2f7, #f8fafc);
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Container */
.login-container {
  width: 100%;
  max-width: 420px;
  text-align: center;
}

/* Logo */
.login-header img {
  height: 50px;
  margin-bottom: 25px;
}

/* Card */
.login-card {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(18px);
  border-radius: 18px;
  padding: 35px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.08);
  text-align: left;
}

/* Heading */
.login-top h1 {
  margin: 0;
  font-size: 26px;
  font-weight: 600;
  color: #1f2937;
}

.login-top p {
  margin-top: 6px;
  color: #6b7280;
  font-size: 14px;
}

/* Inputs */
.input-group {
  margin-top: 20px;
}

.input-group label {
  display: block;
  font-size: 13px;
  margin-bottom: 6px;
  color: #374151;
}

.input-group input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  font-size: 14px;
  transition: 0.2s ease;
}

.input-group input:focus {
  border-color: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
  outline: none;
}

/* Forgot link */
.login-actions {
  margin-top: 10px;
  text-align: right;
}

.forgot-link {
  font-size: 13px;
  color: #6b7280;
  text-decoration: none;
}

.forgot-link:hover {
  color: #10b981;
}

/* Button */
.btn-login {
  width: 100%;
  margin-top: 20px;
  padding: 13px;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  color: white;
  background: linear-gradient(135deg, #10b981, #059669);
  cursor: pointer;
  transition: 0.3s ease;
}

.btn-login:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(16, 185, 129, 0.25);
}

/* Error */
.alert-error {
  margin-top: 15px;
  padding: 10px;
  border-radius: 8px;
  background: #fee2e2;
  color: #b91c1c;
  font-size: 13px;
}

/* RESET */
body {
  margin: 0;
  font-family: 'Inter', sans-serif;
  background: linear-gradient(135deg, #eef2f7, #f8fafc);
  color: #1f2937;
}

/* LAYOUT */
.app-shell {
  min-height: 100vh;
}

/* TOPBAR */
.topbar {
  height: 70px;
  background: rgba(255,255,255,0.7);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid #e5e7eb;

  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 30px;
}

/* BRAND */
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand img {
  height: 32px;
}

.brand span {
  font-weight: 600;
}

/* NAV */
.nav {
  display: flex;
  gap: 25px;
}

.nav a {
  text-decoration: none;
  color: #6b7280;
  font-weight: 500;
  padding-bottom: 4px;
}

.nav a.active {
  color: #10b981;
  border-bottom: 2px solid #10b981;
}

/* USER */
.user-section {
  display: flex;
  align-items: center;
  gap: 15px;
}

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

.avatar {
  width: 35px;
  height: 35px;
  border-radius: 50%;
  background: #10b981;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

.user p {
  margin: 0;
  font-size: 12px;
  color: #6b7280;
}

/* BUTTON */
.btn-outline {
  border: 1px solid #d1d5db;
  background: white;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
}

.btn-outline:hover {
  border-color: #10b981;
  color: #10b981;
}

/* PAGE */
.page {
  padding: 40px;
}

.tenant-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 20px;
  margin-bottom: 24px;
}

.tenant-toolbar h2 {
  margin: 6px 0 8px;
  font-size: 28px;
}

.service-create-form {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) minmax(180px, 1fr) auto;
  gap: 10px;
  width: min(100%, 520px);
}

.service-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.service-card {
  display: block;
  padding: 18px;
  border-radius: 16px;
  background: rgba(255,255,255,0.78);
  border: 1px solid #dbe4ef;
  box-shadow: 0 10px 24px rgba(0,0,0,0.04);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.service-card:hover {
  transform: translateY(-2px);
  border-color: #10b981;
}

.service-card.active {
  border-color: #10b981;
  box-shadow: 0 16px 28px rgba(16, 185, 129, 0.12);
}

.service-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.service-card p,
.service-card small {
  display: block;
  margin: 0;
  color: #6b7280;
}

.service-card p {
  margin-bottom: 6px;
  font-size: 13px;
}

.service-state {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 700;
}

.service-state.connected {
  background: #d1fae5;
  color: #065f46;
}

.service-state.connecting,
.service-state.idle {
  background: #fef3c7;
  color: #92400e;
}

.service-state.error {
  background: #fee2e2;
  color: #991b1b;
}

/* PAGE HEAD */
.page-head {
  margin-bottom: 30px;
}

.eyebrow {
  font-size: 12px;
  letter-spacing: 1px;
  color: #10b981;
  font-weight: 600;
}

.page-head h1 {
  margin: 5px 0;
  font-size: 32px;
}

.sub {
  color: #6b7280;
  font-size: 14px;
}

/* GRID */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 25px;
}

/* CARD */
.card {
  background: rgba(255,255,255,0.7);
  backdrop-filter: blur(16px);
  border-radius: 16px;
  padding: 25px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.05);
}

/* CARD HEAD */
.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* DETAILS */
.details {
  margin-top: 20px;
}

.row {
  display: flex;
  justify-content: space-between;
  padding: 12px;
  border-radius: 10px;
  background: #f9fafb;
  margin-bottom: 10px;
}

/* BADGES */
.badge {
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  text-transform: capitalize;
}

.badge.connected {
  background: #d1fae5;
  color: #065f46;
}

.badge.idle {
  background: #fef3c7;
  color: #92400e;
}

.badge.error {
  background: #fee2e2;
  color: #991b1b;
}

/* BUTTONS */
.actions {
  margin-top: 20px;
  display: flex;
  gap: 10px;
}

.btn-primary {
  flex: 1;
  padding: 12px;
  border-radius: 10px;
  border: none;
  color: white;
  background: linear-gradient(135deg, #10b981, #059669);
  cursor: pointer;
}

.btn-danger {
  flex: 1;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid #ef4444;
  background: white;
  color: #ef4444;
  cursor: pointer;
}

/* QR */
.qr-box {
  text-align: center;
  margin-top: 20px;
}

.qr-box img {
  width: 200px;
  margin-bottom: 10px;
}

/* EMPTY */
.empty-state {
  text-align: center;
  padding: 40px 0;
}

.wa-icon {
  width: 60px;
  height: 60px;
  border-radius: 12px;
  background: #e6fffa;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: auto;
  font-weight: bold;
  color: #10b981;
}

/* FORM CARD */
.message-card {
  max-width: 900px;
  margin: auto;
}

/* GRID */
.form-grid {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 20px;
}

/* FIELD */
.field {
  margin-bottom: 20px;
}

.field label {
  display: block;
  font-size: 13px;
  margin-bottom: 6px;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  font-size: 14px;
}

.field textarea {
  resize: none;
}

.field small {
  color: #6b7280;
  font-size: 12px;
}

/* INFO BOX */
.info-box {
  display: flex;
  justify-content: space-between;
  background: #f9fafb;
  padding: 15px;
  border-radius: 10px;
  margin-bottom: 20px;
}

.info-box span {
  font-size: 12px;
  color: #6b7280;
}

/* API */
.api-box {
  background: #0f172a;
  color: white;
  border-radius: 12px;
  padding: 15px;
  margin-bottom: 20px;
}

.api-head {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  margin-bottom: 10px;
}

.method {
  opacity: 0.7;
}

.api-box pre {
  font-size: 13px;
  line-height: 1.5;
}

/* BUTTON FULL */
.btn-primary.full {
  width: 100%;
  font-size: 15px;
}
/* API CONTAINER */
.api-container {
  max-width: 900px;
  margin: auto;
}

/* CARD */
.api-card {
  background: rgba(255,255,255,0.7);
  backdrop-filter: blur(16px);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.05);
}

/* HEAD */
.api-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* METHOD */
.method-badge {
  background: #d1fae5;
  color: #065f46;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 12px;
}

/* ENDPOINT */
.endpoint {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  background: #f9fafb;
  padding: 10px;
  border-radius: 8px;
}

.endpoint code {
  font-size: 14px;
}

.endpoint button {
  border: none;
  background: #10b981;
  color: white;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
}

/* CODE BLOCK */
.code-block {
  position: relative;
  background: #0f172a;
  color: #e5e7eb;
  padding: 15px;
  border-radius: 10px;
  margin-top: 10px;
}

.copy-btn {
  position: absolute;
  right: 10px;
  top: 10px;
  border: none;
  background: #10b981;
  color: white;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
}

.code-block pre {
  font-size: 13px;
  line-height: 1.5;
}

@media (max-width: 960px) {
  .tenant-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .service-create-form {
    grid-template-columns: 1fr;
    width: 100%;
  }

  .service-strip {
    grid-template-columns: 1fr;
  }
}
