/* Navis PLC & HMI Master Portal Styles (`portal.css`) */
:root {
  --bg-deep: #060d1a;
  --bg-card: #0d182b;
  --bg-elev: #13223b;
  --border-line: rgba(56, 189, 248, 0.2);
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --accent-cyan: #06b6d4;
  --accent-teal: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --accent-indigo: #6366f1;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  background: radial-gradient(circle at 15% 0%, #0f2544 0%, var(--bg-deep) 55%);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
}

a {
  color: #38bdf8;
  text-decoration: none;
}

code {
  font-family: "JetBrains Mono", Consolas, monospace;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.22);
  padding: 2px 6px;
  border-radius: 5px;
  color: #7dd3fc;
  font-size: 0.88em;
}

/* Topbar */
.portal-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(6, 13, 26, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-line);
  padding: 10px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-main);
}

.brand-wrap img {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  box-shadow: 0 0 16px rgba(6, 182, 212, 0.35);
}

.brand-title {
  font-weight: 800;
  font-size: 1.08rem;
  letter-spacing: -0.01em;
}

.brand-sub {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.nav-bar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.nav-links, .nav-auth {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.nav-pill {
  padding: 7px 13px;
  border-radius: 8px;
  font-size: 0.86rem;
  font-weight: 600;
  color: #cbd5e1;
  background: rgba(30, 41, 59, 0.65);
  border: 1px solid rgba(148, 163, 184, 0.2);
  transition: all 0.16s ease;
}

.nav-pill:hover, .nav-pill.active {
  color: #fff;
  background: rgba(6, 182, 212, 0.22);
  border-color: #22d3ee;
}

.nav-pill.primary-btn {
  background: linear-gradient(135deg, #0ea5e9, #10b981);
  color: #04131f;
  font-weight: 700;
  border: none;
}

.quota-chip {
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.45);
  color: #a7f3d0;
}

.quota-chip.pro {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.22), rgba(16, 185, 129, 0.22));
  border-color: #fbbf24;
  color: #fde68a;
}

.quota-chip.warn {
  background: rgba(245, 158, 11, 0.16);
  border-color: rgba(245, 158, 11, 0.48);
  color: #fde68a;
}

.user-badge {
  font-size: 0.84rem;
  color: #e2e8f0;
  padding: 5px 10px;
  background: rgba(15, 23, 42, 0.75);
  border-radius: 7px;
  border: 1px solid rgba(148, 163, 184, 0.2);
}

/* Main Container */
.container {
  max-width: 1320px;
  margin: 0 auto;
  padding: 24px 20px 64px;
}

.notice-banner {
  background: linear-gradient(90deg, rgba(6, 182, 212, 0.14), rgba(16, 185, 129, 0.14));
  border: 1px solid rgba(34, 211, 238, 0.35);
  border-radius: 12px;
  padding: 11px 16px;
  font-size: 0.9rem;
  color: #e0f2fe;
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* Auto-Detect Hero Box */
.detect-hero {
  background: linear-gradient(160deg, rgba(13, 24, 43, 0.96), rgba(19, 34, 59, 0.92));
  border: 1px solid rgba(34, 211, 238, 0.35);
  border-radius: 18px;
  padding: 24px;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.42);
  margin-bottom: 30px;
}

.detect-hero h1 {
  margin: 0 0 6px;
  font-size: 1.62rem;
  background: linear-gradient(90deg, #ffffff, #67e8f9, #6ee7b7);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.detect-sub {
  margin: 0 0 18px;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.detect-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(265px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.detect-method-card {
  background: rgba(6, 13, 26, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
}

.detect-method-card h3 {
  margin: 0;
  font-size: 1rem;
  color: #e2e8f0;
}

.detect-method-card p {
  margin: 0;
  font-size: 0.84rem;
  color: var(--text-muted);
}

.btn-action {
  cursor: pointer;
  padding: 10px 15px;
  border-radius: 10px;
  border: 1px solid rgba(34, 211, 238, 0.45);
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.24), rgba(16, 185, 129, 0.24));
  color: #ecfeff;
  font-weight: 700;
  font-size: 0.9rem;
  transition: transform 0.12s ease, border-color 0.15s ease;
}

.btn-action:hover {
  transform: translateY(-1px);
  border-color: #67e8f9;
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.38), rgba(16, 185, 129, 0.36));
}

.file-drop-zone {
  border: 2px dashed rgba(56, 189, 248, 0.45);
  border-radius: 12px;
  padding: 12px;
  text-align: center;
  cursor: pointer;
  background: rgba(15, 23, 42, 0.55);
  transition: all 0.16s ease;
}

.file-drop-zone.dragover, .file-drop-zone:hover {
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.12);
}

.search-detect-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.search-detect-bar input[type="text"] {
  flex: 1;
  min-width: 240px;
  padding: 12px 15px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: rgba(6, 13, 26, 0.9);
  color: #fff;
  font-size: 0.95rem;
}

.quick-chips {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin-top: 10px;
  align-items: center;
}

.sample-chip {
  cursor: pointer;
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(148, 163, 184, 0.25);
  color: #cbd5e1;
  border-radius: 999px;
  padding: 4px 11px;
  font-size: 0.78rem;
}

.sample-chip:hover {
  border-color: #22d3ee;
  color: #fff;
}

/* Detection Result Panel */
.detect-result-box {
  margin-top: 16px;
  padding: 18px;
  border-radius: 14px;
  background: rgba(6, 28, 38, 0.88);
  border: 1px solid #10b981;
  display: none;
}

.detect-result-box.visible {
  display: block;
}

.detect-result-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.btn-launch-detected {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: 10px;
  background: linear-gradient(135deg, #10b981, #06b6d4);
  color: #03151e;
  font-weight: 800;
  font-size: 0.96rem;
}

.dialect-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.dialect-item {
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 9px;
  padding: 9px 12px;
  font-size: 0.83rem;
}

/* Studio Ecosystem Grid */
.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 26px 0 14px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.16);
  padding-bottom: 8px;
}

.section-heading h2 {
  margin: 0;
  font-size: 1.25rem;
}

.studios-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(305px, 1fr));
  gap: 16px;
}

.studio-card {
  background: var(--bg-card);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-top: 3px solid var(--card-accent, #06b6d4);
  border-radius: 14px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.studio-card:hover, .studio-card.highlight-detected {
  transform: translateY(-3px);
  border-color: var(--card-accent, #22d3ee);
  box-shadow: 0 12px 30px rgba(6, 182, 212, 0.18);
}

.studio-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.vendor-tag {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #7dd3fc;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: #cbd5e1;
  background: rgba(15, 23, 42, 0.8);
  padding: 3px 9px;
  border-radius: 999px;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #64748b;
}

.live-dot.on {
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
}

.live-dot.local {
  background: #38bdf8;
}

.live-dot.warn {
  background: #f59e0b;
}

.studio-card h3 {
  margin: 2px 0;
  font-size: 1.08rem;
}

.studio-soft {
  margin: 0;
  font-size: 0.82rem;
  color: #38bdf8;
  font-weight: 600;
}

.studio-series {
  margin: 0;
  font-size: 0.83rem;
  color: var(--text-muted);
}

.dialect-mini {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.78rem;
  color: #cbd5e1;
}

.studio-actions {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

.studio-open-btn {
  flex: 1;
  text-align: center;
  padding: 9px 12px;
  border-radius: 9px;
  background: rgba(6, 182, 212, 0.2);
  border: 1px solid rgba(34, 211, 238, 0.45);
  color: #ecfeff;
  font-weight: 700;
  font-size: 0.86rem;
}

.studio-open-btn:hover {
  background: rgba(6, 182, 212, 0.35);
}

.studio-open-btn.secondary {
  background: rgba(30, 41, 59, 0.7);
  border-color: rgba(148, 163, 184, 0.3);
}

.studio-sub-btn {
  padding: 9px 12px;
  border-radius: 9px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.25);
  color: #cbd5e1;
  font-size: 0.84rem;
}

/* Pricing & SePay Cards */
.quota-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  margin-bottom: 26px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-line);
  border-radius: 14px;
  padding: 16px;
}

.stat-card .stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.stat-card .stat-val {
  font-size: 1.5rem;
  font-weight: 800;
  color: #67e8f9;
  margin-top: 4px;
}

.plans-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 18px;
  margin-bottom: 32px;
}

.plan-card {
  background: var(--bg-card);
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 16px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.plan-card.featured {
  border: 2px solid #10b981;
  box-shadow: 0 14px 36px rgba(16, 185, 129, 0.2);
}

.plan-badge {
  display: inline-block;
  align-self: flex-start;
  font-size: 0.74rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.18);
  color: #6ee7b7;
  margin-bottom: 8px;
}

.plan-price {
  font-size: 1.9rem;
  font-weight: 900;
  color: #fff;
  margin: 6px 0;
}

.plan-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
}

.plan-perks {
  list-style: none;
  padding: 0;
  margin: 12px 0 18px;
  font-size: 0.87rem;
}

.plan-perks li {
  margin-bottom: 7px;
}

.btn-buy-sepay {
  cursor: pointer;
  width: 100%;
  text-align: center;
  padding: 12px 16px;
  border-radius: 11px;
  border: none;
  background: linear-gradient(135deg, #10b981, #0ea5e9);
  color: #03151f;
  font-weight: 800;
  font-size: 0.95rem;
}

/* VietQR Modal */
.qr-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.84);
  backdrop-filter: blur(6px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.qr-modal-backdrop.open {
  display: flex;
}

.qr-modal {
  background: #0f1d33;
  border: 1px solid #22d3ee;
  border-radius: 18px;
  max-width: 460px;
  width: 100%;
  padding: 22px;
  text-align: center;
}

.qr-modal img.vietqr-img {
  max-width: 280px;
  width: 100%;
  border-radius: 12px;
  background: #fff;
  padding: 8px;
  margin: 12px auto;
  display: block;
}

/* Tables, Preblocks & Admin Forms */
.panel-card {
  background: var(--bg-card);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 15px;
  padding: 20px;
  margin-bottom: 22px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.87rem;
}

.data-table th, .data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.14);
  text-align: left;
}

.data-table th {
  color: #7dd3fc;
  font-weight: 700;
  background: rgba(15, 23, 42, 0.6);
}

pre.code-block {
  background: #050b14;
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 10px;
  padding: 14px;
  overflow-x: auto;
  color: #e2e8f0;
  font-size: 0.84rem;
}

.admin-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.admin-form-grid label, .admin-plan-row label {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.admin-form-grid input, .admin-plan-row input, .admin-form-grid select {
  width: 100%;
  padding: 9px 11px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: #07101f;
  color: #fff;
}

.admin-plan-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  padding: 14px;
  border-radius: 12px;
  background: rgba(6, 13, 26, 0.65);
  border: 1px solid rgba(148, 163, 184, 0.18);
  margin-bottom: 12px;
  align-items: end;
}

.span-full {
  grid-column: 1 / -1;
}

.btn-save-sm, .btn-sim-sepay {
  cursor: pointer;
  padding: 9px 14px;
  border-radius: 8px;
  border: 1px solid #10b981;
  background: rgba(16, 185, 129, 0.22);
  color: #a7f3d0;
  font-weight: 700;
}

.alert {
  padding: 11px 15px;
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: 0.9rem;
}

.alert.ok {
  background: rgba(16, 185, 129, 0.18);
  border: 1px solid #10b981;
  color: #a7f3d0;
}

.alert.error {
  background: rgba(244, 63, 94, 0.18);
  border: 1px solid #f43f5e;
  color: #fecdd3;
}

.st-paid { color: #34d399; font-weight: 700; }
.st-pending { color: #fbbf24; font-weight: 700; }
.st-partial { color: #38bdf8; font-weight: 700; }

/* Login / Register Split */
.auth-wrap {
  max-width: 880px;
  margin: 36px auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
}

.btn-google {
  cursor: pointer;
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid #38bdf8;
  background: rgba(14, 165, 233, 0.18);
  color: #fff;
  font-weight: 700;
  margin-bottom: 12px;
}
