:root {
  --red: #991b1b;
  --red-700: #b91c1c;
  --bg: #f9f9f8;
  --ink: #1a1c1b;
  --ctrl-h: 40px;
  --ctrl-radius: 10px;
  --ctrl-pad-x: .85rem;
  --ctrl-font: .9rem;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Roboto", system-ui, sans-serif;
  font-optical-sizing: auto;
  background: var(--bg);
  color: var(--ink);
  display: flex;
  min-height: 100vh;
}

/* Tabler icons */
.ti {
  font-size: 1.15rem;
  line-height: 1;
  vertical-align: -0.12em;
  flex-shrink: 0;
}
.sidebar a .ti { font-size: 1.2rem; opacity: .92; }
.sidebar a.is-active .ti { opacity: 1; }
.sidebar {
  width: 260px;
  flex-shrink: 0;
  background: linear-gradient(180deg, #7f1d1d, #450a0a);
  color: #fff;
  padding: 1.15rem 1rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: .75rem;
  transition: width .22s ease, padding .22s ease;
  overflow: hidden;
}
.brand {
  display: flex;
  align-items: center;
  gap: .7rem;
  margin-bottom: .5rem;
  padding: .35rem .4rem .85rem;
  border-bottom: 1px solid rgba(255,255,255,.12);
  min-height: 52px;
}
.brand__text {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  transition: opacity .18s ease, width .18s ease;
}
.brand__logo {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: #fff;
  object-fit: contain;
}
.brand strong {
  display: block;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: -.02em;
  font-size: 1rem;
  line-height: 1.1;
}
.brand span {
  display: block;
  margin-top: .15rem;
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #fecaca;
}
.sidebar nav { display: grid; gap: .15rem; flex: 1; align-content: start; overflow-y: auto; overflow-x: hidden; padding-right: .15rem; }
.nav-group {
  margin: .95rem 0 .3rem;
  padding: .35rem .65rem 0;
  font-size: .62rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: rgba(254, 202, 202, .55);
  border-top: 1px solid rgba(255,255,255,.08);
}
.sidebar nav > .nav-group:first-child {
  margin-top: .15rem;
  padding-top: 0;
  border-top: none;
}
.sidebar a {
  display: flex;
  align-items: center;
  gap: .55rem;
  color: #fecaca;
  text-decoration: none;
  padding: .55rem .7rem;
  border-radius: 9px;
  font-weight: 600;
  font-size: .875rem;
  white-space: nowrap;
}
.sidebar a .ti { font-size: 1.15rem; opacity: .9; flex-shrink: 0; }
.sidebar a:hover { background: rgba(255,255,255,.1); color: #fff; }
.sidebar a.is-active {
  background: rgba(255,255,255,.16);
  color: #fff;
  box-shadow: inset 3px 0 0 #fecaca;
}
.nav-label {
  overflow: hidden;
  white-space: nowrap;
  transition: opacity .15s ease, max-width .2s ease;
  max-width: 180px;
}
.sidebar-collapse {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: .55rem;
  width: 100%;
  border: 0;
  background: rgba(255,255,255,.08);
  color: #fecaca;
  padding: .58rem .7rem;
  border-radius: 9px;
  font-weight: 700;
  font-size: .85rem;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
}
.sidebar-collapse:hover { background: rgba(255,255,255,.14); color: #fff; }
.sidebar-collapse .ti { font-size: 1.2rem; flex-shrink: 0; }
.sidebar-close {
  display: none;
  margin-left: auto;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 0;
  border-radius: 10px;
  background: rgba(255,255,255,.1);
  color: #fff;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}
.sidebar-close .ti { font-size: 1.25rem; }
.sidebar-close:hover { background: rgba(255,255,255,.18); }
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(24, 24, 27, .45);
  backdrop-filter: blur(2px);
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
}

html.sidebar-collapsed .sidebar {
  width: 76px;
  padding-left: .7rem;
  padding-right: .7rem;
  overflow: visible;
  z-index: 30;
}
html.sidebar-collapsed .brand {
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
}
html.sidebar-collapsed .brand__text,
html.sidebar-collapsed .nav-group {
  opacity: 0;
  max-width: 0;
  width: 0;
  pointer-events: none;
  overflow: hidden;
}
html.sidebar-collapsed .sidebar a,
html.sidebar-collapsed .sidebar-collapse {
  position: relative;
  justify-content: center;
  padding-left: .55rem;
  padding-right: .55rem;
  gap: 0;
}
html.sidebar-collapsed .sidebar a.is-active {
  background: rgba(255,255,255,.2);
}

/* Collapsed: label flies out horizontally on hover */
html.sidebar-collapsed .sidebar a .nav-label,
html.sidebar-collapsed .sidebar-collapse .nav-label {
  position: absolute;
  left: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%) translateX(-4px);
  opacity: 0;
  visibility: hidden;
  max-width: none;
  width: max-content;
  pointer-events: none;
  padding: .42rem .8rem;
  border-radius: 8px;
  background: #450a0a;
  color: #fff;
  font-size: .86rem;
  font-weight: 700;
  letter-spacing: .01em;
  box-shadow: 0 10px 28px rgba(24, 24, 27, .28);
  z-index: 40;
  transition: opacity .15s ease, transform .15s ease, visibility .15s ease;
}
html.sidebar-collapsed .sidebar a .nav-label::before,
html.sidebar-collapsed .sidebar-collapse .nav-label::before {
  content: "";
  position: absolute;
  left: -5px;
  top: 50%;
  width: 10px;
  height: 10px;
  background: #450a0a;
  transform: translateY(-50%) rotate(45deg);
  border-radius: 2px;
}
html.sidebar-collapsed .sidebar a:hover .nav-label,
html.sidebar-collapsed .sidebar a:focus-visible .nav-label,
html.sidebar-collapsed .sidebar-collapse:hover .nav-label,
html.sidebar-collapsed .sidebar-collapse:focus-visible .nav-label {
  opacity: 1;
  visibility: visible;
  transform: translateY(-50%) translateX(0);
}

.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
  background: rgba(255,255,255,.92);
  border-bottom: 1px solid #e4e4e7;
  position: sticky;
  top: 0;
  z-index: 5;
  backdrop-filter: blur(8px);
}
.top__left {
  display: flex;
  align-items: center;
  gap: .65rem;
  min-width: 0;
}
.top__sidebar-btn {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid #e4e4e7;
  border-radius: 10px;
  background: #fff;
  color: #52525b;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
  line-height: 1;
  font: inherit;
}
.top__sidebar-btn .ti {
  font-size: 1.25rem;
  line-height: 1;
  width: 1.25rem;
  height: 1.25rem;
  display: grid;
  place-items: center;
  vertical-align: 0;
  margin: 0;
}
.top__sidebar-btn:hover {
  color: var(--red);
  border-color: #fecaca;
  background: #fef2f2;
}
.top__title { font-weight: 800; color: #3f3f46; }
.top__actions { display: flex; align-items: center; gap: .65rem; }
.top button:not(.top__sidebar-btn):not(.notif__btn):not(.user-menu__btn) {
  border: 0;
  background: #f4f4f5;
  padding: .5rem .9rem;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
}

.notif { position: relative; }
.notif__btn {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid #e4e4e7;
  border-radius: 12px;
  background: #fff;
  color: #52525b;
  cursor: pointer;
  line-height: 1;
  font: inherit;
}
.notif__btn .ti {
  font-size: 1.25rem;
  line-height: 1;
  width: 1.25rem;
  height: 1.25rem;
  display: grid;
  place-items: center;
  vertical-align: 0;
  margin: 0;
}
.notif__btn:hover,
.notif.is-open .notif__btn {
  color: var(--red);
  border-color: #fecaca;
  background: #fff7f7;
}
.notif__badge {
  position: absolute;
  top: -2px;
  right: -2px;
  z-index: 1;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-size: .62rem;
  font-weight: 800;
  line-height: 16px;
  text-align: center;
  box-shadow: 0 0 0 2px #fff;
  pointer-events: none;
}
.notif__panel {
  position: absolute;
  right: 0;
  top: calc(100% + .45rem);
  width: min(360px, calc(100vw - 1.5rem));
  background: #fff;
  border: 1px solid #e4e4e7;
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(40, 10, 10, .14);
  z-index: 45;
  overflow: hidden;
}
.notif__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .85rem 1rem;
  border-bottom: 1px solid #f4f4f5;
}
.notif__head strong {
  font-size: .92rem;
  font-weight: 800;
  color: #18181b;
}
.notif__mark {
  border: 0;
  background: transparent;
  color: var(--red);
  font: inherit;
  font-size: .75rem;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
}
.notif__mark:hover { text-decoration: underline; }
.notif__list {
  max-height: min(420px, 60vh);
  overflow: auto;
  padding: .35rem;
}
.notif__empty {
  padding: 1.5rem 1rem;
  text-align: center;
  color: #a1a1aa;
  font-size: .85rem;
  font-weight: 600;
}
.notif__item {
  display: flex;
  gap: .7rem;
  align-items: flex-start;
  padding: .7rem .75rem;
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
}
.notif__item:hover { background: #fafafa; }
.notif__item.is-unread {
  background: #fff7f7;
}
.notif__item.is-unread:hover { background: #fef2f2; }
.notif__ico {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: #f4f4f5;
  color: #71717a;
  flex-shrink: 0;
}
.notif__item.is-unread .notif__ico {
  background: #fee2e2;
  color: var(--red);
}
.notif__ico .ti { font-size: 1.15rem; }
.notif__body {
  display: flex;
  flex-direction: column;
  gap: .15rem;
  min-width: 0;
  flex: 1;
}
.notif__body strong {
  font-size: .84rem;
  font-weight: 750;
  color: #18181b;
  line-height: 1.35;
}
.notif__body small {
  font-size: .75rem;
  color: #71717a;
  font-weight: 600;
  line-height: 1.3;
}
.notif__body em {
  font-style: normal;
  font-size: .7rem;
  color: #a1a1aa;
  font-weight: 650;
  margin-top: .1rem;
}
.notif__foot {
  border-top: 1px solid #f4f4f5;
  padding: .65rem .9rem;
}
.notif__foot a {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: .82rem;
  font-weight: 700;
  color: #b91c1c;
  text-decoration: none;
}
.notif__foot a:hover { text-decoration: underline; }

.user-menu { position: relative; }
.user-menu__btn {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  height: 42px;
  padding: .2rem .55rem .2rem .25rem;
  border: 1px solid #e4e4e7;
  border-radius: 999px;
  background: #fff;
  cursor: pointer;
  font: inherit;
}
.user-menu__btn:hover,
.user-menu.is-open .user-menu__btn {
  border-color: #fecaca;
  background: #fff7f7;
}
.user-menu__avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #c01f26, #7f1d1d);
  color: #fff;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .02em;
  flex-shrink: 0;
}
.user-menu__avatar--lg {
  width: 40px;
  height: 40px;
  font-size: .82rem;
}
.user-menu__meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.15;
  text-align: left;
  max-width: 140px;
}
.user-menu__meta strong {
  font-size: .82rem;
  font-weight: 800;
  color: #18181b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.user-menu__meta small {
  font-size: .7rem;
  color: #71717a;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.user-menu__caret {
  font-size: 1.15rem;
  color: #a1a1aa;
  transition: transform .15s ease;
}
.user-menu.is-open .user-menu__caret { transform: rotate(180deg); }
.user-menu__dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + .45rem);
  width: min(260px, calc(100vw - 2rem));
  background: #fff;
  border: 1px solid #e4e4e7;
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(40, 10, 10, .14);
  padding: .45rem;
  z-index: 40;
}
.user-menu__head {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .65rem .7rem .75rem;
  border-bottom: 1px solid #f4f4f5;
  margin-bottom: .35rem;
}
.user-menu__head strong {
  display: block;
  font-size: .9rem;
  font-weight: 800;
  color: #18181b;
}
.user-menu__head small {
  display: block;
  margin-top: .15rem;
  font-size: .75rem;
  color: #71717a;
  font-weight: 600;
}
.user-menu__item {
  display: flex;
  align-items: center;
  gap: .55rem;
  width: 100%;
  padding: .65rem .7rem;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #3f3f46;
  font: inherit;
  font-size: .9rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  text-align: left;
  box-sizing: border-box;
}
.user-menu__item .ti { font-size: 1.2rem; color: #71717a; }
.user-menu__item:hover { background: #f4f4f5; color: #18181b; }
.user-menu__item.is-active {
  background: #fef2f2;
  color: var(--red);
}
.user-menu__item.is-active .ti { color: var(--red); }
.user-menu__item--danger { color: #b91c1c; }
.user-menu__item--danger .ti { color: #b91c1c; }
.user-menu__item--danger:hover { background: #fef2f2; }
.user-menu__sep {
  height: 1px;
  background: #f4f4f5;
  margin: .35rem .4rem;
}
.user-menu__logout { margin: 0; }
@media (max-width: 700px) {
  .user-menu__meta { display: none; }
}
main {
  padding: 1.5rem;
  flex: 1;
  min-width: 0;
  overflow-x: clip;
}
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; }
.card { background: #fff; border: 1px solid #e4e4e7; border-radius: 16px; padding: 1.1rem; box-shadow: 0 8px 20px rgba(0,0,0,.04); }
.card span { display: block; color: #71717a; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.card strong { display: block; margin-top: .6rem; font-size: 1.8rem; color: var(--red); }
table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 12px; overflow: hidden; }
th, td { padding: .85rem; border-bottom: 1px solid #f4f4f5; text-align: left; font-size: .92rem; }
th { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: #71717a; background: #fafafa; }
/* ===== Portal login ===== */
.login-body {
  display: block;
  min-height: 100vh;
  margin: 0;
  font-family: "Roboto", system-ui, sans-serif;
  color: #1c1917;
  background:
    radial-gradient(ellipse 80% 55% at 12% 0%, rgba(192, 31, 38, .18), transparent 55%),
    radial-gradient(ellipse 70% 50% at 100% 100%, rgba(212, 175, 55, .12), transparent 50%),
    linear-gradient(165deg, #f8f4f0 0%, #efe6df 48%, #e8ddd4 100%);
  background-attachment: fixed;
}

.login-stage {
  min-height: 100vh;
  display: grid;
  place-content: center;
  gap: 1.15rem;
  padding: 1.5rem 1rem 1.75rem;
}

.login-shell {
  width: min(880px, 100%);
  display: grid;
  grid-template-columns: 1fr;
  background: #fff;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid rgba(127, 29, 29, .08);
  box-shadow:
    0 24px 48px rgba(69, 10, 10, .12),
    0 2px 6px rgba(28, 25, 23, .04);
  animation: login-rise .55s cubic-bezier(.22, 1, .36, 1) both;
}

@media (min-width: 860px) {
  .login-shell { grid-template-columns: 1fr 1.05fr; min-height: 520px; }
}

@keyframes login-rise {
  from { opacity: 0; transform: translateY(14px) scale(.985); }
  to { opacity: 1; transform: none; }
}

.login-brand {
  position: relative;
  background: linear-gradient(155deg, #a3181f 0%, #7f1d1d 42%, #5c1010 100%);
  color: #fff;
  padding: 2.6rem 2.15rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
}

.login-brand__pattern {
  position: absolute;
  inset: -8%;
  background: url("/images/brand/bg.svg") center / cover no-repeat;
  opacity: .28;
  pointer-events: none;
  animation: login-pattern 18s ease-in-out infinite alternate;
}

@keyframes login-pattern {
  from { transform: scale(1) translate(0, 0); }
  to { transform: scale(1.06) translate(-1.5%, 1%); }
}

.login-brand::after {
  content: "";
  position: absolute;
  inset: auto -18% -28% auto;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(245, 197, 66, .28), transparent 68%);
  pointer-events: none;
  animation: login-glow 7s ease-in-out infinite alternate;
}

@keyframes login-glow {
  from { transform: translate(-6%, 4%) scale(1); opacity: .65; }
  to { transform: translate(8%, -8%) scale(1.14); opacity: 1; }
}

.login-brand__inner {
  position: relative;
  z-index: 1;
  max-width: 24rem;
  animation: login-fade .7s .12s cubic-bezier(.22, 1, .36, 1) both;
}

@keyframes login-fade {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.login-emblem {
  width: 76px;
  height: 76px;
  border-radius: 16px;
  background: linear-gradient(145deg, #f8e7b0, #d4af37 55%, #b8860b);
  padding: 2px;
  margin-bottom: 1.5rem;
  box-shadow: 0 10px 24px rgba(0, 0, 0, .22);
}

.login-emblem__inner {
  width: 100%;
  height: 100%;
  border-radius: 14px;
  background: linear-gradient(180deg, #fffaf0, #f3e2b0);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.login-emblem img {
  width: 78%;
  height: auto;
  object-fit: contain;
  display: block;
}

.login-brand__eyebrow {
  margin: 0 0 .65rem;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #f5d78e;
}

.login-brand h1 {
  margin: 0;
  display: flex;
  flex-direction: column;
  font-family: "Cormorant Garamond", "Times New Roman", serif;
  font-size: clamp(1.9rem, 3.2vw, 2.45rem);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -.01em;
}
.login-brand__title-line {
  display: block;
  white-space: nowrap;
}
.login-brand__title-portal {
  display: block;
  font-weight: 600;
  opacity: .92;
}

.login-brand__rule {
  width: 2.75rem;
  height: 2px;
  background: linear-gradient(90deg, #f5c542, transparent);
  border-radius: 999px;
  margin: 1.05rem 0 1rem;
}

.login-brand__lead {
  margin: 0;
  font-size: .9rem;
  line-height: 1.6;
  color: rgba(255, 255, 255, .86);
  font-weight: 400;
  max-width: 18.5rem;
}

.login-panel {
  padding: 2.5rem 2.25rem 2.2rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: #fff;
  animation: login-fade .65s .18s cubic-bezier(.22, 1, .36, 1) both;
}

.login-panel__head { margin-bottom: 1.5rem; }

.login-panel__eyebrow {
  margin: 0 0 .45rem;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #b91c1c;
}

.login-panel h2 {
  margin: 0;
  color: #1c1917;
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -.03em;
  line-height: 1.15;
}

.login-panel__sub {
  margin: .45rem 0 0;
  color: #78716c;
  font-size: .9rem;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  line-height: 1.45;
}

.login-alert:empty { display: none; }
.login-alert {
  margin: 0 0 1rem;
  padding: .75rem .9rem;
  border-radius: 12px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  font-size: .88rem;
  font-weight: 600;
}
.login-alert ul { margin: 0; padding-left: 1.1rem; }

.login-form { display: grid; gap: .1rem; }

.auth-field { margin-bottom: 1.05rem; }
.auth-field label {
  display: block;
  margin-bottom: .45rem;
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .02em;
  text-transform: none;
  color: #44403c;
}

.input-shell {
  display: flex;
  align-items: center;
  gap: .55rem;
  background: #fafaf9;
  border: 1px solid #e7e5e4;
  border-radius: 12px;
  padding: 0 .95rem;
  min-height: 50px;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.input-shell:hover { border-color: #d6d3d1; }
.input-shell:focus-within {
  background: #fff;
  border-color: #b91c1c;
  box-shadow: 0 0 0 3px rgba(185, 28, 28, .12);
}
.input-shell .ti {
  color: #a8a29e;
  font-size: 1.15rem;
}
.input-shell:focus-within .ti { color: #b91c1c; }
.input-shell input {
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  font: inherit;
  font-size: .95rem;
  padding: .9rem 0;
  color: #1c1917;
  min-width: 0;
}
.input-shell input::placeholder { color: #a8a29e; }
.input-shell .toggle-pass {
  border: 0;
  background: transparent;
  color: #a8a29e;
  cursor: pointer;
  padding: .3rem;
  display: grid;
  place-items: center;
  border-radius: 8px;
}
.input-shell .toggle-pass:hover {
  color: #8f1419;
  background: #fef2f2;
}

.btn-login-main {
  width: 100%;
  margin-top: .55rem;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(180deg, #c8252c, #8f1419);
  color: #fff;
  font: inherit;
  font-weight: 700;
  font-size: .92rem;
  letter-spacing: .02em;
  text-transform: none;
  padding: 1rem 1.15rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  box-shadow: 0 10px 22px rgba(143, 20, 25, .28);
  transition: filter .15s ease, transform .15s ease, box-shadow .15s ease;
}
.btn-login-main .ti { font-size: 1.15rem; transition: transform .2s ease; }
.btn-login-main:hover {
  filter: brightness(1.05);
  box-shadow: 0 14px 28px rgba(143, 20, 25, .34);
}
.btn-login-main:hover .ti { transform: translateX(3px); }
.btn-login-main:active { transform: translateY(1px); }

.login-foot {
  margin: 0;
  text-align: center;
  font-size: .75rem;
  font-weight: 500;
  letter-spacing: .02em;
  text-transform: none;
  color: #78716c;
  animation: login-fade .6s .35s both;
}

@media (max-width: 859px) {
  .login-brand { min-height: 220px; padding: 2rem 1.5rem; }
  .login-panel { padding: 1.85rem 1.4rem 1.9rem; }
  .login-brand h1 { font-size: 1.85rem; }
  .login-brand__pattern { opacity: .22; }
}
.portal-credit { padding: 1rem 1.5rem 1.5rem; color: #a1a1aa; font-size: .8rem; font-weight: 600; }

/* ===== Admin chrome ===== */
.admin-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem 1.25rem;
  margin-bottom: 1.15rem;
  flex-wrap: wrap;
}
.admin-head h1 {
  margin: 0;
  font-size: 1.45rem;
  line-height: 1.25;
  letter-spacing: -.02em;
  color: var(--red);
}
.admin-head > .admin-toolbar__actions,
.admin-head > .btn-admin,
.admin-head > .btn-soft,
.admin-head > a.btn-soft,
.admin-head > .period-switch,
.admin-head > form {
  margin-left: auto;
  flex-shrink: 0;
}
.admin-head > div:first-child {
  min-width: 0;
  flex: 1 1 12rem;
}
.admin-head--section {
  align-items: center;
  margin-bottom: .85rem;
}
.admin-head--section h3 {
  margin: 0;
  font-size: 1.05rem;
  color: #18181b;
}
.btn-admin,
.btn-soft,
.admin-toolbar button,
.admin-toolbar .btn-admin,
.admin-actions .btn-admin,
.admin-actions .btn-soft,
.fm-toolbar .btn-admin {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  height: var(--ctrl-h);
  min-height: var(--ctrl-h);
  padding: 0 1.05rem;
  border-radius: var(--ctrl-radius);
  font: inherit;
  font-size: var(--ctrl-font);
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
  box-sizing: border-box;
  white-space: nowrap;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.btn-admin {
  background: var(--red-700);
  color: #fff;
  border: 1px solid transparent;
}
.btn-admin:hover { background: var(--red); }
.btn-soft {
  background: #fff;
  color: #3f3f46;
  border: 1px solid #e4e4e7;
}
.btn-soft:hover { background: #fafafa; border-color: #d4d4d8; }
.btn-admin--ghost {
  background: #fff;
  color: var(--red);
  border: 1px solid #fecaca;
}
.btn-admin--ghost:hover { background: #fef2f2; }
.btn-admin--danger {
  background: #b91c1c;
  color: #fff;
  border: 1px solid transparent;
}
.btn-admin--danger:hover { background: #991b1b; }
.btn-admin .ti,
.btn-soft .ti,
.admin-toolbar button .ti {
  font-size: 1.15rem;
  line-height: 1;
  font-variation-settings: "FILL" 0, "wght" 500, "GRAD" 0, "opsz" 20;
}

/* ===== UI modals (confirm / flash) ===== */
.ui-modal {
  border: none;
  border-radius: 18px;
  padding: 0;
  max-width: min(420px, calc(100vw - 2rem));
  width: 100%;
  background: transparent;
  box-shadow: none;
}
.ui-modal::backdrop {
  background: rgba(24, 24, 27, .48);
  backdrop-filter: blur(2px);
}
.ui-modal__card {
  margin: 0;
  padding: 1.35rem 1.4rem 1.3rem;
  background: #fff;
  border: 1px solid #e4e4e7;
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(24, 24, 27, .22);
  display: grid;
  gap: .55rem;
  justify-items: center;
  text-align: center;
}
.ui-modal__icon {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  margin-bottom: .15rem;
}
.ui-modal__icon .ti {
  font-size: 1.75rem;
  font-variation-settings: "FILL" 1, "wght" 500, "GRAD" 0, "opsz" 24;
}
.ui-modal__icon--ok { background: #ecfdf5; color: #047857; }
.ui-modal__icon--err { background: #fef2f2; color: #b91c1c; }
.ui-modal__icon--warn { background: #fff7ed; color: #c2410c; }
.ui-modal__title {
  margin: 0;
  font-size: 1.15rem;
  letter-spacing: -.01em;
  color: #18181b;
}
.ui-modal__msg {
  margin: 0;
  color: #52525b;
  font-size: .95rem;
  line-height: 1.45;
  max-width: 34ch;
}
.ui-modal__actions {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem;
  justify-content: center;
  margin-top: .65rem;
  width: 100%;
}
.ui-modal__actions .btn-admin,
.ui-modal__actions .btn-soft {
  min-width: 108px;
}
.alert-ok {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
  padding: .8rem 1rem;
  border-radius: 12px;
  margin-bottom: 1rem;
  font-weight: 600;
}
.muted { color: #71717a; font-size: .8rem; margin-top: .2rem; }
.muted--flush { margin: .15rem 0 .35rem; }
.muted--lead { margin: .35rem 0 0; font-size: .88rem; font-weight: 500; max-width: 42rem; }

/* Row actions — icon-only, horizontal */
.actions {
  display: inline-flex;
  gap: .28rem;
  align-items: center;
  flex-wrap: nowrap;
  justify-content: flex-end;
}
.actions__form,
.form-inline { display: inline-flex; margin: 0; }
.btn-row {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  min-width: 32px;
  padding: 0;
  border-radius: 8px;
  border: 1px solid #fecaca;
  background: #fff;
  color: var(--red);
  font: inherit;
  text-decoration: none;
  cursor: pointer;
  box-sizing: border-box;
  transition: background .12s ease, border-color .12s ease, color .12s ease;
}
.btn-row .ti {
  font-size: 1.15rem;
  line-height: 1;
  font-variation-settings: "FILL" 0, "wght" 500, "GRAD" 0, "opsz" 20;
}
.btn-row:hover { background: #fef2f2; }
.btn-row--ghost { border-color: #e4e4e7; color: #52525b; }
.btn-row--ghost:hover { background: #f4f4f5; color: #18181b; }
.btn-row--danger {
  border-color: #fecaca;
  color: #b91c1c;
  background: #fff;
}
.btn-row--danger:hover { background: #fef2f2; }
.link-danger {
  display: inline-flex;
  align-items: center;
  gap: .2rem;
  background: none;
  border: 0;
  color: #b91c1c;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
  font: inherit;
}
.link-danger .ti { font-size: 1.05rem; line-height: 1; }

/* Forms */
.admin-form {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  width: 100%;
  max-width: 720px;
  background: #fff;
  border: 1px solid #e4e4e7;
  border-radius: 16px;
  padding: 1.35rem 1.5rem 1.4rem;
  box-shadow: 0 1px 2px rgba(24, 24, 27, .03);
}
.admin-form--wide { max-width: 980px; }
.admin-form > label:not(.chk),
.admin-form .field > label,
.admin-form .admin-row > div > label {
  display: block;
  font-size: .72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #71717a;
  margin: .85rem 0 0;
}
.admin-form > label:not(.chk):first-of-type,
.admin-form > .alert-err + label:not(.chk),
.admin-form > .field:first-of-type > label,
.admin-form > .admin-row:first-of-type > div > label {
  margin-top: 0;
}
.admin-form .field {
  display: grid;
  gap: .4rem;
  margin-top: .85rem;
}
.admin-form .field:first-child,
.admin-form > .alert-err + .field { margin-top: 0; }
.admin-form .field > label { margin: 0; }
.admin-form input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
.admin-form select,
.admin-form textarea {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  border: 1px solid #e4e4e7;
  border-radius: var(--ctrl-radius);
  font: inherit;
  font-size: var(--ctrl-font);
  box-sizing: border-box;
  background: #fff;
  color: #18181b;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.admin-form input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):focus,
.admin-form select:focus,
.admin-form textarea:focus {
  outline: none;
  border-color: #fca5a5;
  box-shadow: 0 0 0 3px rgba(185, 28, 28, .1);
}
.admin-form input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
.admin-form select {
  height: var(--ctrl-h);
  min-height: var(--ctrl-h);
  padding: 0 var(--ctrl-pad-x);
  line-height: 1.25;
}
.admin-form textarea {
  min-height: 96px;
  padding: .7rem var(--ctrl-pad-x);
  line-height: 1.45;
  resize: vertical;
}
.admin-form input[type="hidden"] {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
}
.admin-form select {
  appearance: none;
  -webkit-appearance: none;
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .75rem center;
  background-size: 1rem;
  padding-right: 2.2rem;
}
.admin-form textarea.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .82rem; }
.admin-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: .85rem;
  align-items: start;
}
.admin-form > .admin-row:first-of-type { margin-top: 0; }
.admin-row > div,
.admin-row > .field {
  display: grid;
  gap: .4rem;
  min-width: 0;
  margin-top: 0;
}
.admin-row > div > label,
.admin-row > .field > label { margin: 0; }
.admin-row--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.admin-row--end { align-items: end; }
.admin-form > .chk { margin-top: .85rem; }
.admin-form .admin-checkrow {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem 1.35rem;
  margin-top: 1rem;
  padding: .9rem 1rem;
  background: #fafafa;
  border: 1px solid #f4f4f5;
  border-radius: 12px;
}
.admin-form .admin-checkrow .chk { margin-top: 0; }
.admin-section--pad {
  margin-top: .35rem;
  padding: .85rem 1rem;
  background: #fafafa;
  border: 1px solid #f4f4f5;
  border-radius: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: .55rem 1.1rem;
}
.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .65rem;
  align-items: center;
  margin-top: 1.25rem;
  padding-top: 1.15rem;
  border-top: 1px solid #f4f4f5;
}
.chk {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
  font-size: .92rem;
  line-height: 1.2;
  color: #18181b;
  cursor: pointer;
}
.chk input[type="checkbox"],
.chk input[type="radio"],
.admin-form input[type="checkbox"],
.admin-form input[type="radio"] {
  appearance: auto;
  -webkit-appearance: auto;
  width: 1.05rem;
  height: 1.05rem;
  min-width: 1.05rem;
  min-height: 1.05rem;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  background: none;
  box-shadow: none;
  flex-shrink: 0;
  align-self: center;
  accent-color: var(--red-700);
  vertical-align: middle;
}
.field-validation-error,
.validation-summary-errors { color: #b91c1c; font-size: .85rem; }
/* Hide empty validation / flash boxes (asp-validation-summary still renders a shell) */
.validation-summary-valid,
.alert-err:empty,
.alert-ok:empty,
.login-alert.validation-summary-valid {
  display: none !important;
}
@media (max-width: 800px) {
  .admin-row,
  .admin-row--3,
  .admin-row--end { grid-template-columns: 1fr; }
  .admin-toolbar .field,
  .admin-toolbar .field.grow,
  .admin-toolbar .field.field--sm {
    flex: 1 1 100%;
    max-width: none;
  }
  .admin-toolbar__actions {
    width: 100%;
    margin-left: 0;
  }
  .admin-toolbar__actions .btn-admin,
  .admin-toolbar__actions .btn-soft {
    flex: 1 1 auto;
  }
}

/* ===== Admin list / filter / pager ===== */
.admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: .85rem 1rem;
  align-items: end;
  margin-bottom: 1.1rem;
  padding: 1.05rem 1.15rem;
  background: #fff;
  border: 1px solid #e4e4e7;
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(24, 24, 27, .03);
}
.admin-toolbar .field {
  display: grid;
  gap: .35rem;
  flex: 1 1 150px;
  min-width: 140px;
  max-width: 240px;
}
.admin-toolbar .field.grow {
  flex: 2 1 260px;
  max-width: none;
  min-width: 200px;
}
.admin-toolbar .field.field--sm {
  flex: 0 1 140px;
  max-width: 160px;
}
.admin-toolbar label {
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: #71717a;
  line-height: 1.2;
}
.admin-toolbar input:not([type="checkbox"]):not([type="radio"]),
.admin-toolbar select {
  width: 100%;
  height: var(--ctrl-h);
  min-height: var(--ctrl-h);
  padding: 0 var(--ctrl-pad-x);
  border: 1px solid #e4e4e7;
  border-radius: var(--ctrl-radius);
  font: inherit;
  font-size: var(--ctrl-font);
  line-height: 1.25;
  background: #fff;
  box-sizing: border-box;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.admin-toolbar input:not([type="checkbox"]):not([type="radio"]):focus,
.admin-toolbar select:focus {
  outline: none;
  border-color: #fca5a5;
  box-shadow: 0 0 0 3px rgba(185, 28, 28, .1);
}
.admin-toolbar select {
  appearance: none;
  -webkit-appearance: none;
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .75rem center;
  background-size: 1rem;
  padding-right: 2.2rem;
}
.admin-toolbar__actions {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  align-items: center;
  margin-left: auto;
  padding-bottom: 0;
}
.admin-table-wrap {
  background: #fff;
  border: 1px solid #e4e4e7;
  border-radius: 14px;
  overflow: auto;
  box-shadow: 0 1px 2px rgba(24, 24, 27, .03);
}
.admin-table-wrap table { border-radius: 0; box-shadow: none; }
.admin-table-wrap th,
.admin-table-wrap td {
  padding: .8rem 1rem;
  vertical-align: middle;
}
.admin-table-wrap tbody tr:hover { background: #fffbfb; }
.admin-table-wrap tbody tr:last-child td { border-bottom: 0; }
.th-sort { white-space: nowrap; }
.th-sort.is-active .th-sort__link { color: var(--red); }
.th-sort__link {
  display: inline-flex;
  align-items: center;
  gap: .2rem;
  color: inherit;
  text-decoration: none;
  font: inherit;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.th-sort__link:hover { color: var(--red); }
.th-sort__icon .ti {
  font-size: 1rem;
  opacity: .55;
  vertical-align: middle;
}
.th-sort.is-active .th-sort__icon .ti { opacity: 1; color: var(--red); }
.th-actions {
  width: 1%;
  white-space: nowrap;
  text-align: right;
}
td.actions { text-align: right; }
.badge {
  display: inline-flex;
  align-items: center;
  padding: .22rem .55rem;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}
.badge--ok { background: #ecfdf5; color: #047857; }
.badge--warn { background: #fff7ed; color: #c2410c; }
.badge--muted { background: #f4f4f5; color: #52525b; }
.badge--danger { background: #fef2f2; color: #b91c1c; }
.badge--info { background: #eff6ff; color: #1d4ed8; }
.admin-pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-top: 1rem;
  padding-top: .15rem;
}
.admin-pager__info { font-size: .85rem; font-weight: 600; color: #71717a; }
.admin-pager__nav { display: flex; gap: .45rem; }
.admin-pager__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .2rem;
  height: var(--ctrl-h);
  min-height: var(--ctrl-h);
  padding: 0 .9rem;
  border-radius: var(--ctrl-radius);
  border: 1px solid #e4e4e7;
  background: #fff;
  color: var(--red);
  font-size: var(--ctrl-font);
  font-weight: 700;
  text-decoration: none;
  box-sizing: border-box;
}
.admin-pager__btn .ti { font-size: 1.15rem; line-height: 1; }
.admin-pager__btn:hover { background: #fef2f2; }
.admin-pager__btn.is-disabled { opacity: .45; pointer-events: none; color: #a1a1aa; }
.admin-empty {
  padding: 2.25rem 1rem;
  text-align: center;
  color: #71717a;
  font-weight: 600;
}
.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem;
  margin-bottom: 1.15rem;
  border-bottom: 1px solid #e4e4e7;
  padding-bottom: 0;
}
.admin-tabs a {
  padding: .7rem 1rem;
  border-radius: 10px 10px 0 0;
  text-decoration: none;
  font-weight: 700;
  font-size: .88rem;
  color: #71717a;
  border: 1px solid transparent;
  border-bottom: none;
  margin-bottom: -1px;
}
.admin-tabs a:hover { color: var(--red); background: #fff; }
.admin-tabs a.is-active {
  color: var(--red);
  background: #fff;
  border-color: #e4e4e7;
  border-bottom-color: #fff;
}
.admin-section {
  background: #fff;
  border: 1px solid #e4e4e7;
  border-radius: 14px;
  padding: 1.15rem;
  margin-bottom: 1rem;
}
.admin-section h3 {
  margin: 0 0 .85rem;
  font-size: 1rem;
  color: #3f3f46;
}
.repeat-row {
  display: grid;
  gap: .4rem;
  padding: 1rem 1.1rem;
  border: 1px solid #e4e4e7;
  border-radius: 12px;
  margin-bottom: .75rem;
  background: #fff;
}
.repeat-row__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .5rem;
  font-weight: 800;
  font-size: .72rem;
  color: #71717a;
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: .25rem;
  padding-bottom: .55rem;
  border-bottom: 1px solid #f4f4f5;
}
.material-row .repeat-row__head {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: 0;
  text-transform: none;
  letter-spacing: 0;
}
.material-row.is-open .repeat-row__head {
  margin-bottom: .35rem;
  padding-bottom: .55rem;
  border-bottom: 1px solid #f4f4f5;
}
.material-row__toggle {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  border: 0;
  background: transparent;
  padding: .15rem .1rem;
  margin: 0;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  font-size: .92rem;
  color: #18181b;
  text-align: left;
  min-width: 0;
  flex: 1;
}
.material-row__toggle:hover { color: var(--red); }
.material-row__chevron {
  font-size: 1.15rem;
  color: #71717a;
  flex-shrink: 0;
}
.material-row__label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.material-row__chip {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  max-width: 11rem;
  margin-left: .15rem;
  padding: .18rem .55rem;
  border-radius: 999px;
  background: #f4f4f5;
  border: 1px solid #e4e4e7;
  color: #52525b;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  flex-shrink: 1;
}
.material-row__chip .ti {
  flex-shrink: 0;
  font-size: .85rem;
  color: var(--red);
}
.material-row__chip > span {
  overflow: hidden;
  text-overflow: ellipsis;
}
.material-row__body {
  display: grid;
  gap: .4rem;
  min-width: 0;
}
.material-row:not(.is-open) .material-row__body {
  display: none;
}
.repeat-row > label,
.material-row__body > label {
  font-size: .72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #71717a;
  margin-top: .45rem;
}
.repeat-row > input,
.repeat-row > textarea,
.repeat-row > select,
.material-row__body > input,
.material-row__body > textarea,
.material-row__body > select {
  width: 100%;
  border: 1px solid #e4e4e7;
  border-radius: var(--ctrl-radius);
  font: inherit;
  font-size: var(--ctrl-font);
  padding: 0 var(--ctrl-pad-x);
  box-sizing: border-box;
}
.repeat-row > input,
.repeat-row > select,
.material-row__body > input,
.material-row__body > select { height: var(--ctrl-h); }
.repeat-row > textarea,
.material-row__body > textarea { padding: .7rem var(--ctrl-pad-x); min-height: 88px; }
.material-row__body .admin-row { margin-top: .45rem; }
.material-row__body .admin-row label {
  font-size: .72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #71717a;
}

/* Tài liệu — chọn tệp từ media */
.material-file {
  margin-top: .85rem;
  padding: .9rem 1rem;
  border: 1px solid #e4e4e7;
  border-radius: 12px;
  background: linear-gradient(180deg, #fafafa 0%, #fff 48%);
}
.material-file__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  flex-wrap: wrap;
  margin-bottom: .7rem;
}
.material-file__title {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-size: .78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #52525b;
}
.material-file__title .ti { font-size: 1rem; color: var(--red); }
.material-file__actions {
  display: flex;
  align-items: center;
  gap: .4rem;
  flex-wrap: wrap;
}
.material-file__actions .btn-admin,
.material-file__actions .btn-soft {
  height: 2.15rem;
  padding: 0 .85rem;
  font-size: .82rem;
}
.material-file__drop {
  display: grid;
  place-items: stretch;
  min-height: 5.5rem;
  border: 1.5px dashed #d4d4d8;
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.material-file__drop:hover {
  border-color: #fca5a5;
  background: #fffbfb;
  box-shadow: 0 0 0 3px rgba(185, 28, 28, .06);
}
.material-file__drop.is-filled {
  cursor: default;
  border-style: solid;
  border-color: #e4e4e7;
  background: #fafafa;
}
.material-file__drop.is-filled:hover {
  border-color: #e4e4e7;
  background: #fafafa;
  box-shadow: none;
}
.material-file__empty,
.material-file__selected {
  display: flex;
  align-items: center;
  gap: .85rem;
  padding: 1rem 1.1rem;
}
.material-file__empty {
  flex-direction: column;
  justify-content: center;
  text-align: center;
  gap: .25rem;
  color: #71717a;
}
.material-file__empty .ti {
  font-size: 1.65rem;
  color: #a1a1aa;
  margin-bottom: .15rem;
}
.material-file__empty strong {
  font-size: .9rem;
  color: #3f3f46;
}
.material-file__empty span {
  font-size: .8rem;
  color: #a1a1aa;
}
.material-file__selected > .ti {
  font-size: 1.75rem;
  color: var(--red);
  flex-shrink: 0;
}
.material-file__meta {
  min-width: 0;
  display: grid;
  gap: .2rem;
}
.material-file__meta strong {
  font-size: .92rem;
  color: #18181b;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.material-file__meta code {
  font-size: .75rem;
  color: #71717a;
  background: transparent;
  padding: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.banner-upload {
  border: 1px dashed #fecaca;
  border-radius: 12px;
  background: #fff;
  padding: .9rem 1rem;
  display: grid;
  gap: .75rem;
}
.banner-upload.is-filled {
  border-style: solid;
  border-color: #fca5a5;
  background: #fff7f7;
}
.banner-upload__preview {
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #fecaca;
  background: #fff;
  max-height: 180px;
}
.banner-upload__preview img {
  display: block;
  width: 100%;
  max-height: 180px;
  object-fit: cover;
}
.banner-upload__empty {
  display: grid;
  justify-items: center;
  gap: .25rem;
  padding: .85rem .5rem;
  color: #71717a;
  text-align: center;
}
.banner-upload__empty .ti {
  font-size: 1.6rem;
  color: var(--red, #b91c1c);
}
.banner-upload__empty strong { color: #18181b; font-size: .95rem; }
.banner-upload__empty span { font-size: .82rem; }
.banner-upload__actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  align-items: center;
}
.banner-upload__pick {
  cursor: pointer;
  margin: 0;
}
.banner-upload__hint {
  margin: 0;
  font-size: .8rem;
  word-break: break-all;
}

.alert-err {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
  padding: .75rem 1rem;
  border-radius: 10px;
  margin-bottom: 1rem;
  font-weight: 600;
}
.admin-kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .75rem; margin-bottom: 1.25rem; }
.kpi-card {
  display: flex;
  align-items: center;
  gap: .85rem;
  padding: 1rem 1.05rem;
}
.kpi-card__ico {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.kpi-card__ico .ti {
  font-size: 1.35rem;
  font-variation-settings: "FILL" 1, "wght" 500, "GRAD" 0, "opsz" 24;
}
.kpi-card__body { min-width: 0; }
.kpi-card__body span {
  display: block;
  color: #71717a;
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.kpi-card__body strong {
  display: block;
  margin-top: .25rem;
  font-size: 1.55rem;
  line-height: 1.1;
  color: var(--red);
}
.kpi-card__ico.is-users { background: #eff6ff; color: #1d4ed8; }
.kpi-card__ico.is-contest { background: #fef3c7; color: #b45309; }
.kpi-card__ico.is-live { background: #fef2f2; color: #b91c1c; }
.kpi-card__ico.is-submit { background: #ecfdf5; color: #047857; }
.kpi-card__ico.is-quiz { background: #f5f3ff; color: #6d28d9; }
.kpi-card__ico.is-org { background: #f0f9ff; color: #0369a1; }
.kpi-card__ico.is-news { background: #fff7ed; color: #c2410c; }
.kpi-card__ico.is-report { background: #fdf2f8; color: #be185d; }
.kpi-card__ico.is-visit { background: #f4f4f5; color: #52525b; }

.dash-charts {
  display: grid;
  grid-template-columns: 1.2fr 1.2fr .85fr;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.dash-charts--ratios {
  grid-template-columns: repeat(3, 1fr);
}
.dash-chart { margin-bottom: 0; }
.dash-chart__canvas {
  position: relative;
  height: 240px;
}
.dash-chart__canvas--donut {
  height: 220px;
  max-width: 260px;
  margin: 0 auto;
}
.dash-chart__canvas--trend {
  height: 300px;
}
.dash-chart__hint {
  margin: .65rem 0 0;
  text-align: center;
  font-size: .78rem;
}
.dash-trend { margin-bottom: 1.25rem; }

.period-switch {
  display: inline-flex;
  padding: .2rem;
  border: 1px solid #e4e4e7;
  border-radius: 999px;
  background: #fafafa;
  gap: .15rem;
}
.period-switch__btn {
  display: inline-flex;
  align-items: center;
  padding: .45rem .95rem;
  border-radius: 999px;
  font-size: .85rem;
  font-weight: 700;
  color: #71717a;
  text-decoration: none;
  transition: background .15s, color .15s;
}
.period-switch__btn:hover { color: var(--red); background: #fff; }
.period-switch__btn.is-active {
  background: var(--red);
  color: #fff;
  box-shadow: 0 1px 2px rgba(153, 27, 27, .25);
}

@media (max-width: 1100px) {
  .dash-charts { grid-template-columns: 1fr 1fr; }
  .dash-charts--ratios { grid-template-columns: 1fr 1fr; }
  .dash-chart--narrow { grid-column: 1 / -1; }
  .dash-chart__canvas--donut { max-width: 320px; }
}
@media (max-width: 700px) {
  .dash-charts,
  .dash-charts--ratios { grid-template-columns: 1fr; }
  .admin-head { flex-wrap: wrap; gap: .75rem; }
}

.kpi-card__sub {
  display: block;
  margin-top: .2rem;
  font-style: normal;
  font-size: .72rem;
  font-weight: 700;
  color: #a1a1aa;
}
.reports-h3 {
  margin: 0 0 .75rem;
  font-size: 1rem;
  color: #3f3f46;
}
.reports-charts {
  grid-template-columns: 1fr 1fr;
}
@media (max-width: 900px) {
  .reports-charts { grid-template-columns: 1fr; }
}

/* ===== Settings tabs ===== */
.settings-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-bottom: 1rem;
  padding: .35rem;
  background: #fff;
  border: 1px solid #e4e4e7;
  border-radius: 14px;
}
.settings-tabs__btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  height: var(--ctrl-h);
  padding: 0 .95rem;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #52525b;
  font: inherit;
  font-size: .88rem;
  font-weight: 700;
  cursor: pointer;
}
.settings-tabs__btn .ti { font-size: 1.15rem; }
.settings-tabs__btn:hover { background: #f4f4f5; color: #18181b; }
.settings-tabs__btn.is-active {
  background: linear-gradient(180deg, #c01f26, #8f1419);
  color: #fff;
  box-shadow: 0 8px 18px rgba(143, 20, 25, .22);
}
.settings-panel {
  max-width: min(980px, 100%);
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.settings-pane[hidden],
.settings-pane:not(.is-active) {
  display: none !important;
}
.settings-pane.is-active {
  display: block;
  min-width: 0;
  max-width: 100%;
}
.settings-pane__head {
  margin-bottom: 1rem;
  padding-bottom: .85rem;
  border-bottom: 1px solid #f4f4f5;
}
.settings-pane__head h2 {
  margin: 0;
  font-size: 1.15rem;
  color: var(--red);
}
.settings-pane__head p {
  margin: .35rem 0 0;
  color: #71717a;
  font-size: .9rem;
  font-weight: 500;
}
.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1rem 1.15rem;
  min-width: 0;
}
.settings-field { min-width: 0; max-width: 100%; }
.settings-field--full { grid-column: 1 / -1; }
.settings-field > label {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .45rem;
  margin: 0 0 .35rem;
}
.settings-key {
  font-size: .68rem;
  font-weight: 600;
  color: #a1a1aa;
  background: #f4f4f5;
  padding: .1rem .4rem;
  border-radius: 6px;
  text-transform: none;
  letter-spacing: 0;
}
.settings-hint {
  margin: 0 0 .45rem;
  font-size: .8rem;
  color: #a1a1aa;
  font-weight: 500;
}
.settings-bool { margin-top: .25rem; }
.settings-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: .65rem;
  margin: 0;
  cursor: pointer;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
  line-height: 1;
  color: #18181b;
  flex-wrap: nowrap;
}
.settings-switch__input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  border: 0;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
}
.settings-switch__ui {
  width: 46px;
  height: 26px;
  border-radius: 999px;
  background: #e4e4e7;
  position: relative;
  transition: .2s ease;
  flex-shrink: 0;
  display: block;
}
.settings-switch__ui::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
  transition: .2s ease;
}
.settings-switch__input:checked + .settings-switch__ui {
  background: #b91c1c;
}
.settings-switch__input:checked + .settings-switch__ui::after {
  transform: translateX(20px);
}
.settings-switch__label {
  font-size: .9rem;
  line-height: 26px; /* khớp chiều cao nút gạt */
  display: inline-flex;
  align-items: center;
  margin: 0;
  padding: 0;
}
.settings-actions { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid #f4f4f5; }
@media (max-width: 700px) {
  .settings-grid { grid-template-columns: 1fr; }
  .settings-tabs__btn { flex: 1 1 auto; justify-content: center; }
}

/* ===== Roles / permissions ===== */
.roles-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1rem;
  align-items: start;
}
.roles-side { margin-bottom: 0; }
.roles-list { display: grid; gap: .45rem; }
.roles-list__item {
  display: grid;
  gap: .2rem;
  padding: .75rem .85rem;
  border-radius: 12px;
  border: 1px solid #e4e4e7;
  text-decoration: none;
  color: inherit;
  background: #fafafa;
}
.roles-list__item:hover { border-color: #fecaca; background: #fff; }
.roles-list__item.is-active {
  border-color: #fecaca;
  background: #fef2f2;
}
.roles-list__item strong { font-size: .95rem; color: #18181b; }
.roles-list__item span { font-size: .8rem; color: #71717a; font-weight: 500; line-height: 1.35; }
.roles-list__item em { font-style: normal; font-size: .7rem; font-weight: 700; color: #a1a1aa; letter-spacing: .04em; }
.roles-main { margin-bottom: 0; }
.perm-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.perm-group {
  border: 1px solid #e4e4e7;
  border-radius: 12px;
  padding: .85rem;
  background: #fafafa;
}
.perm-group h4 {
  margin: 0 0 .65rem;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--red);
}
.perm-item {
  display: flex;
  gap: .65rem;
  align-items: flex-start;
  padding: .55rem .5rem;
  border-radius: 10px;
  cursor: pointer;
  margin: 0 0 .25rem;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 600;
  color: #18181b;
}
.perm-item:hover { background: #fff; }
.perm-item.is-on { background: #fff; }
.perm-item input { margin-top: .2rem; accent-color: #b91c1c; width: auto; }
.perm-item strong { display: block; font-size: .9rem; }
.perm-item small { display: block; margin-top: .15rem; font-size: .75rem; color: #71717a; font-weight: 500; }
.perm-item code { font-size: .68rem; color: #a1a1aa; }
.perm-grid--readonly .perm-item { cursor: default; opacity: .85; }
@media (max-width: 900px) {
  .roles-layout { grid-template-columns: 1fr; }
  .perm-grid { grid-template-columns: 1fr; }

  body {
    display: block;
    min-height: 100vh;
  }

  .sidebar-backdrop {
    display: block;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
  }
  html.nav-open .sidebar-backdrop:not([hidden]) {
    opacity: 1;
    pointer-events: auto;
  }

  .sidebar,
  html.sidebar-collapsed .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 50;
    width: min(300px, 86vw);
    max-width: 300px;
    padding: 1rem .9rem 1.25rem;
    transform: translateX(-105%);
    transition: transform .24s ease;
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: 8px 0 28px rgba(0, 0, 0, .28);
    flex: none;
  }
  html.nav-open .sidebar,
  html.nav-open.sidebar-collapsed .sidebar {
    transform: translateX(0);
  }

  /* Reset desktop collapsed look on mobile drawer */
  html.sidebar-collapsed .sidebar {
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 50;
  }
  html.sidebar-collapsed .brand__text,
  html.sidebar-collapsed .nav-group {
    opacity: 1;
    max-width: none;
    width: auto;
    pointer-events: auto;
    overflow: visible;
  }
  html.sidebar-collapsed .sidebar a .nav-label,
  html.sidebar-collapsed .sidebar-collapse .nav-label {
    position: static;
    left: auto;
    top: auto;
    transform: none;
    opacity: 1;
    visibility: visible;
    max-width: 180px;
    width: auto;
    pointer-events: auto;
    padding: 0;
    background: transparent;
    color: inherit;
    box-shadow: none;
    font-size: inherit;
    font-weight: inherit;
  }
  html.sidebar-collapsed .sidebar a .nav-label::before,
  html.sidebar-collapsed .sidebar-collapse .nav-label::before {
    content: none;
  }
  html.sidebar-collapsed .brand { justify-content: flex-start; }
  html.sidebar-collapsed .sidebar a,
  html.sidebar-collapsed .sidebar-collapse {
    position: static;
    justify-content: flex-start;
    gap: .55rem;
    padding: .58rem .7rem;
  }
  html.sidebar-collapsed .sidebar a.is-active {
    background: rgba(255,255,255,.16);
  }

  .sidebar nav {
    display: grid;
    grid-template-columns: 1fr;
    gap: .2rem;
  }
  .sidebar-collapse { display: none; }
  .sidebar-close { display: grid; }
  .top__sidebar-btn { display: inline-grid; }

  .content {
    width: 100%;
    min-width: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: clip;
  }
  .top {
    padding: .75rem 1rem;
    gap: .65rem;
  }
  .top__title {
    font-size: .95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  main {
    padding: 1rem;
    min-width: 0;
    overflow-x: clip;
  }
  .portal-credit { padding: 1rem; }

  .admin-head {
    flex-wrap: wrap;
    align-items: flex-start;
    gap: .75rem;
  }
  .admin-head--tight {
    flex-wrap: nowrap;
    align-items: center;
  }
  .admin-head h1 { font-size: 1.2rem; width: 100%; }
  .admin-head > .admin-toolbar__actions,
  .admin-head > a.btn-admin,
  .admin-head > a.btn-soft {
    width: 100%;
    margin-left: 0;
  }
  .admin-head > a.admin-head__link {
    width: auto;
    margin-left: auto;
  }
  .admin-head > .admin-toolbar__actions {
    display: flex;
    flex-wrap: wrap;
  }
  .admin-head > .admin-toolbar__actions > .btn-admin,
  .admin-head > .admin-toolbar__actions > .btn-soft,
  .admin-head > a.btn-admin,
  .admin-head > a.btn-soft {
    flex: 1 1 calc(50% - .35rem);
    justify-content: center;
    text-align: center;
  }
  .admin-kpi-row,
  .cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .65rem;
  }
  .kpi-card { padding: .85rem .8rem; gap: .65rem; }
  .kpi-card__ico { width: 38px; height: 38px; border-radius: 10px; }
  .kpi-card__body strong { font-size: 1.25rem; }
  .kpi-card__body span { font-size: .62rem; }

  .admin-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: .65rem;
  }
  .admin-toolbar .field,
  .admin-toolbar .field.grow { flex: 1 1 auto; width: 100%; max-width: none; }
  .admin-toolbar__actions {
    width: 100%;
    margin-left: 0;
    justify-content: stretch;
  }
  .admin-toolbar__actions .btn-admin,
  .admin-toolbar__actions .btn-soft {
    flex: 1;
  }

  .admin-table-wrap {
    margin: 0;
    border-radius: 12px;
    -webkit-overflow-scrolling: touch;
    overflow-x: auto;
    overscroll-behavior-x: contain;
  }
  .admin-table-wrap table { min-width: 640px; }
  .admin-table-wrap th.th-actions,
  .admin-table-wrap td.actions {
    position: sticky;
    right: 0;
    z-index: 1;
    background: #fff;
    box-shadow: -10px 0 14px -12px rgba(24, 24, 27, .35);
  }
  .admin-table-wrap thead th.th-actions {
    background: #fafafa;
    z-index: 2;
  }
  .admin-table-wrap td.actions { max-width: 48vw; }
  .admin-table-wrap .btn-row {
    width: 34px;
    height: 34px;
    min-width: 34px;
  }
  th, td { padding: .7rem .65rem; font-size: .86rem; }

  .admin-form {
    padding: 1rem;
    border-radius: 14px;
    max-width: 100%;
  }
  .admin-form--wide { max-width: 100%; }
  .admin-actions {
    flex-wrap: wrap;
  }
  .admin-actions .btn-admin,
  .admin-actions .btn-soft {
    flex: 1 1 auto;
  }

  .dash-charts,
  .dash-charts--trio {
    grid-template-columns: 1fr;
  }
  .dash-chart__canvas { height: 210px; }
  .dash-chart__canvas--trend { height: 240px; }
  .period-switch { width: 100%; }
  .period-switch__btn { flex: 1; justify-content: center; }

  .settings-tabs,
  .admin-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
  }
  .admin-pager {
    flex-direction: column;
    align-items: stretch;
  }
  .admin-pager__nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .admin-pager__btn { width: 100%; }

  .fm-layout {
    grid-template-columns: 1fr;
  }
  .fm-tree {
    position: static;
    max-height: none;
    order: -1;
  }
  .fm-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .fm-search {
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
  }
  .fm-toolbar__actions {
    margin-left: 0;
    width: 100%;
  }
  .fm-toolbar__actions .btn-admin,
  .fm-toolbar__actions .btn-soft {
    flex: 1 1 auto;
    justify-content: center;
  }
  .fm-folders { grid-template-columns: 1fr; }
  .fm-folder__actions { width: auto; }

  .tox-tinymce { max-width: 100% !important; }
  .ui-modal { max-width: calc(100vw - 1.5rem); }
  .ui-modal__actions .btn-admin,
  .ui-modal__actions .btn-soft {
    flex: 1 1 auto;
    min-width: 0;
  }
}


@media (max-width: 480px) {
  .admin-kpi-row,
  .cards { grid-template-columns: 1fr 1fr; }
  .kpi-card { flex-direction: column; align-items: flex-start; }
  .user-menu__caret { display: none; }
  .user-menu__btn { padding-right: .25rem; }
  .dash-chart { overflow: hidden; }
  .dash-chart__canvas--donut { max-width: 220px; margin-inline: auto; }
  .admin-head > .admin-toolbar__actions > .btn-admin,
  .admin-head > .admin-toolbar__actions > .btn-soft,
  .admin-head > a.btn-admin,
  .admin-head > a.btn-soft {
    flex: 1 1 100%;
  }
}

/* —— Utility / layout helpers —— */
body.is-nav-locked { overflow: hidden; }
.is-hidden { display: none !important; }
.grow { flex: 1 1 auto; min-width: 0; }
.admin-row .grow { grid-column: span 1; }
.admin-head--tight {
  margin: 0 0 .75rem;
  align-items: center;
  flex-wrap: nowrap;
  gap: .75rem;
}
.admin-head--tight h3 {
  margin: 0;
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.admin-head__link {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  flex: 0 0 auto;
  white-space: nowrap;
  color: var(--red);
  font-weight: 700;
  font-size: .82rem;
  text-decoration: none;
  line-height: 1.2;
}
.admin-head__link .ti { font-size: 1rem; }
.admin-head__link:hover { text-decoration: underline; }
.admin-head--bank { margin: 1.25rem 0 .75rem; }
.admin-head h3,
.admin-section > h3.section-title { margin: 0; }
.admin-head .muted--sm { font-size: .85rem; margin: 0; }
.muted--gap { margin: 0 0 1rem; }
.muted--side { margin: 1rem 0 0; font-size: .8rem; }
.admin-row--top { align-items: start; }
.admin-actions--center { justify-content: center; }
.admin-section--upload { margin-top: 1rem; }
.icon-btn-sm { font-size: 1.1rem; }
.th-check { width: 3rem; }
.admin-row--end {
  grid-template-columns: 4.5rem minmax(0, 1fr) auto;
  align-items: end;
}
.option-label { max-width: none; }
.option-correct {
  display: flex;
  align-items: center;
  min-height: var(--ctrl-h);
  padding-bottom: 0;
}
.option-correct .chk {
  min-height: var(--ctrl-h);
  align-items: center;
}
.questions-options-title {
  margin: 1.35rem 0 .35rem;
  font-size: 1rem;
  color: #18181b;
}
.q-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .35rem;
  margin-top: .2rem;
}
.q-meta__sep { color: #d4d4d8; }
.roles-chk { margin: 0; }
.access-denied {
  max-width: 560px;
  margin: 2rem auto;
  text-align: center;
}
.access-denied__icon {
  font-size: 3rem;
  color: var(--red);
}
.access-denied__title {
  color: var(--red);
  margin: .5rem 0;
}

/* File manager */
.fm-layout {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}
.fm-tree {
  position: sticky;
  top: 4.5rem;
  max-height: calc(100vh - 5.5rem);
  overflow: auto;
  background: #fff;
  border: 1px solid #e4e4e7;
  border-radius: 14px;
  padding: .75rem .65rem .9rem;
  box-shadow: 0 1px 2px rgba(24, 24, 27, .03);
}
.fm-tree__head {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .15rem .4rem .65rem;
  margin-bottom: .35rem;
  border-bottom: 1px solid #f4f4f5;
  color: var(--red);
  font-size: .82rem;
}
.fm-tree__head .ti { font-size: 1.15rem; }
.fm-tree__head strong { font-weight: 800; letter-spacing: .01em; }
.fm-tree__root {
  display: flex;
  align-items: center;
  gap: .45rem;
  padding: .45rem .5rem;
  margin-bottom: .25rem;
  border-radius: 8px;
  color: #3f3f46;
  text-decoration: none;
  font-weight: 700;
  font-size: .88rem;
}
.fm-tree__root .ti { color: var(--red); font-size: 1.2rem; }
.fm-tree__root:hover { background: #fef2f2; color: var(--red); }
.fm-tree__root.is-active {
  background: #fef2f2;
  color: var(--red);
}
.fm-tree__empty { margin: .5rem .4rem; font-size: .84rem; }
.fm-tree__list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.fm-tree__item { margin: 0; }
.fm-tree__row {
  display: flex;
  align-items: center;
  gap: .1rem;
  min-width: 0;
}
.fm-tree__toggle {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #71717a;
  cursor: pointer;
  padding: 0;
}
.fm-tree__toggle .ti { font-size: 1.1rem; }
.fm-tree__toggle:hover { background: #f4f4f5; color: #18181b; }
.fm-tree__toggle--spacer {
  display: inline-block;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}
.fm-tree__link {
  display: flex;
  align-items: center;
  gap: .35rem;
  min-width: 0;
  flex: 1;
  padding: .38rem .45rem .38rem .2rem;
  border-radius: 8px;
  color: #3f3f46;
  text-decoration: none;
  font-weight: 600;
  font-size: .86rem;
}
.fm-tree__link:hover { background: #fafafa; color: var(--red); }
.fm-tree__ico { color: #ca8a04; font-size: 1.15rem; flex-shrink: 0; }
.fm-tree__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fm-tree__item.is-active > .fm-tree__row .fm-tree__link {
  background: #fef2f2;
  color: var(--red);
}
.fm-tree__item.is-active > .fm-tree__row .fm-tree__ico { color: var(--red); }
.fm-tree__children {
  padding-left: .85rem;
  margin-left: .55rem;
  border-left: 1px dashed #e4e4e7;
}
.fm-main { min-width: 0; }
.fm-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .4rem;
  margin-bottom: .85rem;
  font-size: .9rem;
  font-weight: 600;
}
.fm-breadcrumb a { color: var(--red); text-decoration: none; }
.fm-breadcrumb a:hover { text-decoration: underline; }
.fm-breadcrumb__sep { color: #a1a1aa; }
.fm-breadcrumb__current { color: #3f3f46; }
.fm-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: .85rem 1rem;
  align-items: end;
  margin-bottom: 1.1rem;
  padding: 1.05rem 1.15rem;
  background: #fff;
  border: 1px solid #e4e4e7;
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(24, 24, 27, .03);
}
.fm-search {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: .5rem;
  flex: 2 1 280px;
  min-width: 220px;
  align-items: end;
}
.fm-search input {
  width: 100%;
  height: var(--ctrl-h);
  border: 1px solid #e4e4e7;
  border-radius: var(--ctrl-radius);
  padding: 0 .85rem;
  font: inherit;
  font-size: var(--ctrl-font);
}
.fm-toolbar__actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-left: auto;
}
.fm-section { margin-bottom: 1.5rem; }
.fm-section__title {
  margin: 0 0 .7rem;
  font-size: .72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #71717a;
}
.fm-folders {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: .75rem;
}
.fm-folder {
  border: 1px solid #e4e4e7;
  border-radius: 12px;
  background: #fff;
  padding: .8rem .85rem;
  display: grid;
  gap: .55rem;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.fm-folder:hover {
  border-color: #fecaca;
  box-shadow: 0 4px 14px rgba(153, 27, 27, .06);
}
.fm-folder__link {
  display: flex;
  align-items: center;
  gap: .5rem;
  text-decoration: none;
  color: #18181b;
  font-weight: 700;
  min-width: 0;
}
.fm-folder__link .ti { color: #ca8a04; flex-shrink: 0; }
.fm-folder__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fm-folder__actions {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: .28rem;
}
.fm-file {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  font-weight: 600;
}
.fm-file .ti { font-size: 1.15rem; color: #71717a; }
.fm-file a { color: inherit; text-decoration: none; }
.fm-file a:hover { color: var(--red); }
.fm-pick-name {
  border: 0;
  background: none;
  padding: 0;
  margin: 0;
  font: inherit;
  font-weight: 600;
  color: inherit;
  cursor: pointer;
  text-align: left;
}
.fm-pick-name:hover { color: var(--red); text-decoration: underline; }
.fm-dialog {
  border: none;
  border-radius: 16px;
  padding: 0;
  max-width: min(440px, calc(100vw - 2rem));
  width: 100%;
  box-shadow: 0 20px 50px rgba(0,0,0,.18);
}
.fm-dialog::backdrop { background: rgba(24, 24, 27, .45); }
.fm-dialog__form {
  display: flex;
  flex-direction: column;
  gap: .4rem;
  padding: 1.25rem 1.35rem 1.35rem;
}
.fm-dialog__form h3 { margin: 0 0 .5rem; color: var(--red); font-size: 1.1rem; }
.fm-dialog__form label {
  font-size: .72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #71717a;
  margin-top: .45rem;
}
.fm-dialog__form input:not([type="file"]):not([type="checkbox"]):not([type="radio"]),
.fm-dialog__form select {
  width: 100%;
  height: var(--ctrl-h);
  border: 1px solid #e4e4e7;
  border-radius: var(--ctrl-radius);
  padding: 0 .85rem;
  font: inherit;
  font-size: var(--ctrl-font);
  line-height: 1.25;
}
.fm-dialog__form select {
  appearance: none;
  -webkit-appearance: none;
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .75rem center;
  background-size: 1rem;
  padding-right: 2.2rem;
}
.fm-dialog__label {
  display: block;
  font-size: .72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #71717a;
  margin-top: .45rem;
}
.fm-dialog__form .admin-actions { margin-top: 1rem; }
.fm-acl-form .admin-table-wrap { margin-bottom: .75rem; }

/* File picker / dropzone */
.fm-dropzone {
  position: relative;
  display: block;
  margin-top: .35rem;
  cursor: pointer;
}
.fm-dropzone__input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}
.fm-dropzone__ui {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  min-height: 9.5rem;
  padding: 1.25rem 1rem;
  border: 1.5px dashed #d4d4d8;
  border-radius: 14px;
  background:
    linear-gradient(180deg, #fafafa 0%, #fff 100%);
  text-align: center;
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.fm-dropzone:hover .fm-dropzone__ui,
.fm-dropzone:focus-within .fm-dropzone__ui {
  border-color: color-mix(in srgb, var(--red) 55%, #d4d4d8);
  background: #fff5f5;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--red) 12%, transparent);
}
.fm-dropzone.is-dragover .fm-dropzone__ui {
  border-color: var(--red);
  border-style: solid;
  background: #fef2f2;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--red) 16%, transparent);
}
.fm-dropzone.is-filled .fm-dropzone__ui {
  border-color: color-mix(in srgb, var(--red) 40%, #d4d4d8);
  border-style: solid;
  background: #fff;
}
.fm-dropzone__icon {
  font-size: 2rem;
  color: var(--red);
  line-height: 1;
  margin-bottom: .15rem;
}
.fm-dropzone__title {
  font-size: .92rem;
  font-weight: 700;
  color: #27272a;
}
.fm-dropzone__name {
  font-size: .82rem;
  color: #71717a;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 .5rem;
}
.fm-dropzone.is-filled .fm-dropzone__name {
  color: var(--red);
  font-weight: 600;
}
.fm-dropzone__hint {
  margin: .35rem 0 0;
  font-size: .82rem;
}

/* TinyMCE in admin forms */
.admin-form .tox-tinymce,
.repeat-row .tox-tinymce {
  border-radius: 12px !important;
  border: 1px solid #e4e4e7 !important;
  overflow: hidden;
}
.admin-form .tox .tox-toolbar__primary,
.repeat-row .tox .tox-toolbar__primary {
  background: #fafafa;
  border-bottom: 1px solid #f4f4f5;
}
.admin-form .tox-editor-header,
.repeat-row .tox-editor-header {
  box-shadow: none !important;
  border-bottom: 1px solid #f4f4f5;
}
.admin-form .tox .tox-edit-area::before,
.repeat-row .tox .tox-edit-area::before {
  border-radius: 0;
}
.admin-form textarea.js-editor,
.repeat-row textarea.js-editor {
  min-height: 160px;
}

/* Attempt review (admin) */
.attempt-review { display: grid; gap: .85rem; }
.attempt-review__q { margin-bottom: 0; }
.attempt-review__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: .65rem;
}
.attempt-review__content {
  font-size: .95rem;
  font-weight: 650;
  color: #18181b;
  margin-bottom: .75rem;
  line-height: 1.45;
}
.attempt-review__opts {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: .4rem;
}
.attempt-review__opt {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .45rem .65rem;
  padding: .55rem .7rem;
  border: 1px solid #e4e4e7;
  border-radius: 10px;
  background: #fafafa;
  font-size: .88rem;
}
.attempt-review__opt em {
  font-style: normal;
  font-size: .72rem;
  font-weight: 750;
  color: #71717a;
  margin-left: auto;
}
.attempt-review__opt em.is-ok { color: #15803d; }
.attempt-review__opt.is-picked {
  border-color: #fecaca;
  background: #fff7f7;
}
.attempt-review__opt.is-answer {
  border-color: #86efac;
  background: #f0fdf4;
}
.attempt-review__opt.is-picked.is-answer {
  border-color: #4ade80;
}
.attempt-review__label {
  display: inline-grid;
  place-items: center;
  min-width: 1.4rem;
  height: 1.4rem;
  border-radius: 6px;
  background: #e4e4e7;
  font-weight: 800;
  font-size: .75rem;
}
.attempt-review__q.is-correct { border-color: #bbf7d0; }
.attempt-review__q.is-wrong { border-color: #fecaca; }

/* ===== Flatpickr (QuizHub theme) ===== */
.flatpickr-calendar {
  font-family: inherit;
  border: 1px solid #e4e4e7;
  border-radius: 14px;
  box-shadow: 0 18px 40px rgba(40, 10, 10, .14);
  padding: .35rem .2rem .55rem;
  width: 308px;
}
.flatpickr-calendar.arrowTop:before,
.flatpickr-calendar.arrowTop:after,
.flatpickr-calendar.arrowBottom:before,
.flatpickr-calendar.arrowBottom:after { display: none; }
.flatpickr-months {
  align-items: center;
  padding: .35rem .55rem .15rem;
}
.flatpickr-months .flatpickr-month {
  height: 36px;
  overflow: visible;
}
.flatpickr-current-month {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .2rem;
  padding-top: 0;
  height: 36px;
  font-size: .95rem;
  font-weight: 800;
  color: #18181b;
}
.flatpickr-current-month .flatpickr-monthDropdown-months,
.flatpickr-current-month input.cur-year {
  font-weight: 800;
  color: #18181b;
  background: transparent;
  border-radius: 8px;
}
.flatpickr-current-month .flatpickr-monthDropdown-months:hover,
.flatpickr-current-month input.cur-year:hover {
  background: #fef2f2;
}
.flatpickr-months .flatpickr-prev-month,
.flatpickr-months .flatpickr-next-month {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 10px;
  display: inline-grid;
  place-items: center;
  top: 6px;
  fill: #52525b;
  color: #52525b;
}
.flatpickr-months .flatpickr-prev-month:hover,
.flatpickr-months .flatpickr-next-month:hover {
  background: #fef2f2;
  color: var(--red);
  fill: var(--red);
}
.flatpickr-months .flatpickr-prev-month .ti,
.flatpickr-months .flatpickr-next-month .ti {
  font-size: 1.1rem;
  line-height: 1;
  vertical-align: 0;
}
.flatpickr-weekdays { height: 28px; margin-top: .15rem; }
span.flatpickr-weekday {
  color: #a1a1aa;
  font-size: .72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.flatpickr-days { width: 100%; }
.dayContainer { width: 100%; min-width: 100%; max-width: 100%; }
.flatpickr-day {
  max-width: 40px;
  height: 38px;
  line-height: 38px;
  border-radius: 10px;
  border: 0;
  font-weight: 650;
  color: #3f3f46;
  margin: 1px 0;
}
.flatpickr-day:hover,
.flatpickr-day:focus {
  background: #fef2f2;
  border-color: transparent;
  color: var(--red);
}
.flatpickr-day.today {
  border: 1px solid #fecaca;
  color: var(--red);
  font-weight: 800;
}
.flatpickr-day.today:hover {
  background: #fef2f2;
  border-color: #fecaca;
  color: var(--red);
}
.flatpickr-day.selected,
.flatpickr-day.startRange,
.flatpickr-day.endRange,
.flatpickr-day.selected:hover,
.flatpickr-day.startRange:hover,
.flatpickr-day.endRange:hover {
  background: var(--red) !important;
  border-color: var(--red) !important;
  color: #fff !important;
  box-shadow: 0 6px 14px rgba(153, 27, 27, .28);
}
.flatpickr-day.inRange {
  background: #fef2f2;
  border-color: transparent;
  box-shadow: none;
  color: var(--red);
}
.flatpickr-day.prevMonthDay,
.flatpickr-day.nextMonthDay {
  color: #d4d4d8;
  font-weight: 500;
}
.flatpickr-day.flatpickr-disabled,
.flatpickr-day.flatpickr-disabled:hover {
  color: #e4e4e7;
  background: transparent;
}
.flatpickr-time {
  border-top: 1px solid #f4f4f5;
  max-height: 44px;
  height: 44px;
}
.flatpickr-time input {
  font-weight: 750;
  color: #18181b;
}
.flatpickr-time .flatpickr-time-separator,
.flatpickr-time .flatpickr-am-pm {
  color: #71717a;
  font-weight: 700;
}
.flatpickr-time .numInputWrapper span.arrowUp:after { border-bottom-color: #a1a1aa; }
.flatpickr-time .numInputWrapper span.arrowDown:after { border-top-color: #a1a1aa; }
.flatpickr-time .numInputWrapper:hover { background: #fef2f2; }

input.flatpickr-alt,
.admin-form input.flatpickr-input[readonly],
.admin-toolbar input.flatpickr-alt,
.admin-form input.flatpickr-alt {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23a1a1aa' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .85rem center;
  background-size: 1.05rem;
  padding-right: 2.4rem !important;
}
.flatpickr-input[type="hidden"] + input.flatpickr-alt,
input.flatpickr-input:not([type="hidden"]) { /* keep layout */ }
/* hide native calendar icon when flatpickr wraps */
input[type="date"].flatpickr-input,
input[type="datetime-local"].flatpickr-input {
  position: absolute !important;
  opacity: 0 !important;
  pointer-events: none !important;
  height: 0 !important;
  width: 0 !important;
  border: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
}
