:root{
  --teb-primary:#7367f0;
  --teb-primary-rgb:115,103,240;
  --teb-text:#5d596c;
  --teb-heading:#384551;
  --teb-muted:#a5a3ae;
  --teb-bg:#f8f7fa;
  --teb-surface:#fff;
  --teb-border:#e6e6e8;
  --teb-header-bg:#fff;
  --teb-shadow:0 4px 18px rgba(47,43,61,.1);
  --teb-sidebar-gradient:linear-gradient(180deg,#7367f0 0%,#5e50ee 100%);
}
/* TebManager Panel — Zeno / Vuexy-inspired RTL admin shell */
*,*::before,*::after{box-sizing:border-box}
html{height:100%}
body.teb-panel,body.teb-zeno{
  margin:0;min-height:100%;
  font-family:Vazirmatn,Tahoma,system-ui,sans-serif;
  font-size:14px;line-height:1.55;
  color:var(--teb-text,#5d596c);
  background:var(--teb-bg,#f8f7fa);
  -webkit-font-smoothing:antialiased;
}
a{color:var(--teb-primary,#7367f0);text-decoration:none}
a:hover{color:color-mix(in srgb,var(--teb-primary,#7367f0) 85%,#000)}
img{max-width:100%;height:auto}

/* App shell */
.teb-app{display:flex;min-height:100vh;width:100%}
.teb-main-wrap{flex:1;min-width:0;display:flex;flex-direction:column;margin-right:260px}
@media(max-width:1199px){.teb-main-wrap{margin-right:0}}

/* Sidebar — Zeno purple gradient */
.teb-sidebar{
  position:fixed;top:0;right:0;bottom:0;width:260px;z-index:1030;
  display:flex;flex-direction:column;
  background:var(--teb-sidebar-gradient,linear-gradient(180deg,#7367f0 0%,#5e50ee 100%));
  color:#fff;
  box-shadow:-4px 0 24px rgba(115,103,240,.25);
}
.teb-sidebar__brand{
  display:flex;align-items:center;gap:12px;
  padding:1.35rem 1.25rem 1rem;
}
.teb-logo{
  width:36px;height:36px;border-radius:8px;
  background:rgba(255,255,255,.2);
  display:grid;place-items:center;
  font-weight:800;font-size:.75rem;letter-spacing:.02em;
}
.teb-brand-text{display:flex;flex-direction:column;line-height:1.25}
.teb-brand-name{font-size:.95rem;font-weight:700;color:#fff}
.teb-brand-sub{font-size:.7rem;opacity:.75;color:#fff}
.teb-nav{flex:1;overflow:auto;padding:.5rem 1rem 1rem;display:flex;flex-direction:column;gap:4px}
.teb-nav__item{
  display:flex;align-items:center;gap:12px;
  padding:.7rem 1rem;border-radius:.5rem;
  color:rgba(255,255,255,.85)!important;
  font-size:.875rem;font-weight:500;
  transition:background .15s,color .15s;
}
.teb-nav__item:hover{background:rgba(255,255,255,.12);color:#fff!important}
.teb-nav__item.is-active{
  background:#fff!important;color:var(--teb-primary,#7367f0)!important;
  font-weight:600;
  box-shadow:0 2px 8px rgba(0,0,0,.08);
}
.teb-nav__item.is-active .teb-nav__icon{color:var(--teb-primary,#7367f0)}
.teb-nav__icon{display:grid;place-items:center;opacity:.95}
.teb-sidebar__foot{padding:1rem 1.25rem;font-size:.7rem;opacity:.55;border-top:1px solid rgba(255,255,255,.1)}
.teb-sidebar-overlay{
  position:fixed;inset:0;background:rgba(0,0,0,.4);z-index:1025;display:none;
}
.teb-sidebar-overlay.is-visible,.teb-sidebar-overlay:not([hidden]){display:block}
@media(max-width:1199px){
  .teb-sidebar{transform:translateX(105%);transition:transform .25s ease}
  .teb-sidebar.is-open{transform:translateX(0)}
}

/* Topbar */
.teb-topbar{
  position:sticky;top:0;z-index:100;
  display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;
  padding:.85rem 1.5rem;
  background:var(--teb-header-bg,#fff);
  border-bottom:1px solid var(--teb-border,#e6e6e8);
  box-shadow:0 1px 0 rgba(0,0,0,.02);
}
.teb-topbar__start,.teb-topbar__end{display:flex;align-items:center;gap:12px}
.teb-page-heading__title{margin:0;font-size:1.25rem;font-weight:700;color:var(--teb-heading,#384551)}
.teb-page-heading__crumb{margin:2px 0 0;font-size:.75rem;color:var(--teb-muted,#a5a3ae)}
.teb-topbar-meta{display:flex;flex-direction:column;align-items:flex-end;line-height:1.2}
.teb-topbar-date{font-size:.7rem;color:var(--teb-muted)}
.teb-topbar-time{font-size:.95rem;font-weight:700;color:var(--teb-heading);font-variant-numeric:tabular-nums}
.teb-icon-btn{
  width:38px;height:38px;border:0;border-radius:50%;
  background:#f1f0f2;color:var(--teb-heading);cursor:pointer;
  display:grid;place-items:center;
}
.teb-icon-btn:hover{background:#e8e7ea}
.teb-user-menu{display:flex;align-items:center;gap:10px}
.teb-user-avatar{
  width:38px;height:38px;border-radius:50%;
  background:linear-gradient(135deg,var(--teb-primary,#7367f0),#9e95f5);
  color:#fff;display:grid;place-items:center;font-weight:700;font-size:.9rem;
}
.teb-user-meta{display:flex;flex-direction:column;line-height:1.2}
.teb-user-name{font-size:.85rem;font-weight:600;color:var(--teb-heading)}
.teb-user-role{font-size:.7rem;color:var(--teb-muted)}
@media(max-width:768px){
  .teb-user-meta,.teb-topbar-meta{display:none}
  .teb-topbar{padding:.65rem 1rem}
}

/* Content */
.teb-content{flex:1;padding:1.5rem;max-width:100%}
.teb-panel-footer{
  display:flex;justify-content:space-between;gap:12px;flex-wrap:wrap;
  padding:.75rem 1.5rem 1.25rem;font-size:.75rem;color:var(--teb-muted);
}

/* Cards — Zeno soft shadow */
.teb-card{
  background:var(--teb-surface,#fff);
  border-radius:.5rem;
  box-shadow:var(--teb-shadow);
  border:0;
  margin-bottom:1.25rem;
}
.teb-card__header{
  display:flex;align-items:center;justify-content:space-between;gap:12px;
  padding:1.15rem 1.25rem;border-bottom:1px solid #f0f0f2;
}
.teb-card__header h3{margin:0;font-size:1.05rem;font-weight:600;color:var(--teb-heading)}
.teb-card__body{padding:1.25rem}
.teb-card--flush .teb-card__body{padding:0}
.teb-card--flush .teb-table-wrap{border-radius:.5rem;overflow:hidden}

/* Stats */
.teb-stats-grid,.teb-stat-grid{
  display:grid;grid-template-columns:repeat(auto-fill,minmax(200px,1fr));
  gap:1.25rem;margin-bottom:1.25rem;
}
.teb-stat-card{
  background:#fff;border-radius:.5rem;padding:1.25rem;
  box-shadow:var(--teb-shadow);
  display:flex;align-items:center;gap:14px;
}
.teb-stat-card__body{display:flex;flex-direction:column;gap:2px;min-width:0}
.teb-stat-card__value{font-size:1.5rem;font-weight:700;color:var(--teb-heading);line-height:1.2}
.teb-stat-card__label{font-size:.8rem;color:var(--teb-muted)}
.teb-stat-card__icon{
  width:48px;height:48px;border-radius:.5rem;flex-shrink:0;
  background:rgba(var(--teb-primary-rgb,115,103,240),.12);
  display:grid;place-items:center;
}

/* Page hero */
.teb-page-hero{
  display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;
  background:#fff;border-radius:.5rem;padding:1.15rem 1.25rem;
  box-shadow:var(--teb-shadow);margin-bottom:1.25rem;
}
.teb-page-hero__title{margin:0;font-size:1.2rem;font-weight:700;color:var(--teb-heading)}
.teb-page-hero__sub{margin:.25rem 0 0;font-size:.85rem;color:var(--teb-muted)}

/* Buttons */
.teb-btn{
  display:inline-flex;align-items:center;justify-content:center;gap:6px;
  padding:.55rem 1.15rem;border-radius:.375rem;border:1px solid transparent;
  font-family:inherit;font-size:.875rem;font-weight:500;cursor:pointer;
  transition:background .15s,box-shadow .15s,color .15s;
}
.teb-btn--primary{background:var(--teb-primary,#7367F0);border-color:var(--teb-primary,#7367F0);color:#fff}
.teb-btn--primary:hover{filter:brightness(.95);color:#fff!important}
.teb-btn--secondary{background:#f1f0f2;color:var(--teb-heading)!important}
.teb-btn--secondary:hover{background:#e8e7ea}
.teb-btn--danger{background:#ea5455;color:#fff!important}
.teb-btn--xs{padding:.3rem .65rem;font-size:.75rem}
.teb-btn:disabled{opacity:.55;cursor:not-allowed}

/* Forms */
.teb-input,.teb-form-grid input,.teb-form-grid select,.teb-form-grid textarea{
  width:100%;padding:.55rem .85rem;
  border:1px solid #d8d6de;border-radius:.375rem;
  background:#fff;color:var(--teb-heading);
  font-family:inherit;font-size:.875rem;
  transition:border-color .15s,box-shadow .15s;
}
.teb-input:focus,select.teb-input:focus,textarea.teb-input:focus{
  outline:0;border-color:var(--teb-primary,#7367f0);
  box-shadow:0 0 0 3px rgba(var(--teb-primary-rgb,115,103,240),.15);
}
.teb-form-grid{
  display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:1rem;
}
.teb-form-grid > label,label.teb-field{
  display:flex;flex-direction:column;gap:6px;
  font-size:.8rem;font-weight:600;color:var(--teb-heading);
  padding:12px;background:#f8f7fa;border:1px solid #efefef;border-radius:.5rem;
}
.teb-form-actions{margin-top:1rem;padding-top:.75rem;border-top:1px solid #f0f0f2}

/* Tables */
.teb-table-wrap{overflow:auto}
.teb-table{width:100%;border-collapse:collapse;font-size:.875rem}
.teb-table th{
  text-align:right;padding:.85rem 1rem;font-weight:600;font-size:.8rem;
  color:var(--teb-muted);background:#fafafa;border-bottom:1px solid #efefef;
  white-space:nowrap;
}
.teb-table td{padding:.85rem 1rem;border-bottom:1px solid #f3f2f5;color:var(--teb-text)}
.teb-table tr:hover td{background:#faf9fc}

/* Tabs */
.teb-tabs{display:flex;flex-wrap:wrap;gap:4px;margin-bottom:1rem;border-bottom:1px solid #efefef;padding-bottom:0}
.teb-tab{
  border:0;background:transparent;padding:.65rem 1rem;cursor:pointer;
  font-family:inherit;font-size:.875rem;font-weight:500;color:var(--teb-muted);
  border-bottom:2px solid transparent;margin-bottom:-1px;
}
.teb-tab.is-active{color:var(--teb-primary);border-bottom-color:var(--teb-primary)}
.teb-tab-panel[hidden]{display:none!important}

/* Alerts & badges */
.teb-alert{padding:.85rem 1rem;border-radius:.375rem;margin-bottom:1rem;font-size:.875rem}
.teb-alert--error{background:#fceaea;color:#ea5455}
.teb-alert--success{background:#eafaf1;color:#28c76f}
.teb-alert--info{background:#eef0ff;color:#7367f0}
.teb-badge{
  display:inline-flex;padding:.2rem .55rem;border-radius:4px;
  font-size:.7rem;font-weight:600;background:#f1f0f2;color:var(--teb-heading);
}
.teb-badge--ok{background:#eafaf1;color:#28c76f}
.teb-badge--purple{background:#eeedfd;color:#7367f0}
.teb-empty,.teb-muted{color:var(--teb-muted);font-size:.875rem}

/* Toolbar */
.teb-toolbar{display:flex;flex-wrap:wrap;gap:8px;align-items:center;margin-bottom:1rem}

/* Modal */
.teb-modal{
  position:fixed;inset:0;z-index:2000;background:rgba(0,0,0,.45);
  display:none;align-items:center;justify-content:center;padding:1rem;
}
.teb-modal:not([hidden]){display:flex}
.teb-modal__dialog{
  background:#fff;border-radius:.5rem;width:100%;max-width:520px;
  max-height:90vh;overflow:auto;box-shadow:0 8px 40px rgba(0,0,0,.18);
}
.teb-modal__header{
  display:flex;justify-content:space-between;align-items:center;
  padding:1rem 1.25rem;border-bottom:1px solid #f0f0f2;
}
.teb-modal__body{padding:1.25rem}
.teb-modal__close{border:0;background:transparent;font-size:1.25rem;cursor:pointer;color:var(--teb-muted)}

/* Toast */
.teb-toast-root{position:fixed;top:1rem;left:1rem;z-index:3000;display:flex;flex-direction:column;gap:8px}
.teb-toast{
  padding:.75rem 1.1rem;border-radius:.375rem;background:#384551;color:#fff;
  font-size:.85rem;box-shadow:0 4px 16px rgba(0,0,0,.2);min-width:200px;
}
.teb-toast--success{background:#28c76f}
.teb-toast--error{background:#ea5455}

/* Bottom nav mobile */
.teb-bottom-nav{
  display:none;position:fixed;bottom:0;left:0;right:0;z-index:100;
  background:#fff;border-top:1px solid #efefef;
  padding:.4rem .5rem calc(.4rem + env(safe-area-inset-bottom));
  justify-content:space-around;
}
.teb-bottom-nav a{
  flex:1;text-align:center;padding:.45rem;font-size:.7rem;font-weight:600;
  color:var(--teb-muted)!important;
}
.teb-bottom-nav a.is-active{color:var(--teb-primary)!important}
@media(max-width:991px){
  .teb-bottom-nav{display:flex}
  .teb-content{padding:1rem 1rem 4.5rem}
}

/* Command palette */
.teb-cmd{
  position:fixed;inset:0;z-index:2500;background:rgba(0,0,0,.4);
  display:flex;align-items:flex-start;justify-content:center;padding:10vh 1rem 1rem;
}
.teb-cmd[hidden]{display:none!important}
.teb-cmd__box{
  background:#fff;border-radius:.5rem;width:100%;max-width:520px;
  box-shadow:0 12px 48px rgba(0,0,0,.2);overflow:hidden;
}
.teb-cmd__input{width:100%;border:0;padding:1rem 1.15rem;font-size:1rem;font-family:inherit;outline:0}
.teb-cmd__list{list-style:none;margin:0;padding:.5rem;max-height:280px;overflow:auto;border-top:1px solid #f0f0f2}
.teb-cmd__list li a,.teb-cmd__list button{
  display:block;width:100%;text-align:right;padding:.65rem .85rem;border:0;background:transparent;
  font-family:inherit;font-size:.875rem;cursor:pointer;border-radius:.375rem;color:var(--teb-heading);
}
.teb-cmd__list li a:hover,.teb-cmd__list button:hover{background:#f8f7fa}

/* Calendar grid */
.teb-cal{width:100%;border-collapse:collapse;font-size:.8rem}
.teb-cal th,.teb-cal td{border:1px solid #efefef;padding:6px;vertical-align:top;min-width:90px}
.teb-cal__time{width:52px;background:#fafafa;font-weight:600;color:var(--teb-muted)}
.teb-cal__cell{min-height:48px;cursor:pointer}
.teb-cal__cell:hover{background:#f8f7fa}

/* Section */
.teb-section{max-width:100%}
.teb-code{font-family:ui-monospace,monospace;font-size:.8rem;background:#f1f0f2;padding:2px 6px;border-radius:4px}

/* Dashboard grid helpers */
.teb-dashboard .teb-form-grid{grid-template-columns:1fr 1fr}
@media(max-width:900px){.teb-dashboard .teb-form-grid{grid-template-columns:1fr}}

/* Print */
@media print{
  .teb-sidebar,.teb-topbar,.teb-bottom-nav,.teb-panel-footer{display:none!important}
  .teb-main-wrap{margin:0!important}
}

/* Zeno header extras */
.teb-topbar-search{
  display:flex;align-items:center;gap:8px;
  background:#f1f0f2;border-radius:2rem;padding:6px 14px;min-width:180px;
}
.teb-topbar-search__input{
  border:0!important;background:transparent!important;outline:0!important;
  width:100%!important;min-width:0!important;flex:1!important;
  font-family:inherit;font-size:.85rem;color:var(--teb-heading);
  pointer-events:auto!important;cursor:text!important;
}
.teb-topbar-actions{display:flex;align-items:center;gap:4px}
.teb-icon-btn--badge{position:relative}
.teb-badge-dot{
  position:absolute;top:4px;left:4px;min-width:16px;height:16px;padding:0 4px;
  background:#ea5455;color:#fff;font-size:10px;font-weight:700;
  border-radius:999px;display:grid;place-items:center;
}
.teb-dropdown{position:relative}
.teb-dropdown__menu{
  position:absolute;top:calc(100% + 8px);left:0;min-width:220px;
  background:#fff;border-radius:.5rem;box-shadow:0 8px 28px rgba(0,0,0,.12);
  padding:.5rem;z-index:200;border:1px solid #f0f0f2;
}
.teb-dropdown__menu--grid{
  display:grid;grid-template-columns:1fr 1fr;min-width:260px;gap:4px;
}
.teb-dropdown__title{font-size:.75rem;font-weight:700;color:var(--teb-muted);padding:.4rem .6rem}
.teb-dropdown__menu a{
  display:block;padding:.55rem .75rem;border-radius:.375rem;
  color:var(--teb-heading)!important;font-size:.85rem;
}
.teb-dropdown__menu a:hover{background:#f8f7fa}
@media(max-width:900px){
  .teb-topbar-search{display:flex;min-width:0;flex:0 1 auto;max-width:220px}
  .teb-topbar-search__input{width:100%;min-width:0}
}
/* Compact filters row */
.teb-filters-row{
  display:flex;flex-wrap:wrap;gap:8px;align-items:flex-end;
  margin-bottom:12px;padding:12px;background:#fff;border-radius:.5rem;
  box-shadow:var(--teb-shadow);
}
.teb-filters-row label{
  display:flex;flex-direction:column;gap:4px;font-size:.75rem;font-weight:600;
  margin:0;padding:0;background:transparent;border:0;min-width:120px;flex:1;
}
.teb-filters-row .teb-input{min-width:100px}
.teb-filters-row .teb-btn{flex:0 0 auto;margin-bottom:1px}
/* Two-column dense forms */
.teb-form-grid--2{grid-template-columns:1fr 1fr!important}
@media(max-width:700px){.teb-form-grid--2{grid-template-columns:1fr!important}}
.teb-form-grid > label.teb-span-2{grid-column:1 / -1}
/* Table filter bar */
.teb-table-tools{
  display:flex;flex-wrap:wrap;gap:8px;align-items:center;justify-content:space-between;
  padding:12px 16px;border-bottom:1px solid #f0f0f2;
}
.teb-table-tools__left,.teb-table-tools__right{display:flex;flex-wrap:wrap;gap:8px;align-items:center}
.teb-table-tools .teb-input{width:auto;min-width:160px}
.teb-table-tools select.teb-input{min-width:90px;width:auto}


/* TEB SIDEBAR FIX 5.2 */
body.teb-panel, body.teb-zeno { overflow-x: hidden; }
.teb-sidebar {
  position: fixed !important;
  top: 0; right: 0; bottom: 0;
  width: 260px;
  z-index: 1040;
  overflow-y: auto;
}
.teb-main-wrap { margin-right: 260px; min-height: 100vh; }
@media (max-width: 1199px) {
  .teb-main-wrap { margin-right: 0 !important; }
  .teb-sidebar {
    transform: translateX(105%) !important;
    transition: transform .25s ease;
    box-shadow: -8px 0 24px rgba(0,0,0,.2);
  }
  body.teb-sidebar-open .teb-sidebar,
  .teb-sidebar.is-open {
    transform: translateX(0) !important;
  }
  .teb-sidebar-overlay,
  .teb-sidebar-overlay#teb-sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(47,43,61,.45);
    z-index: 1035;
  }
  body.teb-sidebar-open .teb-sidebar-overlay,
  .teb-sidebar-overlay.is-visible {
    display: block !important;
  }
  #teb-menu-toggle { display: inline-flex !important; }
}
@media (min-width: 1200px) {
  #teb-menu-toggle { display: inline-flex !important; }
  .teb-sidebar { transform: none !important; transition: width .25s ease, transform .25s ease; }
  body.teb-sidebar-collapsed .teb-sidebar {
    width: 72px !important;
    min-width: 72px !important;
    overflow: hidden !important;
    padding: 0.5rem 0 !important;
  }
  body.teb-sidebar-collapsed .teb-nav__label,
  body.teb-sidebar-collapsed .teb-brand-text,
  body.teb-sidebar-collapsed .teb-sidebar__foot {
    display: none !important;
  }
  body.teb-sidebar-collapsed .teb-nav__item {
    justify-content: center !important;
    padding-left: 0.65rem !important;
    padding-right: 0.65rem !important;
  }
  body.teb-sidebar-collapsed .teb-logo {
    margin: 0 auto;
  }
  body.teb-sidebar-collapsed .teb-main-wrap {
    margin-right: 72px !important;
  }
}

/* ========== UI/UX FIXES & MODERN IMPROVEMENTS (5.5.1) ========== */

/* 1. Focus visible for accessibility (keyboard) */
:focus-visible {
  outline: 2px solid var(--teb-primary, #7367f0);
  outline-offset: 2px;
}
.teb-nav__item:focus-visible,
.teb-btn:focus-visible,
.teb-icon-btn:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

/* 2. Dark mode complete */
body.teb-dark {
  --teb-text: #c9c7d2;
  --teb-heading: #e7e5ec;
  --teb-muted: #8a8796;
  --teb-bg: #16151c;
  --teb-surface: #221f2e;
  --teb-border: #2f2b3d;
  --teb-header-bg: #1c1a24;
  --teb-shadow: 0 4px 18px rgba(0,0,0,.35);
}
body.teb-dark .teb-card,
body.teb-dark .teb-stat-card,
body.teb-dark .teb-modal__dialog {
  background: var(--teb-surface);
  border-color: var(--teb-border);
  color: var(--teb-text);
}
body.teb-dark .teb-input {
  background: #1a1822;
  border-color: var(--teb-border);
  color: var(--teb-heading);
}
body.teb-dark .teb-topbar { background: var(--teb-header-bg); border-color: var(--teb-border); }
body.teb-dark .teb-icon-btn { background: #2a2736; color: var(--teb-heading); }
body.teb-dark .teb-btn--outline { border-color: var(--teb-border); color: var(--teb-heading); }

/* 3. Stat cards & grids */
.teb-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}
.teb-stat-grid--cards {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.teb-stat-card {
  background: var(--teb-surface, #fff);
  border: 1px solid var(--teb-border, #e6e6e8);
  border-radius: 12px;
  padding: 1rem 1.15rem;
  min-height: 108px;
  box-shadow: var(--teb-shadow);
  transition: transform .15s ease, box-shadow .15s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.teb-stat-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(47,43,61,.12); }
.teb-stat-card__label { font-size: .78rem; font-weight: 600; color: var(--teb-muted); margin-bottom: .5rem; line-height: 1.35; }
.teb-stat-card__value { font-size: 1.25rem; font-weight: 700; color: var(--teb-heading); font-variant-numeric: tabular-nums; line-height: 1.2; }
.teb-stat-card--blue { border-top: 3px solid #7367f0; }
.teb-stat-card--teal { border-top: 3px solid #28c3b0; }
.teb-stat-card--green { border-top: 3px solid #28c76f; }
.teb-stat-card--amber { border-top: 3px solid #ff9f43; }
.teb-stat-card--purple { border-top: 3px solid #a855f7; }

/* 4. Cards, buttons, forms */
.teb-card {
  background: var(--teb-surface, #fff);
  border: 1px solid var(--teb-border, #e6e6e8);
  border-radius: 12px;
  box-shadow: var(--teb-shadow);
  overflow: hidden;
}
.teb-card__header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--teb-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  flex-wrap: wrap;
}
.teb-card__title { margin: 0; font-size: 1rem; font-weight: 600; color: var(--teb-heading); }
.teb-card__body { padding: 1.25rem; }
.teb-card--link { text-decoration: none; color: inherit; display: block; transition: border-color .15s, box-shadow .15s; }
.teb-card--link:hover { border-color: var(--teb-primary); box-shadow: 0 6px 20px rgba(115,103,240,.15); }

.teb-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .55rem 1.1rem; border-radius: 8px; font-size: .875rem; font-weight: 600;
  border: 1px solid transparent; cursor: pointer; transition: background .15s, color .15s, box-shadow .15s;
  font-family: inherit; line-height: 1.4; text-decoration: none;
}
.teb-btn--primary { background: var(--teb-primary, #7367f0); color: #fff; }
.teb-btn--primary:hover { background: color-mix(in srgb, var(--teb-primary) 88%, #000); color: #fff; }
.teb-btn--outline { background: transparent; border-color: var(--teb-border); color: var(--teb-heading); }
.teb-btn--outline:hover { border-color: var(--teb-primary); color: var(--teb-primary); }
.teb-btn--ghost { background: transparent; color: var(--teb-muted); }
.teb-btn--ghost:hover { color: var(--teb-heading); background: rgba(0,0,0,.04); }

.teb-input {
  width: 100%; padding: .6rem .85rem; border: 1px solid var(--teb-border); border-radius: 8px;
  font-size: .9rem; font-family: inherit; background: #fff; color: var(--teb-heading);
  transition: border-color .15s, box-shadow .15s;
}
.teb-input:focus { border-color: var(--teb-primary); box-shadow: 0 0 0 3px rgba(115,103,240,.15); outline: none; }
.teb-input--search { max-width: 320px; }

.teb-form-row { margin-bottom: 1rem; }
.teb-form-row label { display: block; font-size: .8rem; font-weight: 600; margin-bottom: .35rem; color: var(--teb-heading); }
.teb-form-row--2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 560px) { .teb-form-row--2 { grid-template-columns: 1fr; } }

/* 5. Tabs */
.teb-tabs { display: flex; gap: .25rem; flex-wrap: wrap; }
.teb-tab {
  padding: .5rem 1rem; border: 0; background: transparent; border-radius: 8px;
  font-size: .875rem; font-weight: 600; color: var(--teb-muted); cursor: pointer; font-family: inherit;
}
.teb-tab.is-active { background: rgba(115,103,240,.12); color: var(--teb-primary); }
.teb-tab:hover:not(.is-active) { color: var(--teb-heading); background: rgba(0,0,0,.04); }

/* 6. Modal */
.teb-modal[hidden] { display: none !important; }
.teb-modal { position: fixed; inset: 0; z-index: 2000; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.teb-modal__backdrop { position: absolute; inset: 0; background: rgba(47,43,61,.5); backdrop-filter: blur(2px); }
.teb-modal__dialog {
  position: relative; background: var(--teb-surface, #fff); border-radius: 14px;
  width: 100%; max-width: 480px; max-height: 90vh; overflow: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.25); z-index: 1;
}
.teb-modal__header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--teb-border);
}
.teb-modal__header h3 { margin: 0; font-size: 1.05rem; }
.teb-modal__close {
  width: 36px; height: 36px; border: 0; border-radius: 50%; background: transparent;
  font-size: 1.4rem; cursor: pointer; color: var(--teb-muted); line-height: 1;
}
.teb-modal__close:hover { background: rgba(0,0,0,.06); color: var(--teb-heading); }
.teb-modal__body { padding: 1.25rem; }
.teb-modal__footer {
  display: flex; justify-content: flex-end; gap: .5rem; padding: 1rem 1.25rem;
  border-top: 1px solid var(--teb-border); margin: 0 -1.25rem -1.25rem; padding-top: 1rem;
}

/* 7. Content area & utilities */
.teb-content { padding: 1.5rem; flex: 1; }
.teb-page-intro { margin-bottom: 1.25rem; }
.teb-h2 { margin: 0 0 .25rem; font-size: 1.35rem; font-weight: 700; color: var(--teb-heading); }
.teb-muted { color: var(--teb-muted); font-size: .875rem; }
.teb-flex-between { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.teb-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.teb-quick-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.teb-grid--2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 768px) { .teb-grid--2 { grid-template-columns: 1fr; } }
.teb-list { margin: 0; padding-right: 1.2rem; line-height: 1.8; color: var(--teb-text); }
.teb-user-chip { display: flex; align-items: center; gap: .5rem; }
.teb-user-avatar { border-radius: 50%; object-fit: cover; }
.teb-user-name { font-size: .85rem; font-weight: 600; color: var(--teb-heading); max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 640px) { .teb-user-name { display: none; } }

/* 8. Bottom nav (mobile) */
.teb-bottom-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 1020;
  background: var(--teb-surface, #fff); border-top: 1px solid var(--teb-border);
  padding: .4rem .5rem calc(.4rem + env(safe-area-inset-bottom));
  justify-content: space-around; gap: .25rem;
}
.teb-bottom-nav__item {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: .35rem .5rem; border-radius: 8px; color: var(--teb-muted); font-size: .65rem;
  text-decoration: none; min-width: 56px;
}
.teb-bottom-nav__item.is-active { color: var(--teb-primary); background: rgba(115,103,240,.08); }
.teb-bottom-nav__icon { display: grid; place-items: center; }
@media (max-width: 767px) {
  .teb-bottom-nav { display: flex; }
  .teb-content { padding-bottom: 5rem; }
  .teb-panel-footer { display: none; }
}

/* 9. Toast */
.teb-toast-root {
  position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%);
  z-index: 3000; display: flex; flex-direction: column; gap: .5rem; pointer-events: none;
}
.teb-toast {
  pointer-events: auto; padding: .75rem 1.25rem; border-radius: 10px;
  background: #2f2b3d; color: #fff; font-size: .875rem; font-weight: 500;
  box-shadow: 0 8px 24px rgba(0,0,0,.2); max-width: 90vw;
}
.teb-toast--success { background: #28c76f; }
.teb-toast--error { background: #ea5455; }
.teb-toast--info { background: #7367f0; }

/* 10. NProgress bar */
#teb-nprogress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 9999; pointer-events: none; }
#teb-nprogress > div {
  height: 100%; width: 0; background: linear-gradient(90deg, #7367f0, #28c3b0);
  transition: width .25s ease; border-radius: 0 2px 2px 0;
}

/* Footer */
.teb-panel-footer {
  padding: .75rem 1.5rem; font-size: .75rem; color: var(--teb-muted);
  border-top: 1px solid var(--teb-border); display: flex; gap: .5rem; align-items: center;
}

/* Badge */
.teb-badge {
  display: inline-block; padding: .2rem .55rem; border-radius: 6px;
  font-size: .7rem; font-weight: 600;
}
.teb-badge--success { background: rgba(40,199,111,.15); color: #28c76f; }
.teb-badge--warning { background: rgba(255,159,67,.15); color: #ff9f43; }
.teb-badge--danger { background: rgba(234,84,85,.15); color: #ea5455; }
.teb-badge--info { background: rgba(115,103,240,.15); color: #7367f0; }

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

/* Print */
@media print {
  .teb-sidebar, .teb-topbar, .teb-bottom-nav, .teb-panel-footer, .teb-icon-btn { display: none !important; }
  .teb-main-wrap { margin: 0 !important; }
  .teb-content { padding: 0 !important; }
}

/* Tables */
.teb-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.teb-table th, .teb-table td { padding: .65rem .75rem; text-align: right; border-bottom: 1px solid var(--teb-border, #e6e6e8); }
.teb-table th { font-weight: 600; color: var(--teb-muted); font-size: .75rem; background: rgba(0,0,0,.02); }
.teb-table tbody tr:hover { background: rgba(115,103,240,.04); }
.teb-table-wrap { overflow-x: auto; }
.teb-btn--sm { padding: .3rem .6rem; font-size: .75rem; }
.teb-table-actions { white-space: nowrap; }
body.teb-dark .teb-table th { background: rgba(255,255,255,.03); }
.teb-badge--primary { background: rgba(115,103,240,.15); color: #7367f0; }
.teb-badge--secondary { background: rgba(0,0,0,.06); color: #5d596c; }
.teb-badge--purple { background: rgba(168,85,247,.15); color: #a855f7; }

/* ========== Theme Gallery & Settings (Appearance) ========== */
.teb-sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.teb-appear-hero__inner {
  display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap;
}
.teb-appear-hero__preview {
  display: flex; width: 200px; height: 110px; border-radius: 12px; overflow: hidden;
  border: 1px solid var(--teb-border); box-shadow: var(--teb-shadow); flex-shrink: 0;
}
.teb-preview-sidebar { width: 36%; }
.teb-preview-main { flex: 1; display: flex; flex-direction: column; background: var(--teb-bg, #f8f7fa); }
.teb-preview-bar { height: 18px; border-bottom: 1px solid rgba(0,0,0,.06); }
.teb-preview-cards { display: flex; gap: 6px; padding: 10px; flex: 1; align-items: flex-start; }
.teb-preview-cards span {
  flex: 1; height: 36px; border-radius: 6px; background: #e8e6ed;
}
.teb-preview-cards span:first-child { opacity: .95; }

.teb-theme-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
}
.teb-theme-card {
  display: block; cursor: pointer; border-radius: 14px;
  border: 2px solid var(--teb-border, #e6e6e8);
  background: var(--teb-surface, #fff);
  overflow: hidden;
  transition: border-color .2s, box-shadow .2s, transform .15s;
  position: relative;
}
.teb-theme-card:hover {
  border-color: color-mix(in srgb, var(--teb-primary) 50%, #ccc);
  transform: translateY(-3px);
  box-shadow: 0 10px 28px rgba(47,43,61,.12);
}
.teb-theme-card.is-selected {
  border-color: var(--teb-primary, #7367f0);
  box-shadow: 0 0 0 3px rgba(var(--teb-primary-rgb, 115,103,240), .25), 0 8px 24px rgba(47,43,61,.1);
}
.teb-theme-card__visual {
  display: flex; height: 100px; position: relative; overflow: hidden;
}
.teb-theme-card__sidebar { width: 28%; min-width: 36px; }
.teb-theme-card__canvas { flex: 1; display: flex; flex-direction: column; }
.teb-theme-card__topbar { height: 16px; border-bottom: 1px solid rgba(0,0,0,.05); }
.teb-theme-card__blocks {
  display: flex; gap: 5px; padding: 8px; flex: 1; align-items: flex-start;
}
.teb-theme-card__blocks i {
  display: block; flex: 1; height: 28px; border-radius: 5px;
  background: rgba(0,0,0,.06);
}
.teb-theme-card__blocks i:first-child { box-shadow: 0 2px 6px rgba(0,0,0,.12); }
.teb-theme-card__check {
  position: absolute; top: 8px; left: 8px;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--teb-primary, #7367f0); color: #fff;
  font-size: 12px; font-weight: 700;
  display: grid; place-items: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
.teb-theme-card__meta {
  display: flex; align-items: center; justify-content: space-between;
  padding: .65rem .85rem; border-top: 1px solid var(--teb-border);
}
.teb-theme-card__name { font-size: .8rem; font-weight: 600; color: var(--teb-heading); }
.teb-theme-card__swatch {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.12);
}
.teb-theme-card--dark .teb-theme-card__name { color: #e2e8f0; }
.teb-theme-card--dark { background: #1e293b; border-color: #334155; }
.teb-theme-card--dark .teb-theme-card__meta { border-color: #334155; }

.teb-color-row { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.teb-color-input {
  width: 48px; height: 48px; padding: 0; border: 2px solid var(--teb-border);
  border-radius: 12px; cursor: pointer; background: transparent;
}
.teb-color-input::-webkit-color-swatch-wrapper { padding: 4px; }
.teb-color-input::-webkit-color-swatch { border-radius: 8px; border: none; }

.teb-check { display: flex; align-items: center; gap: .5rem; font-weight: 500; cursor: pointer; }
.teb-check input { width: 18px; height: 18px; accent-color: var(--teb-primary); }

body.teb-density-spacious .teb-content { padding: 2rem; }
body.teb-density-spacious .teb-card__body { padding: 1.5rem; }
body.teb-density-spacious .teb-nav__item { padding: .85rem 1.1rem; }

@media (max-width: 640px) {
  .teb-theme-gallery { grid-template-columns: repeat(2, 1fr); gap: .75rem; }
  .teb-theme-card__visual { height: 80px; }
  .teb-appear-hero__preview { width: 140px; height: 80px; }
}


/* Header dropdown (3-dot) */
.teb-dropdown { position: relative; display: inline-flex; }
.teb-dropdown__menu {
  position: absolute; top: calc(100% + 8px); left: 0; min-width: 200px; z-index: 2000;
  background: var(--teb-surface, #fff); border: 1px solid var(--teb-border);
  border-radius: 12px; box-shadow: 0 12px 40px rgba(47,43,61,.18);
  padding: .4rem; display: none;
}
.teb-dropdown__menu.is-open,
.teb-dropdown__menu:not([hidden]) { display: block; }
.teb-dropdown__item {
  display: block; padding: .65rem .9rem; border-radius: 8px;
  color: var(--teb-heading); font-size: .875rem; font-weight: 500; text-decoration: none;
}
.teb-dropdown__item:hover { background: rgba(var(--teb-primary-rgb,115,103,240),.1); color: var(--teb-primary); }
.teb-dropdown__item--danger { color: #ea5455; }
.teb-dropdown__sep { border: 0; border-top: 1px solid var(--teb-border); margin: .35rem 0; }
body.teb-dark .teb-dropdown__menu { background: #221f2e; border-color: #2f2b3d; }

/* Stat value overflow fix */
.teb-stat-card { min-width: 0; overflow: hidden; }
.teb-stat-card__value {
  font-size: clamp(0.95rem, 2.5vw, 1.5rem) !important;
  font-weight: 700; color: var(--teb-heading);
  font-variant-numeric: tabular-nums;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 100%; line-height: 1.3;
}
.teb-stat-card__label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 480px) {
  .teb-stat-grid { grid-template-columns: 1fr 1fr; gap: .65rem; }
  .teb-stat-card { padding: .85rem; }
  .teb-stat-card__value { font-size: 0.9rem !important; }
}

/* Appointments advanced */
.teb-appt-filters { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: 1rem; }
.teb-appt-filters .teb-input { max-width: 180px; }
.teb-chip {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .35rem .75rem; border-radius: 999px; font-size: .75rem; font-weight: 600;
  background: rgba(var(--teb-primary-rgb,115,103,240),.1); color: var(--teb-primary);
  border: 0; cursor: pointer; font-family: inherit;
}
.teb-chip.is-active { background: var(--teb-primary); color: #fff; }
.teb-chip--muted { background: rgba(0,0,0,.05); color: var(--teb-muted); }
.teb-row-selected { background: rgba(var(--teb-primary-rgb,115,103,240),.08) !important; }
.teb-bulk-bar {
  display: none; position: sticky; bottom: 1rem; z-index: 50;
  background: var(--teb-heading, #384551); color: #fff; border-radius: 12px;
  padding: .75rem 1rem; margin-top: 1rem;
  align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  box-shadow: 0 8px 24px rgba(0,0,0,.2);
}
.teb-bulk-bar.is-visible { display: flex; }
.teb-bulk-bar .teb-btn { color: #fff; border-color: rgba(255,255,255,.3); }
.teb-module-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem;
}
.teb-module-card {
  display: flex; flex-direction: column; gap: .5rem;
  padding: 1.15rem; border-radius: 14px;
  border: 1px solid var(--teb-border); background: var(--teb-surface);
  text-decoration: none; color: inherit;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.teb-module-card:hover {
  border-color: var(--teb-primary); transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(115,103,240,.12);
}
.teb-module-card__icon {
  width: 40px; height: 40px; border-radius: 10px;
  background: rgba(var(--teb-primary-rgb,115,103,240),.12);
  color: var(--teb-primary); display: grid; place-items: center; font-size: 1.1rem;
}
.teb-module-card__title { font-weight: 700; color: var(--teb-heading); margin: 0; }
.teb-module-card__desc { font-size: .8rem; color: var(--teb-muted); margin: 0; }
.teb-module-card__meta { font-size: .7rem; color: var(--teb-primary); font-weight: 600; margin-top: auto; }
.teb-empty-state { text-align: center; padding: 2.5rem 1rem; }
.teb-empty-state__icon { font-size: 2.5rem; opacity: .4; margin-bottom: .75rem; }


/* ========== TebManager Panel UX 6.0 — 30 modern backend ideas ========== */
:root {
  --teb-radius-lg: 16px;
  --teb-radius-md: 12px;
  --teb-shadow-sm: 0 1px 2px rgba(15,23,42,.06);
  --teb-shadow-md: 0 8px 24px rgba(15,23,42,.08);
  --teb-shadow-lg: 0 16px 40px rgba(15,23,42,.12);
  --teb-glass: rgba(255,255,255,.72);
  --teb-focus: 0 0 0 3px rgba(115,103,240,.28);
}

/* 1 Density modes */
body.teb-density-compact .teb-card__body { padding: .75rem 1rem; }
body.teb-density-compact .teb-table td, body.teb-density-compact .teb-table th { padding: .4rem .55rem; font-size: .82rem; }
body.teb-density-compact .teb-btn { padding: .4rem .7rem; font-size: .8rem; }
body.teb-density-comfy .teb-card__body { padding: 1.35rem 1.5rem; }
body.teb-density-comfy .teb-table td, body.teb-density-comfy .teb-table th { padding: .85rem 1rem; }

/* 2 Dark mode panel */
body.teb-theme-dark {
  --teb-bg: #0b1220;
  --teb-surface: #111827;
  --teb-border: #1f2a3d;
  --teb-heading: #f1f5f9;
  --teb-text: #e2e8f0;
  --teb-muted: #94a3b8;
  --teb-glass: rgba(17,24,39,.8);
  color-scheme: dark;
}
body.teb-theme-dark .teb-topbar { background: rgba(17,24,39,.9); border-color: #1f2a3d; }
body.teb-theme-dark .teb-input, body.teb-theme-dark input, body.teb-theme-dark select, body.teb-theme-dark textarea {
  background: #0f172a; color: #e2e8f0; border-color: #334155;
}

/* 3 Sticky smart filter bar */
.teb-smart-filters {
  position: sticky; top: 64px; z-index: 30;
  background: var(--teb-glass); backdrop-filter: blur(12px);
  border: 1px solid var(--teb-border); border-radius: var(--teb-radius-md);
  padding: .75rem 1rem; margin-bottom: 1rem;
  box-shadow: var(--teb-shadow-sm);
}

/* 4 Command palette */
.teb-cmdk {
  position: fixed; inset: 0; z-index: 10000;
  background: rgba(15,23,42,.45); backdrop-filter: blur(4px);
  display: none; align-items: flex-start; justify-content: center; padding-top: 12vh;
}
.teb-cmdk.is-open { display: flex; }
.teb-cmdk__box {
  width: min(560px, 92vw); background: var(--teb-surface);
  border-radius: 16px; box-shadow: var(--teb-shadow-lg);
  border: 1px solid var(--teb-border); overflow: hidden;
}
.teb-cmdk__input {
  width: 100%; border: 0; border-bottom: 1px solid var(--teb-border);
  padding: 1rem 1.15rem; font-size: 1rem; background: transparent; color: var(--teb-heading);
  outline: none;
}
.teb-cmdk__list { max-height: 320px; overflow: auto; padding: .5rem; }
.teb-cmdk__item {
  display: flex; align-items: center; justify-content: space-between;
  padding: .65rem .85rem; border-radius: 10px; cursor: pointer; color: var(--teb-text);
}
.teb-cmdk__item:hover, .teb-cmdk__item.is-active { background: rgba(115,103,240,.12); color: var(--teb-primary); }
.teb-cmdk__hint { font-size: .7rem; color: var(--teb-muted); }

/* 5 Skeleton loaders */
.teb-skeleton {
  background: linear-gradient(90deg, #e2e8f0 25%, #f8fafc 50%, #e2e8f0 75%);
  background-size: 200% 100%; animation: tebSkel 1.2s ease-in-out infinite;
  border-radius: 8px; height: 14px;
}
body.teb-theme-dark .teb-skeleton { background: linear-gradient(90deg,#1e293b 25%,#334155 50%,#1e293b 75%); background-size:200% 100%; }
@keyframes tebSkel { 0%{background-position:200% 0} 100%{background-position:-200% 0} }

/* 6 Page header actions row */
.teb-page-head {
  display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between;
  gap: 1rem; margin-bottom: 1.25rem;
}
.teb-page-head__title { margin: 0; font-size: 1.35rem; font-weight: 800; color: var(--teb-heading); letter-spacing: -.02em; }
.teb-page-head__sub { margin: .25rem 0 0; color: var(--teb-muted); font-size: .88rem; }
.teb-page-head__actions { display: flex; flex-wrap: wrap; gap: .5rem; }

/* 7 Pill tabs */
.teb-pills { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }
.teb-pill {
  border: 1px solid var(--teb-border); background: var(--teb-surface);
  border-radius: 999px; padding: .4rem .9rem; font-size: .82rem; font-weight: 600;
  color: var(--teb-muted); text-decoration: none; cursor: pointer;
  transition: all .15s;
}
.teb-pill:hover { border-color: var(--teb-primary); color: var(--teb-primary); }
.teb-pill.is-active { background: var(--teb-primary); border-color: var(--teb-primary); color: #fff; }

/* 8 Status chips */
.teb-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: .15rem .55rem; border-radius: 999px; font-size: .72rem; font-weight: 700;
}
.teb-chip--ok { background: #dcfce7; color: #166534; }
.teb-chip--warn { background: #fef3c7; color: #92400e; }
.teb-chip--danger { background: #fee2e2; color: #991b1b; }
.teb-chip--info { background: #e0e7ff; color: #3730a3; }
body.teb-theme-dark .teb-chip--ok { background:#14532d; color:#bbf7d0; }
body.teb-theme-dark .teb-chip--warn { background:#78350f; color:#fde68a; }
body.teb-theme-dark .teb-chip--danger { background:#7f1d1d; color:#fecaca; }
body.teb-theme-dark .teb-chip--info { background:#312e81; color:#c7d2fe; }

/* 9 Floating action button (mobile) */
.teb-fab {
  position: fixed; left: 1rem; bottom: 5.5rem; z-index: 90;
  width: 52px; height: 52px; border-radius: 16px; border: 0;
  background: var(--teb-primary); color: #fff; font-size: 1.5rem;
  box-shadow: 0 8px 24px rgba(115,103,240,.4); cursor: pointer;
  display: none; align-items: center; justify-content: center;
}
@media (max-width: 991px) { .teb-fab { display: flex; } }

/* 10 Split view cards */
.teb-split { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 900px) { .teb-split { grid-template-columns: 1fr; } }

/* 11 KPI sparkline placeholder */
.teb-kpi {
  background: var(--teb-surface); border: 1px solid var(--teb-border);
  border-radius: var(--teb-radius-md); padding: 1rem 1.15rem;
  display: flex; flex-direction: column; gap: .35rem;
  transition: transform .15s, box-shadow .15s;
}
.teb-kpi:hover { transform: translateY(-2px); box-shadow: var(--teb-shadow-md); }
.teb-kpi__label { font-size: .78rem; color: var(--teb-muted); font-weight: 600; }
.teb-kpi__value { font-size: 1.55rem; font-weight: 800; color: var(--teb-heading); font-variant-numeric: tabular-nums; }
.teb-kpi__delta { font-size: .75rem; font-weight: 600; }
.teb-kpi__delta--up { color: #16a34a; }
.teb-kpi__delta--down { color: #dc2626; }

/* 12 Table row hover + selection */
.teb-table tbody tr { transition: background .12s; }
.teb-table tbody tr:hover { background: rgba(115,103,240,.05); }
.teb-table tbody tr.is-selected { background: rgba(115,103,240,.1); }

/* 13 Focus rings a11y */
.teb-btn:focus-visible, .teb-input:focus-visible, a:focus-visible {
  outline: none; box-shadow: var(--teb-focus);
}

/* 14 Empty state modern */
.teb-empty {
  text-align: center; padding: 3rem 1.5rem;
  border: 1px dashed var(--teb-border); border-radius: var(--teb-radius-lg);
  background: var(--teb-surface);
}
.teb-empty__icon { font-size: 2.75rem; opacity: .35; margin-bottom: .75rem; }
.teb-empty__title { font-weight: 700; color: var(--teb-heading); margin: 0 0 .35rem; }
.teb-empty__desc { color: var(--teb-muted); font-size: .9rem; margin: 0 0 1rem; }

/* 15 Progress / loading bar top */
.teb-nprogress {
  position: fixed; top: 0; right: 0; left: 0; height: 3px; z-index: 10001;
  background: linear-gradient(90deg, #7367f0, #a78bfa, #7367f0);
  background-size: 200% 100%; transform-origin: right;
  animation: tebProg 1s linear infinite; display: none;
}
.teb-nprogress.is-on { display: block; }
@keyframes tebProg { 0%{background-position:100% 0} 100%{background-position:-100% 0} }

/* 16 Sidebar collapsed rail */
body.teb-sidebar-collapsed .teb-sidebar { width: 72px !important; }
body.teb-sidebar-collapsed .teb-nav__label,
body.teb-sidebar-collapsed .teb-sidebar__label,
body.teb-sidebar-collapsed .teb-brand-text,
body.teb-sidebar-collapsed .teb-sidebar__brand span { display: none !important; }
body.teb-sidebar-collapsed .teb-main-wrap { margin-right: 72px !important; }
@media (max-width: 1199px) {
  body.teb-sidebar-collapsed .teb-main-wrap { margin-right: 0; }
}

/* 17 Notification drawer */
.teb-drawer {
  position: fixed; top: 0; bottom: 0; right: 0; left: auto; width: min(400px, 94vw);
  background: var(--teb-surface, #fff); border-right: 1px solid var(--teb-border, #e2e8f0);
  box-shadow: -8px 0 32px rgba(15,23,42,.12); z-index: 10050;
  transform: translateX(105%); transition: transform .28s cubic-bezier(.4,0,.2,1);
  display: flex; flex-direction: column;
}
.teb-drawer.is-open { transform: translateX(0) !important; }
.teb-notif-tabs{display:flex;gap:6px;flex-wrap:wrap;padding:0 1rem 8px}
.teb-notif-tabs button{font:inherit;font-size:.75rem;font-weight:700;padding:6px 10px;border-radius:999px;border:1px solid #e2e8f0;background:#f8fafc;cursor:pointer}
.teb-notif-tabs button.is-on{background:#7367F0;color:#fff;border-color:#7367F0}
.teb-notif-item{display:flex;gap:10px;align-items:flex-start;padding:12px;border-bottom:1px solid #f1f5f9}
.teb-notif-item__icon{width:36px;height:36px;border-radius:10px;background:#f1f5f9;display:grid;place-items:center;flex-shrink:0;font-size:.9rem}
.teb-notif-item--urgent .teb-notif-item__icon{background:#fef2f2;color:#dc2626}
.teb-notif-item--booking .teb-notif-item__icon{background:#eff6ff;color:#2563eb}
.teb-notif-item--msg .teb-notif-item__icon{background:#f5f3ff;color:#7c3aed}
.teb-drawer__head { padding: 1rem 1.15rem; border-bottom: 1px solid var(--teb-border); font-weight: 700; display:flex; justify-content:space-between; align-items:center; }
.teb-drawer__body { flex: 1; overflow: auto; padding: 1rem; }

/* 18 Quick settings popover */
.teb-popover {
  position: absolute; top: calc(100% + 8px); left: 0;
  min-width: 220px; background: var(--teb-surface);
  border: 1px solid var(--teb-border); border-radius: 12px;
  box-shadow: var(--teb-shadow-md); padding: .5rem; z-index: 50;
  display: none;
}
.teb-popover.is-open { display: block; }
.teb-popover button {
  width: 100%; text-align: right; border: 0; background: transparent;
  padding: .55rem .7rem; border-radius: 8px; cursor: pointer; color: var(--teb-text);
}
.teb-popover button:hover { background: rgba(115,103,240,.1); color: var(--teb-primary); }

/* 19 Card section title */
.teb-sec-title {
  display: flex; align-items: center; justify-content: space-between;
  margin: 0 0 .85rem; font-size: .95rem; font-weight: 700; color: var(--teb-heading);
}

/* 20 Inline edit affordance */
.teb-editable { border-bottom: 1px dashed transparent; cursor: text; }
.teb-editable:hover { border-bottom-color: var(--teb-primary); }

/* 21 Badge on nav */
.teb-nav-badge {
  margin-right: auto; background: #ef4444; color: #fff;
  font-size: .65rem; font-weight: 700; min-width: 18px; height: 18px;
  border-radius: 999px; display: inline-grid; place-items: center; padding: 0 5px;
}

/* 22 Smooth page enter */
.teb-content > * { animation: tebFade .25s ease; }
@keyframes tebFade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* 23 Toolbar group */
.teb-toolbar {
  display: flex; flex-wrap: wrap; gap: .5rem; align-items: center;
  margin-bottom: 1rem;
}
.teb-toolbar .teb-spacer { flex: 1; }

/* 24 Better form grid */
.teb-form-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .85rem 1rem;
}
.teb-form-grid label { display: flex; flex-direction: column; gap: .35rem; font-size: .82rem; color: var(--teb-muted); font-weight: 600; }

/* 25 Confirm danger zone */
.teb-danger-zone {
  border: 1px solid #fecaca; background: #fef2f2; border-radius: var(--teb-radius-md);
  padding: 1rem 1.15rem;
}
body.teb-theme-dark .teb-danger-zone { background: #450a0a; border-color: #7f1d1d; }

/* 26 Horizontal scroll hint for tables */
.teb-table-wrap { position: relative; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.teb-table-wrap::after {
  content: ''; pointer-events: none; position: absolute; top: 0; bottom: 0; left: 0; width: 24px;
  background: linear-gradient(90deg, var(--teb-surface), transparent); opacity: .0;
}

/* 27 Avatar stack */
.teb-avatars { display: flex; direction: ltr; }
.teb-avatars img {
  width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--teb-surface);
  margin-left: -8px;
}

/* 28 Toast stack already exists — enhance */
.teb-toast-root {
  position: fixed; bottom: 1.25rem; left: 1.25rem; z-index: 10050;
  display: flex; flex-direction: column; gap: .5rem; max-width: min(360px, 92vw);
}
.teb-toast {
  padding: .75rem 1rem; border-radius: 12px; background: #0f172a; color: #fff;
  box-shadow: var(--teb-shadow-md); font-size: .88rem; animation: tebFade .2s ease;
}
.teb-toast--success { background: #166534; }
.teb-toast--error { background: #991b1b; }
.teb-toast--info { background: #1e3a8a; }

/* 29 Keyboard shortcut hint in topbar */
.teb-kbd {
  font-size: .65rem; border: 1px solid var(--teb-border); border-radius: 6px;
  padding: .1rem .35rem; color: var(--teb-muted); background: var(--teb-surface);
  font-family: ui-monospace, monospace;
}

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



/* —— Pro Topbar 5.9.5 —— */
.teb-topbar--pro {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: .7rem 1.25rem;
  background: var(--teb-header-bg, #fff);
  border-bottom: 1px solid var(--teb-border, #e6e6e8);
  position: sticky;
  top: 0;
  z-index: 100;
  min-height: 64px;
}
.teb-topbar--pro .teb-topbar__start {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 0 1 auto;
}
.teb-topbar--pro .teb-topbar__center {
  flex: 1 1 auto;
  display: flex;
  justify-content: center;
  max-width: 420px;
  margin: 0 auto;
}
.teb-topbar--pro .teb-topbar__end {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-inline-start: auto;
}
.teb-topbar-search {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 380px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--teb-border, #e6e6e8);
  background: #f4f3f5;
  color: var(--teb-muted, #a5a3ae);
  cursor: pointer;
  font-family: inherit;
  font-size: .85rem;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.teb-topbar-search:hover {
  background: #fff;
  border-color: color-mix(in srgb, var(--teb-primary, #7367f0) 40%, var(--teb-border));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--teb-primary, #7367f0) 12%, transparent);
}
.teb-topbar-search__ph {
  flex: 1;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.teb-kbd {
  font-size: .68rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 6px;
  background: #fff;
  border: 1px solid var(--teb-border);
  color: var(--teb-muted);
  font-family: inherit;
}
.teb-topbar-cta {
  white-space: nowrap;
  border-radius: 999px !important;
  padding: .4rem 1rem !important;
}
.teb-icon-btn--badge { position: relative; }
.teb-badge-dot {
  position: absolute;
  top: 6px; left: 6px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #ef4444;
  border: 2px solid #fff;
}
.teb-user-chip--btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px 4px 4px;
  border-radius: 999px;
  border: 1px solid var(--teb-border);
  background: #fff;
  cursor: pointer;
  font-family: inherit;
  color: inherit;
}
.teb-user-chip--btn:hover { background: #f8f7fa; }
.teb-user-caret { opacity: .5; }
.teb-user-dropdown {
  min-width: 220px;
  left: 0; right: auto;
}
.teb-user-dropdown__head {
  padding: 12px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-bottom: 1px solid var(--teb-border);
  margin-bottom: 4px;
}
.teb-user-dropdown__head strong { font-size: .9rem; }
.teb-crumb-sep { margin: 0 4px; opacity: .45; }
.teb-topbar--pro .teb-topbar-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.2;
  padding-inline-end: 4px;
}
.teb-topbar--pro .teb-topbar-date { font-size: .7rem; color: var(--teb-muted); }
.teb-topbar--pro .teb-topbar-time { font-size: .9rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--teb-heading); }

@media (max-width: 992px) {
  .teb-topbar--pro .teb-topbar__center { display: none; }
  .teb-topbar--pro .teb-topbar-meta { display: none; }
  .teb-user-name { display: none; }
  .teb-topbar-cta { display: none; }
}
@media (max-width: 600px) {
  .teb-page-heading__crumb { display: none; }
}

/* dropdown item as button reset */
button.teb-dropdown__item {
  width: 100%;
  text-align: right;
  background: none;
  border: 0;
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  color: inherit;
}


/* Quick access menu */
.teb-quick-access { position: relative; }
.teb-quick-menu {
  min-width: 260px;
  max-height: 70vh;
  overflow: auto;
  left: 0; right: auto;
}
.teb-quick-menu__label {
  font-size: .68rem;
  font-weight: 700;
  color: var(--teb-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 10px 14px 4px;
}


/* اعداد فارسی در UI */
.teb-stat-card__value,
.teb-topbar-time,
.teb-topbar-date,
.teb-qboard__clock,
.teb-queue-now__name,
.teb-bb-sticky,
.teb-page-heading__title {
  font-feature-settings: "ss01" 0;
}
.teb-fa-num, [data-fa-num] {
  font-variant-numeric: normal;
}


/* مودال روی تمام لایه‌های قالب */
body.teb-modal-open { overflow: hidden !important; }
.teb-modal {
  position: fixed !important;
  inset: 0 !important;
  z-index: 99999 !important;
}
.teb-modal:not([hidden]) { display: flex !important; }


/* مودال سراسری — بالاتر از قالب و سایدبار */
body.teb-modal-open { overflow: hidden !important; }
.teb-modal {
  position: fixed !important;
  top: 0 !important; right: 0 !important; bottom: 0 !important; left: 0 !important;
  z-index: 2147483000 !important;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: transparent !important;
}
.teb-modal:not([hidden]) { display: flex !important; }
.teb-modal[hidden] { display: none !important; }
.teb-modal__backdrop {
  position: absolute !important;
  inset: 0 !important;
  background: rgba(15, 23, 42, 0.55) !important;
  backdrop-filter: blur(3px);
}
.teb-modal__dialog {
  position: relative !important;
  z-index: 1 !important;
  background: #fff !important;
  border-radius: 16px;
  max-width: 520px;
  width: 100%;
  max-height: 90vh;
  overflow: auto;
  box-shadow: 0 24px 64px rgba(0,0,0,.25);
}
body.teb-dark .teb-modal__dialog { background: #1e293b !important; color: #f1f5f9; }


/* —— تایپوگرافی استاندارد پنل —— */
body.teb-panel, body.teb-zeno {
  font-size: 14px;
  line-height: 1.55;
}
.teb-page-heading__title { font-size: 1.2rem !important; font-weight: 700 !important; }
.teb-card__title { font-size: 0.95rem !important; font-weight: 650 !important; }

/* مبلغ: عدد خوانا، واحد کوچک */
.teb-money {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  max-width: 100%;
  line-height: 1.15;
}
.teb-money__n {
  font-size: 1.2rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  color: var(--teb-heading, #384551);
  word-break: break-all;
}
.teb-money__u {
  font-size: 0.55rem !important;
  font-weight: 500 !important;
  color: var(--teb-muted, #8a8796) !important;
  letter-spacing: 0;
  line-height: 1.2;
}

/* باکس‌های داشبورد استاندارد */
.teb-stat-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)) !important;
  gap: 14px !important;
}
.teb-stat-card {
  min-height: 108px;
  padding: 1rem 1.15rem !important;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
}
.teb-stat-card__label {
  font-size: 0.78rem !important;
  font-weight: 600 !important;
  color: var(--teb-muted, #8a8796) !important;
  margin-bottom: 0.5rem !important;
  line-height: 1.35;
}
.teb-stat-card__value {
  font-size: 1.25rem !important;
  font-weight: 700 !important;
  line-height: 1.2 !important;
  word-break: break-word;
}
.teb-stat-card__value .teb-money__n {
  font-size: 1.15rem;
}
.teb-stat-card__num {
  font-size: 1.4rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--teb-heading, #384551);
}

/* ops-stats و کارت‌های مشابه در صفحات دیگر */
.teb-ops-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 1rem;
}
.teb-ops-stats .teb-card__body,
.teb-ops-stats .teb-card {
  padding: 12px 14px;
}
.teb-ops-stats span.teb-muted,
.teb-ops-stats .teb-muted {
  font-size: 0.75rem !important;
  display: block;
  margin-bottom: 4px;
}
.teb-ops-stats strong,
.teb-ops-stats .teb-num {
  font-size: 1.15rem !important;
  font-weight: 750 !important;
  font-variant-numeric: tabular-nums;
  display: block;
  line-height: 1.25;
}
.teb-ops-stats .teb-money__n { font-size: 1.05rem; }
.teb-ops-stats .teb-money__u { font-size: 0.5rem !important; }

/* جدول و بدنه — اندازه استاندارد */
.teb-table { font-size: 0.875rem !important; }
.teb-btn { font-size: 0.875rem !important; }
.teb-input, .teb-field input, .teb-field select, .teb-field textarea {
  font-size: 0.875rem !important;
}

/* تومان دو سایز کوچکتر */
.teb-money__u,
.bi-stat .teb-money__u,
.ins-stat .teb-money__u,
.ds-stat .teb-money__u,
.svc-stat .teb-money__u {
  font-size: 0.5rem !important;
  font-weight: 500 !important;
  opacity: 0.85;
  margin-top: 1px;
}
.teb-money {
  gap: 1px !important;
}

/* جستجوی هدر باریک‌تر */
.teb-topbar-search,
.teb-topbar-search--live,
#teb-header-search-wrap {
  flex: 0 1 auto !important;
  max-width: 220px !important;
  width: 220px;
  min-width: 120px;
}
.teb-topbar-search__input,
#teb-header-search {
  width: 100% !important;
  max-width: 100%;
  font-size: 0.85rem !important;
}
@media (max-width: 767px) {
  .teb-topbar-search,
  #teb-header-search-wrap {
    max-width: 140px !important;
    width: 140px;
  }
}


/* Notification backdrop + drawer polish */
.teb-drawer-backdrop {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .35);
  z-index: 9985; opacity: 0; pointer-events: none; transition: opacity .2s ease;
}
.teb-drawer-backdrop.is-open { opacity: 1; pointer-events: auto; }
.teb-drawer { z-index: 9990; }
.teb-drawer.is-open { transform: translateX(0) !important; }
.teb-notif-item { padding: 12px 4px; border-bottom: 1px solid var(--teb-border, #e2e8f0); }
.teb-notif-item a { color: inherit; text-decoration: none; font-weight: 600; display: block; }
.teb-notif-item:hover { background: rgba(15, 118, 110, .06); border-radius: 8px; padding-right: 8px; padding-left: 8px; }

/* Smart table filter bar */
.teb-smart-filter {
  display: flex; align-items: center; gap: 8px; margin: 0 0 12px;
  flex-wrap: wrap;
}
.teb-smart-filter__input {
  flex: 1; min-width: 180px; padding: .55rem .85rem;
  border: 1px solid var(--teb-border, #e2e8f0); border-radius: 10px;
  font-size: .9rem; background: var(--teb-surface, #fff); color: var(--teb-text, #0f172a);
}
.teb-smart-filter__input:focus {
  outline: none; border-color: var(--teb-primary, #7367F0);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, .15);
}
.teb-smart-filter__count {
  font-size: .8rem; color: var(--teb-muted, #64748b);
  background: #f1f5f9; padding: .25rem .55rem; border-radius: 999px;
}
.teb-smart-filter__clear {
  border: 0; background: #f1f5f9; width: 32px; height: 32px; border-radius: 8px; cursor: pointer;
  color: #64748b;
}
.teb-smart-filter__clear:hover { background: #e2e8f0; color: #0f172a; }

/* UI polish: sticky table head, density */
.teb-panel table thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--teb-surface, #fff); box-shadow: 0 1px 0 var(--teb-border, #e2e8f0);
}
.teb-badge-dot {
  position: absolute; top: 6px; left: 6px; width: 8px; height: 8px;
  background: #ef4444; border-radius: 50%; box-shadow: 0 0 0 2px #fff;
}
.teb-icon-btn--badge { position: relative; }
.teb-badge-count {
  position: absolute; top: 2px; left: 2px; min-width: 16px; height: 16px;
  padding: 0 4px; font-size: 10px; line-height: 16px; text-align: center;
  background: #ef4444; color: #fff; border-radius: 999px; font-weight: 700;
}
