/* ===========================================================
   ISRI Admin — custom theme (Bootstrap 5.3.8 + custom CSS)
   Inspired by esri.ie : clean, professional, teal/petrol brand
   =========================================================== */

:root {
  --brand-primary:   #006d77;   /* deep teal */
  --brand-primary-d: #00525a;
  --brand-primary-l: #0a8a95;
  --brand-accent:    #e29c2e;   /* warm accent */
  --brand-ink:       #122a30;   /* near-black teal ink */
  --sidebar-bg:      #073640;   /* dark petrol sidebar */
  --sidebar-bg-2:    #052a32;
  --sidebar-link:    #b9d4d8;
  --sidebar-link-h:  #ffffff;
  --body-bg:         #f3f6f7;
  --card-border:     #e3e9ea;
  --muted:           #6b7d80;

  --sidebar-w: 256px;
  --topbar-h: 64px;

  --bs-body-font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

/* ----------  Base  ---------- */
* { scroll-behavior: smooth; }

body {
  font-family: var(--bs-body-font-family);
  background: var(--body-bg);
  color: var(--brand-ink);
  font-size: 0.94rem;
}

a { text-decoration: none; }

h1, h2, h3, h4, h5, h6 { font-weight: 700; letter-spacing: -0.01em; }

.text-muted-2 { color: var(--muted) !important; }

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

/* ----------  Sidebar  ---------- */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg-2) 100%);
  color: var(--sidebar-link);
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 1045;
  display: flex;
  flex-direction: column;
  transition: transform .25s ease;
  overflow-y: auto;
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: .65rem;
  height: var(--topbar-h);
  padding: 0 1.15rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
  color: #fff;
  flex-shrink: 0;
}

.brand-logo {
  width: 40px; height: 40px;
  border-radius: 9px;
  display: grid; place-items: center;
  background: rgba(255,255,255,.12);
  border: 1px dashed rgba(255,255,255,.4);
  font-weight: 800;
  font-size: .72rem;
  color: #fff;
  letter-spacing: .03em;
  flex-shrink: 0;
}

.sidebar__brand .brand-name { font-weight: 800; font-size: 1.05rem; line-height: 1; }
.sidebar__brand .brand-tag  { font-size: .68rem; color: var(--sidebar-link); opacity: .8; }

.sidebar__section {
  padding: 1.1rem 1.15rem .35rem;
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: rgba(255,255,255,.4);
  font-weight: 700;
}

.sidebar__nav { list-style: none; padding: 0 .6rem; margin: 0; }

.sidebar__nav a {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .62rem .7rem;
  margin: .12rem 0;
  border-radius: 9px;
  color: var(--sidebar-link);
  font-weight: 500;
  transition: background .15s, color .15s;
}
.sidebar__nav a:hover { background: rgba(255,255,255,.08); color: var(--sidebar-link-h); }
.sidebar__nav a.active {
  background: var(--brand-primary);
  color: #fff;
  box-shadow: 0 6px 16px -6px rgba(0,109,119,.8);
}
.sidebar__nav a .ico { width: 18px; text-align: center; font-size: 1rem; flex-shrink: 0; }
.sidebar__nav a .badge { margin-left: auto; }

.sidebar__foot {
  margin-top: auto;
  padding: 1rem 1.15rem;
  border-top: 1px solid rgba(255,255,255,.08);
  font-size: .72rem;
  color: rgba(255,255,255,.45);
}

/* ----------  Main column  ---------- */
.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ----------  Topbar  ---------- */
.topbar {
  height: var(--topbar-h);
  background: #fff;
  border-bottom: 1px solid var(--card-border);
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 1.4rem;
  position: sticky;
  top: 0;
  z-index: 1030;
}
.topbar .menu-btn {
  border: none; background: transparent; font-size: 1.3rem; color: var(--brand-ink);
  display: none;
}
.topbar .search {
  max-width: 360px; width: 100%;
}
.topbar .search .form-control { background: var(--body-bg); border-color: transparent; }
.topbar .search .form-control:focus { background: #fff; }

.topbar .top-actions { margin-left: auto; display: flex; align-items: center; gap: .35rem; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%;
  border: none; background: transparent; color: var(--brand-ink);
  display: grid; place-items: center; position: relative;
  transition: background .15s;
}
.icon-btn:hover { background: var(--body-bg); }
.icon-btn .dot {
  position: absolute; top: 8px; right: 9px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--brand-accent); border: 2px solid #fff;
}
.avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--brand-primary); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: .85rem;
}

/* ----------  Page body  ---------- */
.page {
  padding: 1.6rem;
  flex: 1;
}
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; margin-bottom: 1.4rem;
}
.page-head h1 { font-size: 1.55rem; margin: 0; }
.page-head .crumb { font-size: .8rem; color: var(--muted); }
.page-head .crumb a { color: var(--brand-primary); }

/* ----------  Cards  ---------- */
.card {
  border: 1px solid var(--card-border);
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(18,42,48,.04);
}
.card-header {
  background: #fff;
  border-bottom: 1px solid var(--card-border);
  font-weight: 700;
  border-top-left-radius: 14px !important;
  border-top-right-radius: 14px !important;
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
}

/* ----------  Stat cards  ---------- */
.stat {
  display: flex; align-items: center; gap: 1rem; padding: 1.15rem 1.25rem;
}
.stat__icon {
  width: 52px; height: 52px; border-radius: 13px;
  display: grid; place-items: center; font-size: 1.4rem; color: #fff; flex-shrink: 0;
}
.stat__num { font-size: 1.6rem; font-weight: 800; line-height: 1; }
.stat__label { color: var(--muted); font-size: .82rem; }
.stat__trend { font-size: .74rem; font-weight: 700; }
.bg-teal   { background: var(--brand-primary); }
.bg-blue   { background: #2b6cb0; }
.bg-amber  { background: var(--brand-accent); }
.bg-rose   { background: #c2557a; }
.bg-green  { background: #2f9e6f; }
.bg-slate  { background: #51697a; }
.soft-teal  { background: #e0f0f1; color: var(--brand-primary); }
.soft-blue  { background: #e4eef8; color: #2b6cb0; }
.soft-amber { background: #fbeed3; color: #b67a12; }
.soft-rose  { background: #f7e3eb; color: #b04772; }
.soft-green { background: #e0f1ea; color: #2f9e6f; }

/* ----------  Buttons  ---------- */
.btn-brand { background: var(--brand-primary); border-color: var(--brand-primary); color: #fff; font-weight: 600; }
.btn-brand:hover { background: var(--brand-primary-d); border-color: var(--brand-primary-d); color: #fff; }
.btn-outline-brand { border-color: var(--brand-primary); color: var(--brand-primary); font-weight: 600; }
.btn-outline-brand:hover { background: var(--brand-primary); color: #fff; }
.btn { border-radius: 9px; }
.btn-sm { border-radius: 7px; }

/* ----------  Tables  ---------- */
.table-wrap { overflow-x: auto; }
.table { margin: 0; }
.table thead th {
  background: #fafbfb;
  text-transform: uppercase;
  font-size: .7rem;
  letter-spacing: .05em;
  color: var(--muted);
  border-bottom: 1px solid var(--card-border);
  white-space: nowrap;
  font-weight: 700;
}
.table tbody td { vertical-align: middle; border-color: #eef2f2; }
.table tbody tr:hover { background: #f8fafa; }

.tag {
  display: inline-block; padding: .2rem .6rem; border-radius: 999px;
  font-size: .72rem; font-weight: 600;
}
.badge-soft { background: #e0f0f1; color: var(--brand-primary); border-radius:999px; font-weight:600;}

.file-pill {
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .78rem; color: var(--brand-primary); font-weight: 600;
}

.row-actions .btn { width: 32px; height: 32px; display: inline-grid; place-items: center; padding: 0; }

/* ----------  Forms  ---------- */
.form-label { font-weight: 600; font-size: .84rem; margin-bottom: .35rem; }
.form-control, .form-select { border-radius: 9px; border-color: #d8e0e1; }
.form-control:focus, .form-select:focus {
  border-color: var(--brand-primary-l);
  box-shadow: 0 0 0 .2rem rgba(10,138,149,.15);
}
.req::after { content: " *"; color: #c2557a; }

.upload-box {
  border: 2px dashed #cfdadb; border-radius: 12px;
  padding: 1.4rem; text-align: center; color: var(--muted);
  background: #fafcfc; cursor: pointer; transition: border-color .15s, background .15s;
}
.upload-box:hover { border-color: var(--brand-primary-l); background: #f3fafa; }
.upload-box .ico { font-size: 1.6rem; color: var(--brand-primary); }

/* ----------  News cards  ---------- */
.news-thumb {
  height: 168px; background: #e7eded; border-radius: 12px 12px 0 0;
  display: grid; place-items: center; color: #9fb1b3; position: relative; overflow: hidden;
}
.news-thumb img { width: 100%; height: 100%; object-fit: cover; }
.news-cat {
  position: absolute; top: .7rem; left: .7rem;
  background: rgba(0,109,119,.92); color: #fff; font-size: .68rem; font-weight: 700;
  padding: .25rem .6rem; border-radius: 6px; text-transform: uppercase; letter-spacing: .04em;
}

/* ----------  Team / about  ---------- */
.team-card { text-align: center; padding: 1.4rem 1rem; }
.team-avatar {
  width: 84px; height: 84px; border-radius: 50%;
  background: #e7eded; border: 1px dashed #b9c7c8;
  margin: 0 auto .8rem; display: grid; place-items: center; color: #95a8aa; font-size: 1.6rem;
}
.logo-slot {
  height: 64px; border: 1px dashed #c4d0d1; border-radius: 10px;
  display: grid; place-items: center; color: #9fb1b3; font-size: .78rem;
  background: #fafcfc;
}

/* social row */
.social-input .input-group-text { width: 130px; }

/* agenda table inputs */
.agenda-table td { padding: .4rem; }
.agenda-table .form-control { font-size: .85rem; }

/* ----------  Misc  ---------- */
.divider { height: 1px; background: var(--card-border); margin: 1.2rem 0; }
.empty {
  text-align: center; padding: 2.5rem 1rem; color: var(--muted);
}
.empty .ico { font-size: 2.4rem; color: #c4d0d1; }

.backdrop {
  display: none; position: fixed; inset: 0; background: rgba(7,54,64,.45); z-index: 1040;
}

/* ----------  Responsive  ---------- */
@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .topbar .menu-btn { display: inline-block; }
  .backdrop.show { display: block; }
}

@media (max-width: 575.98px) {
  .page { padding: 1rem; }
  .topbar .search { display: none; }
}
.content { padding: 1.35rem; }
.cardx { background: #fff; border: 1px solid var(--card-border); border-radius: 10px; padding: 1.15rem; box-shadow: 0 10px 26px rgba(18,42,48,.04); }
.cardx-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .85rem; }
.cardx-head h2 { font-size: 1rem; margin: 0; }
.stat-card { background: #fff; border: 1px solid var(--card-border); border-radius: 10px; padding: 1rem; min-height: 96px; display: flex; flex-direction: column; justify-content: space-between; }
.stat-card span { color: var(--muted); font-size: .82rem; font-weight: 700; text-transform: uppercase; }
.stat-card strong { color: var(--brand-primary); font-size: 2rem; line-height: 1; }
.brand-logo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.brand-preview { width: 180px; min-height: 72px; border: 1px solid var(--card-border); border-radius: 8px; display: grid; place-items: center; background: #fff; color: var(--brand-primary); font-weight: 800; padding: .65rem; }
.brand-preview img { max-width: 100%; max-height: 58px; object-fit: contain; }
.favicon-preview { width: 54px; height: 54px; border: 1px solid var(--card-border); border-radius: 8px; display: grid; place-items: center; background: #fff; color: var(--brand-primary); font-size: .72rem; font-weight: 800; overflow: hidden; }
.favicon-preview img { max-width: 36px; max-height: 36px; object-fit: contain; }
.brand-color-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
.brand-color-grid label { margin: 0; font-size: .78rem; font-weight: 700; color: var(--muted); }
.brand-color-grid span { display: block; margin-bottom: .3rem; }
.brand-color-grid .form-control-color { width: 100%; height: 42px; padding: .25rem; }
.auth-page { min-height: 100vh; display: grid; place-items: center; background: var(--body-bg); padding: 1rem; }
.auth-card { width: min(420px, 100%); background: #fff; border: 1px solid var(--card-border); border-radius: 8px; padding: 2rem; box-shadow: 0 18px 42px -30px rgba(18,42,48,.55); }
.auth-card h1 { font-size: 1.55rem; margin-bottom: 1.25rem; }
.auth-card a { font-weight: 700; color: var(--brand-primary); }
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background:
    radial-gradient(circle at top left, color-mix(in srgb, var(--brand-primary) 18%, transparent), transparent 32rem),
    linear-gradient(135deg, #f7fafb 0%, #e9f0f1 100%);
}
.login-card {
  width: min(440px, 100%);
  padding: 2rem;
  border: 1px solid rgba(18,42,48,.08);
  border-radius: 10px;
  box-shadow: 0 24px 70px -42px rgba(18,42,48,.65);
}
.login-brand { display: flex; align-items: center; gap: .75rem; margin-bottom: 1.5rem; }
.login-brand strong { display: block; font-size: 1.05rem; line-height: 1.1; color: var(--brand-ink); }
.login-brand small { display: block; color: var(--muted); font-weight: 700; font-size: .75rem; margin-top: .15rem; }
.login-logo { width: 52px; height: 52px; border-radius: 8px; display: grid; place-items: center; background: var(--brand-primary); color: #fff; font-weight: 800; overflow: hidden; flex: 0 0 52px; }
.login-logo img { width: 100%; height: 100%; object-fit: contain; }
.login-head { margin-bottom: 1.25rem; }
.login-head h1 { margin: 0 0 .35rem; font-size: 1.8rem; letter-spacing: 0; color: var(--brand-ink); }
.login-head p { margin: 0; color: var(--muted); font-weight: 600; }
.auth-field { display: block; position: relative; margin: 0; }
.auth-field span { display: block; color: var(--brand-ink); font-size: .78rem; font-weight: 800; margin-bottom: .35rem; }
.auth-field i { position: absolute; left: .9rem; bottom: .83rem; color: var(--brand-primary); font-size: 1rem; }
.auth-field input { width: 100%; height: 48px; border: 1px solid #d8e0e1; border-radius: 8px; padding: .75rem .9rem .75rem 2.55rem; outline: 0; background: #fbfdfd; font-weight: 600; }
.auth-field input:focus { border-color: var(--brand-primary-l); box-shadow: 0 0 0 .22rem color-mix(in srgb, var(--brand-primary) 16%, transparent); background: #fff; }
.login-links { display: flex; justify-content: flex-end; margin-top: -.25rem; }
.login-links a, .back-link { color: var(--brand-primary); font-weight: 800; font-size: .88rem; }
.auth-submit { height: 48px; border-radius: 8px; font-weight: 800; }
.back-link { display: inline-flex; align-items: center; justify-content: center; margin-top: .15rem; text-align: center; }
@media (max-width: 480px) {
  .login-page { padding: 1rem; }
  .login-card { padding: 1.35rem; }
  .login-head h1 { font-size: 1.55rem; }
}

.admin-thumb {
  width: 34px;
  height: 34px;
  border-radius: 6px;
  background: #e7eded;
  color: #8ba0a3;
  display: inline-grid;
  place-items: center;
  overflow: hidden;
  flex: 0 0 auto;
}
.admin-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.admin-thumb.empty {
  border: 1px dashed #b9c7c8;
}
.upload-box .admin-thumb {
  width: 72px;
  height: 52px;
}

.rich-editor {
  border: 1px solid #d8e0e1;
  border-radius: 9px;
  background: #fff;
  overflow: hidden;
}
.rich-editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .25rem;
  padding: .45rem;
  background: #f8fafa;
  border-bottom: 1px solid #d8e0e1;
}
.rich-editor-toolbar button {
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--brand-ink);
}
.rich-editor-size {
  height: 32px;
  min-width: 94px;
  border: 1px solid #d8e0e1;
  border-radius: 6px;
  background: #fff;
  color: var(--brand-ink);
  font-size: .82rem;
  font-weight: 700;
  padding: 0 .45rem;
}
.rich-editor-toolbar button:hover,
.rich-editor-toolbar button:focus,
.rich-editor-size:focus {
  background: #fff;
  border-color: var(--card-border);
  color: var(--brand-primary);
}
.rich-editor-toolbar span {
  width: 1px;
  height: 22px;
  background: #d8e0e1;
  margin: 0 .15rem;
}
.rich-editor-surface {
  min-height: 180px;
  padding: .85rem .95rem;
  outline: 0;
  line-height: 1.6;
}
.rich-editor-surface:focus {
  box-shadow: inset 0 0 0 .2rem rgba(10,138,149,.12);
}
.rich-editor-surface p,
.rich-editor-surface ul,
.rich-editor-surface ol,
.rich-editor-surface h2,
.rich-editor-surface h3 {
  margin: 0 0 .75rem;
}
.rich-editor-surface h2 {
  font-size: 1.35rem;
}
.rich-editor-surface h3 {
  font-size: 1.1rem;
}
.rich-editor-source {
  display: none !important;
}


.role-checks { display: flex; flex-wrap: wrap; gap: .65rem; }
.role-checks label { display: inline-flex; align-items: center; gap: .35rem; min-height: 32px; padding: .25rem .6rem; border: 1px solid var(--card-border); border-radius: 999px; background: #fff; font-weight: 700; font-size: .82rem; }
.role-checks.compact label { min-height: 28px; padding: .2rem .5rem; font-size: .78rem; }
.user-row-form { min-width: 440px; display: grid; gap: .45rem; }
.user-update-cell { width: 470px; }
.user-admin-table small { color: var(--muted); }
.admin-permissions { border: 1px solid var(--card-border); border-radius: 10px; padding: .8rem; background: #f8fafa; }
.admin-permissions__head { display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem; margin-bottom: .7rem; }
.admin-permissions__head > div:first-child { display: grid; gap: .15rem; }
.admin-permissions__head small { color: var(--muted); font-size: .75rem; }
.admin-permissions__actions { display: flex; gap: .35rem; flex: 0 0 auto; }
.admin-permissions__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .45rem; }
.admin-permission-option { display: flex; align-items: flex-start; gap: .5rem; padding: .55rem; border: 1px solid #dce5e6; border-radius: 8px; background: #fff; cursor: pointer; }
.admin-permission-option input { margin-top: .2rem; flex: 0 0 auto; }
.admin-permission-option span { display: grid; gap: .1rem; line-height: 1.25; }
.admin-permission-option strong { font-size: .78rem; }
.admin-permission-option small { color: var(--muted); font-size: .69rem; }
.admin-permissions.is-compact { margin-top: .5rem; padding: .65rem; }
.admin-permissions.is-compact .admin-permissions__grid { grid-template-columns: repeat(2, minmax(180px, 1fr)); }
.permission-details { border: 1px solid var(--card-border); border-radius: 8px; background: #f8fafa; }
.permission-details summary { padding: .55rem .7rem; color: var(--brand-primary); font-size: .8rem; font-weight: 800; cursor: pointer; }
.permission-details[open] summary { border-bottom: 1px solid var(--card-border); }
.permission-details .admin-permissions { border: 0; border-radius: 0 0 8px 8px; margin: 0; }
@media (max-width: 991.98px) {
  .user-row-form { min-width: 360px; }
  .user-update-cell { width: auto; }
}
@media (max-width: 575.98px) {
  .admin-permissions__head { display: grid; }
  .admin-permissions__grid,
  .admin-permissions.is-compact .admin-permissions__grid { grid-template-columns: 1fr; }
}

/* Brand logo refresh */
.sidebar__brand {
  gap: .85rem;
}
.brand-logo {
  width: 72px;
  height: 48px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow: visible;
  letter-spacing: 0;
}
.brand-logo img {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  display: block;
  object-fit: contain;
}
.sidebar__brand .brand-name {
  font-size: 1rem;
}
@media (max-width: 991.98px) {
  .brand-logo {
    width: 64px;
    height: 42px;
  }
}

/* Mobile logo-only brand */
@media (max-width: 991.98px) {
  .sidebar__brand > span:last-child {
    display: none;
  }
  .sidebar__brand {
    justify-content: center;
    gap: 0;
  }
}
.mobile-app-admin-logo { width: 70px; height: 70px; flex: 0 0 70px; display: grid; place-items: center; overflow: hidden; border: 1px solid var(--card-border); border-radius: 16px; background: rgba(79, 34, 232, .08); color: var(--brand-primary); }
.mobile-app-admin-logo img { width: 100%; height: 100%; object-fit: contain; padding: 8px; }
.mobile-app-admin-logo i { font-size: 2rem; }
