:root {
  --ink: #17231f;
  --muted: #62706a;
  --paper: #fffaf1;
  --canvas: #f4efe5;
  --line: #ded6c8;
  --teal: #0f766e;
  --teal-dark: #0b4f4a;
  --coral: #c2410c;
  --gold: #c58a12;
  --blue: #1d4ed8;
  --rose: #be123c;
  --green: #15803d;
  --white: #ffffff;
  --shadow: 0 18px 48px rgba(23, 35, 31, 0.12);
  --radius: 8px;
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--canvas);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(255, 250, 241, 0.88), rgba(244, 239, 229, 0.96)),
    var(--canvas);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-root {
  min-height: 100vh;
}

.login-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 520px);
}

.login-visual {
  position: relative;
  min-height: 100vh;
  padding: 32px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  color: var(--white);
  background:
    linear-gradient(90deg, rgba(8, 51, 47, 0.86), rgba(8, 51, 47, 0.34)),
    url("https://images.unsplash.com/photo-1522202176988-66273c2fd55f?auto=format&fit=crop&w=1500&q=80")
      center/cover;
}

.login-visual::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.08), rgba(0, 0, 0, 0.46));
  pointer-events: none;
}

.brand-mark,
.visual-copy,
.visual-stats {
  position: relative;
  z-index: 1;
}

.brand-mark {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-logo {
  width: 74px;
  height: 54px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(12px);
  overflow: hidden;
}

.brand-logo svg {
  width: 26px;
  height: 26px;
}

.asean-logo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand-logo .asean-logo {
  width: 66px;
  height: 48px;
}

.visual-copy {
  max-width: 720px;
}

.visual-copy h1 {
  max-width: 640px;
  margin: 0;
  font-size: clamp(40px, 6vw, 82px);
  line-height: 0.94;
  letter-spacing: 0;
}

.visual-copy p {
  max-width: 560px;
  margin: 20px 0 0;
  color: rgba(255, 255, 255, 0.88);
  font-size: 18px;
  line-height: 1.6;
}

.visual-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  max-width: 720px;
}

.visual-stat {
  min-height: 94px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(14px);
}

.visual-stat strong {
  display: block;
  font-size: 26px;
  line-height: 1;
}

.visual-stat span {
  display: block;
  margin-top: 8px;
  color: rgba(255, 255, 255, 0.82);
  line-height: 1.35;
}

.login-panel {
  min-height: 100vh;
  padding: 40px;
  display: flex;
  align-items: center;
  background: var(--paper);
}

.login-card {
  width: 100%;
  max-width: 460px;
  margin: 0 auto;
}

.login-card h2,
.panel-title h2,
.section-heading h2 {
  margin: 0;
  font-size: 30px;
  line-height: 1.1;
  letter-spacing: 0;
}

.login-card > p,
.panel-title p,
.section-heading p {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.form-stack {
  display: grid;
  gap: 14px;
  margin-top: 24px;
}

.field {
  display: grid;
  gap: 7px;
}

.field label {
  color: #35433d;
  font-size: 13px;
  font-weight: 700;
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  color: var(--ink);
  background: var(--white);
  outline: none;
}

.textarea {
  min-height: 88px;
  resize: vertical;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

.button-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.btn {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 9px 14px;
  color: var(--ink);
  background: var(--white);
  font-weight: 800;
  text-decoration: none;
  transition:
    transform 0.16s ease,
    border-color 0.16s ease,
    background 0.16s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.58;
  transform: none;
}

.btn svg {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
}

.btn-primary {
  color: var(--white);
  background: var(--teal);
}

.btn-primary:hover {
  background: var(--teal-dark);
}

.btn-secondary {
  border-color: var(--line);
}

.btn-warning {
  color: var(--white);
  background: var(--coral);
}

.btn-good {
  color: var(--white);
  background: var(--green);
}

.btn-blue {
  color: var(--white);
  background: var(--blue);
}

.btn-small {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 13px;
}

.btn-icon {
  width: 40px;
  min-width: 40px;
  padding: 0;
}

.demo-accounts {
  margin-top: 24px;
  display: grid;
  gap: 10px;
}

.demo-account {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  background: var(--white);
}

.avatar {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex: 0 0 38px;
  border-radius: var(--radius);
  color: var(--white);
  background: var(--teal);
  font-weight: 900;
}

.branded-avatar {
  position: relative;
  display: inline-grid;
  width: 44px;
  height: 44px;
  place-items: center;
  flex: 0 0 44px;
}

.branded-avatar .avatar {
  box-shadow: 0 0 0 2px var(--white);
}

.branded-avatar-small {
  width: 36px;
  height: 36px;
  flex-basis: 36px;
}

.avatar-logo-badge {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border: 2px solid var(--white);
  border-radius: 6px;
  background: var(--white);
  box-shadow: 0 5px 12px rgba(23, 35, 31, 0.18);
  overflow: hidden;
}

.branded-avatar-small .avatar-logo-badge {
  width: 16px;
  height: 16px;
  border-radius: 5px;
}

.avatar-logo {
  width: 100%;
  height: 100%;
}

.avatar-small {
  width: 30px;
  height: 30px;
  flex-basis: 30px;
  font-size: 12px;
}

.meta-title {
  font-weight: 850;
}

.meta-subtitle {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.error-box,
.success-box,
.info-box {
  display: none;
  border-radius: var(--radius);
  padding: 12px;
  line-height: 1.45;
}

.error-box {
  border: 1px solid rgba(190, 18, 60, 0.22);
  color: #881337;
  background: #fff1f2;
}

.success-box {
  border: 1px solid rgba(21, 128, 61, 0.22);
  color: #14532d;
  background: #f0fdf4;
}

.info-box {
  display: block;
  border: 1px solid rgba(29, 78, 216, 0.18);
  color: #1e3a8a;
  background: #eff6ff;
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 18px;
  border-right: 1px solid var(--line);
  background: #fff7ea;
  overflow-y: auto;
}

.sidebar .brand-mark {
  color: var(--ink);
}

.sidebar .brand-logo {
  color: var(--white);
  background: var(--white);
  border-color: var(--line);
  backdrop-filter: none;
}

.copyright-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.sidebar-footer .copyright-note {
  margin: 0;
  padding: 0 2px;
}

.role-pill {
  margin-top: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  background: var(--white);
}

.nav-list {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.nav-btn {
  width: 100%;
  min-height: 44px;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 10px;
  color: #35433d;
  background: transparent;
  text-align: left;
  font-weight: 800;
}

.nav-btn svg {
  width: 20px;
  height: 20px;
}

.nav-btn.active {
  color: var(--teal-dark);
  border-color: rgba(15, 118, 110, 0.18);
  background: #e7f4ef;
}

.sidebar-footer {
  margin-top: 18px;
  display: grid;
  gap: 10px;
}

.main {
  min-width: 0;
  padding: 22px;
}

.topbar {
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  background: rgba(255, 250, 241, 0.88);
  backdrop-filter: blur(12px);
}

.topbar h1 {
  margin: 0;
  font-size: 23px;
  line-height: 1.15;
  letter-spacing: 0;
}

.topbar p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.content {
  margin-top: 18px;
  display: grid;
  gap: 18px;
}

.grid {
  display: grid;
  gap: 14px;
}

.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.span-2 {
  grid-column: span 2;
}

.span-3 {
  grid-column: span 3;
}

.card,
.metric,
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: 0 8px 22px rgba(23, 35, 31, 0.05);
}

.metric {
  min-height: 120px;
  padding: 16px;
  display: grid;
  align-content: space-between;
  gap: 12px;
}

.metric-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.metric-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  color: var(--teal-dark);
  background: #dff3ed;
}

.metric-icon svg {
  width: 20px;
  height: 20px;
}

.metric-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.metric strong {
  display: block;
  font-size: 30px;
  line-height: 1;
  letter-spacing: 0;
}

.metric small {
  color: var(--muted);
  line-height: 1.4;
}

.panel {
  padding: 18px;
}

.panel-header,
.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.panel-title h2,
.section-heading h2 {
  font-size: 22px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
}

table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
}

th,
td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: #42504a;
  background: #fff3df;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

tr:last-child td {
  border-bottom: 0;
}

.table-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  border-radius: var(--radius);
  padding: 4px 8px;
  color: #35433d;
  background: #eee6d9;
  font-size: 12px;
  font-weight: 850;
}

.badge svg {
  width: 14px;
  height: 14px;
}

.badge-good {
  color: #14532d;
  background: #dcfce7;
}

.badge-warn {
  color: #7c2d12;
  background: #ffedd5;
}

.badge-blue {
  color: #1e3a8a;
  background: #dbeafe;
}

.badge-rose {
  color: #881337;
  background: #ffe4e6;
}

.timeline {
  display: grid;
  gap: 10px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: var(--white);
}

.time-box {
  display: grid;
  gap: 3px;
  color: var(--teal-dark);
  font-weight: 900;
}

.time-box small {
  color: var(--muted);
  font-weight: 700;
}

.person-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.person-row + .person-row {
  margin-top: 8px;
}

.lesson-title {
  font-weight: 900;
}

.lesson-meta {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

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

.form-grid .wide {
  grid-column: span 2;
}

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

.kpi-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.kpi {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: var(--white);
}

.kpi span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.kpi strong {
  display: block;
  margin-top: 6px;
  font-size: 22px;
}

.profile-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  background: var(--white);
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.tag {
  border-radius: var(--radius);
  padding: 5px 7px;
  color: #35433d;
  background: #eee6d9;
  font-size: 12px;
  font-weight: 800;
}

.notice-list {
  display: grid;
  gap: 10px;
}

.notice {
  border: 1px solid var(--line);
  border-left: 4px solid var(--gold);
  border-radius: var(--radius);
  padding: 12px;
  background: var(--white);
}

.notice h3 {
  margin: 0;
  font-size: 15px;
}

.notice p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.call-stage {
  display: grid;
  gap: 14px;
}

.call-frame {
  min-height: 420px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: #111827;
}

.call-frame iframe {
  width: 100%;
  height: 520px;
  border: 0;
  display: block;
}

.call-placeholder {
  min-height: 360px;
  display: grid;
  place-items: center;
  padding: 24px;
  color: var(--white);
  text-align: center;
  background:
    linear-gradient(120deg, rgba(15, 118, 110, 0.92), rgba(194, 65, 12, 0.82)),
    #111827;
}

.call-placeholder svg {
  width: 56px;
  height: 56px;
  margin-bottom: 16px;
}

.call-placeholder h3 {
  margin: 0;
  font-size: 24px;
}

.call-placeholder p {
  max-width: 520px;
  margin: 10px auto 0;
  color: rgba(255, 255, 255, 0.84);
  line-height: 1.55;
}

.empty {
  min-height: 150px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 20px;
  color: var(--muted);
  text-align: center;
  background: rgba(255, 255, 255, 0.5);
}

.mobile-menu {
  display: none;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
}

.status-dot.live {
  background: var(--rose);
  box-shadow: 0 0 0 4px rgba(190, 18, 60, 0.12);
}

.status-dot.ok {
  background: var(--green);
}

.status-dot.wait {
  background: var(--gold);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 30;
  max-width: min(420px, calc(100vw - 36px));
  border: 1px solid rgba(15, 118, 110, 0.18);
  border-radius: var(--radius);
  padding: 12px 14px;
  color: var(--teal-dark);
  background: #e7f4ef;
  box-shadow: var(--shadow);
}

.hidden {
  display: none !important;
}

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

  .grid-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .span-3 {
    grid-column: span 2;
  }

  .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

  .login-visual {
    min-height: 430px;
  }

  .login-panel {
    min-height: auto;
  }

  .sidebar {
    position: relative;
    height: auto;
    padding: 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .mobile-menu {
    display: inline-flex;
  }

  .nav-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .nav-btn {
    grid-template-columns: 22px minmax(0, 1fr);
    min-height: 42px;
  }

  .main {
    padding: 14px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 680px) {
  .login-visual {
    min-height: 360px;
    padding: 22px;
  }

  .login-panel {
    padding: 22px;
  }

  .visual-copy h1 {
    font-size: 40px;
  }

  .visual-stats,
  .grid-2,
  .grid-3,
  .grid-4,
  .kpi-strip,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .span-2,
  .span-3,
  .form-grid .wide {
    grid-column: auto;
  }

  .nav-list {
    grid-template-columns: 1fr 1fr;
  }

  .panel-header,
  .section-heading {
    display: grid;
  }

  .timeline-item {
    grid-template-columns: 1fr;
  }

  .demo-account {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .demo-account .btn {
    grid-column: 1 / -1;
    width: 100%;
  }

  .call-frame iframe {
    height: 420px;
  }
}

@media (max-width: 430px) {
  .login-card h2,
  .panel-title h2,
  .section-heading h2 {
    font-size: 24px;
  }

  .topbar h1 {
    font-size: 20px;
  }

  .button-row,
  .topbar-actions,
  .table-actions {
    width: 100%;
  }

  .button-row .btn,
  .topbar-actions .btn,
  .table-actions .btn {
    flex: 1 1 140px;
  }
}
