.portal-body {
  margin: 0;
  font-family: "Segoe UI", system-ui, sans-serif;
  background: #f4f6f8;
  color: #1a1a2e;
  min-height: 100vh;
}

.portal-body,
.portal-body *,
.portal-body *::before,
.portal-body *::after {
  box-sizing: border-box;
}

.portal-body .lang-switcher-btn {
  min-width: 44px;
  min-height: 44px;
}

.portal-auth-tools {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 20px;
}

.portal-logo img {
  height: 56px;
  width: auto;
  max-width: min(100%, 260px);
  object-fit: contain;
  display: block;
}

.portal-body :is(a, button, input, select):focus-visible {
  outline: 3px solid #1565c0;
  outline-offset: 3px;
}

.portal-auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.portal-auth-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
  max-width: 960px;
  width: 100%;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,.08);
  overflow: hidden;
}

.portal-auth-form {
  padding: 48px 40px;
  min-width: 0;
}

.portal-auth-side {
  background: linear-gradient(135deg, #1565c0 0%, #0d47a1 100%);
  color: #fff;
  padding: 48px 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.portal-logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1565c0;
  margin-bottom: 24px;
}

.portal-logo span { color: #e65100; }

.portal-auth-form h1 {
  font-size: 1.75rem;
  margin: 0 0 8px;
}

.portal-sub { color: #666; margin-bottom: 24px; }

.portal-field {
  margin-bottom: 16px;
}

.portal-field label {
  display: block;
  font-size: .875rem;
  margin-bottom: 6px;
  font-weight: 500;
}

.portal-field-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.portal-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 400;
  margin-bottom: 0;
  cursor: pointer;
}

.portal-checkbox input[type="checkbox"] {
  width: auto;
  margin: 0;
  flex-shrink: 0;
}

.portal-field input, .portal-field select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  font-size: 1rem;
  box-sizing: border-box;
}

.portal-signup-card {
  max-width: 560px;
}

.portal-mobile-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.portal-mobile-row select {
  width: 110px;
  flex: 0 0 110px;
}

.portal-mobile-row input {
  flex: 1 1 auto;
  min-width: 0;
}

.portal-mobile-row .portal-btn {
  flex: 0 0 auto;
  white-space: nowrap;
  align-self: stretch;
}

.portal-otp-hint {
  margin: 8px 0 0;
  font-size: 0.8125rem;
  color: #64748b;
}

.portal-otp-hint-error {
  color: #c62828;
}

.portal-otp-channels {
  display: flex;
  gap: 12px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.portal-otp-channel {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.875rem;
  color: #1e293b;
  cursor: pointer;
  margin: 0;
  font-weight: 500;
}

.portal-otp-channel input {
  width: auto;
  margin: 0;
}

.portal-msg91-captcha {
  margin-top: 10px;
  min-height: 0;
}

.portal-btn {
  display: inline-block;
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  min-height: 44px;
}

.portal-btn-primary {
  background: #1565c0;
  color: #fff;
  width: 100%;
}

.portal-btn-inline {
  width: auto;
}

.portal-btn-sm {
  padding: 8px 16px;
  font-size: 0.875rem;
}

.portal-btn-primary:hover { background: #0d47a1; }

.portal-btn-outline {
  background: #fff;
  color: #1565c0;
  border: 1px solid #1565c0;
}

.portal-btn-google {
  background: #fff;
  color: #333;
  border: 1px solid #d0d5dd;
  width: 100%;
  margin-top: 12px;
}

.portal-link {
  color: #1565c0;
  text-decoration: none;
}

.portal-link:hover { text-decoration: underline; }

.portal-error {
  background: #ffebee;
  color: #c62828;
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: .875rem;
}

.portal-success {
  background: #e8f5e9;
  color: #2e7d32;
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 16px;
}

.portal-home-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 32px;
  background: #fff;
  border-bottom: 1px solid #e0e0e0;
}

.portal-home-content {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px;
}

.portal-toolbar {
  margin-bottom: 24px;
  padding: 16px 18px;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,.05);
}

.portal-toolbar-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.portal-toolbar .portal-btn-primary,
.portal-toolbar .portal-btn-outline,
.portal-toolbar a.portal-btn {
  width: auto;
}

.portal-db-form {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 0;
}

.portal-db-select-wrap {
  position: relative;
  min-width: 180px;
  max-width: 280px;
}

.portal-db-select {
  width: 100%;
  padding: 9px 34px 9px 12px;
  border: 1px solid #90a4ae;
  border-radius: 10px;
  font-size: 0.875rem;
  font-weight: 500;
  background: linear-gradient(180deg, #fff 0%, #f5f7fa 100%);
  color: #1a1a2e;
  appearance: none;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(21, 101, 192, 0.08);
  transition: border-color .2s, box-shadow .2s;
}

.portal-db-select:hover,
.portal-db-select:focus {
  border-color: #1565c0;
  outline: none;
  box-shadow: 0 0 0 3px rgba(21, 101, 192, 0.12);
}

.portal-db-select-wrap::after {
  content: "▾";
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #1565c0;
  font-size: 0.9rem;
  pointer-events: none;
}

.portal-active-db {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  background: #e8f5e9;
  border: 1px solid #c8e6c9;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  color: #2e7d32;
}

.portal-active-db-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #2e7d32;
  color: #fff;
  font-size: 0.65rem;
}

.portal-input-inline {
  padding: 8px 12px;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  font-size: 0.875rem;
  min-width: 160px;
  max-width: 220px;
}

.portal-create-form {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 0;
}

.portal-section-title {
  margin: 0 0 8px;
  font-size: 1.25rem;
}

.portal-section-sub {
  margin-bottom: 24px;
}

.portal-create-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(244, 246, 248, 0.82);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.portal-create-overlay.active {
  display: flex;
}

.portal-create-progress-card {
  background: #fff;
  padding: 28px 36px;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  text-align: center;
  min-width: 300px;
  max-width: 90vw;
}

.portal-create-progress-card h3 {
  margin: 12px 0 6px;
  font-size: 1.1rem;
}

.portal-create-progress-card p {
  margin: 0;
  color: #666;
  font-size: 0.875rem;
}

.portal-create-spinner {
  width: 36px;
  height: 36px;
  margin: 0 auto;
  border: 3px solid #e3f2fd;
  border-top-color: #1565c0;
  border-radius: 50%;
  animation: portal-spin 0.8s linear infinite;
}

@keyframes portal-spin {
  to { transform: rotate(360deg); }
}

.portal-progress-bar-wrap {
  width: 100%;
  height: 6px;
  background: #e0e0e0;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 18px;
}

.portal-progress-bar {
  height: 100%;
  width: 40%;
  background: linear-gradient(90deg, #1565c0, #42a5f5);
  border-radius: 999px;
  animation: portal-progress-slide 1.4s ease-in-out infinite;
}

@keyframes portal-progress-slide {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(350%); }
}

body.portal-wait-cursor,
body.portal-wait-cursor * {
  cursor: wait !important;
}

.portal-btn-danger {
  background: #c62828;
  color: #fff;
}

.portal-btn-danger:hover { background: #b71c1c; }

.portal-btn-danger:disabled {
  opacity: .6;
  cursor: not-allowed;
}

.portal-sessions-link-wrap {
  margin: -8px 0 16px;
  font-size: .9rem;
  font-weight: 600;
}

.portal-sessions-link-wrap .bx {
  vertical-align: -2px;
}

.portal-sessions-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.portal-sessions-overlay.active {
  display: flex;
}

.portal-sessions-dialog {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
  width: 100%;
  max-width: 900px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  padding: 20px 24px;
}

.portal-sessions-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.portal-sessions-header h3 {
  margin: 0;
  font-size: 1.15rem;
}

.portal-sessions-close {
  background: none;
  border: none;
  font-size: 1.6rem;
  line-height: 1;
  color: #64748b;
  cursor: pointer;
  min-width: 44px;
  min-height: 44px;
}

.portal-sessions-close:hover { color: #1a1a2e; }

.portal-sessions-table-wrap {
  overflow: auto;
}

.portal-sessions-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
}

.portal-sessions-table th,
.portal-sessions-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #e5e7eb;
  text-align: start;
  vertical-align: middle;
}

.portal-sessions-table th {
  background: #f8fafc;
  font-weight: 600;
  color: #475569;
  position: sticky;
  top: 0;
}

.portal-sessions-table td.portal-sessions-device {
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.portal-sessions-table td.portal-sessions-empty {
  text-align: center;
  color: #64748b;
  padding: 20px;
}

.portal-launch-card {
  max-width: 480px;
  margin: 0 auto;
  background: #fff;
  border-radius: 12px;
  padding: 28px 32px;
  box-shadow: 0 2px 12px rgba(0,0,0,.06);
}

.portal-launch-card h1 {
  margin: 0 0 8px;
  font-size: 1.35rem;
}

.portal-launch-form .portal-field {
  margin-bottom: 18px;
}

.portal-launch-form .portal-db-select {
  max-width: 100%;
}

.portal-launch-actions {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

.portal-license-bar {
  padding: 12px 16px;
  background: #e3f2fd;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: .9rem;
}

.portal-warning {
  background: #fff3e0;
  color: #e65100;
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 20px;
}

.portal-modules {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr));
  gap: 20px;
}

.portal-module-card {
  position: relative;
  min-width: 0;
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 2px 12px rgba(0,0,0,.06);
  border: 1px solid #e8e8e8;
  transition: box-shadow .2s;
  display: flex;
  flex-direction: column;
}

.portal-module-icon-wrap {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: #eef2f6;
  color: #1976d2;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: 14px;
}

.portal-module-card.enabled .portal-module-icon-wrap {
  background: #e3f2fd;
  color: #1565c0;
}

.portal-module-card.enabled:hover {
  box-shadow: 0 4px 20px rgba(21,101,192,.15);
}

.portal-module-card.enabled:focus-within {
  outline: 3px solid #1565c0;
  outline-offset: 3px;
}

.portal-module-card.enabled .portal-module-card-action a::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 12px;
}

.portal-module-card.disabled {
  background: #eef2f6;
  border-color: #cbd5e1;
  color: #475569;
}

.portal-module-card.disabled p,
.portal-module-card.disabled .portal-btn {
  color: #475569;
  opacity: 1 !important;
}

.portal-module-card.disabled .portal-btn,
.portal-module-card.disabled a {
  pointer-events: none;
}

.portal-module-card h3 { margin: 0 0 8px; font-size: 1.1rem; }

.portal-module-card p { color: #666; font-size: .875rem; margin: 0 0 16px; flex-grow: 1; }

.portal-module-card-action {
  margin-top: auto;
}

.portal-module-card .portal-btn { width: auto; font-size: .875rem; }

@media (max-width: 768px) {
  .portal-auth-card { grid-template-columns: 1fr; }
  .portal-auth-side { display: none; }
}

@media (max-width: 767.98px) {
  .portal-auth-wrap { padding: 16px; }
  .portal-auth-form { padding: 24px 20px; }
  .portal-auth-tools { margin-bottom: 16px; }
  .portal-logo-wrap img { max-width: 100%; }
  .portal-home-nav { padding: 16px; flex-wrap: wrap; gap: 12px; }
  .portal-nav-brand { min-width: 0; }
  .portal-nav-brand img { max-width: 100%; }
  .portal-home-content { padding: 24px 16px; }
  .portal-db-form, .portal-create-form { flex-wrap: wrap; width: 100%; }
  .portal-db-select-wrap, .portal-input-inline { flex: 1 1 100%; min-width: 0; max-width: 100%; }
  .portal-toolbar .portal-btn { width: 100%; }
  .portal-active-db { max-width: 100%; overflow-wrap: anywhere; }
  .portal-create-progress-card { min-width: 0; padding: 24px; }
}
