body { background: var(--bg-soft); }
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }

/* sidebar */
.side { background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; padding: 18px 12px; position: sticky; top: 0; height: 100vh; }
.side-logo img { width: 150px; height: auto; display: block; margin: 0 8px 18px; }
.side-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.side-nav a { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 9px; color: var(--text-2); font-weight: 550; font-size: 14px; text-decoration: none; }
.side-nav a svg { width: 19px; height: 19px; fill: currentColor; flex: none; }
.side-nav a:hover { background: var(--bg-soft); color: var(--text); }
.side-nav a.active { background: var(--aj-teal-light); color: var(--aj-teal-dark); }
@media (prefers-color-scheme: dark) { .side-nav a.active { color: #4FD1C5; } }
.side-user { border-top: 1px solid var(--border); padding: 14px 6px 0; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.side-user > div { width: 100%; display: flex; flex-direction: column; font-size: 14px; }
.side-user span { font-size: 12px; color: var(--text-3); text-transform: capitalize; }
.menu-btn { display: none; }

/* main */
.main { padding: 28px 32px 48px; min-width: 0; }
.head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.head h1 { font-size: 24px; margin: 0 0 2px; }
.head p { color: var(--text-2); margin: 0; font-size: 14px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 18px; box-shadow: var(--shadow-sm); }
.panel h2 { font-size: 15px; margin-bottom: 12px; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1.3fr 1fr; gap: 18px; }
.grid2 .panel { margin-bottom: 18px; }

/* tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 18px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow-sm); }
.tile .v { font-size: 26px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.tile .l { font-size: 13px; color: var(--text-2); }
.tile .s { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.tile.accent { border-top: 3px solid var(--aj-orange); }
.tile.teal { border-top: 3px solid var(--aj-teal); }

/* bar chart */
.bars { display: flex; align-items: flex-end; gap: 6px; height: 150px; padding-top: 18px; }
.bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; min-width: 0; }
.bar i { display: block; width: 100%; max-width: 30px; background: var(--aj-teal); border-radius: 4px 4px 0 0; min-height: 2px; position: relative; }
.bar i:hover { background: var(--aj-teal-dark); }
.bar i[data-n]:hover::after { content: attr(data-n); position: absolute; bottom: 100%; left: 50%; transform: translate(-50%, -4px); font-size: 11px; font-style: normal; background: var(--text); color: var(--bg); padding: 1px 6px; border-radius: 4px; white-space: nowrap; }
.bar span { font-size: 10px; color: var(--text-3); white-space: nowrap; }
.list { margin: 0; padding-left: 20px; font-size: 14px; }
.list li { padding: 5px 0; border-bottom: 1px solid var(--border); }
.list li:last-child { border-bottom: 0; }
.list .n { color: var(--text-3); font-size: 12px; margin-left: 6px; }
.list.empty-list { list-style: none; padding: 0; color: var(--text-3); }

/* upload */
.upload { display: flex; flex-direction: column; gap: 16px; }
.drop { border: 2px dashed var(--border); border-radius: var(--radius); padding: 22px; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; cursor: pointer; transition: border-color .15s, background .15s; font-weight: 400; }
.drop svg { width: 34px; height: 34px; fill: var(--aj-teal); }
.drop:hover, .drop.over { border-color: var(--aj-teal); background: var(--aj-teal-light); }
.picked { font-size: 13px; color: var(--aj-teal-dark); font-weight: 600; }
.upload-opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.upload-actions { display: flex; justify-content: flex-end; align-items: center; gap: 14px; }
.progress { flex: 1; height: 8px; background: var(--bg-soft); border-radius: 99px; overflow: hidden; border: 1px solid var(--border); }
.progress div { height: 100%; width: 0; background: var(--aj-orange); transition: width .2s; }

/* files / web switch */
.seg { display: inline-flex; background: var(--bg-soft); border: 1px solid var(--border); border-radius: 10px; padding: 3px; align-self: flex-start; }
.seg button { font: inherit; font-size: 14px; font-weight: 600; border: 0; background: none; color: var(--text-2); padding: 7px 16px; border-radius: 7px; cursor: pointer; }
.seg button[aria-selected=true] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.web-opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.web-opts .url-field { grid-column: 1 / -1; }
.web-opts .url-field input { font-size: 15px; padding: 11px 14px; }
.scope-hint { grid-column: 1 / -1; margin: -4px 0 0; font-size: 13px; }
.scope-hint:empty { display: none; }
.crawls h2 { margin-bottom: 10px; }
.table-wrap.flat { box-shadow: none; }
.crawl-url { font-weight: 600; color: var(--text); display: block; max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crawl-sub { font-size: 12px; color: var(--text-3); }
.counts { font-size: 13px; color: var(--text-2); white-space: nowrap; }
.counts b { color: var(--text); font-variant-numeric: tabular-nums; }
.filter-note { font-size: 13px; color: var(--text-2); margin: -4px 0 10px; display: flex; gap: 8px; align-items: center; }
.doc-src { font-size: 12px; display: block; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crawl-counts { display: flex; gap: 8px; flex-wrap: wrap; }
.url-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.url-list li { display: grid; grid-template-columns: 92px 1fr; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--border); font-size: 13px; align-items: start; }
.url-list li:last-child { border-bottom: 0; }
.url-list a { overflow-wrap: anywhere; }
.url-list .why { display: block; color: var(--text-3); font-size: 12px; }

/* site logins */
.login-help p { font-size: 14px; color: var(--text-2); margin: 0 0 6px; }
.login-help p:last-child { margin: 0; }
#l-method { flex-wrap: wrap; }
#l-method button[aria-checked=true] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
details.adv summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--text-2); }
.dlg-body.inner { padding: 12px 0 0; max-height: none; overflow: visible; }
label.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 500; }
label.check input { margin-top: 3px; }
.test-result { margin: 0; padding: 10px 12px; border-radius: 8px; font-size: 14px; }
.test-result.ok { background: var(--aj-green-light); color: var(--aj-green-dark); }
.test-result.fail { background: var(--aj-red-light); color: var(--aj-red); }
@media (prefers-color-scheme: dark) { .test-result.ok { color: #A6D96A; } .test-result.fail { color: #F87171; } }
.lock { font-size: 12px; color: var(--text-3); }

/* tables */
.toolbar { display: flex; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.toolbar input { flex: 1; min-width: 200px; }
.toolbar select { width: auto; }
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow-x: auto; box-shadow: var(--shadow-sm); }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .03em; padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--bg-soft); white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--bg-soft); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table td[title] { white-space: nowrap; }
.table .actions { text-align: right; white-space: nowrap; }
.table .actions .btn { margin-left: 4px; }
.doc-title { font-weight: 600; color: var(--text); display: block; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-file { font-size: 12px; color: var(--text-3); display: block; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-err { font-size: 12px; color: var(--aj-red); display: block; max-width: 260px; }
.muted { color: var(--text-3); }
.empty-row td { text-align: center; color: var(--text-3); padding: 28px; }
.spin { width: 10px; height: 10px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; display: inline-block; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* search test */
.test-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.test-form input { flex: 1; min-width: 240px; }
.test-form select { width: auto; }
.t-meta { font-size: 13px; color: var(--text-2); margin: 0 0 12px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.t-result { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 12px; box-shadow: var(--shadow-sm); }
.t-top { display: flex; gap: 12px; align-items: baseline; justify-content: space-between; flex-wrap: wrap; }
.t-top a { font-weight: 650; font-size: 16px; }
.t-pos { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--aj-orange); color: #fff; font-size: 12px; font-weight: 700; margin-right: 8px; }
.t-url { font-size: 12px; color: var(--text-3); overflow-wrap: anywhere; margin: 2px 0 8px; }
.t-hl { border-left: 3px solid var(--aj-teal); padding: 2px 0 2px 12px; margin: 6px 0; color: var(--text-2); font-size: 14px; }
.t-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; align-items: center; }
.relbar { display: inline-block; width: 60px; height: 6px; border-radius: 99px; background: var(--bg-soft); border: 1px solid var(--border); overflow: hidden; vertical-align: middle; }
.relbar i { display: block; height: 100%; background: var(--aj-green); }
details.md { margin-top: 10px; }
details.md summary { cursor: pointer; font-size: 13px; color: var(--link); }
details.md pre { margin-top: 8px; max-height: 320px; overflow: auto; font-size: 12.5px; }

/* agent access */
.connect-help pre { font-size: 13px; }
.connect-help .hint { margin: 10px 0 0; font-size: 13px; }

/* dialogs */
.dlg { border: 0; border-radius: 16px; padding: 0; width: min(480px, calc(100vw - 32px)); background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); }
.dlg.wide { width: min(760px, calc(100vw - 32px)); }
.dlg::backdrop { background: rgba(15, 23, 30, .5); }
.dlg header { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.dlg header h2 { margin: 0; font-size: 18px; }
.dlg .x { background: none; border: 0; font-size: 24px; line-height: 1; cursor: pointer; color: var(--text-3); padding: 0 4px; }
.dlg-body { padding: 18px 22px; display: flex; flex-direction: column; gap: 14px; max-height: 68vh; overflow-y: auto; }
.dlg-body h3 { font-size: 14px; margin: 6px 0 -4px; }
.dlg footer { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--border); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.copy-row { display: flex; gap: 8px; align-items: center; }
.copy-row code { flex: 1; overflow-wrap: anywhere; word-break: break-all; padding: 8px 10px; font-size: 12.5px; }
.copy-row input { flex: 1; }
.warn { background: var(--aj-orange-light); color: var(--aj-orange-dark); padding: 10px 12px; border-radius: 8px; font-size: 14px; font-weight: 600; margin: 0; }
@media (prefers-color-scheme: dark) { .warn { color: #F6B94F; } }
.doc-meta { font-size: 13px; color: var(--text-2); display: flex; gap: 14px; flex-wrap: wrap; }
.pages { margin: 0; padding-left: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.pages li { border: 1px solid var(--border); border-radius: 9px; padding: 10px 12px; font-size: 13px; }
.pages li a { font-weight: 600; }
.pages li p { margin: 4px 0 0; color: var(--text-2); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

/* phone */
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 100; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-lg); }
  .side.open { transform: none; }
  .menu-btn { display: grid; place-items: center; position: fixed; top: 12px; left: 12px; z-index: 90; width: 40px; height: 40px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm); cursor: pointer; color: var(--text); }
  .menu-btn svg { width: 22px; height: 22px; fill: currentColor; }
  .main { padding: 64px 16px 40px; }
  .grid2, .row2 { grid-template-columns: 1fr; }
  .table .hide-sm { display: none; }
}
