:root{
  --brand-blue: #0b4f9f;
  --brand-blue-2: #0b4f9f;
  --accent-orange: #d79b37;
  --bg: #eef2f6;
  --panel: #ffffff;
  --muted: #667085;
  --text: #1f2a37;
  --border: rgba(17,24,39,.10);
  --shadow: 0 10px 24px rgba(16,24,40,.10);
  --app-font: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  --sidebar-w: 272px;
  --sidebar-collapsed-w: 86px;
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: var(--app-font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.45;
}

.app-shell{
  display:flex;
  min-height:100vh;
  position: relative;
}

.sidebar{
  width: var(--sidebar-w);
  background: var(--bg);
  border-right: 1px solid var(--border);
  display:flex;
  flex-direction:column;
  transition: width .2s ease;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
}

.sidebar__brand{
  display:flex;
  align-items:center;
  gap: 12px;
  padding: 14px 14px;
  border-bottom: 1px solid var(--border);
  min-height: 86px;
}

.sidebar__brand .logo-img{
  width: 56px;
  height: 56px;
  border-radius: 10px;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--border);
  padding: 4px;
}

.brand-text{
  display:flex;
  flex-direction:column;
  min-width: 0;
}

.brand-text strong{
  font-size: 0.98rem;
  line-height: 1.2;
  color:#0f2d5b;
}

.brand-text span{
  font-size: 0.82rem;
  color: var(--muted);
}

.sidebar__menu{
  padding: 12px 10px;
  display:flex;
  flex-direction:column;
  gap: 8px;
}

.side-link{
  display:flex;
  align-items:center;
  gap: 12px;
  padding: 12px 12px;
  border-radius: 10px;
  text-decoration:none;
  color: #111827;
  font-weight: 700;
  border: 1px solid transparent;
  white-space: nowrap;
}

button.side-link{
  width: 100%;
  background: transparent;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 12px;
  border-radius: 10px;
  text-decoration: none;
  color: #111827;
  font-weight: 700;
  border: 1px solid transparent;
  font-family: inherit;
  font-size: inherit;
}

.side-link:hover{
  background: #e6edf6;
  border-color: rgba(11,61,145,.10);
}

.side-link.active{
  background: var(--brand-blue);
  color:#fff;
}

.side-ico{
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display:flex;
  align-items:center;
  justify-content:center;
  background: rgba(11,61,145,.08);
  color: var(--brand-blue);
  font-weight:900;
  font-size: 0.75rem;
  letter-spacing: .03em;
  flex-shrink:0;
}

.side-ico svg{
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  display: block;
}

.side-link.active .side-ico{
  background: rgba(255,255,255,.18);
  color:#fff;
}

.side-text{
  overflow: hidden;
  text-overflow: ellipsis;
}

.side-submenu{
  padding: 8px 0 4px 44px;
}

.side-parent-toggle{
  margin: 0 6px;
  border-color: #d4ddf1;
  background: #dfe5f2;
  color: #4f66e8;
}

.side-parent-toggle:hover{
  border-color: #c6d2ef;
  background: #d6deef;
  color: #3f58db;
}

.side-parent-toggle.active{
  border-color: #d4ddf1;
  background: #dfe5f2;
  color: #4f66e8;
}

.side-parent-toggle .side-ico{
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: transparent;
  color: #4f66e8;
}

.side-parent-toggle.active .side-ico{
  background: transparent;
  color: #4f66e8;
}

.side-submenu .side-sub-link{
  margin: 0 0 4px;
  padding: 8px 10px;
  min-height: 34px;
  border: 0;
  background: transparent;
  color: #2b334b;
  font-weight: 700;
  border-left: 3px solid transparent;
  padding-left: 7px;
}

.side-submenu .side-sub-link:hover{
  background: rgba(11, 79, 159, 0.05);
  color: #1f2942;
}

.side-submenu .side-sub-link.active{
  background: rgba(11, 79, 159, 0.1);
  color: var(--brand-blue);
  border-left-color: var(--brand-blue);
  font-weight: 700;
}

.side-collapsible{
  display: flex;
  align-items: center;
  gap: 12px !important;
}

.side-caret{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1em;
  transition: transform 0.2s ease;
  color: #667085;
  flex-shrink: 0;
  margin-left: auto;
  width: 1.1rem;
  height: 1.1rem;
}

.side-caret::before{
  content: ">";
  display: block;
  line-height: 1;
  font-weight: 900;
}

.side-collapsible .side-ico{
  flex-shrink: 0;
}

.side-collapsible .side-text{
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Hide submenu by default */
.side-submenu{
  display: none;
}

.side-collapsible.expanded .side-caret{
  transform: rotate(90deg);
}

button.side-collapsible:hover{
  background: #e6edf6;
  border-color: rgba(11,61,145,.10);
}

button.side-collapsible.active{
  background: var(--brand-blue);
  color: #fff;
}

button.side-collapsible.active .side-ico{
  background: rgba(255,255,255,.18);
  color: #fff;
}

button.side-collapsible.active .side-caret{
  color: #fff;
}

.side-group{
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255,255,255,.45);
}

.side-group__summary{
  list-style: none;
  cursor: pointer;
  padding: 10px 12px;
  display:flex;
  align-items:center;
  gap: 8px;
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: #475467;
}

.side-group__summary::-webkit-details-marker{
  display: none;
}

.side-group__icon{
  width: 22px;
  height: 22px;
  border-radius: 7px;
  display:flex;
  align-items:center;
  justify-content:center;
  background: rgba(11,61,145,.08);
  color: var(--brand-blue);
  flex-shrink: 0;
}

.side-group__icon svg{
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.side-sub-link{
  margin: 0 6px 6px;
  padding-top: 10px;
  padding-bottom: 10px;
}

.side-sub-group{
  margin: 0 8px 8px;
  border: 1px dashed rgba(17,24,39,.16);
  border-radius: 10px;
  background: rgba(255,255,255,.5);
}

.side-sub-group__summary{
  list-style: none;
  cursor: pointer;
  padding: 8px 10px;
  font-size: .78rem;
  font-weight: 700;
  color: #475467;
}

.side-sub-group__summary::-webkit-details-marker{
  display: none;
}

.side-sub-link-2{
  margin: 0 8px 6px;
  min-height: 36px;
  padding: 8px 10px;
}

.side-sub-link-2 .side-text{
  font-size: .88rem;
}

.main-col{
  flex:1;
  display:flex;
  flex-direction:column;
  min-width:0;
}

.topbar{
  background: var(--brand-blue);
  color:#fff;
  padding: 10px 16px;
  box-shadow: 0 6px 18px rgba(16,24,40,.12);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar__inner{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
}

.topbar__left{
  display:flex;
  align-items:center;
  gap: 10px;
  min-width:0;
}

.topbar-logo{
  width: 36px;
  height: 36px;
  border-radius: 8px;
  object-fit: contain;
  background:#fff;
  padding: 3px;
}

.topbar__title{
  font-size: 1.15rem;
  font-weight: 900;
  letter-spacing: .02em;
  text-transform: uppercase;
  line-height: 1.1;
}

.icon-btn{
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 10px;
  background: rgba(255,255,255,.12);
  display:flex;
  flex-direction:column;
  justify-content:center;
  align-items:center;
  gap: 4px;
  cursor:pointer;
}

.icon-btn span{
  width: 16px;
  height: 2px;
  background:#fff;
  border-radius:2px;
}

.topbar__right{
  display:flex;
  align-items:center;
  gap: 8px;
}

.profile-menu{
  position: relative;
}

.profile-trigger{
  border: 1px solid rgba(255,255,255,.35);
  background: rgba(255,255,255,.12);
  color:#fff;
  border-radius: 999px;
  padding: 4px 10px 4px 4px;
  display:flex;
  align-items:center;
  gap: 8px;
  cursor:pointer;
}

.user-avatar{
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: rgba(255,255,255,.2);
  border: 1px solid rgba(255,255,255,.55);
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:900;
  font-size: 0.76rem;
  letter-spacing: .03em;
}

.profile-name{
  font-size: 0.9rem;
  font-weight: 700;
}

.profile-caret{
  font-size: 0.78rem;
  opacity: .92;
}

.profile-dropdown{
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 220px;
  background:#fff;
  border:1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 14px 26px rgba(15, 23, 42, .16);
  padding: 8px;
  display:none;
}

.profile-menu.open .profile-dropdown{
  display:block;
}

.profile-head{
  padding: 8px 10px 10px;
  border-bottom:1px solid var(--border);
  margin-bottom:4px;
}

.profile-head strong{
  display:block;
  color:#0f2d5b;
  font-size: 0.92rem;
}

.profile-head span{
  display:block;
  color: var(--muted);
  font-size: 0.8rem;
  margin-top:3px;
}

.profile-dropdown a{
  display:block;
  padding: 9px 10px;
  border-radius: 8px;
  color:#1f2a37;
  text-decoration:none;
  font-size: 0.9rem;
  font-weight: 600;
}

.profile-dropdown a:hover{
  background:#f4f7fb;
}

.profile-dropdown a.danger{
  color:#b42318;
}

.notification-menu{
  position: relative;
}
.notification-trigger{
  border: 1px solid rgba(255,255,255,.35);
  background: rgba(255,255,255,.12);
  border-radius: 999px;
  width: 48px;
  height: 48px;
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  position: relative;
}
.notification-trigger:hover{
  background: rgba(255,255,255,.2);
}
.notification-badge{
  position: absolute;
  top: 6px;
  right: 6px;
  min-width: 18px;
  padding: 1px 5px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  text-align:center;
}
.notification-dropdown{
  position: absolute;
  right: 0;
  top: 60px;
  width: 320px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 18px 28px rgba(15,23,42,.16);
  display:none;
  flex-direction:column;
  max-height: 420px;
  overflow:hidden;
}
.notification-dropdown.open{
  display:flex;
}
.notification-dropdown__header,
.notification-dropdown__footer{
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  display:flex;
  align-items:center;
  justify-content:space-between;
}
.notification-dropdown__footer{
  border-top: 1px solid var(--border);
  border-bottom: none;
  font-size: 0.85rem;
}
.notification-dropdown__content{
  max-height: 280px;
  overflow-y:auto;
  padding: 8px 0;
  display:flex;
  flex-direction:column;
  gap: 4px;
}
.notification-entry{
  padding: 8px 14px;
  display:flex;
  flex-direction:column;
  gap: 4px;
  color:#1f2a37;
  text-decoration:none;
  border-radius:8px;
}
.notification-entry:hover{
  background: #f4f7fb;
}
.notification-entry--unread{
  background: #f1fbff;
}
.notification-entry__message{
  font-weight: 600;
  font-size: 0.85rem;
}
.notification-entry__meta{
  color: #4b5563;
  font-size: 0.75rem;
}
.notification-empty{
  padding: 12px 14px;
  color: #4b5563;
  font-size: 0.85rem;
}
.notification-page .notification-list{
  list-style:none;
  margin:0;
  padding:0;
  display:flex;
  flex-direction:column;
  gap: 12px;
}
.notification-item{
  border: 1px solid rgba(15,23,42,.12);
  border-radius: 12px;
  padding: 12px 16px;
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap: 12px;
}
.notification-item--unread{
  border-color: rgba(59,130,246,.6);
  background: rgba(59,130,246,.08);
}
.notification-actions{
  display:flex;
  gap: 8px;
  align-items:center;
}

.main{
  padding: 16px 18px 28px;
}

.pagebar{
  width: 100%;
  margin: 0 0 14px;
  background: linear-gradient(180deg, #f4f7fc 0%, #edf2f8 100%);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 14px;
}

.pagebar__crumbs{
  min-width: 0;
  flex: 1 1 auto;
}

.breadcrumbs{
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.crumb{
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 10px;
  text-decoration: none;
  color: #173b68;
  font-size: 0.86rem;
  font-weight: 700;
  background: rgba(11,79,159,.08);
  border: 1px solid rgba(11,79,159,.12);
}

.crumb:hover{
  background: rgba(11,79,159,.14);
}

.crumb.current{
  color: #fff;
  background: var(--brand-blue);
  border-color: var(--brand-blue);
}

.crumb-sep{
  color: #95a2b6;
  font-size: 0.8rem;
  font-weight: 800;
}

.pagebar__actions{
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex: 0 0 auto;
}

.pagebar__actions:empty{
  display: none;
}

.btn-pill{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid rgba(11,61,145,.20);
  background: var(--brand-blue);
  color: #fff;
  font-weight: 900;
  text-decoration:none;
  box-shadow: 0 6px 14px rgba(16,24,40,.10);
}
.btn-pill:hover{
  filter: brightness(.98);
}

button[data-filter-toggle]{
  width: auto;
  min-width: 96px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid rgba(11,61,145,.22);
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 800;
  color: #fff;
  background: var(--brand-blue);
  box-shadow: 0 6px 14px rgba(16,24,40,.10);
  transition: filter .15s ease, box-shadow .15s ease, transform .08s ease;
}

button[data-filter-toggle]:not(.is-on){
  background: #dbe7f8;
  color: #123f75;
  border-color: rgba(11,79,159,.22);
  box-shadow: none;
}

button[data-filter-toggle]:hover{
  filter: brightness(.98);
}

button[data-filter-toggle]:focus-visible{
  outline: 3px solid rgba(79, 134, 243, .35);
  outline-offset: 2px;
}

.content-panel{
  width: 100%;
  margin: 0;
  background: var(--panel);
  border-radius: 14px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 26px 28px;
}

.content-panel h2,
.content-panel h3,
.content-panel h4{
  color: #103a70;
  margin-top: 0;
}

.content-panel a:not(.btn):not(.btn-pill){
  color: var(--brand-blue-2);
  font-weight: 600;
  text-decoration: none;
}

.content-panel a:not(.btn):not(.btn-pill):hover{
  text-decoration: underline;
}

.card{
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin: 12px 0;
  background: #fff;
}

.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--brand-blue);
  color:#fff;
  font-weight: 800;
  text-decoration:none;
  border:none;
  cursor:pointer;
  box-shadow: 0 6px 14px rgba(16,24,40,.10);
  transition: transform .08s ease, filter .15s ease, box-shadow .15s ease;
}

.btn-sm{
  padding: 6px 10px;
  font-size: 0.78rem;
}

.btn:hover{
  filter: brightness(.98);
  box-shadow: 0 8px 16px rgba(16,24,40,.13);
}

.btn.gray{
  background: #dbe7f8;
  color: #123f75;
  border: 1px solid rgba(11,79,159,.22);
}
.btn.danger{ background: #d06060; }
.btn:active{ transform: translateY(1px); }

.btn[disabled],
.btn:disabled,
.btn.disabled{
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

input, select, textarea{
  width: 100%;
  padding: 12px 14px;
  border: 2px solid var(--accent-orange);
  border-radius: 4px;
  outline:none;
  font-size: 15px;
  font-family: inherit;
  background:#fff;
}
button, .btn, .btn-pill{ font-family: inherit; }
input:focus, select:focus, textarea:focus{
  border-color: #c98612;
  box-shadow: 0 0 0 4px rgba(215,155,55,.22);
}

.ts-wrapper{
  width: 100%;
}

.ts-wrapper .ts-control{
  border: 2px solid var(--accent-orange);
  border-radius: 4px;
  min-height: 48px;
  padding: 10px 12px;
  font-size: 15px;
  font-family: inherit;
  box-shadow: none;
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
}

.ts-wrapper.focus .ts-control{
  border-color: #c98612;
  box-shadow: 0 0 0 4px rgba(215,155,55,.22);
}

.ts-wrapper.single.input-active .ts-control,
.ts-wrapper.single .ts-control{
  background: #fff;
}

.ts-wrapper .ts-control .item{
  flex: 0 0 auto;
  white-space: nowrap;
}

.ts-wrapper .ts-control input{
  flex: 1 1 auto !important;
  min-width: 80px !important;
  width: auto !important;
  line-height: 1.2 !important;
}

.ts-wrapper .ts-dropdown{
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  font-family: inherit;
}

.ts-wrapper .ts-dropdown .active{
  background: #e7eef9;
  color: #0f2d5b;
}

.badge{
  display:inline-flex;
  align-items:center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(11,61,145,.22);
  background: #eef4ff;
  color: #184377;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: .01em;
}

.muted{
  color: var(--muted);
}

.meta{
  color: #667085;
  font-size: 0.84rem;
}

.row-between{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.inline-actions{
  display:flex;
  gap: 8px;
  align-items:center;
  flex-wrap: wrap;
}

.form-inline{
  display:flex;
  gap: 10px;
  align-items:center;
  flex-wrap: wrap;
}

.form-inline > input,
.form-inline > select{
  flex: 1 1 220px;
}

.w-full{
  width: 100%;
}

.table{
  width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.table th,
.table td{
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(17,24,39,.08);
  vertical-align: top;
}

.table th{
  background: #f7f9fc;
  color: #2b3f5f;
  font-size: 0.9rem;
  font-weight: 800;
}

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

.msg{
  width: 100%;
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
}
.msg.success{ background:#e7f7ea; border-color:#bfe6c7; }
.msg.error{ background:#fdeaea; border-color:#f2b8b8; }
.msg.info{ background:#eef6ff; border-color:#b6d4fe; }

.sidebar-backdrop{
  display:none;
}

.app-shell.sidebar-collapsed .sidebar{
  width: var(--sidebar-collapsed-w);
}

.app-shell.sidebar-collapsed .brand-text{
  display:none;
}

.app-shell.sidebar-collapsed .sidebar__brand{
  justify-content:center;
}

.app-shell.sidebar-collapsed .side-link{
  justify-content:center;
  padding-left: 8px;
  padding-right: 8px;
}

.app-shell.sidebar-collapsed .side-text{
  display:none;
}

.app-shell.sidebar-collapsed .side-group{
  border: none;
  background: transparent;
}

.app-shell.sidebar-collapsed .side-group__summary,
.app-shell.sidebar-collapsed .side-sub-group__summary{
  display: none;
}

.app-shell.sidebar-collapsed .side-sub-link,
.app-shell.sidebar-collapsed .side-sub-link-2{
  margin: 0;
}

.app-shell.sidebar-collapsed .side-submenu{
  display: none !important;
}

@media (max-width: 1100px){
  .topbar__title{
    font-size: 1rem;
  }
}

@media (max-width: 900px){
  .sidebar{
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: min(80vw, 300px);
    z-index: 40;
    transform: translateX(-100%);
    transition: transform .2s ease;
    box-shadow: 0 12px 30px rgba(15, 23, 42, .22);
  }

  .app-shell.sidebar-open .sidebar{
    transform: translateX(0);
  }

  .sidebar-backdrop{
    position: fixed;
    inset: 0;
    border: 0;
    background: rgba(3, 12, 28, .38);
    z-index: 30;
    display:none;
  }

  .app-shell.sidebar-open .sidebar-backdrop{
    display:block;
  }

  .topbar{
    padding: 9px 10px;
  }

  .topbar-logo{
    width: 32px;
    height: 32px;
  }

  .topbar__title{
    font-size: .92rem;
  }

  .profile-name{
    display:none;
  }

  .main{
    padding: 14px 10px 24px;
  }

  .pagebar{
    padding: 12px 14px;
    flex-direction: column;
    align-items: stretch;
  }

  .content-panel{
    padding: 18px 14px;
  }

  .pagebar__actions{
    justify-content: flex-start;
  }
}
