@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@500;600;700;800&family=Inter:wght@400;500;600;700;800&display=swap');

.auth-page {
  --blue: #3838ff;
  --blue-dark: #0f1fff;
  --blue-light: #eaf1ff;
  --yellow: #f5b400;
  --yellow-dark: #d99a00;
  --white: #ffffff;
  --ink: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --field: #f4f6f9;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --success: #16a34a;
  --success-bg: #f0fdf4;
}

.auth-page * {
  box-sizing: border-box;
}

.auth-page {
  min-height: 100vh;
  width: 100%;
  display: flex;
  align-items: stretch;
  justify-content: center;
  background: var(--white);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: var(--ink);
  padding: 0;
}

.auth-shell {
  width: 100%;
  max-width: none;
  display: flex;
  background: var(--white);
  border: none;
  border-radius: 0;
  overflow: hidden;
  box-shadow: none;
  min-height: 100vh;
}

.auth-brand {
  width: 42%;
  min-width: 300px;
  background: linear-gradient(160deg, var(--blue) 0%, #3f3fda 55%, #2121c7 100%);
  display: flex;
  border-radius: 0 160px 160px 0;
}

.auth-brand-inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 56px 48px;
  color: var(--white);
}

.auth-brand-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 17px;
  font-weight: 800;
}
.auth-brand-logo svg rect {
  fill: var(--white);
}
.auth-brand-logo svg path {
  stroke: var(--blue);
}

.auth-brand-fullname {
  margin-top: 14px;
  display: inline-block;
  padding: 6px 14px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.15);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--white);
  width: fit-content;
}

.auth-brand-body {
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-width: 400px;
}

.auth-brand-title {
  font-family: 'Poppins', 'Inter', sans-serif;
  font-size: 34px;
  line-height: 1.22;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.auth-brand-accent {
  width: 48px;
  height: 5px;
  background: var(--yellow);
  border-radius: 3px;
}

.auth-brand-desc {
  font-size: 15.5px;
  line-height: 1.65;
  color: #eaf1ff;
  max-width: 340px;
}

.auth-brand-foot {
  font-size: 11.5px;
  color: #c7d9ff;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 600;
}

.auth-form-panel,
.auth-full-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 44px 40px;
  background: var(--white);
  gap: 16px;
}

.auth-full-panel {
  min-height: 100vh;
  width: 100%;
}

.auth-copyright {
  font-size: 12px;
  color: var(--muted);
}

.af-shell {
  width: 100%;
  max-width: 360px;
}
.af-shell.af-shake {
  animation: authShake 0.5s ease both;
}

.af-card {
  width: 100%;
}
.af-card--narrow {
  max-width: 360px;
}

.af-header {
  margin-bottom: 24px;
}
.af-title {
  font-family: 'Poppins', 'Inter', sans-serif;
  font-size: 26px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.af-title.af-mb-6 {
  margin-bottom: 6px;
}
.af-subtitle {
  font-size: 13px;
  color: var(--muted);
  margin-top: 6px;
}
.af-subtitle.af-mb-24 {
  margin-bottom: 24px;
}

.af-banner {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 16px;
}
.af-banner svg {
  flex-shrink: 0;
  margin-top: 1px;
}
.af-banner--error {
  background: var(--danger-bg);
  border: 1px solid #fecaca;
  color: var(--danger);
}
.af-banner--success {
  background: var(--success-bg);
  border: 1px solid #bbf7d0;
  color: var(--success);
}

.af-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.af-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.af-label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.af-input-wrap {
  position: relative;
}

.af-input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  display: flex;
  pointer-events: none;
}

.af-input {
  width: 100%;
  height: 44px;
  padding: 0 14px 0 40px;
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}
.af-input::placeholder {
  color: #94a3b8;
}
.af-input:focus {
  background: var(--white);
  border-color: var(--blue);
}
.af-input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.af-input--dim {
  opacity: 0.45;
}
.af-input--pass {
  padding-right: 40px;
}
.af-input--error {
  border-color: var(--danger) !important;
}
.af-input--captcha {
  letter-spacing: 0.14em;
  font-weight: 700;
}

.af-eye {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  padding: 4px;
}
.af-eye:hover {
  color: var(--blue);
}

.af-field-err {
  font-size: 12px;
  color: var(--danger);
  padding-left: 2px;
}

.af-captcha-row {
  display: flex;
  align-items: stretch;
  gap: 10px;
}

.af-captcha-box {
  flex: 1;
  min-height: 56px;
  background: #eef3fa;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.af-captcha-render {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  pointer-events: none;
  line-height: 0;
}
.af-captcha-render svg {
  max-width: 100%;
  height: auto;
  display: block;
}

.af-captcha-loading,
.af-captcha-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 12px;
  width: 100%;
  height: 100%;
}

.af-captcha-refresh {
  width: 56px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--white);
  border: 1px solid var(--blue);
  color: var(--blue);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}
.af-captcha-refresh:hover {
  background: var(--blue-light);
}
.af-captcha-refresh:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.af-captcha-input-wrap {
  margin-top: 8px;
}

.af-captcha-timer {
  margin-top: 8px;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
}
.af-captcha-timer--warn {
  color: var(--yellow-dark);
}
.af-captcha-timer--expired {
  color: var(--danger);
  font-weight: 600;
}

.af-row {
  display: flex;
}
.af-row--split {
  justify-content: space-between;
  align-items: center;
}

.af-check-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

.af-checkbox {
  width: 17px;
  height: 17px;
  border-radius: 4px;
  border: 1.5px solid #cbd5e1;
  background: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s;
}
.af-checkbox--on {
  background: var(--blue);
  border-color: var(--blue);
}

.af-submit {
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--blue);
  color: var(--white);
  border: none;
  border-radius: 8px;
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  margin-top: 4px;
  box-shadow: 0 2px 10px rgba(37, 99, 235, 0.25);
}
.af-submit:hover:not(:disabled) {
  background: var(--blue-dark);
}
.af-submit:active:not(:disabled) {
  transform: translateY(1px);
}
.af-submit:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.af-submit--accent {
  background: var(--yellow);
  color: var(--ink);
}
.af-submit--accent:hover:not(:disabled) {
  background: var(--yellow-dark);
  color: var(--white);
}
.af-mt-8 {
  margin-top: 8px;
}
.af-mt-20 {
  margin-top: 20px;
}

.af-link {
  background: none;
  border: none;
  padding: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--blue);
  cursor: pointer;
}
.af-link:hover {
  text-decoration: underline;
}
.af-link--small {
  font-size: 12px;
}

.af-text-center {
  text-align: center;
}
.af-mt-14 {
  margin-top: 14px;
}

.af-otp-icon {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: var(--blue-light);
  color: var(--blue);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}

.af-accent-text {
  color: var(--blue-dark);
}

.af-otp-row {
  display: flex;
  gap: 8px;
  justify-content: center;
}
.af-otp-cell {
  width: 44px;
  height: 50px;
  text-align: center;
  font-size: 18px;
  font-weight: 700;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field);
  color: var(--ink);
  outline: none;
}
.af-otp-cell:focus {
  border-color: var(--blue);
  background: var(--white);
}
.af-otp-cell--filled {
  border-color: var(--blue);
  background: var(--white);
}
.af-otp-cell:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.af-strength {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.af-strength-bars {
  display: flex;
  gap: 5px;
}
.af-strength-bar {
  height: 4px;
  flex: 1;
  border-radius: 2px;
  background: var(--line);
  transition: background 0.3s;
}
.af-strength[data-score="1"] .af-strength-bar--filled {
  background: var(--danger);
}
.af-strength[data-score="2"] .af-strength-bar--filled {
  background: var(--yellow-dark);
}
.af-strength[data-score="3"] .af-strength-bar--filled {
  background: var(--success);
}
.af-strength[data-score="4"] .af-strength-bar--filled {
  background: var(--blue);
}
.af-strength-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.af-scheck {
  font-size: 11px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 3px;
}
.af-scheck--ok {
  color: var(--success);
}

.af-forgot-shell {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.af-back {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 18px;
  padding: 0;
}
.af-back:hover {
  color: var(--blue);
}

.af-logo-text {
  font-size: 14px;
  font-weight: 800;
  color: var(--blue);
  letter-spacing: 0.02em;
  margin-bottom: 18px;
}

.af-steps {
  display: flex;
  align-items: center;
  margin-bottom: 26px;
}
.af-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: #94a3b8;
}
.af-step-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  background: var(--white);
}
.af-step--active {
  color: var(--blue);
}
.af-step--active .af-step-dot {
  border-color: var(--blue);
  color: var(--blue);
}
.af-step--done {
  color: var(--success);
}
.af-step--done .af-step-dot {
  border-color: var(--success);
  background: var(--success);
  color: var(--white);
}
.af-step-label {
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}
.af-step-line {
  flex: 1;
  height: 1.5px;
  background: var(--line);
  margin: 0 6px 18px;
}
.af-step-line--done {
  background: var(--success);
}

.af-success {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 14px;
  padding: 12px 0;
}
.af-success-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--success-bg);
  border: 2px solid #bbf7d0;
  color: var(--success);
  display: flex;
  align-items: center;
  justify-content: center;
}

.af-muted-text {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}
.af-hint-text {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 12px;
}

.af-spin {
  animation: authSpin 0.7s linear infinite;
  flex-shrink: 0;
}

@keyframes authSpin {
  to {
    transform: rotate(360deg);
  }
}
@keyframes authShake {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-4px); }
  40%, 60% { transform: translateX(4px); }
}

@media (max-width: 900px) {
  .auth-shell {
    flex-direction: column;
  }
  .auth-brand {
    width: 100%;
    min-width: 0;
    border-radius: 0 0 60px 60px;
  }
  .auth-brand-inner {
    padding: 32px 28px;
  }
  .auth-brand-title {
    font-size: 30px;
  }
  .auth-brand-desc {
    max-width: none;
  }
}

@media (max-width: 480px) {
  .auth-page {
    padding: 16px;
  }
  .auth-form-panel,
  .auth-full-panel {
    padding: 28px 20px;
  }
  .af-card {
    padding: 0;
  }
  .af-otp-cell {
    width: 40px;
    height: 48px;
    font-size: 16px;
  }
  .af-title {
    font-size: 20px;
  }
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body, #root { height: 100%; }
body { font-family: 'Inter', system-ui, -apple-system, sans-serif; }

.app-shell { display: flex; flex-direction: column; min-height: 100vh; position: relative; overflow: hidden; }
.app-body  { display: flex; flex: 1; overflow: hidden; position: relative; z-index: 1; }

.app-header {
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  gap: 12px;
  flex-shrink: 0;
}
.header-left  { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.header-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.header-brand { display: flex; align-items: center; gap: 10px; }
.header-brand-text { display: flex; flex-direction: column; }
.header-brand-text .brand-name { font-size: 14px; font-weight: 900; line-height: 1.2; letter-spacing: -0.3px; }
.header-brand-text .brand-sub  { font-size: 9px; letter-spacing: 0.12em; text-transform: uppercase; }
.header-breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 12px; margin-left: 8px; }

.sidebar-nav {
  flex-shrink: 0;
  overflow: hidden;
  overflow-y: auto;
  z-index: 300;
  transition: width 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.main-content { flex: 1; overflow-y: auto; overflow-x: hidden; }
.page-inner   { padding: 28px 32px; }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table       { width: 100%; border-collapse: collapse; }

.kpi-grid         { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.chart-grid-2     { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; }
.chart-grid-equal { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.mini-stat-grid   { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }

.profile-grid { display: grid; grid-template-columns: 300px 1fr; gap: 20px; align-items: start; }

.modal-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }

.pill { padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; letter-spacing: 0.05em; white-space: nowrap; }

* { scrollbar-width: thin; }
*::-webkit-scrollbar       { width: 4px; height: 4px; }
*::-webkit-scrollbar-thumb { border-radius: 3px; }

@keyframes toastIn  { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes modalIn  { from { opacity: 0; transform: scale(0.94) translateY(12px); } to { opacity: 1; transform: scale(1) translateY(0); } }
@keyframes spin     { to { transform: rotate(360deg); } }
@keyframes shimmer  { 0%, 100% { opacity: 0.4; } 50% { opacity: 0.8; } }
@keyframes pulse    { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

@media (max-width: 1024px) {
  .page-inner        { padding: 20px 20px; }
  .chart-grid-2      { grid-template-columns: 1fr; }
  .chart-grid-equal  { grid-template-columns: 1fr; }
  .kpi-grid          { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
  .mini-stat-grid    { grid-template-columns: repeat(2, 1fr); }
  .profile-grid      { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .app-header           { padding: 0 12px; height: 52px; }
  .header-brand-text    { display: none; }
  .header-breadcrumb    { display: none; }
  .header-right .live-badge { display: none; }

  .sidebar-nav {
    position: fixed !important;
    top: 52px;
    left: 0;
    bottom: 0;
    width: 240px !important;
    transform: translateX(-100%);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
    z-index: 500;
  }
  .sidebar-nav.mobile-open {
    transform: translateX(0);
  }
  .sidebar-overlay {
    display: block !important;
    position: fixed;
    inset: 52px 0 0 0;
    z-index: 499;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
  }

  .main-content { width: 100%; }
  .page-inner   { padding: 14px 12px; }

  .kpi-grid       { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .mini-stat-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }

  .chart-grid-2     { grid-template-columns: 1fr; }
  .chart-grid-equal { grid-template-columns: 1fr; }

  .profile-grid         { grid-template-columns: 1fr; gap: 12px; }
  .profile-info-grid    { grid-template-columns: 1fr !important; }
  .profile-account-grid { grid-template-columns: 1fr 1fr !important; }

  .table-wrap { font-size: 12px; }
  table th, table td { padding: 8px 10px !important; }

  .modal-form-grid { grid-template-columns: 1fr !important; }

  .toolbar-wrap { flex-wrap: wrap; gap: 8px; }
  .toolbar-search { min-width: 100% !important; max-width: 100% !important; }

  .pagination-wrap { flex-direction: column; align-items: flex-start !important; gap: 8px; }

  .header-user-name { display: none; }

  .page-header-wrap   { flex-direction: column; gap: 8px; }
  .page-header-action { align-self: flex-start; }

  .export-col-grid { grid-template-columns: 1fr 1fr !important; }
}

@media (max-width: 480px) {
  .kpi-grid       { grid-template-columns: 1fr; }
  .mini-stat-grid { grid-template-columns: 1fr; }

  .profile-account-grid { grid-template-columns: 1fr !important; }

  .header-right .theme-switcher { display: none; }

  table th:nth-child(3),
  table td:nth-child(3) { display: none; }

  table th:nth-child(5),
  table td:nth-child(5) { display: none; }
}

@media (min-width: 1400px) {
  .kpi-grid     { grid-template-columns: repeat(6, 1fr); }
  .page-inner   { padding: 32px 40px; }
  .profile-grid { grid-template-columns: 320px 1fr; }
}

.sidebar-overlay { display: none; }

@media (pointer: coarse) {
  button, a { min-height: 40px; }
  .nav-item  { min-height: 44px !important; }
}