/* ============================================================
   UData PTMS — navy / red brand layer over Bootstrap 5
   ============================================================ */
:root {
  --navy: #0d1f3c;
  --navy-2: #16294d;
  --navy-3: #1f3763;
  --red: #c00000;
  --bs-body-bg: #f4f6fa;
  --bs-body-font-size: .9rem;
}
body { background: #f4f6fa; }

/* ---------- Layout ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 250px; flex-shrink: 0; background: var(--navy); color: #cdd6e6;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
  overflow-y: auto; z-index: 1040;
}
.brand { display: flex; gap: 10px; align-items: center; padding: 18px 16px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand-mark {
  width: 40px; height: 40px; border-radius: 9px; background: var(--red); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 20px;
  box-shadow: 0 2px 10px rgba(192,0,0,.5);
}
.brand-name { font-weight: 700; color: #fff; font-size: 15px; }
.brand-name span { color: #ff8a8a; }
.brand-sub { font-size: 11px; color: #8fa0bd; }

.sidebar .nav { padding: 8px 0 16px; flex: 1; }
.nav-group {
  padding: 15px 18px 5px; font-size: 10.5px; font-weight: 700; letter-spacing: 1.2px;
  text-transform: uppercase; color: #6d7f9e;
}
.sidebar .nav-link {
  display: flex; align-items: center; color: #cdd6e6; padding: 9px 18px; font-size: 13.5px;
  border-left: 3px solid transparent; border-radius: 0;
}
.sidebar .nav-link:hover { background: var(--navy-2); color: #fff; }
.sidebar .nav-link.active { background: var(--navy-2); color: #fff; border-left-color: var(--red); font-weight: 600; }
.sidebar-foot { padding: 13px 18px; font-size: 11px; color: #6d7f9e; border-top: 1px solid rgba(255,255,255,.08); }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  background: #fff; border-bottom: 1px solid #e4e8f0; display: flex; align-items: center;
  gap: 12px; padding: 0 22px; height: 60px; position: sticky; top: 0; z-index: 1030;
}
.topbar-title { font-size: 16px; font-weight: 700; color: var(--navy); }
.menu-btn { color: var(--navy); font-size: 19px; }
.avatar {
  width: 35px; height: 35px; border-radius: 50%; background: var(--navy-3); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px;
}
.bell { color: var(--navy); }
.notif-menu { width: 330px; max-height: 420px; overflow-y: auto; }
.notif-item { white-space: normal; border-bottom: 1px solid #f0f2f7; padding: 8px 14px; }
.notif-item.unread { background: #eef3fc; }

.content { padding: 24px; flex: 1; }
.pagefoot { padding: 13px 24px; font-size: 12px; color: #6b7488; border-top: 1px solid #e4e8f0; }

/* ---------- Cards / stats ---------- */
.card { border: 1px solid #e4e8f0; box-shadow: 0 1px 3px rgba(13,31,60,.06); margin-bottom: 20px; }
.card-header { background: #fff; font-weight: 700; color: var(--navy); }
.stat-card { display: flex; gap: 14px; align-items: center; padding: 16px 18px; }
.stat-ic {
  width: 46px; height: 46px; border-radius: 10px; display: flex; align-items: center;
  justify-content: center; font-size: 19px; flex-shrink: 0;
}
.ic-navy { background: #e6ecf8; color: var(--navy-3); }
.ic-red { background: #fdecec; color: var(--red); }
.ic-ok { background: #e6f4ec; color: #157347; }
.ic-warn { background: #fff4d6; color: #9a6700; }
.stat-num { font-size: 23px; font-weight: 800; color: var(--navy); line-height: 1.1; }
.stat-lbl { font-size: 12.5px; color: #6b7488; }

/* ---------- Buttons / theme ---------- */
.btn-navy { background: var(--navy); color: #fff; }
.btn-navy:hover { background: var(--navy-3); color: #fff; }
.btn-red { background: var(--red); color: #fff; }
.btn-red:hover { background: #9d0000; color: #fff; }
.text-navy { color: var(--navy) !important; }

/* ---------- Built-in rich-text editor ---------- */
.rte-source { display: none !important; }
.rte-shell {
  overflow: hidden; border: 1px solid #cfd6e2; border-radius: 9px; background: #fff;
  box-shadow: 0 1px 2px rgba(13,31,60,.04); transition: border-color .15s, box-shadow .15s;
}
.rte-shell:focus-within { border-color: #59749f; box-shadow: 0 0 0 .2rem rgba(13,31,60,.12); }
.rte-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 5px; padding: 8px;
  background: #f4f6fa; border-bottom: 1px solid #dfe4ec;
}
.rte-group { display: inline-flex; align-items: center; gap: 2px; padding-right: 5px; border-right: 1px solid #d8dee8; }
.rte-group:last-child { padding-right: 0; border-right: 0; }
.rte-button, .rte-format {
  min-width: 34px; height: 34px; border: 1px solid transparent; border-radius: 6px;
  background: transparent; color: var(--navy); font-size: 13px;
}
.rte-button:hover, .rte-button:focus-visible, .rte-button.is-active {
  background: #e2e8f2; border-color: #c5cfdf; color: var(--red); outline: 0;
}
.rte-format { width: 118px; padding: 0 8px; background: #fff; border-color: #cfd6e2; }
.rte-surface {
  min-height: 300px; max-height: 620px; overflow-y: auto; padding: 18px 20px;
  color: #1b2738; line-height: 1.65; outline: 0; overflow-wrap: anywhere;
}
.rte-surface:empty::before { content: attr(data-placeholder); color: #8b96a8; pointer-events: none; }
.rte-surface.is-invalid { box-shadow: inset 0 0 0 2px #dc3545; }
.rte-surface h1, .rte-surface h2, .rte-surface h3 { color: var(--navy); }
.rte-surface blockquote { margin: 1rem 0; padding: .7rem 1rem; border-left: 4px solid var(--red); background: #f7f8fb; color: #536078; }
.rte-surface table { width: 100%; border-collapse: collapse; }
.rte-surface th, .rte-surface td { padding: .5rem; border: 1px solid #d8dee8; }
.rte-surface img { max-width: 100%; height: auto; }
.rte-status {
  display: flex; justify-content: space-between; gap: 12px; padding: 5px 10px;
  border-top: 1px solid #edf0f5; background: #fbfcfe; color: #7a8598; font-size: 10.5px;
}

/* ---------- 2-step method switches ---------- */
.two-factor-method { border: 1px solid #dfe4ec; border-radius: 10px; padding: 16px; background: #fff; }
.two-factor-method.is-enabled { border-color: #a8d4b9; box-shadow: inset 4px 0 #198754; }
.two-factor-method .form-switch { margin: 0; min-height: auto; }
.two-factor-method .form-check-input { width: 2.8em; height: 1.45em; cursor: pointer; }
.two-factor-method .method-state { min-width: 31px; font-weight: 700; font-size: 11px; text-align: center; }
.two-factor-choices { display: grid; gap: 14px; }
.two-factor-divider { display: flex; align-items: center; gap: 10px; margin: 14px 0; color: #8792a5; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.two-factor-divider::before, .two-factor-divider::after { content: ''; height: 1px; background: #dfe4ec; flex: 1; }

/* ---------- Info rows ---------- */
.info-row { display: flex; gap: 12px; padding: 8px 0; border-bottom: 1px dashed #e4e8f0; font-size: 13.5px; }
.info-row:last-child { border-bottom: none; }
.info-row .k { width: 165px; min-width: 165px; color: #6b7488; font-weight: 600; }

/* ---------- Agreement ---------- */
.agreement-body {
  background: #fff; border: 1px solid #e4e8f0; border-radius: 8px; padding: 30px;
  font-family: Georgia, "Times New Roman", serif; line-height: 1.75; font-size: 14px;
}
.agreement-scroll { max-height: 480px; overflow-y: auto; }
.sig-box { border: 2px dashed #b9c3d6; border-radius: 8px; background: #fbfcff; touch-action: none; width: 100%; }
.sig-preview { max-height: 90px; border: 1px solid #e4e8f0; border-radius: 6px; background: #fff; padding: 4px; }

@media print {
  .sidebar, .topbar, .pagefoot, .no-print { display: none !important; }
  body { background: #fff; }
  .content { padding: 0; }
  .agreement-body { border: none; padding: 0; }
}

/* ---------- Login ---------- */
.auth-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(140deg, var(--navy) 0%, var(--navy-3) 100%); padding: 20px;
}
.auth-card {
  width: 420px; max-width: 100%; background: #fff; border-radius: 14px;
  padding: 36px 34px; box-shadow: 0 20px 60px rgba(0,0,0,.35); border-top: 5px solid var(--red);
}

/* ---------- Responsive ---------- */
@media (max-width: 991px) {
  .sidebar { position: fixed; left: -270px; transition: left .25s; }
  .sidebar.open { left: 0; box-shadow: 6px 0 30px rgba(0,0,0,.4); }
}

@media (max-width: 575px) {
  .rte-toolbar { gap: 3px; padding: 6px; }
  .rte-group { padding-right: 3px; }
  .rte-button { min-width: 31px; height: 31px; }
  .rte-format { width: 108px; height: 31px; }
  .rte-surface { min-height: 240px; padding: 14px; }
}
