:root {
  --tz-primary: #6d28d9;
  --tz-primary-soft: #f3efff;
  --tz-primary-dark: #4c1d95;
  --tz-text: #172033;
  --tz-muted: #667085;
  --tz-border: #e7eaf0;
  --tz-surface: #ffffff;
  --tz-canvas: #f6f7fb;
  --tz-success: #16a34a;
  --tz-danger: #dc2626;
  --tz-sidebar-width: 264px;
  --tz-sidebar-mini: 76px;
  --tz-topbar-height: 64px;
}

* { box-sizing: border-box; }
.material-icons { font-family: "Material Icons" !important; }
body { background: var(--tz-canvas); color: var(--tz-text); }

.tz-sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 1035;
  width: var(--tz-sidebar-width); display: flex; flex-direction: column;
  background: var(--tz-surface); border-right: 1px solid var(--tz-border);
  box-shadow: 8px 0 28px rgba(16, 24, 40, .04);
  transition: width .22s ease;
}
.tz-sidebar__brand { height: var(--tz-topbar-height); display: flex; align-items: center; justify-content: space-between; padding: 0 14px 0 18px; border-bottom: 1px solid var(--tz-border); }
.tz-brand { min-width: 0; display: flex; align-items: center; gap: 10px; color: var(--tz-text); text-decoration: none !important; }
.tz-brand__logo { width: 36px; height: 36px; flex: 0 0 36px; border-radius: 10px; object-fit: cover; }
.tz-brand__name { font-size: 17px; font-weight: 700; letter-spacing: -.02em; white-space: nowrap; }
.tz-icon-button { width: 38px; height: 38px; border: 0; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; background: transparent; color: var(--tz-muted); cursor: pointer; }
.tz-icon-button:hover { background: var(--tz-primary-soft); color: var(--tz-primary); }
.tz-icon-button .material-icons { font-size: 21px; }

.tz-user-card { margin: 12px; padding: 10px; display: flex; align-items: center; gap: 10px; border: 1px solid var(--tz-border); border-radius: 12px; color: var(--tz-text); text-decoration: none !important; background: #fbfbfd; }
.tz-user-card:hover { border-color: #cfc4f8; background: var(--tz-primary-soft); }
.tz-user-card img { width: 34px; height: 34px; flex: 0 0 34px; border-radius: 10px; object-fit: cover; }
.tz-user-card__copy { min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.tz-user-card__copy strong { overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.tz-user-card__copy small { color: var(--tz-muted); font-size: 11px; }

.tz-sidebar__nav { min-height: 0; flex: 1; overflow-y: auto; overflow-x: hidden; padding: 2px 10px 14px; scrollbar-width: thin; }
.tz-nav-link, .tz-nav-group__toggle { min-height: 42px; width: 100%; border: 0; border-radius: 9px; display: flex; align-items: center; gap: 12px; padding: 8px 11px; color: #475467; background: transparent; text-decoration: none !important; font-size: 13px; font-weight: 600; text-align: left; cursor: pointer; }
.tz-nav-link:hover, .tz-nav-group__toggle:hover { color: var(--tz-primary); background: #f8f7fc; }
.tz-nav-link.is-active { color: var(--tz-primary-dark); background: var(--tz-primary-soft); box-shadow: inset 3px 0 var(--tz-primary); }
.tz-nav-link .material-icons, .tz-nav-group__toggle .material-icons { width: 22px; flex: 0 0 22px; font-size: 21px; text-align: center; }
.tz-nav-group { margin-top: 3px; }
.tz-nav-group__toggle { justify-content: space-between; }
.tz-nav-group__toggle > span { display: flex; align-items: center; gap: 12px; min-width: 0; }
.tz-nav-group__chevron { transition: transform .18s ease; }
.tz-nav-group.is-open .tz-nav-group__chevron { transform: rotate(180deg); }
.tz-nav-group__items { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .2s ease; }
.tz-nav-group__items::before { content: ""; overflow: hidden; }
.tz-nav-group.is-open .tz-nav-group__items { grid-template-rows: 1fr; }
.tz-nav-group__items > a { display: none; margin: 1px 0 1px 43px; padding: 7px 10px; border-radius: 7px; color: var(--tz-muted); text-decoration: none !important; font-size: 12.5px; line-height: 1.25; }
.tz-nav-group.is-open .tz-nav-group__items > a { display: block; }
.tz-nav-group__items > a:hover { color: var(--tz-primary); background: #f8f7fc; }
.tz-nav-group__items > a.is-active { color: var(--tz-primary-dark); font-weight: 700; background: var(--tz-primary-soft); }
.tz-sidebar__footer { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 10px; border-top: 1px solid var(--tz-border); }
.tz-sidebar__footer .tz-nav-link { justify-content: center; padding: 8px; }
.tz-nav-link--danger:hover { color: var(--tz-danger); background: #fff1f2; }

.main-panel { width: calc(100% - var(--tz-sidebar-width)) !important; margin-left: var(--tz-sidebar-width) !important; min-height: 100vh; float: none !important; transition: width .22s ease, margin-left .22s ease; }
.tz-topbar { position: sticky; top: 0; z-index: 1025; height: var(--tz-topbar-height); display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 0 22px; border-bottom: 1px solid var(--tz-border); background: rgba(255,255,255,.94); backdrop-filter: blur(14px); }
.tz-topbar__title { min-width: 0; display: flex; align-items: center; gap: 8px; }
.tz-topbar__title > div { min-width: 0; display: flex; flex-direction: column; }
.tz-topbar__title strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 17px; letter-spacing: -.02em; }
.tz-topbar__eyebrow { color: var(--tz-muted); font-size: 10px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
.tz-topbar__status { display: flex; align-items: center; gap: 9px; }
.tz-market-status { display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; border-radius: 999px; background: #f2f4f7; color: var(--tz-muted); font-size: 11px; }
.tz-market-status span { width: 7px; height: 7px; border-radius: 50%; background: #98a2b3; }
.tz-market-status.is-open { color: #08783d; background: #eafaf1; }
.tz-market-status.is-open span { background: var(--tz-success); box-shadow: 0 0 0 4px rgba(22,163,74,.12); }
.tz-topbar__date { color: var(--tz-muted); font-size: 12px; white-space: nowrap; }
.tz-topbar__avatar { width: 34px; height: 34px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--tz-primary), #9f67ef); color: white !important; font-weight: 700; text-decoration: none !important; }
.tz-topbar__mobile-menu { display: none; }
.content { margin-top: 0 !important; padding: 14px 14px 28px !important; }
.content > .container-fluid { padding-top: 0 !important; }

.wrapper.tz-sidebar-collapsed .tz-sidebar { width: var(--tz-sidebar-mini); }
.wrapper.tz-sidebar-collapsed .main-panel { width: calc(100% - var(--tz-sidebar-mini)) !important; margin-left: var(--tz-sidebar-mini) !important; }
.wrapper.tz-sidebar-collapsed .tz-brand__name, .wrapper.tz-sidebar-collapsed .tz-user-card__copy, .wrapper.tz-sidebar-collapsed .tz-nav-link > span, .wrapper.tz-sidebar-collapsed .tz-nav-group__toggle span span, .wrapper.tz-sidebar-collapsed .tz-nav-group__chevron, .wrapper.tz-sidebar-collapsed .tz-nav-group__items { display: none; }
.wrapper.tz-sidebar-collapsed .tz-sidebar__brand { justify-content: center; padding: 0; }
.wrapper.tz-sidebar-collapsed .tz-brand { display: none; }
.wrapper.tz-sidebar-collapsed .tz-user-card { justify-content: center; margin: 10px; padding: 9px; }
.wrapper.tz-sidebar-collapsed .tz-nav-link, .wrapper.tz-sidebar-collapsed .tz-nav-group__toggle { justify-content: center; padding: 9px; }
.wrapper.tz-sidebar-collapsed .tz-sidebar__footer { grid-template-columns: 1fr; }
.wrapper.tz-sidebar-collapsed [data-tooltip] { position: relative; }

.tz-mobile-nav, .tz-mobile-sheet { display: none; }

@media (max-width: 991px) {
  body { padding-bottom: calc(66px + env(safe-area-inset-bottom)); }
  .tz-sidebar { display: none; }
  .main-panel, .wrapper.tz-sidebar-collapsed .main-panel { width: 100% !important; margin-left: 0 !important; }
  .tz-topbar { height: 58px; padding: 0 12px; }
  .tz-topbar__eyebrow, .tz-topbar__date, .tz-topbar__status > .tz-icon-button { display: none; }
  .tz-topbar__title strong { font-size: 15px; }
  .tz-topbar__mobile-menu { display: inline-flex; }
  .tz-market-status { padding: 6px 8px; }
  .tz-market-status strong { font-size: 10px; }
  .content { padding: 10px 8px 18px !important; }
  .tz-mobile-nav { position: fixed; z-index: 1040; inset: auto 0 0; height: calc(64px + env(safe-area-inset-bottom)); padding: 6px 6px env(safe-area-inset-bottom); display: grid; grid-template-columns: repeat(5, 1fr); border-top: 1px solid var(--tz-border); background: rgba(255,255,255,.97); box-shadow: 0 -8px 24px rgba(16,24,40,.08); backdrop-filter: blur(14px); }
  .tz-mobile-nav a, .tz-mobile-nav button { border: 0; background: transparent; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: #7a8494; text-decoration: none !important; font-size: 10px; font-weight: 600; }
  .tz-mobile-nav .material-icons { font-size: 22px; }
  .tz-mobile-nav .is-active { color: var(--tz-primary); }
  .tz-mobile-sheet { position: fixed; z-index: 1060; inset: 0; visibility: hidden; display: block; pointer-events: none; }
  .tz-mobile-sheet.is-open { visibility: visible; pointer-events: auto; }
  .tz-mobile-sheet__backdrop { position: absolute; inset: 0; width: 100%; border: 0; background: rgba(15,23,42,.46); opacity: 0; transition: opacity .2s; }
  .tz-mobile-sheet.is-open .tz-mobile-sheet__backdrop { opacity: 1; }
  .tz-mobile-sheet__panel { position: absolute; inset: auto 0 0; max-height: 85vh; overflow-y: auto; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); border-radius: 22px 22px 0 0; background: white; transform: translateY(105%); transition: transform .24s ease; }
  .tz-mobile-sheet.is-open .tz-mobile-sheet__panel { transform: translateY(0); }
  .tz-mobile-sheet__header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 14px; }
  .tz-mobile-sheet__header > div { display: flex; flex-direction: column; }
  .tz-mobile-sheet__header strong { font-size: 17px; }
  .tz-mobile-sheet__header small { color: var(--tz-muted); }
  .tz-mobile-sheet__grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
  .tz-mobile-sheet__grid a { min-height: 82px; padding: 10px 6px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--tz-border); border-radius: 13px; color: var(--tz-text); text-align: center; text-decoration: none !important; font-size: 11px; font-weight: 600; }
  .tz-mobile-sheet__grid a:hover { border-color: #cfc4f8; color: var(--tz-primary); background: var(--tz-primary-soft); }
  .tz-mobile-sheet__grid .material-icons { color: var(--tz-primary); font-size: 24px; }
  .tz-mobile-sheet__logout { margin-top: 14px; min-height: 42px; display: flex; align-items: center; justify-content: center; gap: 8px; border-radius: 10px; color: var(--tz-danger); background: #fff1f2; text-decoration: none !important; font-weight: 600; }
}

@media (max-width: 430px) {
  .tz-mobile-sheet__grid { grid-template-columns: repeat(3, 1fr); }
  .tz-market-status strong { display: none; }
  .tz-market-status { width: 24px; height: 24px; justify-content: center; padding: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .tz-sidebar, .main-panel, .tz-nav-group__items, .tz-mobile-sheet__panel, .tz-mobile-sheet__backdrop { transition: none !important; }
}
