:root {
  color-scheme: light;
  --app-bg: #f2f4f8;
  --surface: #ffffff;
  --surface-soft: #f8f9fc;
  --sidebar-bg: #f7f8fb;
  --border: #e4e8ef;
  --text: #1f2a37;
  --muted: #7b8494;
  --primary: #5a4ff0;
  --primary-soft: #efedff;
  --danger: #ff4b4b;
  --success: #22a06b;
  --shadow: 0 12px 24px rgba(16, 24, 40, 0.06);
}

* {
  box-sizing: border-box;
}

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

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

.shell-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 210px;
  border-right: 1px solid var(--border);
  background: var(--sidebar-bg);
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.brand {
  margin-bottom: 16px;
  padding: 6px 8px 12px;
  border-bottom: 1px solid var(--border);
}

.brand-line {
  margin-bottom: 10px;
}

.brand-header {
  justify-content: space-between;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-mini {
  color: #8f98a9;
  font-size: 12px;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  background: var(--primary-soft);
  color: var(--primary);
}

.brand-mark.large {
  width: 42px;
  height: 42px;
  font-size: 13px;
}

.brand-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.brand-subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.side-menu {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  overflow: auto;
  padding-right: 2px;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 10px 9px;
  color: #556078;
  font-size: 12px;
  font-weight: 500;
}

.menu-item:hover {
  background: #f3f5fa;
}

.menu-item.active {
  background: linear-gradient(90deg, #5142e8, #6d5fff);
  color: #ffffff;
  font-weight: 600;
}

.menu-parent {
  justify-content: flex-start;
}

.menu-caret {
  margin-left: auto;
  font-size: 11px;
  color: inherit;
}

.menu-group {
  display: block;
}

.submenu {
  margin: 4px 0 8px 14px;
  border-left: 1px solid #d8deea;
  padding-left: 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.submenu-item {
  display: block;
  color: #737d8f;
  font-size: 12px;
  padding: 7px 6px;
  border-radius: 7px;
}

.submenu-item:hover {
  background: #f0f3f9;
}

.submenu-item.active {
  background: #ecebff;
  color: #5b50ef;
  font-weight: 600;
}

.menu-icon {
  width: 16px;
  font-size: 14px;
  line-height: 1;
  text-align: center;
}

.layout-main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.topbar {
  min-height: 46px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: var(--surface);
}

.topbar-space { display: block; }
.globe-icon { color: #75839a; font-size: 16px; }

.page-wrap {
  padding: 18px 16px;
}

.card {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
  padding: 14px;
  box-shadow: var(--shadow);
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.metric-title {
  margin: 0 0 9px;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 600;
}

.metric-value {
  margin: 0;
  font-size: 30px;
  font-weight: 700;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  text-align: left;
  color: var(--muted);
  font-size: 11px;
  border-bottom: 1px solid #eef1f5;
  padding: 10px 8px;
  text-transform: uppercase;
}

tbody td {
  border-bottom: 1px solid #eef1f5;
  padding: 12px 8px;
  font-size: 13px;
}

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 26px 8px;
}

.badge {
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 11px;
  display: inline-flex;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.badge.success {
  background: var(--success-bg);
  color: var(--success);
}

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

.badge.warning {
  background: var(--warning-bg);
  color: var(--warning);
}

.badge.info {
  background: var(--primary-soft);
  color: var(--primary);
}

.login-center {
  display: block;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.login-left-panel {
  background: #151821;
  color: #ffffff;
  padding: 26px;
}

.login-left-content {
  min-height: calc(100vh - 52px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.left-brand {
  margin: 0;
  font-size: 38px;
}

.left-quote {
  margin: 0 0 10px;
  font-size: 30px;
  max-width: 380px;
  line-height: 1.2;
}

.left-powered {
  margin: 0;
  color: #c8d0df;
}

.login-right-panel {
  background: #f0f2f7;
  display: grid;
  place-items: center;
  padding: 20px;
}

.login-box {
  width: min(440px, 100%);
  text-align: center;
}

.login-logo-wrap {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.login-logo-wrap h2 {
  margin: 0;
  color: #24385e;
  letter-spacing: 0.02em;
}

.login-box h3 {
  margin: 8px 0 4px;
  font-size: 38px;
  color: #202734;
}

.login-box p {
  margin: 0 0 12px;
  color: #7f8795;
}

.form-card {
  border: 1px solid #bcc5d1;
  background: #ffffff;
  border-radius: 8px;
  padding: 16px;
  text-align: left;
}

.login-error {
  background: #ffecec;
  color: #b42318;
  border: 1px solid #f7c7c3;
  border-radius: 8px;
  padding: 9px 10px;
  margin-bottom: 10px;
  font-size: 12px;
  font-weight: 600;
}

.role-entry {
  border: 1px solid #e3e8f0;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 10px;
}

.role-entry:last-child {
  margin-bottom: 0;
}

.role-title {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 700;
  color: #27344c;
}

.role-text {
  margin: 0 0 10px;
  color: #76839a;
  font-size: 12px;
}

.flash-card {
  margin-bottom: 12px;
  border-left: 4px solid #5a4ff0;
  color: #32415f;
  font-weight: 600;
}

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

.simple-form input,
.simple-form select {
  border: 1px solid #d9e1ec;
  border-radius: 8px;
  padding: 9px 10px;
  font-size: 13px;
  background: #fff;
}

.inline-form {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr 0.8fr 2fr 0.8fr;
  gap: 8px;
  align-items: center;
  border-bottom: 1px solid #edf1f6;
  padding: 8px 0;
}

.inline-form span {
  font-size: 13px;
  color: #3e4c67;
}

.inline-form input,
.inline-form select {
  border: 1px solid #d9e1ec;
  border-radius: 8px;
  padding: 7px 8px;
  font-size: 12px;
}

.form-button {
  width: auto;
  min-width: 180px;
}

.form-button-sm {
  width: auto;
  margin-top: 0;
  padding: 8px 10px;
  font-size: 12px;
}

.permission-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
}

.permission-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: #5a6781;
  border: 1px solid #dde3ef;
  border-radius: 999px;
  padding: 4px 8px;
  background: #f8f9fc;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
}

.field label {
  font-size: 14px;
  color: var(--text);
  font-weight: 600;
}

.field input {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  padding: 10px 12px;
}

.button {
  display: block;
  margin-top: 16px;
  width: 100%;
  border: 0;
  background: linear-gradient(90deg, #5142e8, #6a5eff);
  color: #ffffff;
  border-radius: 10px;
  padding: 11px 14px;
  font-weight: 700;
  text-align: center;
  border-radius: 7px;
}

.button:hover {
  opacity: 0.96;
}

.button-muted {
  background: linear-gradient(90deg, #667085, #7b8798);
}

.payment-shell {
  min-height: 100vh;
  padding: 14px 10px 20px;
  background: #eef1f7;
}

.payment-header {
  max-width: 620px;
  margin: 0 auto 10px;
  display: grid;
  gap: 6px;
}

.payment-chip {
  background: linear-gradient(180deg, #2f4878, #253d68);
  border: 1px solid #324f84;
  border-radius: 10px;
  color: #f3f7ff;
  text-align: center;
  padding: 7px 10px;
  font-size: clamp(13px, 1.2vw, 16px);
  font-weight: 600;
}

.payment-alert {
  max-width: 620px;
  margin: 0 auto 10px;
}

.payment-card {
  max-width: 620px;
  margin: 0 auto;
  border: 1px solid #d9deea;
  border-radius: 12px;
  background: #ffffff;
  padding: 10px;
  box-shadow: 0 6px 18px rgba(17, 27, 44, 0.07);
}

.payment-success-card {
  text-align: center;
  margin-bottom: 10px;
  border: 1px solid #bfe9d3;
  background: #f4fff8;
}

.payment-success-card h2 {
  margin: 2px 0 6px;
  color: #158357;
  font-size: clamp(20px, 2vw, 26px);
}

.payment-success-card p {
  margin: 0 0 12px;
  color: #2d5f49;
  font-size: 14px;
}

.payment-success-icon {
  width: 54px;
  height: 54px;
  border-radius: 999px;
  margin: 2px auto 10px;
  background: #1da96d;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  font-weight: 700;
}

.payment-card h2 {
  margin: 4px 0 10px;
  text-align: center;
  font-size: clamp(18px, 1.6vw, 24px);
  color: #20293b;
}

.payment-timer-card {
  margin-bottom: 10px;
  background: #2a426f;
  border: 1px solid #314f82;
  border-radius: 10px;
  padding: 9px;
  text-align: center;
  color: #ffffff;
}

.payment-timer-card p {
  margin: 0;
  opacity: 0.82;
  font-size: clamp(12px, 1vw, 14px);
}

.payment-timer-card strong {
  display: block;
  margin-top: 4px;
  font-size: clamp(24px, 2.8vw, 32px);
  letter-spacing: 0.05em;
}

.payment-account-card {
  border: 1px solid #e0e6f0;
  border-radius: 10px;
  padding: 10px;
  background: #fbfcff;
  margin-bottom: 10px;
}

.payment-account-card h3 {
  margin: 0 0 8px;
  text-align: center;
  font-size: clamp(16px, 1.2vw, 20px);
  color: #2a3345;
}

.payment-detail-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 6px;
  align-items: center;
  border-top: 1px solid #ebeff6;
  padding: 7px 0;
}

.payment-detail-row:first-of-type {
  border-top: 0;
}

.payment-detail-row span {
  color: #6f7b92;
  font-size: clamp(11px, 0.9vw, 13px);
}

.payment-detail-row strong {
  color: #232e43;
  font-size: clamp(12px, 1vw, 15px);
}

.payment-detail-row.highlight strong {
  color: #15a66c;
  font-size: clamp(18px, 1.8vw, 24px);
}

.copy-btn {
  border: 1px solid #d7deea;
  background: #f5f8fc;
  color: #516180;
  border-radius: 7px;
  padding: 4px 8px;
  font-size: 12px;
  cursor: pointer;
}

.payment-meta {
  margin: 6px 0 0;
  color: #76839a;
  font-size: 11px;
}

.payment-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.payment-item {
  border: 1px solid #e2e8f2;
  border-radius: 9px;
  background: #f7faff;
  padding: 7px 8px;
}

.payment-item span {
  display: block;
  font-size: 10px;
  color: #7a879d;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.payment-item strong {
  display: block;
  margin-top: 3px;
  font-size: 12px;
  color: #1f2e4b;
}

.payment-action {
  margin-top: 10px;
}

.payment-button {
  width: 100%;
  font-size: 14px;
  border-radius: 10px;
  padding: 9px 10px;
  background: linear-gradient(90deg, #2d4c83, #243d68);
  border: 1px solid #2f4f88;
}

.payment-return-button {
  display: inline-block;
  width: auto;
  min-width: 180px;
  text-align: center;
  text-decoration: none;
}

/* Security page */
.section-block {
  max-width: 1100px;
}

.section-title {
  margin: 0 0 14px;
  color: #4f46e5;
  font-size: 42px;
}

.section-description {
  margin: 0 0 12px;
  color: var(--muted);
}

.security-card {
  margin-bottom: 14px;
}

.security-card h3 {
  margin: 0 0 4px;
  font-size: 46px;
}

.danger-title {
  color: var(--danger);
}

.security-card p {
  margin: 0 0 12px;
  color: var(--muted);
}

/* Profile page compact sizing */
.profile-page .profile-title {
  font-size: 24px;
  margin-bottom: 10px;
}

.profile-page .profile-card-title {
  font-size: 18px;
  margin-bottom: 8px;
}

.profile-page .security-card {
  padding: 12px;
}

.profile-page .field input {
  height: 36px;
  padding: 8px 10px;
}

.profile-page .security-actions {
  margin-top: 0;
}

.profile-page .button.form-button-sm {
  min-height: 36px;
  padding: 8px 12px;
}

.profile-single-col {
  grid-template-columns: 1fr;
}

.security-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}

.security-grid.two-cols {
  grid-template-columns: 1fr 1fr;
}

.security-actions {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
}

.secondary-link {
  color: #516189;
  font-weight: 600;
}

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

.sidebar-user {
  display: flex;
  gap: 8px;
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 8px;
  margin-top: 10px;
}

.user-badge {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #eceaff;
  color: #5a50ef;
  font-size: 10px;
  font-weight: 700;
}

.user-name {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
}

.user-mail {
  margin: 1px 0 0;
  font-size: 11px;
  color: var(--muted);
}

@media (max-width: 1280px) {
  .grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .login-shell {
    grid-template-columns: 1fr;
  }

  .login-left-content {
    min-height: 220px;
  }

  .left-quote {
    font-size: 22px;
  }
}

@media (max-width: 900px) {
  .shell-layout {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .page-wrap {
    padding: 16px;
  }

  .security-grid,
  .security-grid.two-cols {
    grid-template-columns: 1fr;
  }

  .section-title {
    font-size: 30px;
  }

  .payment-grid {
    grid-template-columns: 1fr;
  }

  .payment-chip {
    font-size: 13px;
  }

  .payment-card h2 {
    font-size: 18px;
  }

  .payment-timer-card p {
    font-size: 12px;
  }

  .payment-timer-card strong {
    font-size: 24px;
  }

  .payment-account-card h3 {
    font-size: 16px;
  }

  .payment-detail-row {
    grid-template-columns: 1fr auto;
  }

  .payment-detail-row span {
    font-size: 11px;
  }

  .payment-detail-row strong {
    font-size: 12px;
    justify-self: end;
  }

  .payment-detail-row .copy-btn {
    grid-column: span 2;
    justify-self: end;
    font-size: 12px;
    padding: 5px 9px;
  }

  .payment-detail-row.highlight strong {
    font-size: 18px;
  }

  .payment-meta,
  .payment-item span,
  .payment-item strong {
    font-size: 11px;
  }

  .payment-button {
    font-size: 13px;
  }
}
