﻿/* =========================================================
   GLOBAL VARIABLES (HYBRID THEME)
   ========================================================= */
:root {
  --font-family: 'Inter', sans-serif;
  --transition: 0.3s ease;

  /* Light Theme */
  --bg: #f7f9fc;
  --bg-sub: #ffffff;
  --text-main: #212529;
  --text-sub: #555;
  --accent: #0b5ed7;
  --hover: #dbe6ff;
  --shadow: 0 2px 10px rgba(11, 94, 215, 0.1);
}

body.theme-dark {
  --bg: #0e1624;
  --bg-sub: #182336;
  --text-main: #ffffff;
  --text-sub: #a5b4c2;
  --accent: #0080ff;
  --hover: #2a3b57;
  --shadow: 0 0 15px rgba(0, 128, 255, 0.15);
}

/* =========================================================
   BASE STRUCTURE
   ========================================================= */
body {
  font-family: var(--font-family);
  background: var(--bg);
  color: var(--text-main);
  margin: 0;
  transition: background var(--transition), color var(--transition);
}

*, *::before, *::after {
  box-sizing: border-box;
}

/* Password reveal toggle */
.pw-field {
  position: relative;
  display: block;
  width: 100%;
}

.pw-input {
  width: 100%;
  padding-right: 2rem;
}

.pw-toggle {
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: 0;
  padding: 4px;
  cursor: pointer;
  color: var(--text-sub);
}

.pw-toggle svg {
  width: 18px;
  height: 18px;
  display: block;
}

.pw-toggle .pw-eye-off {
  display: none;
}

.pw-toggle.is-visible .pw-eye-on {
  display: none;
}

.pw-toggle.is-visible .pw-eye-off {
  display: block;
}

.container {
  padding: 1rem;
  padding-top: calc(1rem + 70px);
  min-height: calc(100vh - 120px);
}

@media (max-width: 900px) {
  :root {
    --mobile-header-h: 110px;
    --mobile-banner-h: 82px;
  }
  body {
    overflow-x: hidden;
  }

  html,
  body {
    max-width: 100vw;
    overflow-x: hidden;
  }

  .container {
    width: 100%;
    padding-left: 0;
    padding-right: 0;
  }

  .content {
    padding: 0;
  }

  .layout,
  .content,
  .panel,
  .card {
    width: 100%;
    max-width: 100vw;
    min-width: 0;
  }

  .panel {
    padding: 0;
  }

  .card {
    margin: 0;
    border-radius: 0;
  }

  .app-header {
    flex-wrap: wrap;
    padding: 0.5rem 0.75rem;
    gap: 0.5rem;
    height: auto;
    overflow-x: hidden;
    max-width: 100vw;
  }

  .app-header {
    min-height: 110px;
    overflow-y: visible;
  }

  .app-header .brand {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 0.95rem;
    line-height: 1.2;
    padding-right: 96px;
  }

  .app-header .header-actions {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-end;
    min-width: 0;
    margin-top: 0;
  }

  .app-header .user-label {
    order: 0;
    font-size: 0.8rem;
    max-width: 100vw;
    position: absolute;
    top: 8px;
    right: 12px;
    max-width: 45%;
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .app-header .btn,
  .app-header .btn.alt {
    padding: 0.35rem 0.6rem;
    font-size: 0.82rem;
  }
}

/* =========================================================
   HEADER
   ========================================================= */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-sub);
  color: var(--text-main);
  padding: 0.75rem 1rem;
  height: 70px;
  box-sizing: border-box;
  box-shadow: var(--shadow);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 1100;
}

.brand {
  display: flex;
  align-items: center;
  font-weight: 600;
  font-size: 1.1rem;
  gap: 0.5rem;
}

.menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-main);
  font-size: 1.4rem;
  cursor: pointer;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* =========================================================
   SIDEBAR
   ========================================================= */
.sidebar [data-panel="tsecurity"],
.sidebar [data-panel="mc"],
.sidebar [data-panel="me"],
.sidebar [data-panel="prep"],
.sidebar [data-panel="ppr"] {
  display: none;
}
.layout {
  display: flex;
  min-height: calc(100vh - 120px);
  padding-left: 230px;
}

.sidebar {
  width: 230px;
  background: var(--bg-sub);
  box-shadow: var(--shadow);
  transition: transform var(--transition);
  padding: 1rem 0;
  position: fixed;
  top: 70px;
  left: 0;
  height: calc(100vh - 70px);
  overflow-y: auto;
  z-index: 1001;
}

body.sidebar-open .sidebar {
  transform: translateX(0);
}

.sidebar nav {
  display: flex;
  flex-direction: column;
}

.sidebar .nav-item {
  background: none;
  border: none;
  text-align: left;
  padding: 0.8rem 1.2rem;
  font-size: 0.95rem;
  color: var(--text-main);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.sidebar .nav-item:hover {
  background: var(--hover);
  color: var(--accent);
}

.sidebar .nav-item.active {
  background: var(--accent);
  color: #fff;
}

.sidebar .admin-back-link {
  margin-top: 0.75rem;
  background: #f0f7ff;
  color: #1d4ed8;
  border: 1px solid #cfe0ff;
  font-weight: 600;
}

.sidebar .admin-back-link:hover {
  background: #e2ecff;
  color: #1d4ed8;
}

/* =========================================================
   CONTENT AREA
   ========================================================= */
.content {
  flex: 1;
  padding: 1.2rem;
}

.card {
  background: var(--bg-sub);
  color: var(--text-main);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 1.5rem;
  margin-bottom: 1.2rem;
  transition: transform 0.2s ease;
}

.card:hover {
  transform: translateY(-3px);
}

/* =========================================================
   BUTTONS
   ========================================================= */
.btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 0.55rem 1.1rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background var(--transition), transform 0.2s;
}

.btn:hover {
  background: #0a53be;
  transform: translateY(-1px);
}

.btn.alt {
  background: var(--bg-sub);
  color: var(--text-main);
  border: 1px solid var(--accent);
}

.btn.alt:hover {
  background: var(--accent);
  color: #fff;
}

/* =========================================================
   FOOTER
   ========================================================= */
.app-footer {
  text-align: center;
  padding: 1rem;
  color: var(--text-sub);
  font-size: 0.85rem;
}

/* =========================================================
   AUTH FORMS (LOGIN / REGISTER)
   ========================================================= */
.auth-container {
  max-width: 420px;
  margin: 6vh auto;
  background: var(--bg-sub);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 2.4rem;
}

.policy-container {
  max-width: 60%;
}

@media (max-width: 900px) {
  .policy-container {
    max-width: 92%;
  }
}

.auth-container h1 {
  text-align: center;
  margin-top: 0;
  font-size: 1.5rem;
}

.auth-container form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 0.6rem 0.2rem;
}
.auth-container .panel-form > div {
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
}

#register-step-2 {
  gap: 1.2rem;
}

#register-step-2 .payment-method {
  margin: 0.3rem 0;
}

.spaced-block {
  margin: 0.35rem 0;
}

/* Force extra vertical spacing for register step 2 blocks */
#register-step-2 > label,
#register-step-2 > .payment-method {
  margin-top: 1rem;
  margin-bottom: 0.4rem;
}

#register-step-2 > label:first-child,
#register-step-2 > .trial-check {
  margin-top: 0;
}
/*
.panel-form label {
  margin-bottom: 1rem;
}
*/
.auth-container input {
  width: 100%;
  padding: 0.4rem 0.5rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: var(--bg);
  color: var(--text-main);
}

.auth-container select {
  width: 100%;
  padding: 0.6rem 0.2rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: var(--bg);
  color: var(--text-main);
}

.payment-method .section-title {
  margin-bottom: 0.4rem;
}

.payment-method-grid {
  display: grid;
  grid-template-columns: 1fr minmax(140px, 200px);
  gap: 0.8rem;
  align-items: start;
}

.payment-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, max-content));
  gap: 0.8rem 1rem;
  align-items: center;
  color: #555;
  font-size: 0.9rem;
}

.payment-options .pay-item {
  display: grid;
  grid-template-columns: max-content max-content;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
}

.pay-radio input {
  margin: 0;
}

.payment-options input[type="radio"] {
  margin: 0;
}

.bank-inline {
  display: inline-flex;
  align-items: center;
}

.bank-inline input {
  width: 100%;
  padding: 0.4rem 0.5rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: var(--bg);
  color: var(--text-main);
}

.subscription-card select,
.subscription-card input[type="text"],
.subscription-card input[type="number"],
.subscription-card input[type="date"],
.subscription-card input[type="password"] {
  width: 100%;
  padding: 0.4rem 0.5rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: var(--bg);
  color: var(--text-main);
}

.subscription-card input[type="email"],
.subscription-card input[type="tel"],
.subscription-card input:not([type="checkbox"]) {
  width: 100%;
  padding: 0.4rem 0.5rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: var(--bg);
  color: var(--text-main);
}

.subscription-card input[type="checkbox"] {
  width: auto;
  height: auto;
}

.subscription-card input:-webkit-autofill,
.subscription-card input:-webkit-autofill:hover,
.subscription-card input:-webkit-autofill:focus,
.subscription-card input:autofill {
  box-shadow: 0 0 0 1000px var(--bg) inset;
  -webkit-text-fill-color: var(--text-main);
  caret-color: var(--text-main);
}

.subscription-card .btn.alt {
  border: 1px solid var(--accent);
}

.policy-check {
  display: grid;
  grid-template-columns: 10% 1fr;
  align-items: center;
  gap: 0.6rem;
}

.subscription-card .policy-check {
  display: grid !important;
  grid-template-columns: max-content 1fr;
  align-items: center;
}

.subscription-card .policy-check span {
  order: 2;
}

.subscription-card .policy-check input {
  order: 1;
  justify-self: start;
}

.policy-check input {
  margin: 0;
}

.auth-container input:focus {
  border-color: var(--accent);
  outline: none;
}

.auth-note {
  text-align: center;
  margin-top: 1rem;
  color: var(--text-sub);
}

.requests-filter {
  margin: 0.5rem 0 1rem;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1rem;
}

.requests-filter label {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  grid-column: 1 / 2;
  width: 100%;
}

.requests-filter select {
  width: 100%;
}

.transactions-filter {
  margin: 0.5rem 0 1rem;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1rem;
}

.transactions-filter label {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.transactions-filter select,
.transactions-filter input[type="date"] {
  width: 100%;
}

.requests-actions {
  width: 1%;
  white-space: nowrap;
}

.requests-action-col {
  width: 10%;
}

.requests-table th:nth-child(9),
.requests-table td:nth-child(9) {
  width: 140px;
}

.requests-table .request-due-date {
  width: 130px;
}

.actions-wrap {
  display: grid;
  grid-template-columns: repeat(3, 42px);
  gap: 0.35rem;
  align-items: center;
  justify-content: flex-start;
}

.transactions-actions .actions-wrap {
  grid-template-columns: repeat(2, 42px);
  grid-auto-rows: 1fr;
  row-gap: 0.35rem;
}

.transactions-action-col {
  width: 10%;
}

.transactions-table th:nth-child(9),
.transactions-table td:nth-child(9) {
  width: 140px;
}

.transactions-table .txn-due-date {
  width: 130px;
}

.transactions-actions .icon-btn {
  width: 42px !important;
  min-width: 42px !important;
  height: 75%;
  padding: 0;
  line-height: 1;
}

.transactions-actions .action-form {
  display: inline-flex;
  margin: 0;
  width: 42px;
}

.transactions-table {
  table-layout: auto;
  min-width: 980px;
}

.transactions-table th,
.transactions-table td {
  white-space: nowrap;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.modal.open {
  display: flex;
}

.modal-card {
  background: var(--bg-sub);
  color: var(--text-main);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 1.2rem;
  width: min(820px, 92vw);
  max-height: 85vh;
  overflow: auto;
}

.subscription-card {
  max-width: 420px;
  width: 92vw;
  padding: 2rem;
}

.subscription-card .panel-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.subscription-card .panel-form label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.subscription-status-card {
  max-width: 420px;
  width: 92vw;
  padding: 2rem;
}

.subscription-card .subscription-payment .payment-method-grid {
  grid-template-columns: max-content minmax(140px, 240px);
  align-items: center;
}

.subscription-card .subscription-payment .payment-options {
  display: grid;
  grid-template-columns: repeat(4, max-content);
  gap: 1rem;
  align-items: center;
}

.subscription-card .subscription-payment .pay-item {
  display: inline-flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 0.35rem;
}

.subscription-card .subscription-payment .payment-options label {
  display: inline-flex !important;
  flex-direction: row !important;
  align-items: center;
}

.trial-check {
  display: grid;
  grid-template-columns: 15px 1fr;
  align-items: center;
  column-gap: 0.5rem;
  font-weight: 600;
}

.trial-divider {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.6rem;
  margin: 0.3rem 0 0.6rem;
  color: #6b7280;
  font-weight: 600;
}

.trial-divider::before,
.trial-divider::after {
  content: "";
  height: 1px;
  background: #e5e7eb;
}

.trial-fields.trial-disabled {
  opacity: 0.55;
  filter: blur(1px);
  pointer-events: none;
}

.register-top-gap {
  margin-top: 0.9rem;
}

#register-paid-fields {
  display: flex;
  flex-direction: column;
  gap: 0.72rem;
}

.flow-locked .panel-form,
.flow-locked .creds-btns,
.flow-locked .btn-group {
  opacity: 0.55;
  filter: blur(1px);
  pointer-events: none;
}

.job-result-card {
  max-width: 520px;
  width: 92vw;
  padding: 1.8rem;
  border: 1px solid #d0d7e2;
}

.job-result-card.success {
  background: #1f6b3a;
  border-color: #1a5d33;
  color: #ffffff;
}

.job-result-card.warn {
  background: #a85a12;
  border-color: #8f4b0f;
  color: #ffffff;
}

.job-result-card.error {
  background: #8f1d1d;
  border-color: #7a1717;
  color: #ffffff;
}

.modal-card.warning-card {
  background: #fff3cd;
  border-color: #f2d38a;
  color: #6b4b00;
}

.job-result-card .hint,
.job-result-card h3,
.job-result-card p {
  color: #ffffff;
}

.job-result-progress {
  margin-top: 0.75rem;
  background: #ffffff80;
  border: 1px dashed #c9c9c9;
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  font-size: 0.9rem;
  color: var(--text-main);
  line-height: 1.4;
  white-space: pre-wrap;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.8rem;
}

#request-edit-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
}

#request-edit-form label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

#request-edit-form .span-2 {
  grid-column: 1 / -1;
}

#txn-edit-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
}

#txn-add-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
}

#txn-edit-form label,
#txn-add-form label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

#txn-edit-form .span-2 {
  grid-column: 1 / -1;
}


.txn-user-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem 1rem;
}

.icon-btn {
  width: auto;
  min-width: 12px;
  padding: 0.1rem 0.2rem;
  text-align: center;
}

.btn.small.icon-btn {
  width: auto !important;
  padding: 0.1rem 0.2rem !important;
}

.requests-actions .icon-btn {
  width: 42px !important;
  min-width: 42px !important;
  height: 75%;
  padding: 0;
  line-height: 1;
}

.requests-actions .action-form {
  display: inline-flex;
  margin: 0;
  width: 42px;
}

.users-table .actions-wrap .icon-btn {
  width: 42px !important;
  min-width: 42px !important;
  height: 75%;
  padding: 0;
  line-height: 1;
}

.users-table .actions-wrap .action-form {
  display: inline-flex;
  margin: 0;
  width: 42px;
}

.tutorial-actions .icon-btn {
  width: 32px !important;
  min-width: 32px !important;
  padding: 0.15rem 0 !important;
}

.users-filter {
  margin: 0.75rem 0 1rem 0;
  display: grid;
  gap: 0.4rem;
}

.users-filter label {
  font-weight: 600;
  display: grid;
  gap: 0.4rem;
  max-width: 260px;
}

.table-responsive table td,
.table-responsive table th {
  padding: 0.6rem 0.75rem;
}

.tutorial-duration-col {
  width: 6%;
  max-width: 90px;
}

.tutorial-duration-col input {
  width: 100%;
}

.tutorial-table td input,
.tutorial-table td select {
  width: calc(100% - 6px);
  margin-right: 6px;
}

.tutorial-name-col,
.tutorial-url-col {
  width: 12%;
  max-width: 180px;
}

.tutorial-id-col {
  width: 3%;
  max-width: 50px;
}

.tutorial-status-col {
  width: 12%;
  max-width: 180px;
}

.news-table td input,
.news-table td select {
  width: calc(100% - 6px);
  margin-right: 6px;
}

.news-heading-col {
  width: 12%;
  max-width: 160px;
}

.news-id-col {
  width: 3%;
  max-width: 40px;
}

.news-status-col {
  width: 10%;
  max-width: 140px;
}

.news-details-col {
  width: auto;
}

@media (min-width: 1024px) {
  .tutorial-add-btn {
    min-width: 150px;
  }
}

.payment-message {
  margin-top: 0.5rem;
  font-size: 0.9rem;
  color: #13803a;
}

.tutorial-list {
  display: grid;
  gap: 0.6rem;
}

.tutorial-item {
  border: 1px solid #cfd7e3;
  border-radius: 8px;
  padding: 0.65rem 0.8rem;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
  background: #fff;
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 0.75rem;
  align-items: start;
}

.tutorial-item:hover {
  border-color: #4a7bd9;
  box-shadow: 0 6px 16px rgba(42, 74, 145, 0.15);
  transform: translateY(-1px);
}

.tutorial-name {
  font-weight: 600;
}

.tutorial-desc {
  font-size: 0.9rem;
  color: #4b4b4b;
  margin-top: 0.25rem;
}

.tutorial-duration {
  font-size: 0.85rem;
  color: #6b6b6b;
  margin-top: 0.25rem;
}

.tutorial-modal-card {
  width: min(675px, 92vw);
  position: relative;
}

.tutorial-modal-card .modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.tutorial-modal-card .tutorial-list {
  margin-top: 0.6rem;
}

/* =========================================================
   RESPONSIVE SIDEBAR & OVERLAY
   ========================================================= */
.overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(2px);
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s;
}

body.sidebar-open .overlay {
  display: block;
  opacity: 1;
}

@media (max-width: 900px) {
  .menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 8px;
  }

  .sidebar {
    transform: translateX(-100%);
    top: var(--mobile-header-h);
    height: calc(100vh - var(--mobile-header-h));
  }

  body.has-sub-banner .sidebar {
    top: calc(var(--mobile-header-h) + var(--mobile-banner-h) - 6px);
    height: calc(100vh - (var(--mobile-header-h) + var(--mobile-banner-h) - 6px));
  }
}

@media (min-width: 901px) {
  .overlay {
    display: none !important;
    opacity: 0 !important;
  }
}

#walkthroughBtn {
  font-size: 0.85rem;
}

.walkthrough-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(2px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2500;
}

.walkthrough-overlay.open {
  display: flex;
}

.walkthrough-card {
  background: var(--bg-sub);
  color: var(--text-main);
  padding: 1.5rem;
  border-radius: 12px;
  width: min(500px, 90%);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
  position: relative;
  animation: slideIn 0.25s ease-out;
}

.walkthrough-close {
  position: absolute;
  top: 10px;
  right: 12px;
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--text-main);
}

.walkthrough-progress {
  margin: 0.5rem 0 1rem;
  font-size: 0.85rem;
  color: var(--text-sub);
}

.walkthrough-controls {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
}

.walkthrough-controls .btn {
  flex: 1;
}

@media (max-width: 900px) {
  .layout {
    flex-direction: column;
    padding-left: 0;
  }
}

@media (min-width: 901px) {
  .layout {
    padding-left: 230px;
  }
}

/* =========================================================
   PANEL & FORM STYLING INSIDE PORTAL
   ========================================================= */
.panel form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem 1.2rem;
  align-items: end;
  padding-bottom: 0.5rem;
}

.panel p {
  margin-bottom: 2.5rem;
}

.panel label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.3rem;
  margin-right: 1.8rem;
}

.panel input, .panel select {
  width: 100%;
  padding: 0.6rem 0.8rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: var(--bg);
  color: var(--text-main);
}

.panel input:focus {
  border-color: var(--accent);
  outline: none;
}

.panel .btn-group {
  display: flex;
  gap: 0.5rem;
  padding: 1.0rem;
  padding-left: 0rem;
  padding-bottom: 0.3rem;
}

.panel .btn-group .btn {
  width: 50%;
}

.panel .output {
  grid-column: 1 / -1;
  background: #0005;
  color: var(--text-main);
  border-radius: 6px;
  padding: 1rem;
  font-family: monospace;
  font-size: 0.9rem;
  overflow-y: auto;
  max-height: 350px;
  margin-top: 0.5rem;
}

@media (max-width: 768px) {
  .panel form { grid-template-columns: 1fr; }
  .panel .btn-group { flex-direction: column; padding: 0;}
  .panel .btn-group .btn { width: 100%;}
}

/* =========================================================
   ADDITIONAL COMPONENTS (ADMIN + PORTAL)
   ========================================================= */

/* Card Header with Action Buttons */
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

/* Tables (used in admin panels) */
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.5rem;
  font-size: 0.9rem;
}

th, td {
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid #ddd;
  text-align: left;
}

thead {
  background: var(--hover);
  color: var(--text-main);
  font-weight: 600;
}

tr:hover td {
  background: var(--hover);
}

.table-responsive {
  overflow-x: auto;
}

.transactions-scroll {
  overflow-x: auto;
}

@media (min-width: 1200px) {
  .transactions-scroll {
    overflow-x: visible;
  }
}

.logs-search {
  margin: 0.5rem 0 1rem;
}

.logs-search input {
  width: min(420px, 100%);
  padding: 0.55rem 0.7rem;
  border: 1px solid #d0d7e2;
  border-radius: 8px;
  background: #f5f8ff;
  color: var(--text-main);
}

.logs-table th.sortable {
  cursor: pointer;
  user-select: none;
}

.logs-pagination {
  margin-top: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.logs-pagination .btn.small {
  min-width: 68px;
}

.logs-page-info {
  font-weight: 600;
  color: var(--text-main);
}

.log-view-content {
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--bg);
  border: 1px solid #e3e8f3;
  border-radius: 10px;
  padding: 0.85rem;
  max-height: 65vh;
  overflow: auto;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.9rem;
  line-height: 1.4;
}

#tab-screens .card {
  background: #ffffff;
}

.screens-modal-card {
  max-width: 90vw;
  width: 90vw;
}

.screens-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0.5rem 0;
  border-bottom: 1px solid #e7ebf0;
  margin-bottom: 1rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.screens-count {
  color: #596776;
  font-weight: 600;
}

.screens-viewer {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: center;
}

.screens-viewer img {
  width: 100%;
  max-height: 70vh;
  object-fit: contain;
  background: #f1f5f9;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
}

.screens-caption {
  font-size: 0.9rem;
  color: #4b5563;
  word-break: break-all;
  text-align: center;
}

.screens-nav {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}

.screens-close-btn {
  border-radius: 999px;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.screens-thumbs {
  width: 100%;
  display: grid;
  grid-template-columns: 36px 1fr 36px;
  gap: 0.5rem;
  align-items: center;
  background: rgba(203, 213, 225, 0.2);
  border-radius: 12px;
  padding: 0.5rem 0.75rem;
}

.thumb-nav {
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.12);
  color: #1f2937;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
}

.thumb-nav:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.thumb-nav:hover:not(:disabled) {
  background: rgba(15, 23, 42, 0.18);
  transform: translateY(-1px);
}

.thumbs-track {
  display: grid;
  grid-template-columns: repeat(22, 1fr);
  gap: 0.5rem;
  overflow: hidden;
  min-height: 58px;
  align-items: center;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.thumbs-track.thumbs-shift {
  opacity: 0;
  transform: translateX(8px);
}

.thumb-item {
  border: 2px solid transparent;
  border-radius: 10px;
  background: #fff;
  padding: 2px;
  width: 52px;
  height: 40px;
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.thumb-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
}

.thumb-item:hover {
  transform: translateY(-1px);
  border-color: rgba(59, 130, 246, 0.5);
}

.thumb-item.active {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.thumb-empty {
  color: #6b7280;
  font-size: 0.85rem;
}

/* Support Grid */
.support-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(48%, 1fr));
}

.support-item {
  display: flex;
  align-items: stretch;
  gap: 1rem;
  background: var(--bg-sub);
  border-radius: 8px;
  padding: 0.8rem 1rem;
  box-shadow: var(--shadow);
  transition: transform 0.2s;
}
.support-item:hover {
  transform: translateY(-3px);
}

.support-logo {
  flex: 0 0 110px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.support-item img {
  width: 90px;
  height: 90px;
  object-fit: contain;
}

.support-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.support-text {
  flex-grow: 1;
}

.support-label {
  display: inline-block;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}
.support-label:hover {
  text-decoration: underline;
}

.note {
  font-size: 0.9rem;
  color: var(--text-sub);
  margin-top: 4px;
}

.support-delete {
  align-self: flex-start;
  margin-top: 0.8rem;
}

/* Placeholder logo if missing */
.support-placeholder {
  width: 90px;
  height: 90px;
  background: var(--hover);
  color: var(--text-sub);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-size: 0.8rem;
}

/* Buttons */
.btn.small {
  font-size: 0.8rem;
  padding: 0.35rem 0.8rem;
  width: 100px;
}
.btn.success { background: #198754; }
.btn.success:hover { background: #146c43; }
.btn.danger { background: #dc3545; }
.btn.danger:hover { background: #b02a37; }

@media (max-width: 700px) {
  .support-grid {
    grid-template-columns: 1fr;
  }
  .support-item {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  .support-logo {
    margin-bottom: 0.5rem;
  }
  .support-info {
    align-items: center;
  }
  .support-delete {
    align-self: center;
  }
}

/* Hint / Helper Text */
.hint {
  color: var(--text-sub);
  font-size: 0.85rem;
  margin-top: 0.5rem;
}

.rich-view {
  padding: 1rem;
  border-radius: 6px;
  background: var(--bg);
  box-shadow: var(--shadow);
}

/* Inline Form (for admin tables) */
.inline-form {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

/* Scrollable output consistency */
.output pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

/* === your existing CSS from message is kept exactly as-is up to the end === */

/* --- Small additions for secondary button style --- */
.btn.secondary {
  background: var(--bg-sub);
  color: var(--text-main);
  border: 1px solid var(--accent);
}
.btn.secondary:hover {
  background: var(--accent);
  color: #fff;
}

/* --- Credential buttons row under password --- */
.creds-btns {
  display: flex;
  gap: 0.6rem;
  align-items: center;
}

/* =========================================================
   CREDENTIAL MANAGER MODAL
   ========================================================= */
#cred-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1200;
  opacity: 0;
  transition: opacity 0.3s ease;
}
#cred-modal.open {
  display: flex;
  opacity: 1;
}
.cred-card {
  background: var(--bg-sub);
  color: var(--text-main);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 1.3rem;
  width: 95%;
  max-width: 560px;
  animation: slideIn 0.28s ease;
}
@keyframes slideIn {
  from { transform: translateY(-16px); opacity: 0; }
  to   { transform: translateY(0);     opacity: 1; }
}
.cred-card h3 {
  margin: 0 0 0.8rem 0;
  text-align: center;
}
.cred-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 320px;
  overflow-y: auto;
}
.cred-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg);
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
}
.cred-id {
  font-size: 0.95rem;
  word-break: break-all;
}
.cred-actions {
  display: inline-flex;
  gap: 0.5rem;
}

@media (max-width: 900px) {
  #cred-modal .cred-actions .cred-action-btn {
    background: transparent;
    border: none;
    padding: 4px 6px;
    min-width: auto;
    width: auto;
    height: auto;
    line-height: 1;
  }

  #cred-modal .cred-actions .cred-action-btn:hover {
    background: transparent;
  }
}
.cred-footer {
  display: flex;
  justify-content: center;
  margin-top: 0.8rem;
}

/* =========================================================
   FLASH MESSAGES (Fixed below header, auto-hide after 6s)
   ========================================================= */

/* Container that holds all flash messages */
.global-flash-area {
  position: fixed;
  top: 70px;              /* shows below 60px header */
  left: 0;
  width: 100%;
  text-align: center;
  z-index: 2000;          /* stays above content */
  pointer-events: none;   /* avoids blocking clicks */
}

body.has-sub-banner .global-flash-area {
  top: 110px;
}

@media (max-width: 900px) {
  .global-flash-area {
    top: 110px;
  }

  body.has-sub-banner .global-flash-area {
    top: 150px;
  }
}

.subscription-banner {
  position: fixed;
  top: 70px;
  left: 0;
  width: 100%;
  background: #dc3545;
  color: #fff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 1105;
}

@media (max-width: 900px) {
  .subscription-banner {
    top: 110px;
  }

  .subscription-banner-inner {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 1rem 1rem 1rem;
    gap: 0.8rem; /* clean spacing between text and button */
  }

  .subscription-banner-text {
    margin: 0;
    padding: 0 2rem; /* keeps space from close icon */
    font-size: 0.9rem;
    line-height: 1.4;
  }

  .subscription-banner-actions {
    position: relative !important;   /* force remove absolute */
    left: auto !important;
    bottom: auto !important;
    transform: none !important;
    width: 100%;
    display: flex;
    justify-content: center;
  }

  .subscription-banner .btn.small {
    max-width: 170px;
    white-space: normal;
  }

  .subscription-banner-close {
  position: absolute;
  top: -40px;   /* adjust to move higher */
  right: -8px; /* adjust to move further right */
  line-height: 1;
  background: transparent;
  border: none;
  font-size: 18px;
  cursor: pointer;
 }
}

.subscription-banner-success {
  background: #1f6b3a;
}

.subscription-banner-danger {
  background: #dc3545;
}

body.has-sub-banner .container {
  padding-top: calc(1rem + 70px + 44px);
}

.subscription-banner-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  padding: 0.22rem 0.7rem;
  max-width: 1200px;
  margin: 0 auto;
  position: relative;
}

.subscription-banner-text {
  font-size: 0.8rem;
  font-weight: 600;
  width: 100%;
  text-align: center;
}

.subscription-banner-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  position: absolute;
  right: 0.7rem;
  top: 50%;
  transform: translateY(-50%);
}

.subscription-banner .btn.small {
  width: auto;
  padding: 0.16rem 0.5rem;
  background: #fff;
  color: #dc3545;
  border: 1px solid #fff;
  font-size: 0.76rem;
}

.subscription-banner .btn.small:hover {
  background: #f8f9fa;
  color: #b02a37;
}

.subscription-banner-close {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0.2rem;
}

.subscription-banner-close:hover {
  color: #f8d7da;
}

.subscription-block-modal .modal-card {
  max-width: 420px;
  width: 92vw;
  background: #dc3545;
  color: #fff;
  border: 1px solid #b02a37;
}

.subscription-block-modal .modal-header {
  margin-bottom: 0.4rem;
}

.subscription-block-modal .subscription-banner-close {
  color: #fff;
}

.subscription-block-text {
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
}

.subscription-block-modal .btn.small {
  width: auto;
  background: #fff;
  color: #dc3545;
  border: 1px solid #fff;
  padding: 0.28rem 0.75rem;
  font-size: 0.85rem;
}

.subscription-block-modal .btn.small:hover {
  background: #f8f9fa;
  color: #b02a37;
}

/* Individual message box */
.flash {
  display: inline-block;
  background: #2ecc71;    /* default green for success */
  color: #fff;
  padding: 10px 22px;
  margin: 6px auto;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 500;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
  pointer-events: all;
  opacity: 0;
  animation: flashAppear 6s ease forwards;
}

/* Message color variants */
.flash-success { background-color: #2ecc71; }  /* Green */
.flash-error   { background-color: #e74c3c; }  /* Red */
.flash-warn    { background-color: #f39c12; }  /* Orange */

.status-expired {
  color: #dc3545;
  font-weight: 600;
}

/* Appear, stay visible, then fade out */
@keyframes flashAppear {
  0%   { opacity: 0; transform: translateY(-10px); }
  10%  { opacity: 1; transform: translateY(0); }
  85%  { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-10px); }
}


/* Make saved ID in modal clickable */
.cred-id.clickable {
  color: var(--text-main);
  cursor: pointer;
  text-decoration: none;
}
.cred-id.clickable:hover {
  color: var(--text-main);
  cursor: pointer;
  text-decoration: underline;
}
.cred-id.clickable:focus {
  outline: 2px dashed var(--accent);
  outline-offset: 2px;
  text-decoration: underline;
}
.tutorial-serial {
  font-size: 2rem;
  font-weight: 700;
  color: #2c4a9d;
  text-align: center;
  line-height: 1;
  padding-top: 0.1rem;
}

.tutorial-body {
  display: grid;
  gap: 0.2rem;
}


/* SLT Calculator embed */
.slt-embed { width: 100%; }
.slt-iframe { width: 100%; height: 1200px; border: 0; border-radius: 12px; background: #ffffff; }
@media (max-width: 900px) {
  .slt-iframe { height: 1500px; }
}


/* SLT Calculator layout */
#panel-slt .slt-layout {
  display: grid;
  grid-template-columns: 70% 26%;
  gap: 20px;
  align-items: start;
}
#panel-slt .slt-side-col {
  display: grid;
  gap: 16px;
  align-content: start;
}
#panel-slt .slt-side-col .card {
  width: 100%;
  margin-right: 0;
}
#panel-slt .slt-current-card .slt-field {
  width: 100%;
  border: 0;
  border-radius: 8px;
  background: transparent;
  padding: 10px 12px;
  outline: none;
  color: inherit;
}
#panel-slt .slt-current-card .slt-field,
#panel-slt .slt-current-card .slt-meta {
  width: 95%;
}
#panel-slt .slt-current-card .slt-title {
  font-weight: 600;
  font-size: 1.05rem;
  padding-top: 12px;
  padding-bottom: 12px;
  margin-bottom: 8px;
}
#panel-slt .slt-current-card .slt-note {
  background: #f3f6fb;
  min-height: 45px;
  resize: none;
}
#panel-slt .slt-current-card .slt-field:focus {
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}
#panel-slt .slt-meta {
  font-size: 0.9rem;
  color: #4b5563;
  display: grid;
  gap: 6px;
  margin: 10px 0 12px;
}
#panel-slt .slt-saved-list {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}
#panel-slt .slt-saved-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
#panel-slt .slt-saved-header h2 {
  margin: 0;
}
#panel-slt .slt-search {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 6px 10px;
  background: #fff;
  width: 160px;
}
#panel-slt .slt-saved-pagination {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}
#panel-slt .slt-saved-item {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 10px 12px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  background: #fff;
}
#panel-slt .slt-saved-item:hover {
  border-color: #93c5fd;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}
#panel-slt .slt-saved-name {
  font-weight: 600;
}
#panel-slt .slt-saved-note {
  font-size: 0.85rem;
  color: #6b7280;
}
#panel-slt .slt-delete-btn {
  opacity: 0;
  visibility: hidden;
  border: 0;
  background: transparent;
  color: #dc2626;
  font-size: 18px;
  cursor: pointer;
}
#panel-slt .slt-saved-item:hover .slt-delete-btn {
  opacity: 1;
  visibility: visible;
}
#panel-slt {
  overflow: hidden;
}
#panel-slt .slt-layout .card {
  width: 100%;
  margin: 0;
  min-width: 0;
  overflow: hidden;
}
#panel-slt .slt-layout .slt-main-card {
  width: 95%;
}
@media (max-width: 1100px) {
  #panel-slt .slt-layout {
    grid-template-columns: 1fr;
  }
}


/* SLT embed overflow */
#panel-slt .card { overflow-x: hidden;
    max-width: 100vw;
  }
.slt-embed { overflow-x: hidden;
    max-width: 100vw;
  }
.slt-iframe { display: block; max-width: 100vw; }


.slt-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.slt-header-text h2 {
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.slt-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.slt-header-input {
  border: 0;
  background: transparent;
  color: inherit;
  outline: none;
  padding: 2px 4px;
  border-radius: 6px;
}
.slt-header-input:focus {
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}
.slt-title-muted {
  font-weight: 500;
  color: #6b7280;
  font-size: 1em;
}
.slt-title-muted {
  display: inline-flex;
  align-items: center;
  font-size: 1.1em;
}
.slt-header-input {
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}
#slt-header-title {
  width: 240px;
  font-size: 1.1em;
  padding: 4px 6px;
}

#slt-header-note {
  width: 100%;
}
.slt-subtitle {
  color: #6b7280;
  font-size: 0.9rem;
  margin-top: 4px;
}
.slt-card-header h2 {
  margin: 0;
}
.slt-info-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid #d0d7e2;
  background: #fff;
  color: #1f2937;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
}


/* Settings grid */
#tab-settings .card {
  width: 50%;
  margin: 0 auto;
}
@media (max-width: 900px) {
  #tab-settings .card {
    width: 100%;
  }
}
.settings-grid {
  display: grid;
  gap: 12px;
  margin-top: 8px;
}
.settings-row {
  display: grid;
  grid-template-columns: 60px 1fr 220px;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid #e5e7eb;
}
.settings-row:last-child { border-bottom: none; }
.settings-cell select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
}
.settings-sl {
  font-weight: 700;
}

@media (max-width: 900px) {
  #panel-slt .slt-main-card h2 {
    margin-top: 16px;
  }

  #panel-slt .slt-card-header {
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }

  #panel-slt .slt-header-text {
    order: 1;
  }

  #panel-slt .slt-header-actions {
    order: 3;
    justify-content: flex-start;
    margin-top: 8px;
  }

  #panel-slt .slt-header-text h2 {
    display: block;
  }

  #panel-slt .slt-title-muted {
    display: block;
    margin-top: 6px;
    font-size: 0;
  }

  #panel-slt .slt-title-muted input {
    font-size: 1.1rem;
  }

  #slt-header-title {
    display: block;
    width: 100%;
  }

  #slt-header-note {
    display: block;
    width: 100%;
    margin-top: 6px;
    min-height: 4rem;
    resize: vertical;
    white-space: pre-wrap;
  }

  #panel-slt .slt-meta {
    margin-top: 8px;
    font-size: 0.85rem;
    color: var(--text-sub);
  }

  #panel-slt .slt-meta-mobile {
    display: block;
  }

  #panel-slt .slt-current-card .slt-meta {
    display: none;
  }

  #panel-slt .slt-current-card {
    display: none;
  }

  .slt-saved-note {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
  }

  #panel-slt .slt-delete-btn {
    opacity: 1;
    visibility: visible;
  }
}



