/* ==========================================================================
   RUTO@27 — Admin console
   ========================================================================== */

:root {
  --navy:       #0C1A33;
  --navy-700:   #14264A;
  --navy-600:   #1D3461;
  --navy-500:   #2B4879;
  --gold:       #C9A24A;
  --gold-light: #E0BE6E;
  --gold-dark:  #A8832F;
  --flag-red:   #BE1E2D;
  --flag-green: #0B7A45;

  --ink:      #0C1A33;
  --ink-soft: #3D4A63;
  --muted:    #6B7688;
  --line:     #E3E7EE;
  --line-soft:#EFF2F6;
  --paper:    #FFFFFF;
  --canvas:   #F4F6FA;

  /* The console is a dense working tool, so it stays on the sans throughout.
     Playfair appears only where the brand should: the page title and the big
     headings on the sign-in screens. */
  --font-display: 'Playfair Display', Georgia, serif;
  --font-ui:      'Source Sans 3', 'Segoe UI', Arial, sans-serif;
  --font-body:    'Source Sans 3', 'Segoe UI', Arial, sans-serif;

  --radius:    12px;
  --radius-sm: 8px;
  --ease:      cubic-bezier(.22, .61, .36, 1);
  --shadow-sm: 0 1px 3px rgba(12, 26, 51, .07);
  --shadow:    0 8px 26px -12px rgba(12, 26, 51, .22);
  --shadow-lg: 0 22px 56px -20px rgba(12, 26, 51, .34);

  --sidebar-w: 264px;
  --topbar-h:  70px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--canvas);
  color: var(--ink-soft);
  font-size: .94rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5 {
  font-family: var(--font-ui);
  color: var(--ink);
  font-weight: 700;
  letter-spacing: -.015em;
}

a { color: var(--navy-600); text-decoration: none; }
a:hover { color: var(--gold-dark); }

:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 4px; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #C3CBD8; border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: var(--navy-500); }

/* --------------------------------------------------------------------------
   Layout
   -------------------------------------------------------------------------- */
.admin-shell { display: flex; min-height: 100vh; }

.admin-sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--navy);
  color: rgba(255, 255, 255, .62);
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 1045;
  display: flex;
  flex-direction: column;
  transition: transform .3s var(--ease);
}

.admin-main {
  flex: 1;
  min-width: 0;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.admin-content { flex: 1; padding: 1.6rem; }

@media (max-width: 991.98px) {
  .admin-sidebar { transform: translateX(-100%); }
  .admin-sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
  .admin-main { margin-left: 0; }
  .admin-content { padding: 1rem; }
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(9, 18, 36, .55);
  z-index: 1044;
  opacity: 0;
  visibility: hidden;
  transition: opacity .3s var(--ease), visibility .3s;
}
.sidebar-backdrop.show { opacity: 1; visibility: visible; }

/* --------------------------------------------------------------------------
   Sidebar
   -------------------------------------------------------------------------- */
.sidebar-brand {
  padding: 1.15rem 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, .09);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  --bm-size: 1.5rem;
}
.sidebar-close {
  background: transparent;
  border: 0;
  color: rgba(255, 255, 255, .6);
  font-size: 1.1rem;
  padding: .25rem .4rem;
  cursor: pointer;
}

.sidebar-nav { flex: 1; overflow-y: auto; padding: .8rem .7rem 1.5rem; }

.nav-group-label {
  font-family: var(--font-ui);
  font-size: .64rem;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .32);
  padding: 1.1rem .6rem .45rem;
}
.nav-group-label:first-child { padding-top: .25rem; }

.admin-sidebar .nav-item {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .58rem .65rem;
  border-radius: var(--radius-sm);
  color: rgba(255, 255, 255, .66);
  font-size: .875rem;
  font-weight: 500;
  transition: background .2s var(--ease), color .2s var(--ease);
  position: relative;
}
.admin-sidebar .nav-item i:first-child { font-size: 1rem; width: 18px; text-align: center; flex: 0 0 auto; }
.admin-sidebar .nav-item span { flex: 1; min-width: 0; }
.admin-sidebar .nav-item:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.admin-sidebar .nav-item.active {
  background: var(--gold);
  color: var(--navy);
  font-weight: 700;
}
.admin-sidebar .nav-item.text-danger { color: #FF8B8B !important; }
.admin-sidebar .nav-item.text-danger:hover { background: rgba(190, 30, 45, .22); color: #FFB4B4 !important; }

.nav-badge {
  background: var(--flag-red);
  color: #fff;
  font-size: .68rem;
  font-weight: 700;
  border-radius: 99px;
  padding: 0 .42rem;
  min-width: 20px;
  text-align: center;
  flex: 0 0 auto;
}
.nav-item.active .nav-badge { background: var(--navy); }
.nav-lock { font-size: .68rem !important; opacity: .38; width: auto !important; }
.nav-item.active .nav-lock { opacity: .6; }

.sidebar-foot { padding: .7rem; border-top: 1px solid rgba(255, 255, 255, .09); }

/* --------------------------------------------------------------------------
   Topbar
   -------------------------------------------------------------------------- */
.admin-topbar {
  height: var(--topbar-h);
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 1.6rem;
  position: sticky;
  top: 0;
  z-index: 1030;
}
@media (max-width: 991.98px) { .admin-topbar { padding: 0 1rem; } }

.topbar-title {
  font-size: 1.18rem;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar-sub {
  margin: 0;
  font-size: .78rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-icon {
  width: 38px; height: 38px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: #fff;
  color: var(--navy);
  display: grid; place-items: center;
  font-size: 1.15rem;
  cursor: pointer;
  transition: all .2s var(--ease);
  flex: 0 0 auto;
}
.btn-icon:hover { background: var(--canvas); border-color: var(--navy-500); }

.user-chip {
  display: flex;
  align-items: center;
  gap: .6rem;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 99px;
  padding: .28rem .7rem .28rem .28rem;
  cursor: pointer;
  transition: all .2s var(--ease);
  flex: 0 0 auto;
}
.user-chip:hover { background: var(--canvas); border-color: var(--navy-500); }
.user-chip .avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--navy);
  color: var(--gold);
  display: grid; place-items: center;
  font-family: var(--font-ui);
  font-weight: 800;
  font-size: .95rem;
  flex: 0 0 auto;
}

.admin-foot {
  padding: 1rem 1.6rem;
  border-top: 1px solid var(--line);
  font-size: .8rem;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  background: #fff;
}

/* --------------------------------------------------------------------------
   Cards & panels
   -------------------------------------------------------------------------- */
.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.3rem;
}
.panel-head {
  padding: 1.05rem 1.3rem;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.panel-head h2, .panel-head h3 { font-size: 1rem; margin: 0; }
.panel-head .sub { font-size: .78rem; color: var(--muted); margin: .15rem 0 0; }
.panel-body { padding: 1.3rem; }
.panel-body.tight { padding: 0; }

/* Stat tiles */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 1rem;
  margin-bottom: 1.3rem;
}
.stat-tile {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: flex-start;
  gap: .9rem;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease);
}
.stat-tile:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.stat-tile .ico {
  width: 42px; height: 42px;
  border-radius: 11px;
  display: grid; place-items: center;
  font-size: 1.15rem;
  background: rgba(201, 162, 74, .14);
  color: var(--gold-dark);
  flex: 0 0 auto;
}
.stat-tile .ico.navy  { background: rgba(29, 52, 97, .1);  color: var(--navy-600); }
.stat-tile .ico.green { background: rgba(11, 122, 69, .12); color: var(--flag-green); }
.stat-tile .ico.red   { background: rgba(190, 30, 45, .1);  color: var(--flag-red); }
.stat-tile .v {
  font-family: var(--font-ui);
  font-weight: 800;
  font-size: 1.6rem;
  color: var(--ink);
  line-height: 1.1;
}
.stat-tile .k { font-size: .78rem; color: var(--muted); margin-top: .1rem; }

/* --------------------------------------------------------------------------
   Tables
   -------------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; }

.table-admin {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
}
.table-admin th {
  font-family: var(--font-ui);
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--canvas);
  padding: .75rem 1rem;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
}
.table-admin td {
  padding: .8rem 1rem;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}
.table-admin tbody tr:last-child td { border-bottom: 0; }
.table-admin tbody tr { transition: background .15s var(--ease); }
.table-admin tbody tr:hover { background: #FAFBFD; }
.table-admin .t-title {
  font-family: var(--font-ui);
  font-weight: 600;
  color: var(--ink);
  display: block;
  max-width: 380px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.table-admin .t-sub { font-size: .78rem; color: var(--muted); }
.table-admin .thumb {
  width: 54px; height: 40px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--canvas);
  flex: 0 0 auto;
}
.table-admin .actions { white-space: nowrap; text-align: right; }

/* --------------------------------------------------------------------------
   Badges & chips
   -------------------------------------------------------------------------- */
.tag {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-family: var(--font-ui);
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .05em;
  padding: .22rem .6rem;
  border-radius: 5px;
  background: var(--canvas);
  color: var(--navy-600);
  border: 1px solid var(--line);
  white-space: nowrap;
}
.tag-green { background: rgba(11, 122, 69, .1);  color: var(--flag-green); border-color: rgba(11, 122, 69, .28); }
.tag-red   { background: rgba(190, 30, 45, .09); color: var(--flag-red);   border-color: rgba(190, 30, 45, .26); }
.tag-gold  { background: rgba(201, 162, 74, .14);color: var(--gold-dark);  border-color: rgba(201, 162, 74, .36); }
.tag-navy  { background: var(--navy); color: #fff; border-color: var(--navy); }
.tag-grey  { background: #EEF1F6; color: var(--muted); }

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.btn {
  font-family: var(--font-ui);
  font-weight: 600;
  border-radius: var(--radius-sm);
  padding: .5rem 1rem;
  font-size: .87rem;
  border: 1.5px solid transparent;
  transition: all .22s var(--ease);
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  white-space: nowrap;
}
.btn-navy   { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-navy:hover { background: var(--navy-600); border-color: var(--navy-600); color: #fff; }
.btn-gold   { background: var(--gold); border-color: var(--gold); color: var(--navy); }
.btn-gold:hover { background: var(--gold-light); border-color: var(--gold-light); color: var(--navy); }
.btn-ghost  { background: #fff; border-color: var(--line); color: var(--ink-soft); }
.btn-ghost:hover { border-color: var(--navy-500); color: var(--navy); background: #fff; }
.btn-danger-soft { background: rgba(190, 30, 45, .08); border-color: rgba(190, 30, 45, .28); color: var(--flag-red); }
.btn-danger-soft:hover { background: var(--flag-red); border-color: var(--flag-red); color: #fff; }
.btn-sm { padding: .32rem .7rem; font-size: .79rem; }
.btn-xs { padding: .22rem .5rem; font-size: .74rem; border-radius: 6px; }

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */
.form-label {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: .82rem;
  color: var(--navy);
  margin-bottom: .3rem;
}
.form-control, .form-select {
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: .55rem .8rem;
  font-size: .9rem;
  color: var(--ink);
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.form-control:focus, .form-select:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3.5px rgba(201, 162, 74, .16);
}
.form-text { font-size: .77rem; color: var(--muted); }
.form-check-input:checked { background-color: var(--navy); border-color: var(--navy); }
.form-check-input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201, 162, 74, .2); }
.input-group-text { background: var(--canvas); border: 1.5px solid var(--line); color: var(--muted); font-size: .85rem; }

.form-section-title {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: .78rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--gold-dark);
  padding-bottom: .45rem;
  border-bottom: 2px solid var(--gold);
  display: inline-block;
  margin: 0 0 1.1rem;
}

/* Password visibility toggle */
.pw-wrap { position: relative; }
.pw-wrap .form-control { padding-right: 2.9rem; }
.pw-toggle {
  position: absolute;
  right: .25rem; top: 50%;
  transform: translateY(-50%);
  width: 2.2rem; height: 2.2rem;
  display: grid; place-items: center;
  border: 0; background: transparent;
  color: var(--muted);
  border-radius: 6px;
  cursor: pointer;
}
.pw-toggle:hover { color: var(--navy); background: var(--canvas); }

/* Password strength meter */
.pw-meter { height: 5px; background: var(--line-soft); border-radius: 99px; overflow: hidden; margin-top: .45rem; }
.pw-meter > i { display: block; height: 100%; width: 0; border-radius: 99px; transition: width .3s var(--ease), background .3s var(--ease); }
.pw-hint { font-size: .75rem; color: var(--muted); margin-top: .3rem; }

/* Image picker */
.img-picker {
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  text-align: center;
  background: var(--canvas);
  transition: border-color .25s var(--ease), background .25s var(--ease);
}
.img-picker:hover, .img-picker.dragover { border-color: var(--gold); background: #FFFDF7; }
.img-picker .preview {
  width: 100%;
  aspect-ratio: 16/10;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: #fff;
  border: 1px solid var(--line);
  margin-bottom: .8rem;
  display: block;
}
.img-picker .hint { font-size: .78rem; color: var(--muted); }

/* Quill */
.ql-toolbar.ql-snow {
  border-color: var(--line) !important;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  background: var(--canvas);
}
.ql-container.ql-snow {
  border-color: var(--line) !important;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  font-family: var(--font-body);
  font-size: .93rem;
  min-height: 280px;
}
.ql-editor { min-height: 280px; line-height: 1.7; }
/* Headings inside the editor use the site's serif, so what an admin types
   previews the way it will actually publish. */
.ql-editor h2, .ql-editor h3, .ql-editor h4 {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--navy);
}
.ql-snow .ql-stroke { stroke: var(--ink-soft); }
.ql-snow .ql-picker { color: var(--ink-soft); }

/* --------------------------------------------------------------------------
   Login / auth pages
   -------------------------------------------------------------------------- */
.auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--canvas);
}
@media (max-width: 991.98px) { .auth-page { grid-template-columns: 1fr; } }

.auth-aside {
  background:
    radial-gradient(900px 520px at 82% -10%, rgba(201, 162, 74, .20), transparent 62%),
    linear-gradient(165deg, #0A1730 0%, #0C1A33 48%, #101F3C 100%);
  color: rgba(255, 255, 255, .74);
  padding: clamp(2rem, 5vw, 4rem);
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
@media (max-width: 991.98px) { .auth-aside { display: none; } }
.auth-aside::after {
  content: '';
  position: absolute;
  inset: auto -12% -30% auto;
  width: 460px; height: 460px;
  border-radius: 50%;
  border: 1px solid rgba(201, 162, 74, .2);
}
.auth-aside h2 { color: #fff; font-size: clamp(1.6rem, 2.6vw, 2.3rem); margin-bottom: 1rem; }
.auth-aside .brandblock { align-items: flex-start; --bm-size: 2rem; margin-bottom: 2.5rem; }
.auth-aside .brandblock .bm-rule { max-width: 250px; }
.auth-aside ul { list-style: none; padding: 0; margin: 2rem 0 0; }
.auth-aside li { display: flex; gap: .7rem; margin-bottom: .8rem; font-size: .92rem; }
.auth-aside li i { color: var(--gold); }

.auth-form-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1.5rem, 5vw, 3rem);
}
.auth-card { width: 100%; max-width: 420px; }
.auth-card .mobile-brand { --bm-size: 1.9rem; margin-bottom: 2rem; display: block; }
@media (min-width: 992px) { .auth-card .mobile-brand { display: none; } }

/* --------------------------------------------------------------------------
   Misc
   -------------------------------------------------------------------------- */
.empty-row {
  text-align: center;
  padding: 3.5rem 1rem;
  color: var(--muted);
}
.empty-row i { font-size: 2.6rem; color: var(--line); display: block; margin-bottom: .8rem; }

.pagination .page-link {
  border: 1.5px solid var(--line);
  color: var(--navy);
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: .85rem;
  margin: 0 .15rem;
  border-radius: var(--radius-sm) !important;
  min-width: 38px;
  text-align: center;
}
.pagination .page-link:hover { background: var(--canvas); border-color: var(--gold); }
.pagination .active .page-link { background: var(--navy); border-color: var(--navy); color: #fff; }

.alert { border: 0; border-left: 4px solid currentColor; border-radius: var(--radius-sm); font-size: .89rem; }

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  align-items: center;
}
.filter-row .form-control, .filter-row .form-select { max-width: 240px; }

.chip-link {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: .8rem;
  padding: .35rem .8rem;
  border-radius: 99px;
  border: 1.5px solid var(--line);
  background: #fff;
  color: var(--ink-soft);
  transition: all .2s var(--ease);
}
.chip-link:hover { border-color: var(--gold); color: var(--navy); }
.chip-link.active { background: var(--navy); border-color: var(--navy); color: #fff; }

/* Key/value settings rows */
.kv-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: .6rem 0;
  border-bottom: 1px dashed var(--line);
  font-size: .87rem;
}
.kv-row:last-child { border-bottom: 0; }
.kv-row .k { color: var(--muted); }
.kv-row .v { font-family: var(--font-ui); font-weight: 600; color: var(--ink); text-align: right; }

code {
  background: var(--canvas);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: .1rem .35rem;
  font-size: .84em;
  color: var(--navy-600);
}

.sticky-actions {
  position: sticky;
  bottom: 0;
  background: #fff;
  border-top: 1px solid var(--line);
  padding: .9rem 1.3rem;
  display: flex;
  gap: .6rem;
  justify-content: flex-end;
  border-radius: 0 0 var(--radius) var(--radius);
  z-index: 5;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
  }
}

/* --------------------------------------------------------------------------
   Brand serif — used sparingly, only where the console should feel like the
   site rather than like a spreadsheet.
   -------------------------------------------------------------------------- */
.topbar-title {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -.005em;
}
.auth-aside h2,
.auth-card h1 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -.008em;
  line-height: 1.2;
}