.app-shell { display: grid; grid-template-columns: 264px 1fr; min-height: 100vh; }

/* ---------- sidebar ---------- */
.sidebar {
  background: var(--bg-soft); border-right: 1px solid var(--border-soft);
  padding: 22px 16px; display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto; z-index: 300;
}
.sidebar-close { display: none; }
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 22px; }
.brand .mark {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), #ff8154);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 800; color: #1a0904; font-size: 16px;
}
.brand .name { font-family: var(--font-display); font-weight: 700; font-size: 18px; }
.nav-group { margin: 14px 0 6px; padding: 0 10px; font-size: 11px; letter-spacing: .06em; color: var(--text-faint); font-weight: 700; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 10px;
  color: var(--text-dim); font-size: 14px; font-weight: 500; cursor: pointer; transition: background .15s, color .15s;
  border: 1px solid transparent;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--accent-dim); color: var(--accent-2); border-color: #ff5b3c33; }
.nav-item .ic { width: 18px; text-align: center; opacity: .9; }
.nav-item .count { margin-left: auto; background: var(--danger); color: #fff; font-size: 10.5px; padding: 1px 7px; border-radius: 100px; font-weight: 700; }
.sidebar-footer { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--border-soft); }

/* ---------- topbar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 28px; border-bottom: 1px solid var(--border-soft); position: sticky; top: 0;
  background: rgba(9, 13, 22, .85); backdrop-filter: blur(10px); z-index: 100;
}
.topbar .clock { font-family: var(--font-display); font-weight: 600; font-size: 14px; color: var(--text); }
.topbar .clock .date { color: var(--text-dim); font-weight: 500; font-size: 12.5px; }
.topbar-actions { display: flex; align-items: center; gap: 14px; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; cursor: pointer; position: relative; color: var(--text-dim);
}
.icon-btn:hover { color: var(--text); border-color: var(--accent); }
.icon-btn .ping { position: absolute; top: -3px; right: -3px; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); border: 2px solid var(--bg); }
.avatar { width: 38px; height: 38px; border-radius: 10px; background: var(--surface-3); display: flex; align-items: center; justify-content: center; font-weight: 700; font-family: var(--font-display); font-size: 13px; }

.content { padding: 26px 28px 60px; max-width: 1320px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; margin: 0 0 4px; }
.page-head p { margin: 0; color: var(--text-dim); font-size: 13.5px; }
.page-head > div:last-child { display: flex; gap: 8px; flex-wrap: wrap; }
.grid { display: grid; gap: 18px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: 2fr 1fr; }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } .grid-2 { grid-template-columns: 1fr; } }
@media (max-width: 720px) { .app-shell { grid-template-columns: 1fr; } .grid-4, .grid-3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) {
  .content { padding: 16px 14px 48px; }
  .topbar { padding: 12px 14px; }
  .topbar-actions { gap: 8px; }
  .grid-4, .grid-3 { grid-template-columns: 1fr; }
  .page-head { align-items: stretch; }
  .page-head h1 { font-size: 19px; }
  .page-head > div:last-child { width: 100%; }
  .page-head > div:last-child .btn { flex: 1; }
  .stat-card .value { font-size: 22px; }
  .topbar .clock .date { display: none; }
  .card { padding: 16px; }
  .modal { padding: 20px; }
}

/* ---------- mobile off-canvas sidebar ---------- */
.hamburger-btn { display: none; }
@media (max-width: 900px) {
  .hamburger-btn { display: flex; }
  .sidebar {
    position: fixed; top: 0; left: 0; height: 100dvh; width: 264px;
    transform: translateX(-100%); transition: transform .25s ease; box-shadow: var(--shadow);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close { display: flex; margin-left: auto; }
  .sidebar-backdrop {
    display: none; position: fixed; inset: 0; background: rgba(4,6,12,.6); z-index: 290;
  }
  .sidebar-backdrop.show { display: block; }
}

/* dropdown panel (notifications) */
.dropdown-panel {
  position: absolute; top: 52px; right: 0; width: 340px; max-width: calc(100vw - 24px); max-height: 420px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 8px; z-index: 200; display: none;
}
.dropdown-panel.show { display: block; }
.notif-item { padding: 12px; border-radius: 10px; font-size: 13px; display: flex; gap: 10px; }
.notif-item:hover { background: var(--surface-2); }
.notif-item .n-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-top: 5px; flex-shrink: 0; }
.notif-item.read .n-dot { background: var(--text-faint); }
.notif-item .n-time { color: var(--text-faint); font-size: 11px; margin-top: 3px; }

/* ---------- tabs / filters ---------- */
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--border-soft); margin-bottom: 18px; flex-wrap: wrap; }
.tab { padding: 10px 14px; font-size: 13.5px; font-weight: 600; color: var(--text-dim); cursor: pointer; border-bottom: 2px solid transparent; }
.tab.active { color: var(--text); border-color: var(--accent); }

/* ---------- ticket chat ---------- */
.ticket-layout { display: grid; grid-template-columns: 320px 1fr; gap: 18px; height: calc(100vh - 190px); min-height: 480px; }
@media (max-width: 860px) {
  .ticket-layout { grid-template-columns: 1fr; height: auto; min-height: 0; }
  .ticket-list { max-height: 220px; }
  .chat-panel { height: min(70vh, 560px); }
}
.ticket-list { overflow-y: auto; border: 1px solid var(--border-soft); border-radius: var(--radius); background: var(--surface); }
.ticket-list-item { padding: 14px 16px; border-bottom: 1px solid var(--border-soft); cursor: pointer; }
.ticket-list-item:hover, .ticket-list-item.active { background: var(--surface-2); }
.ticket-list-item .subj { font-weight: 600; font-size: 13.5px; margin-bottom: 4px; }
.ticket-list-item .meta { font-size: 11.5px; color: var(--text-faint); }
.chat-panel { display: flex; flex-direction: column; border: 1px solid var(--border-soft); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.chat-head { padding: 14px 18px; border-bottom: 1px solid var(--border-soft); display: flex; justify-content: space-between; align-items: center; }
.chat-messages { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 72%; padding: 10px 14px; border-radius: 14px; font-size: 13.5px; line-height: 1.5; }
.msg.me { align-self: flex-end; background: linear-gradient(135deg, var(--accent), #ff8154); color: #1a0904; border-bottom-right-radius: 4px; }
.msg.them { align-self: flex-start; background: var(--surface-2); border: 1px solid var(--border-soft); border-bottom-left-radius: 4px; }
.msg .m-name { font-size: 10.5px; opacity: .7; margin-bottom: 3px; font-weight: 700; }
.msg img { max-width: 220px; border-radius: 8px; margin-top: 6px; display: block; }
.chat-input { padding: 12px 14px; border-top: 1px solid var(--border-soft); display: flex; gap: 8px; align-items: center; }
.chat-input input[type=text] { flex: 1; background: var(--bg-soft); border: 1px solid var(--border); border-radius: 10px; padding: 11px 14px; color: var(--text); outline: none; }
.chat-input input[type=text]:focus { border-color: var(--accent); }
.chat-closed-note { padding: 14px 18px; text-align: center; color: var(--text-dim); font-size: 13px; background: var(--surface-2); }

/* code block for docs */
pre.code {
  background: #060910; border: 1px solid var(--border-soft); border-radius: var(--radius-sm);
  padding: 16px 18px; overflow-x: auto; font-size: 12.5px; line-height: 1.6; color: #c9d6ff;
  font-family: 'SFMono-Regular', Consolas, monospace;
}
.docs-nav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 90px; }
.docs-layout { display: grid; grid-template-columns: 200px 1fr; gap: 32px; align-items: flex-start; }
@media (max-width: 860px) {
  .docs-layout { grid-template-columns: 1fr; }
  .docs-nav { position: static; flex-direction: row; flex-wrap: wrap; gap: 6px; padding-bottom: 10px; border-bottom: 1px solid var(--border-soft); margin-bottom: 10px; }
  .docs-nav a { flex: 0 0 auto; }
}
.docs-nav a { padding: 8px 12px; border-radius: 8px; font-size: 13.5px; color: var(--text-dim); }
.docs-nav a:hover, .docs-nav a.active { background: var(--surface-2); color: var(--text); }
.docs-section { margin-bottom: 44px; scroll-margin-top: 100px; }
.docs-section h2 { font-size: 18px; }
.docs-section h3 { font-size: 14px; color: var(--text-dim); text-transform: none; margin-top: 24px; }

.qr-only-note { display: flex; gap: 10px; align-items: flex-start; background: var(--info-dim); border: 1px solid #5b9dff33; border-radius: var(--radius-sm); padding: 12px 14px; font-size: 12.5px; color: #cddfff; }

/* live pulse for realtime elements */
.pulse-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--money); position: relative; }
.pulse-dot::after { content:''; position:absolute; inset:-4px; border-radius:50%; background: var(--money); opacity:.5; animation: pulse 1.6s ease-out infinite; }
@keyframes pulse { 0% { transform: scale(.6); opacity:.6; } 100% { transform: scale(2.2); opacity:0; } }
