:root {
  --bg: #eef4f8;
  --bg-soft: #f7fbfe;
  --sidebar: #17314c;
  --sidebar-soft: #214465;
  --panel: #ffffff;
  --panel-soft: #f8fbfe;
  --panel-strong: #f2f7fb;
  --text: #16314a;
  --text-strong: #0f2740;
  --muted: #68829b;
  --soft: #8ba0b3;
  --accent: #1777d8;
  --accent-strong: #0d63bb;
  --accent-soft: #e5f0fc;
  --success: #198d66;
  --success-soft: #e8f7f0;
  --warning: #b87300;
  --warning-soft: #fff4df;
  --danger: #c34562;
  --danger-soft: #ffe9ef;
  --line: #d9e4ee;
  --line-strong: #c8d7e4;
  --radius: 22px;
  --radius-sm: 16px;
  --shadow: 0 16px 36px rgba(18, 49, 74, 0.07);
  --shadow-soft: 0 8px 20px rgba(18, 49, 74, 0.05);
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
}

body.admin-body,
body.admin-auth-body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(23, 119, 216, 0.08), transparent 26%),
    radial-gradient(circle at 88% 12%, rgba(25, 141, 102, 0.05), transparent 20%),
    linear-gradient(180deg, #eef4f8 0%, #e7eff6 100%);
  color: var(--text);
  font-family: "Segoe UI Variable Text", Aptos, "Segoe UI", Arial, sans-serif;
  line-height: 1.55;
}

body.admin-auth-body {
  display: grid;
  place-items: center;
  padding: 24px;
}

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

p,
h1,
h2,
h3 {
  margin: 0;
}

h1,
h2,
h3,
strong,
label,
th {
  color: var(--text-strong);
}

h1,
h2,
h3 {
  letter-spacing: -0.04em;
  line-height: 1.04;
}

.admin-body {
  min-height: 100vh;
}

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

.admin-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 20px 16px;
  border-right: 1px solid rgba(255, 255, 255, 0.14);
  background: linear-gradient(180deg, var(--sidebar), var(--sidebar-soft));
  color: #eff7ff;
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.08);
}

.admin-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
}

.brand-logo {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
  font-size: 1.05rem;
  font-weight: 900;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.brand-title {
  font-size: 1.3rem;
  font-weight: 800;
  color: #ffffff;
}

.brand-subtitle {
  margin-top: 2px;
  color: rgba(239, 247, 255, 0.78);
  font-size: 0.94rem;
}

.admin-menu {
  display: grid;
  gap: 16px;
}

.admin-menu-section {
  display: grid;
  gap: 6px;
}

.admin-menu-heading {
  padding: 0 10px;
  color: rgba(239, 247, 255, 0.72);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.admin-menu a {
  display: block;
  padding: 10px 13px;
  border-radius: 14px;
  color: rgba(239, 247, 255, 0.84);
  border: 1px solid transparent;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.admin-menu a:hover {
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.08);
  transform: translateX(2px);
}

.admin-menu a.active {
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.14);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.admin-menu a.is-disabled {
  opacity: 0.42;
  pointer-events: none;
}

.admin-sidebar-card {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07);
}

.admin-sidebar-label {
  margin-bottom: 10px;
  color: #bfdfff;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.admin-sidebar-card strong {
  display: block;
  margin-bottom: 6px;
  font-size: 1rem;
  color: #ffffff;
}

.admin-sidebar-card p {
  margin-top: 8px;
  color: rgba(239, 247, 255, 0.8);
  font-size: 0.94rem;
}

.admin-main {
  padding: 28px 30px 32px;
}

.admin-topbar {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 24px;
  margin-bottom: 20px;
}

.section-label {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.admin-page-title {
  font-size: clamp(2.2rem, 4.4vw, 3.5rem);
  font-weight: 900;
  color: var(--text-strong);
}

.admin-topbar-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.admin-userbox {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow-soft);
}

.admin-userbox strong {
  color: var(--text-strong);
}

.admin-userbox span {
  display: block;
  color: var(--muted);
  font-size: 0.9rem;
}

.admin-kpis,
.admin-kpis-6 {
  display: grid;
  gap: 16px;
  margin-bottom: 18px;
}

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

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

.stat-box {
  min-height: 128px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: linear-gradient(180deg, var(--panel) 0%, var(--panel-soft) 100%);
  box-shadow: var(--shadow);
}

.stat-box.success {
  background: linear-gradient(180deg, #edf8f3 0%, #ffffff 100%);
  border-color: #cfe9dd;
}

.stat-box.warning {
  background: linear-gradient(180deg, #fff8ed 0%, #ffffff 100%);
  border-color: #f2dfbb;
}

.stat-box.danger {
  background: linear-gradient(180deg, #fff1f4 0%, #ffffff 100%);
  border-color: #efcad3;
}

.stat-label {
  display: block;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.92rem;
}

.stat-value {
  display: block;
  margin-bottom: 8px;
  font-size: clamp(1.9rem, 3.2vw, 2.5rem);
  font-weight: 900;
  line-height: 1;
  color: var(--text-strong);
}

.stat-meta {
  color: var(--muted);
  font-size: 0.94rem;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.9fr);
  gap: 16px;
  align-items: start;
}

.admin-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.82fr);
  gap: 16px;
  align-items: start;
}

.admin-side-stack {
  display: grid;
  gap: 16px;
}

.admin-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--panel) 0%, var(--panel-soft) 100%);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.admin-panel-head,
.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 16px;
  padding: 20px 22px 0;
}

.admin-panel-head h2,
.detail-header h2 {
  font-size: 1.42rem;
  font-weight: 800;
  color: var(--text-strong);
}

.admin-panel-head p,
.detail-subtitle,
.detail-section p {
  color: var(--muted);
}

.admin-panel-head p {
  margin-top: 6px;
}

.detail-type {
  margin-bottom: 8px;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.detail-section {
  padding: 20px 22px;
  border-top: 1px solid rgba(21, 49, 74, 0.06);
}

.admin-filters-form,
.admin-form {
  padding: 20px 22px 0;
}

.admin-filters-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 140px;
  gap: 16px;
}

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

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

.form-field {
  display: grid;
  gap: 8px;
}

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

.form-field label {
  font-size: 0.95rem;
  font-weight: 700;
}

.admin-filters select,
.input-ui,
.form-field input,
.form-field select,
.form-field textarea,
.readonly-box {
  width: 100%;
  min-height: 46px;
  padding: 11px 13px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--text);
  font: inherit;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.form-field textarea {
  min-height: 128px;
  resize: vertical;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus,
.admin-filters select:focus,
.input-ui:focus {
  outline: none;
  border-color: #99bee6;
  box-shadow: 0 0 0 4px rgba(23, 119, 216, 0.12);
}

.readonly-box {
  color: var(--muted);
  background: #f8fbfe;
  overflow-wrap: anywhere;
}

.code-block {
  margin: 0;
  max-height: 520px;
  overflow: auto;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #0f2740;
  color: #eff7ff;
  font-family: "Cascadia Code", Consolas, "Courier New", monospace;
  font-size: 0.86rem;
  line-height: 1.55;
  white-space: pre-wrap;
}

.otp-qr-block {
  display: flex;
  justify-content: center;
  margin-top: 16px;
}

.otp-qr-image {
  width: 220px;
  height: 220px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #ffffff;
  box-shadow: var(--shadow-soft);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
  padding-bottom: 22px;
  flex-wrap: wrap;
}

.form-actions-left {
  justify-content: flex-start;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 15px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--text-strong);
  font-weight: 800;
  text-decoration: none;
  box-shadow: 0 10px 24px rgba(18, 49, 74, 0.06);
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.btn:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
  box-shadow: 0 14px 28px rgba(18, 49, 74, 0.08);
}

.btn-primary {
  background: linear-gradient(180deg, #2690f5 0%, #1777d8 100%);
  border-color: #1777d8;
  color: #ffffff;
}

.btn-secondary {
  background: #ffffff;
}

.btn-danger {
  background: var(--danger-soft);
  border-color: #efcad3;
  color: var(--danger);
}

.btn-full,
.admin-side-stack .btn {
  width: 100%;
}

.task-list {
  padding: 20px 22px 22px;
  display: grid;
  gap: 12px;
}

.task-card,
.comment-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel-strong);
}

.task-card:hover {
  border-color: #c4d8eb;
  background: #ffffff;
  transform: translateY(-1px);
}

.task-card strong,
.comment-card strong {
  display: block;
  margin-bottom: 6px;
}

.task-card p,
.comment-head span,
.comment-card p {
  color: var(--muted);
}

.comment-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.badge-stack,
.table-actions,
.pagination-ui {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #f5f9fd;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1;
}

.badge.success {
  color: var(--success);
  background: linear-gradient(180deg, #eefaf4 0%, #e8f7f0 100%);
  border-color: #cfe9dd;
}

.badge.warning {
  color: var(--warning);
  background: linear-gradient(180deg, #fff7e8 0%, #fff4df 100%);
  border-color: #f2dfbb;
}

.badge.danger {
  color: var(--danger);
  background: linear-gradient(180deg, #fff0f4 0%, #ffe9ef 100%);
  border-color: #efcad3;
}

.badge.neutral {
  color: var(--muted);
  background: #f1f6fb;
  border-color: var(--line);
}

.table-link {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid transparent;
  color: var(--accent);
  font-weight: 800;
  background: rgba(23, 119, 216, 0.06);
}

.table-link:hover {
  color: var(--accent-strong);
  border-color: #cfe0f2;
  background: rgba(23, 119, 216, 0.1);
}

.table-wrap {
  padding: 0 22px 22px;
  overflow-x: auto;
}

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

.table-wrap thead th {
  padding: 15px 0 14px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.table-wrap tbody td {
  padding: 16px 0;
  border-bottom: 1px solid #e7eef5;
  vertical-align: top;
}

.table-wrap tbody tr:hover td {
  background: rgba(255, 255, 255, 0.32);
}

.table-wrap tbody tr:last-child td {
  border-bottom: 0;
}

.meta-list {
  padding: 20px 22px 22px;
  display: grid;
  gap: 12px;
}

.meta-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e7eef5;
}

.meta-row span {
  color: var(--muted);
}

.meta-row strong {
  text-align: right;
}

.flash,
.form-global-error {
  margin-bottom: 18px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  font-weight: 700;
}

.flash-success {
  background: var(--success-soft);
  border-color: #cfe9dd;
  color: var(--success);
}

.flash-error,
.form-global-error {
  background: var(--danger-soft);
  border-color: #efcad3;
  color: var(--danger);
}

.form-error,
.empty-inline,
.panel-footer {
  color: var(--muted);
}

.panel-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 18px 22px 22px;
}

.page-btn {
  display: inline-flex;
  min-width: 38px;
  height: 38px;
  padding: 0 12px;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #ffffff;
}

.page-btn.is-active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: #c9dcf0;
}

.admin-auth-shell {
  width: min(460px, calc(100% - 32px));
}

.admin-auth-card {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--panel) 0%, var(--panel-soft) 100%);
  border-radius: 26px;
  padding: 30px;
  box-shadow: var(--shadow);
}

.admin-auth-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}

.admin-auth-title {
  font-size: 2.2rem;
  font-weight: 900;
  margin-bottom: 8px;
}

.admin-auth-text {
  color: var(--muted);
  margin-bottom: 24px;
}

.admin-auth-text-compact {
  margin-bottom: 0;
  text-align: center;
  font-size: 0.94rem;
}

.admin-auth-form {
  display: grid;
  gap: 16px;
}

.admin-auth-divider {
  margin: 18px 0 10px;
  text-align: center;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
}

.simple-list {
  margin: 10px 0 0;
  padding-left: 18px;
  color: var(--muted);
}

.simple-list li + li {
  margin-top: 6px;
}

@media (max-width: 1500px) {
  .admin-kpis-6 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

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

  .admin-grid,
  .admin-detail-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 980px) {
  .admin-filters-grid,
  .admin-filters-grid-7,
  .form-grid {
    grid-template-columns: 1fr 1fr;
  }
}

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

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

@media (max-width: 700px) {
  .admin-kpis,
  .admin-kpis-6,
  .admin-filters-grid,
  .admin-filters-grid-7,
  .form-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .admin-main {
    padding: 18px;
  }

  .admin-topbar,
  .admin-panel-head,
  .detail-header,
  .panel-footer,
  .comment-head {
    flex-direction: column;
    align-items: stretch;
  }
}
