/* ============================================================================
   AirHive live-demo styles. EVERYTHING is namespaced under .ahv so it can never
   touch the portfolio's core design. AirHive's own light theme + tokens.
   ========================================================================== */
.ahv {
  --ahv-primary: #3379F6;
  --ahv-primary-text: #2267E1;
  --ahv-primary-soft: #DBE0FF;
  --ahv-primary-faint: #EEF3FF;
  --ahv-ink: #1C2023;
  --ahv-ink-muted: #5E656A;
  --ahv-ink-faint: #8A9199;
  --ahv-border: #D5DBDE;
  --ahv-border-muted: #E7EAED;
  --ahv-surface: #FBFCFD;
  --ahv-bg: #F8F9FB;
  --ahv-bg-alt: #F1F3F4;
  --ahv-interactive: #EEF1F2;
  --ahv-accent: #18181A;
  --ahv-success: #1FB964;
  --ahv-danger: #F4573E;
  --ahv-radius: 12px;
  --ahv-shadow: 0 1px 2px rgba(16,24,40,.04), 0 1px 3px rgba(16,24,40,.06);
  --ahv-shadow-lg: 0 12px 32px -8px rgba(16,24,40,.18);
  font-family: "Geist", system-ui, -apple-system, sans-serif;
  color: var(--ahv-ink);
  -webkit-font-smoothing: antialiased;
}

/* ---- overlay (Turbo-frame content fills the viewport) ---- */
#airhive-demo:empty { display: none; }
.ahv-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--ahv-bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: ahv-in .28s cubic-bezier(.16,1,.3,1);
}
@keyframes ahv-in { from { opacity: 0; transform: translateY(8px) scale(.995); } to { opacity: 1; transform: none; } }

/* ---- top demo bar (portfolio chrome: tabs + close) ---- */
.ahv-demobar {
  display: flex; align-items: center; gap: 16px;
  height: 46px; flex: none;
  padding: 0 14px;
  background: #0E0F12; color: #E7E7EA;
  border-bottom: 1px solid #22242A;
}
.ahv-demobar .brandtag { font-size: 12.5px; letter-spacing: .02em; color: #9AA0A8; display: flex; align-items: center; gap: 7px; }
.ahv-demobar .brandtag b { color: #E7E7EA; font-weight: 600; }
.ahv-demobar .dot { width: 6px; height: 6px; border-radius: 50%; background: #34D07F; }
.ahv-back {
  display: inline-flex; align-items: center; gap: 7px; flex: none;
  font: inherit; font-size: 13px; font-weight: 500; color: #C7CBD1;
  background: #191B20; border: 1px solid #2A2D33; border-radius: 8px;
  padding: 6px 13px 6px 10px; cursor: pointer; transition: background .15s, color .15s;
}
.ahv-back:hover { background: #22242A; color: #fff; }
.ahv-back .ti { font-size: 16px; }
.ahv-tabs { display: flex; gap: 2px; padding: 3px; background: #191B20; border-radius: 999px; margin: 0 auto; }
.ahv-tabs button {
  font: inherit; font-size: 13px; font-weight: 500; color: #A7ADB5;
  background: transparent; border: 0; cursor: pointer;
  padding: 5px 16px; border-radius: 999px; display: flex; align-items: center; gap: 6px;
  transition: color .15s, background .15s;
}
.ahv-tabs button:hover { color: #E7E7EA; }
.ahv-tabs button.is-active { background: #F8F9FB; color: #0E0F12; }
.ahv-close {
  font: inherit; color: #A7ADB5; background: transparent; border: 0; cursor: pointer;
  width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; font-size: 18px;
}
.ahv-close:hover { background: #22242A; color: #fff; }

/* ---- panels ---- */
.ahv-panel { flex: 1; min-height: 0; overflow-y: auto; }
.ahv-panel[hidden] { display: none; }

/* ---- AirHive top nav ---- */
.ahv-nav {
  display: flex; align-items: center; gap: 20px;
  height: 66px; padding: 0 24px;
  background: #fff; border-bottom: 1px solid var(--ahv-border-muted);
  position: sticky; top: 0; z-index: 5;
}
.ahv-logo { display: flex; align-items: center; }
.ahv-logo img { height: 30px; width: auto; display: block; }
.ahv-searchwrap { flex: 1; max-width: 560px; margin: 0 auto; position: relative; }
.ahv-search {
  display: flex; align-items: center; gap: 10px;
  height: 42px; padding: 0 8px 0 16px;
  background: #fff; border: 1px solid var(--ahv-border); border-radius: 999px;
  color: var(--ahv-ink-faint);
}
.ahv-search input { flex: 1; border: 0; outline: 0; background: transparent; font: inherit; font-size: 14.5px; color: var(--ahv-ink); }
.ahv-search input::placeholder { color: var(--ahv-ink-faint); }
.ahv-search > .ti { font-size: 18px; }
.ahv-search .clear { border: 0; background: transparent; color: var(--ahv-ink-faint); cursor: pointer; display: grid; place-items: center; padding: 0; }
.ahv-search .filterbtn { flex: none; width: 30px; height: 30px; border: 0; border-radius: 50%; background: var(--ahv-accent); color: #fff; cursor: pointer; display: grid; place-items: center; transition: background .15s; }
.ahv-search .filterbtn .ti { font-size: 16px; }
.ahv-search .filterbtn:hover, .ahv-search .filterbtn.is-on { background: #33353A; }

/* ---- search suggestions popover ---- */
.ahv-search-pop { position: absolute; left: 0; right: 0; top: calc(100% + 8px); z-index: 30; max-height: 460px; overflow-y: auto;
  background: #fff; border: 1px solid var(--ahv-border); border-radius: 16px; box-shadow: 0 12px 30px rgba(16,24,40,.14); padding: 8px; }
.ahv-search-pop .pop-sec { padding: 8px 8px 12px; }
.ahv-search-pop .pop-h { display: flex; align-items: baseline; justify-content: space-between; margin: 4px 4px 8px; }
.ahv-search-pop .pop-h span { font-size: 14px; font-weight: 500; color: var(--ahv-ink-muted); }
.ahv-search-pop .pop-h em { font-style: normal; font-size: 12px; color: var(--ahv-ink-faint); margin-left: 3px; }
.ahv-search-pop .pop-all { border: 0; background: transparent; color: var(--ahv-primary-text); font: inherit; font-size: 12px; font-weight: 500; cursor: pointer; }
.ahv-search-pop .pop-hives { display: flex; flex-direction: column; gap: 6px; }
.ahv-search-pop .pop-hive { display: flex; align-items: center; gap: 10px; border: 1px solid var(--ahv-border-muted); background: #fff; border-radius: 12px; padding: 12px 14px; font: inherit; font-size: 14px; color: var(--ahv-ink); cursor: pointer; text-align: left; }
.ahv-search-pop .pop-hive:hover { background: var(--ahv-bg); }
.ahv-search-pop .pop-hive .fico .ti { font-size: 18px; }
.ahv-search-pop .pop-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.ahv-search-pop .pop-chip { border: 1px solid var(--ahv-primary-soft); background: #fff; color: var(--ahv-ink); border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 13px; cursor: pointer; }
.ahv-search-pop .pop-chip .at { color: var(--ahv-primary-text); }
.ahv-search-pop .pop-chip.tag { border-color: var(--ahv-border); }
.ahv-search-pop .pop-chip:hover { background: var(--ahv-primary-faint); }
.ahv-search-pop .pop-files { display: flex; flex-direction: column; }
.ahv-search-pop .pop-file { display: flex; align-items: center; gap: 12px; border: 0; background: transparent; padding: 8px 6px; border-radius: 10px; font: inherit; font-size: 14px; color: var(--ahv-ink); cursor: pointer; text-align: left; width: 100%; }
.ahv-search-pop .pop-file:hover { background: var(--ahv-bg); }
.ahv-search-pop .pop-file .fi { flex: none; width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; background: color-mix(in srgb, currentColor 14%, #fff); }
.ahv-search-pop .pop-file .fi .ti { font-size: 18px; }
.ahv-search-pop .pop-file .fn { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ahv-search-pop .pop-none { padding: 22px; text-align: center; color: var(--ahv-ink-faint); font-size: 13.5px; }

/* ---- filter bar ---- */
.ahv-filterbar { display: flex; align-items: center; gap: 12px; padding: 12px 24px; background: var(--ahv-bg); border-bottom: 1px solid var(--ahv-border-muted); position: sticky; top: 66px; z-index: 4; }
.ahv-filterbar .fdrop { position: relative; }
.ahv-filterbar .fbtn { display: flex; align-items: center; gap: 6px; min-width: 130px; border: 1px solid var(--ahv-border); background: #fff; border-radius: 10px; padding: 7px 10px; font: inherit; font-size: 14px; color: var(--ahv-ink-muted); cursor: pointer; }
.ahv-filterbar .fbtn .lbl { flex: 1; text-align: left; }
.ahv-filterbar .fbtn .cnt { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--ahv-primary); color: #fff; font-size: 11px; font-weight: 600; display: grid; place-items: center; }
.ahv-filterbar .fbtn .ti { font-size: 15px; color: var(--ahv-ink-faint); }
.ahv-filterbar .fmenu { position: absolute; left: 0; top: calc(100% + 6px); z-index: 20; width: 240px; background: #fff; border: 1px solid var(--ahv-border); border-radius: 12px; box-shadow: 0 12px 30px rgba(16,24,40,.14); overflow: hidden; }
.ahv-filterbar .fsearch { width: calc(100% - 16px); margin: 8px; border: 1px solid var(--ahv-border); background: var(--ahv-bg); border-radius: 8px; padding: 7px 10px; font: inherit; font-size: 13px; outline: none; }
.ahv-filterbar .fopts { max-height: 240px; overflow-y: auto; padding-bottom: 6px; }
.ahv-filterbar .fopt { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; border: 0; background: transparent; padding: 8px 14px; font: inherit; font-size: 13px; color: var(--ahv-ink-muted); cursor: pointer; text-align: left; }
.ahv-filterbar .fopt .t { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ahv-filterbar .fopt .chk { display: none; font-size: 15px; }
.ahv-filterbar .fopt:hover { background: var(--ahv-bg); }
.ahv-filterbar .fopt.on { background: #111214; color: #fff; }
.ahv-filterbar .fopt.on .chk { display: inline; }
.ahv-filterbar .fnone { padding: 10px 14px; font-size: 13px; color: var(--ahv-ink-faint); }
.ahv-filterbar .freset { border: 0; background: transparent; color: var(--ahv-primary-text); font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; }

/* ---- notifications ---- */
.ahv-bellwrap { position: relative; }
.ahv-notif { position: absolute; right: 0; top: calc(100% + 10px); z-index: 40; width: 400px; max-width: 88vw; max-height: 460px; overflow-y: auto;
  background: #fff; border: 1px solid var(--ahv-border); border-radius: 16px; box-shadow: 0 16px 40px rgba(16,24,40,.18); }
.ahv-notif .head { display: flex; align-items: center; gap: 8px; padding: 14px 16px; border-bottom: 1px solid var(--ahv-border-muted); font-size: 14px; }
.ahv-notif .head b { font-size: 15px; }
.ahv-notif .head .n { color: var(--ahv-ink-faint); }
.ahv-notif .head .sp { flex: 1; }
.ahv-notif .head .lnk { border: 0; background: transparent; color: var(--ahv-primary-text); font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; }
.ahv-notif .notif-item { display: flex; align-items: center; gap: 12px; width: 100%; border: 0; background: #F8F9FF; border-bottom: 1px solid var(--ahv-border-muted); padding: 12px 16px; font: inherit; cursor: pointer; text-align: left; }
.ahv-notif .notif-item:hover { background: var(--ahv-bg-alt); }
.ahv-notif .notif-item.read { background: #fff; }
.ahv-notif .notif-item .ava { flex: none; width: 32px; height: 32px; border-radius: 50%; background: var(--ahv-primary-faint); color: var(--ahv-primary-text); display: grid; place-items: center; font-size: 15px; }
.ahv-notif .notif-item .msg { flex: 1; min-width: 0; font-size: 13.5px; color: var(--ahv-ink); line-height: 1.45; }
.ahv-notif .notif-item .msg .pill { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--ahv-border); border-radius: 8px; padding: 1px 7px 1px 5px; font-weight: 600; }
.ahv-notif .notif-item .msg .pill .ti { color: var(--ahv-primary-text); font-size: 13px; }
.ahv-notif .notif-item .view { flex: none; display: inline-flex; align-items: center; gap: 2px; font-size: 13px; font-weight: 500; color: var(--ahv-ink); white-space: nowrap; }
.ahv-notif .notif-empty { padding: 26px; text-align: center; color: var(--ahv-ink-faint); font-size: 13.5px; }
.ahv-nav-right { display: flex; align-items: center; gap: 12px; }
.ahv-btn {
  font: inherit; font-size: 14px; font-weight: 500; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 18px; border-radius: 999px; border: 1px solid transparent;
  transition: transform .12s, background .15s, box-shadow .15s;
}
.ahv-btn:active { transform: scale(.98); }
.ahv-btn-primary { background: var(--ahv-accent); color: #fff; }
.ahv-btn-primary:hover { box-shadow: var(--ahv-shadow-lg); }
.ahv-bell { position: relative; width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--ahv-border-muted); background: #fff; display: grid; place-items: center; color: var(--ahv-ink-muted); cursor: pointer; }
.ahv-bell:hover { border-color: var(--ahv-border); color: var(--ahv-ink); }
.ahv-bell .ti { font-size: 20px; }
.ahv-bell .badge { position: absolute; top: -3px; right: -3px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px; background: var(--ahv-accent); color: #fff; font-size: 11px; font-weight: 600; display: grid; place-items: center; border: 2px solid #fff; }
.ahv-avatar { width: 42px; height: 42px; border-radius: 50%; background: #E4E7EC; color: #5E656A; font-size: 15px; font-weight: 600; display: grid; place-items: center; letter-spacing: .01em; }

/* ---- workspace body ---- */
.ahv-body { max-width: 1240px; margin: 0 auto; padding: 30px 28px 120px; }
.ahv-ws-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.ahv-ws-title { display: flex; align-items: center; gap: 11px; font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
.ahv-ws-title img { width: 26px; height: 26px; }
.ahv-ws-tools { display: flex; align-items: center; gap: 12px; }
.ahv-sort { position: relative; }
.ahv-sortby { display: flex; align-items: center; gap: 6px; font: inherit; font-size: 14px; font-weight: 500; color: var(--ahv-ink-muted); cursor: pointer; border: 0; background: transparent; border-radius: 8px; padding: 5px 8px; }
.ahv-sortby:hover { background: var(--ahv-interactive); }
.ahv-sort-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; width: 168px; background: #fff; border: 1px solid var(--ahv-border); border-radius: 12px; box-shadow: 0 10px 26px rgba(16,24,40,.14); padding: 6px; }
.ahv-sort-menu .opt { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; border: 0; background: transparent; border-radius: 8px; padding: 8px 10px; font: inherit; font-size: 13px; color: var(--ahv-ink-muted); cursor: pointer; text-align: left; }
.ahv-sort-menu .opt:hover { background: var(--ahv-bg); }
.ahv-sort-menu .opt.on { color: var(--ahv-ink); font-weight: 600; }
.ahv-sort-menu .opt .chk { display: none; color: var(--ahv-primary-text); font-size: 15px; }
.ahv-sort-menu .opt.on .chk { display: inline; }
.ahv-viewtoggle { display: flex; gap: 4px; }
.ahv-viewtoggle button { border: 0; background: transparent; cursor: pointer; width: 38px; height: 34px; border-radius: 10px; color: var(--ahv-ink-muted); display: grid; place-items: center; }
.ahv-viewtoggle button .ti { font-size: 19px; }
.ahv-viewtoggle button.is-active { background: var(--ahv-accent); color: #fff; }

/* ---- AI-extracted entity chips row ---- */
.ahv-entities { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 2px 0 24px; }
.ahv-entities .spark { color: var(--ahv-primary); font-size: 15px; margin-right: 2px; }
.ahv-entity { font-size: 13px; color: var(--ahv-ink-muted); background: #fff; border: 1px solid var(--ahv-border-muted); border-radius: 999px; padding: 5px 12px; display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.ahv-entity .at { color: var(--ahv-primary-text); font-weight: 500; }
.ahv-entity.count { color: var(--ahv-ink-muted); font-weight: 500; }
.ahv-entities .see-all { font-size: 13px; font-weight: 500; color: var(--ahv-primary-text); text-decoration: none; margin-left: 2px; }
.ahv-entities .see-all:hover { text-decoration: underline; }

/* ---- hive cards (filled colored folder + name/count, like AirHive) ---- */
.ahv-hives { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 28px; }
.ahv-hive {
  background: #fff; border: 1px solid var(--ahv-border-muted); border-radius: 12px;
  padding: 12px 8px; cursor: pointer; box-shadow: var(--ahv-shadow);
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  transition: border-color .15s, box-shadow .15s;
}
.ahv-hive:hover { border-color: var(--ahv-border); box-shadow: var(--ahv-shadow-lg); }
.ahv-hive .top { display: flex; align-items: center; align-self: stretch; gap: 8px; }
.ahv-hive .fico { flex: none; width: 16px; height: 16px; display: grid; place-items: center; }
.ahv-hive .fico svg { width: 16px; height: 16px; }
.ahv-hive .name { flex: 1; min-width: 0; font-size: 14px; font-weight: 500; line-height: 1.4; letter-spacing: -0.3px; color: #2B2D30; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ahv-hive .more { flex: none; color: var(--ahv-ink-faint); font-size: 18px; display: grid; place-items: center; margin-right: 2px; }
.ahv-hive .count { padding-left: 24px; font-size: 12px; font-weight: 400; line-height: 1.5; letter-spacing: -0.3px; color: #646464; }

/* ---- grid / list view switch ---- */
.ahv-docs[data-view="grid"] .ahv-list { display: none; }
.ahv-docs[data-view="list"] .ahv-grid { display: none; }

/* ---- document grid (white card → real page preview → type / AI name / entities) ---- */
.ahv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(244px, 1fr)); gap: 20px; }
.ahv-doc {
  --tint: var(--ahv-primary); cursor: pointer; display: flex; flex-direction: column;
  background: #fff; border: 1px solid var(--ahv-border-muted); border-radius: 16px; overflow: hidden;
  box-shadow: var(--ahv-shadow); transition: transform .15s, box-shadow .15s, border-color .15s;
}
.ahv-doc:hover { transform: translateY(-3px); box-shadow: var(--ahv-shadow-lg); border-color: var(--ahv-border); }
.ahv-doc .thumb { position: relative; height: 176px; background: #EDF0F4; overflow: hidden; }
.ahv-doc .thumb .page {
  position: absolute; top: 16px; left: 18px; right: 18px; bottom: -28px;
  background: #fff; border-radius: 8px 8px 0 0; box-shadow: 0 2px 12px rgba(16,24,40,.10);
  padding: 14px 15px; overflow: hidden;
}
.ahv-doc .thumb .p-title { font-size: 9px; font-weight: 700; line-height: 1.35; color: var(--tint); letter-spacing: .01em; margin-bottom: 6px; }
.ahv-doc .thumb .p-body { font-size: 6px; line-height: 1.85; color: #9AA1A9; white-space: pre-wrap; word-break: break-word; }
.ahv-doc .body { padding: 14px 16px 16px; }
.ahv-doc .head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.ahv-doc .type { font-size: 11px; font-weight: 600; letter-spacing: .06em; color: var(--ahv-primary-text); }
.ahv-doc .menu { color: var(--ahv-ink-faint); font-size: 18px; display: grid; place-items: center; }
.ahv-doc .fname { font-size: 15px; font-weight: 600; color: var(--ahv-ink); line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ahv-doc .orig { font-size: 13px; color: var(--ahv-ink-faint); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ahv-doc .tags { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 13px; }
.ahv-doc .tag { font-size: 12.5px; color: var(--ahv-ink-muted); background: #fff; border: 1px solid var(--ahv-border); border-radius: 999px; padding: 4px 11px; display: inline-flex; align-items: center; gap: 5px; max-width: 150px; }
.ahv-doc .tag .at { color: var(--ahv-primary-text); font-weight: 500; }
.ahv-doc .tag .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* thumbnail variants by file type */
.ahv-doc[data-kind="image"] .thumb { background: #F1F4F8; }
.ahv-doc[data-kind="image"] .thumb .imgwrap { position: absolute; inset: 0; display: grid; place-items: center; padding: 12px; }
.ahv-doc[data-kind="image"] .thumb img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; box-shadow: 0 2px 10px rgba(16,24,40,.10); }
.ahv-doc .sheet { position: absolute; top: 16px; left: 18px; right: 18px; bottom: -22px; background: #fff; border-radius: 8px 8px 0 0; box-shadow: 0 2px 12px rgba(16,24,40,.10); overflow: hidden; }
.ahv-doc .sheet table { width: 100%; border-collapse: collapse; }
.ahv-doc .sheet th, .ahv-doc .sheet td { text-align: left; padding: 4px 7px; border: 1px solid #EEF1F4; font-size: 7px; line-height: 1.5; white-space: nowrap; }
.ahv-doc .sheet th { background: #E9F6EF; color: #0F6E56; font-weight: 600; }
.ahv-doc .sheet td { color: #6A7178; }
.ahv-doc .sheet td:first-child { color: #16223D; font-weight: 500; }

/* ---- document list (table) view ---- */
.ahv-list { background: #fff; border: 1px solid var(--ahv-border-muted); border-radius: 16px; overflow-x: auto; box-shadow: var(--ahv-shadow); }
.ahv-list table { width: 100%; min-width: 560px; border-collapse: collapse; table-layout: fixed; }
.ahv-list thead th { text-align: left; padding: 13px 14px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--ahv-ink-faint); border-bottom: 1px solid var(--ahv-border); white-space: nowrap; }
.ahv-list thead th .ti { font-size: 13px; vertical-align: -2px; color: #C4CACE; }
.ahv-list .c-check { width: 48px; padding-left: 18px; }
.ahv-list .c-type { width: 120px; }
.ahv-list .c-ent  { width: 23%; }
.ahv-list .c-tag  { width: 15%; }
.ahv-list .c-share { width: 118px; }
.ahv-list .c-date { width: 132px; }
.ahv-list thead .hexcheck { display: inline-block; width: 15px; height: 15px; border: 1.6px solid #D4D4D8; border-radius: 4px; }

.ahv-row { cursor: pointer; border-bottom: 1px solid var(--ahv-border-muted); transition: background .12s; }
.ahv-row:last-child { border-bottom: 0; }
.ahv-row:hover { background: var(--ahv-bg); }
.ahv-row.is-sel { background: #F5F6FF; }
.ahv-row td { padding: 13px 14px; font-size: 14px; color: var(--ahv-ink-muted); vertical-align: middle; }
.ahv-row .c-check { padding-left: 18px; }
.ahv-row .rowcheck { width: 22px; height: 22px; border: 0; background: transparent; cursor: pointer; color: #C4CACE; display: grid; place-items: center; padding: 0; }
.ahv-row .rowcheck .ti { font-size: 20px; }
.ahv-row:hover .rowcheck { color: var(--ahv-ink-faint); }
.ahv-row .rowcheck .on { display: none; }
.ahv-row.is-sel .rowcheck { color: var(--ahv-primary); }
.ahv-row.is-sel .rowcheck .off { display: none; }
.ahv-row.is-sel .rowcheck .on { display: grid; }

.ahv-row .c-file { display: flex; align-items: center; gap: 11px; }
.ahv-row .c-file .ficon { flex: none; width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: color-mix(in srgb, var(--tint) 14%, #fff); color: var(--tint); }
.ahv-row .c-file .ficon .ti { font-size: 18px; }
.ahv-row .c-file .fmeta { min-width: 0; display: flex; flex-direction: column; }
.ahv-row .c-file .t { font-size: 14px; font-weight: 500; color: var(--ahv-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ahv-row .c-file .o { font-size: 12px; color: var(--ahv-ink-faint); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ahv-row .c-type { color: var(--ahv-ink); }
.ahv-row .pills { display: flex; flex-wrap: nowrap; gap: 6px; overflow: hidden; }
.ahv-row .pill { flex: none; font-size: 12px; color: var(--ahv-ink-muted); background: #fff; border: 1px solid var(--ahv-border); border-radius: 999px; padding: 3px 9px; max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ahv-row .pill.ent .at { color: var(--ahv-primary-text); font-weight: 500; }
.ahv-row .pill.more { color: var(--ahv-ink-faint); }
.ahv-row .dash { color: #C4CACE; }

/* ---- async upload: skeleton shimmer, processing overlay, smooth live transitions ---- */
/* Every (re)inserted card/row fades in — so each broadcast stage lands as a gentle transition. */
.ahv-doc, .ahv-row { animation: ahv-cardin .24s ease both; }
@keyframes ahv-cardin { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes ahv-spin { to { transform: rotate(360deg); } }
@keyframes ahv-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.ahv-sk { display: inline-block; height: 12px; border-radius: 6px; vertical-align: middle;
  background: linear-gradient(100deg, #E7ECF1 30%, #F5F7F9 50%, #E7ECF1 70%); background-size: 200% 100%;
  animation: ahv-shimmer 1.25s ease-in-out infinite; }
.ahv-sk.sk-pill { height: 24px; border-radius: 999px; }

.ahv .spin { display: inline-block; width: 13px; height: 13px; border: 2px solid rgba(255,255,255,.45);
  border-top-color: #fff; border-radius: 50%; animation: ahv-spin .7s linear infinite; }

/* card processing state */
.ahv-doc .type.sk { display: inline-flex; }
.ahv-doc .thumb-status { position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; background: linear-gradient(0deg, rgba(16,24,40,.86), rgba(16,24,40,.5)); color: #fff;
  font-size: 12px; font-weight: 500; letter-spacing: .01em; backdrop-filter: blur(1px); }
.ahv-doc.is-processing .thumb .page { opacity: .5; }

/* row processing state — a spinner sits where the file-type glyph will be */
.ahv-row .ficon .spin { width: 15px; height: 15px; border-color: color-mix(in srgb, var(--tint) 28%, transparent); border-top-color: var(--tint); }
.ahv-row.is-busy .c-file .t { color: var(--ahv-ink-muted); }

/* "AI quota reached" visible degradation (card + row) */
.ahv-doc .thumb-status.limited { background: linear-gradient(0deg, rgba(180,120,10,.94), rgba(180,120,10,.62)); }
.ahv-doc .type.limited { color: #B4780A; font-weight: 600; }
.ahv-doc.is-limited { border-color: #F1D592; }
.ahv-retry { font: inherit; font-size: 12.5px; font-weight: 600; color: #8A6100; background: #FEF6E0; border: 1px solid #F1D18A; border-radius: 999px; padding: 5px 12px; display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }
.ahv-retry:hover { background: #FBEBC2; }
.ahv-retry .ti { font-size: 14px; }
.ahv-retry.sm { padding: 3px 9px; font-size: 12px; }
.ahv-row.is-limited .ficon { color: #B4780A; background: #FEF6E0; }
.ahv-limited-tag { font-size: 12px; color: #B4780A; font-weight: 600; }

/* ---- floating dock (pinned to viewport bottom, uniform 56px tiles that lift on hover) ---- */
.ahv-dock {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px; z-index: 60;
}
.ahv-dock .ws, .ahv-dock .tool {
  position: relative; width: 56px; height: 56px; border-radius: 14px; display: grid; place-items: center;
  cursor: pointer; transition: transform .2s cubic-bezier(.16,1,.3,1), box-shadow .2s;
}
.ahv-dock .ws.home {
  overflow: hidden;
  background: linear-gradient(135deg, #E56F8C 0%, #7476ED 55%, #64C2DB 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.30), inset 0 -8px 16px rgba(0,0,0,.06), 0 2px 10px rgba(116,118,237,.28);
}
.ahv-dock .ws.home::before { content: ""; position: absolute; inset: 0; background: radial-gradient(120% 80% at 25% 15%, rgba(255,255,255,.45), rgba(255,255,255,0) 55%); }
.ahv-dock .ws.home img { position: relative; z-index: 1; width: 32px; height: 32px; }
.ahv-dock .ws .ini { width: 100%; height: 100%; border-radius: 14px; display: grid; place-items: center; color: #fff; font-size: 22px; font-weight: 600; box-shadow: var(--ahv-shadow); }
.ahv-dock .ws:hover { transform: translateY(-12px); box-shadow: 0 12px 26px rgba(16,24,40,.28); }
.ahv-dock .ws .dot { position: absolute; bottom: -11px; left: 50%; transform: translateX(-50%); width: 5px; height: 5px; border-radius: 50%; background: transparent; transition: background .15s; }
.ahv-dock .ws.is-active .dot { background: var(--ahv-ink); }
.ahv-dock .tool { background: #fff; border: 1px solid var(--ahv-border-muted); color: #2B2D30; box-shadow: var(--ahv-shadow); }
.ahv-dock .tool svg { width: 24px; height: 24px; }
.ahv-dock .tool:hover { transform: translateY(-12px); box-shadow: var(--ahv-shadow-lg); }

/* the "+" add button + its create menu */
.ahv-add { position: relative; width: 26px; height: 56px; display: grid; place-items: center; }
.ahv-add .add { width: 26px; height: 26px; border: 0; background: transparent; display: grid; place-items: center; color: #6A6A6A; cursor: pointer; transition: color .15s, transform .2s; }
.ahv-add .add svg { width: 26px; height: 26px; }
.ahv-add .add:hover { color: #2B2D30; transform: scale(1.1); }
.ahv-add .add.is-open { color: #EF4444; transform: rotate(45deg); }
.ahv-add-menu { position: absolute; bottom: 52px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 2px; background: #22262B; border-radius: 14px; padding: 7px; box-shadow: 0 10px 30px rgba(16,24,40,.3); z-index: 70; }
.ahv-add-menu button { display: flex; align-items: center; gap: 10px; white-space: nowrap; border: 0; background: transparent; color: #fff; font: inherit; font-size: 14px; padding: 9px 12px; border-radius: 9px; cursor: pointer; }
.ahv-add-menu button:hover { background: rgba(255,255,255,.08); }
.ahv-add-menu button .ti { font-size: 18px; color: #B9C0C7; }

/* create workspace / hive modals */
.ahv-cmodal { position: fixed; inset: 0; z-index: 71; background: rgba(16,24,40,.42); display: grid; place-items: center; padding: 20px; animation: ahv-fade .18s ease; }
.ahv-cmodal-card { width: min(420px, 100%); background: #fff; border-radius: 18px; overflow: hidden; box-shadow: var(--ahv-shadow-lg); animation: ahv-pop .2s cubic-bezier(.16,1,.3,1); }
.ahv-cmodal-card .head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--ahv-border-muted); }
.ahv-cmodal-card .head h3 { font-size: 16px; font-weight: 600; margin: 0; }
.ahv-cmodal-card .head .x { border: 0; background: transparent; color: var(--ahv-ink-faint); font-size: 18px; cursor: pointer; width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; }
.ahv-cmodal-card .head .x:hover { background: var(--ahv-bg-alt); color: var(--ahv-ink); }
.ahv-cmodal-card .body { padding: 18px; }
.ahv-cmodal-card .lbl { display: block; font-size: 12px; font-weight: 600; color: var(--ahv-ink-faint); margin: 0 0 7px; }
.ahv-cmodal-card .cname { width: 100%; height: 46px; border: 1px solid var(--ahv-border); border-radius: 12px; padding: 0 14px; font: inherit; font-size: 15px; color: var(--ahv-ink); outline: none; margin-bottom: 18px; }
.ahv-cmodal-card .cname:focus { border-color: var(--ahv-primary); }
.ahv-cmodal-card .swatches { display: flex; gap: 12px; flex-wrap: wrap; }
.ahv-cmodal-card .sw { width: 26px; height: 26px; border: 0; border-radius: 50%; cursor: pointer; transition: transform .12s; padding: 0; }
.ahv-cmodal-card .sw:hover { transform: scale(1.12); }
.ahv-cmodal-card .sw.is-sel { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--ahv-ink); }
.ahv-cmodal-card .err { color: var(--ahv-danger); font-size: 13px; margin: 12px 0 0; }
.ahv-cmodal-card .foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 18px; border-top: 1px solid var(--ahv-border-muted); }
.ahv-cmodal-card .btn { font: inherit; font-size: 14.5px; font-weight: 600; border: 0; border-radius: 11px; padding: 10px 18px; cursor: pointer; }
.ahv-cmodal-card .btn.ghost { background: var(--ahv-bg-alt); color: var(--ahv-ink-muted); }
.ahv-cmodal-card .btn.ghost:hover { background: #E7EAED; }
.ahv-cmodal-card .btn.primary { background: var(--ahv-accent); color: #fff; }
.ahv-cmodal-card .btn.primary:hover { background: #33353A; }

.ahv-appwrap { position: relative; min-height: 100%; }

/* empty-workspace state: only when the grid has no cards (drives off :empty, so a broadcast
   upload that fills the grid hides it automatically) */
.ahv-ws-empty { display: none; }
.ahv-grid:empty ~ .ahv-ws-empty { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 56px 20px 40px; }
.ahv-grid:empty ~ .ahv-list { display: none; }
.ahv-ws-empty .ic { width: 68px; height: 68px; border-radius: 20px; background: var(--ahv-primary-faint); color: var(--ahv-primary-text); display: grid; place-items: center; font-size: 32px; margin-bottom: 20px; }
.ahv-ws-empty h2 { font-size: 18px; font-weight: 600; color: var(--ahv-ink); margin: 0 0 8px; }
.ahv-ws-empty p { font-size: 14px; color: var(--ahv-ink-muted); line-height: 1.55; max-width: 380px; margin: 0 0 22px; }
.ahv-ws-empty .acts { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.ahv-ws-empty .btn { font: inherit; font-size: 14px; font-weight: 500; border-radius: 999px; padding: 10px 20px; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; }
.ahv-ws-empty .btn .ti { font-size: 17px; }
.ahv-ws-empty .btn.dark { background: var(--ahv-accent); color: #fff; border: 1px solid var(--ahv-accent); }
.ahv-ws-empty .btn.dark:hover { background: #33353A; }
.ahv-ws-empty .btn.light { background: #fff; color: var(--ahv-ink); border: 1px solid var(--ahv-border); }
.ahv-ws-empty .btn.light:hover { background: var(--ahv-bg); }


/* ---- Ask AI fab + chat drawer ---- */
/* ---- bea — floating hexbee launcher (draggable anywhere, click to open chat) ---- */
.ahv-bea {
  position: fixed; right: 24px; bottom: 24px; z-index: 65;
  width: 62px; height: 62px; padding: 0; border: 0; background: transparent;
  cursor: grab; touch-action: none; transition: transform .15s cubic-bezier(.16,1,.3,1);
}
.ahv-bea:hover { transform: scale(1.1); }
.ahv-bea.is-dragging { transform: scale(1.05); cursor: grabbing; transition: none; }
.ahv-bea img { width: 100%; height: 100%; display: block; pointer-events: none; user-select: none; -webkit-user-drag: none; filter: drop-shadow(0 4px 10px rgba(16,24,40,.22)); }
.ahv-appwrap.chat-open .ahv-bea { display: none; }

.ahv-chat {
  position: fixed; top: 46px; right: 0; bottom: 0; width: 420px; max-width: 92vw; z-index: 62;
  background: #fff; border-left: 1px solid var(--ahv-border-muted); box-shadow: -18px 0 40px -24px rgba(16,24,40,.25);
  display: flex; flex-direction: column; transform: translateX(100%); transition: transform .32s cubic-bezier(.16,1,.3,1);
}
.ahv-appwrap.chat-open .ahv-chat { transform: none; }
.ahv-chat-head { display: flex; align-items: center; gap: 11px; padding: 15px 16px; border-bottom: 1px solid var(--ahv-border-muted); }
.ahv-chat-head img { width: 34px; height: 34px; }
.ahv-chat-head .who { flex: 1; }
.ahv-chat-head .who b { font-size: 15px; font-weight: 600; display: block; }
.ahv-chat-head .who span { font-size: 12.5px; color: var(--ahv-ink-muted); display: flex; align-items: center; gap: 5px; }
.ahv-chat-head .who span .d { width: 6px; height: 6px; border-radius: 50%; background: var(--ahv-success); }
.ahv-chat-head .x { border: 0; background: transparent; cursor: pointer; color: var(--ahv-ink-muted); width: 30px; height: 30px; border-radius: 8px; font-size: 18px; }
.ahv-chat-head .x:hover { background: var(--ahv-bg-alt); color: var(--ahv-ink); }

.ahv-log { flex: 1; overflow-y: auto; padding: 18px 16px; display: flex; flex-direction: column; gap: 14px; }
.ahv-msg { max-width: 90%; font-size: 14px; line-height: 1.55; }
.ahv-msg.user { align-self: flex-end; background: var(--ahv-primary); color: #fff; padding: 10px 14px; border-radius: 16px 16px 4px 16px; }
.ahv-msg.bot { align-self: flex-start; color: var(--ahv-ink); }
.ahv-msg.bot .txt { background: var(--ahv-bg-alt); padding: 11px 14px; border-radius: 4px 16px 16px 16px; }
.ahv-msg.bot strong { font-weight: 600; }
.ahv-msg.bot code { background: #fff; border: 1px solid var(--ahv-border-muted); border-radius: 5px; padding: 1px 5px; font-size: 12.5px; }
.ahv-cite { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; margin: 0 1px; font-size: 11px; font-weight: 600; vertical-align: 1px; color: var(--ahv-primary-text); background: var(--ahv-primary-faint); border: 1px solid var(--ahv-primary-soft); border-radius: 5px; cursor: pointer; }
.ahv-cite:hover { background: var(--ahv-primary); color: #fff; }
/* active citation + its source passage highlight yellow, so it's clear which part maps to [n] */
.ahv-cite.is-active { background: #FDE68A; border-color: #F5C518; color: #7A5A00; }
.ahv-source.is-cited { border-color: #F5C518; background: #FEFBE8; animation: ahv-hl .6s ease; }
.ahv-source.is-cited summary { color: #6B5300; }
.ahv-source.is-cited summary b { color: #8A6D00; }
.ahv-source.is-cited .body { color: #4C4425; }
@keyframes ahv-hl { from { background: #FDE68A; } to { background: #FEFBE8; } }
.ahv-sources { margin-top: 10px; display: flex; flex-direction: column; gap: 7px; }
.ahv-source { border: 1px solid var(--ahv-border-muted); border-radius: 10px; overflow: hidden; }
.ahv-source summary { list-style: none; cursor: pointer; padding: 8px 11px; font-size: 12.5px; color: var(--ahv-ink-muted); display: flex; align-items: center; gap: 7px; }
.ahv-source summary::-webkit-details-marker { display: none; }
.ahv-source summary b { color: var(--ahv-primary-text); font-weight: 600; }
.ahv-source .body { padding: 0 12px 11px; font-size: 12.5px; line-height: 1.5; color: var(--ahv-ink-muted); }
.ahv-typing { align-self: flex-start; display: inline-flex; gap: 4px; padding: 12px 14px; background: var(--ahv-bg-alt); border-radius: 4px 16px 16px 16px; }
.ahv-typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--ahv-ink-faint); animation: ahv-bounce 1.2s infinite; }
.ahv-typing span:nth-child(2){ animation-delay:.15s } .ahv-typing span:nth-child(3){ animation-delay:.3s }
@keyframes ahv-bounce { 0%,60%,100%{ transform: translateY(0); opacity:.5 } 30%{ transform: translateY(-4px); opacity:1 } }

.ahv-suggests { display: flex; flex-wrap: wrap; gap: 8px; }
.ahv-suggests button { font: inherit; font-size: 12.5px; color: var(--ahv-primary-text); background: var(--ahv-primary-faint); border: 1px solid var(--ahv-primary-soft); border-radius: 999px; padding: 6px 12px; cursor: pointer; text-align: left; }
.ahv-suggests button:hover { background: var(--ahv-primary); color: #fff; }
.ahv-chat-form { border-top: 1px solid var(--ahv-border-muted); padding: 12px; display: flex; gap: 9px; align-items: flex-end; }
.ahv-chat-form textarea { flex: 1; resize: none; border: 1px solid var(--ahv-border); border-radius: 12px; padding: 10px 12px; font: inherit; font-size: 14px; max-height: 110px; outline: 0; color: var(--ahv-ink); }
.ahv-chat-form textarea:focus { border-color: var(--ahv-primary); }
.ahv-chat-form .send { flex: none; width: 40px; height: 40px; border-radius: 11px; border: 0; background: var(--ahv-primary); color: #fff; cursor: pointer; display: grid; place-items: center; }
.ahv-chat-form .send:disabled { opacity: .4; cursor: default; }
.ahv-chat-note { font-size: 11px; color: var(--ahv-ink-faint); text-align: center; padding: 0 12px 10px; }

/* ---- toast (upload feedback) ---- */
.ahv-toast { position: fixed; bottom: 96px; left: 50%; transform: translateX(-50%); z-index: 63; background: var(--ahv-accent); color: #fff; font-size: 13px; padding: 10px 16px; border-radius: 10px; box-shadow: var(--ahv-shadow-lg); opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none; }
.ahv-toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }
.ahv-toast.err { background: var(--ahv-danger); }

/* ---- search clear + no-results ---- */
.ahv-search .clear { border: 0; background: transparent; cursor: pointer; color: var(--ahv-ink-faint); display: grid; place-items: center; padding: 0; }
.ahv-search .clear:hover { color: var(--ahv-ink); }
.ahv-search .clear .ti { font-size: 16px; }
.ahv-empty { text-align: center; color: var(--ahv-ink-muted); padding: 56px 20px; }
.ahv-empty .ti { font-size: 30px; color: var(--ahv-ink-faint); }
.ahv-empty p { font-size: 14px; margin-top: 8px; }

/* ---- card version menu button ---- */
.ahv-doc .menu { border: 0; background: transparent; cursor: pointer; padding: 2px; border-radius: 6px; }
.ahv-doc .menu:hover { background: var(--ahv-bg-alt); color: var(--ahv-ink); }

/* ---- version history modal ---- */
.ahv-modal { position: fixed; inset: 0; z-index: 70; background: rgba(16,24,40,.42); display: grid; place-items: center; padding: 20px; animation: ahv-fade .18s ease; }
@keyframes ahv-fade { from { opacity: 0; } to { opacity: 1; } }
.ahv-modal-card { width: min(540px, 100%); max-height: 80vh; background: #fff; border-radius: 16px; overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--ahv-shadow-lg); }
.ahv-modal-head { display: flex; align-items: center; justify-content: space-between; padding: 15px 18px; border-bottom: 1px solid var(--ahv-border-muted); }
.ahv-modal-head .mtitle { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.ahv-modal-head .mname { color: var(--ahv-ink-muted); font-weight: 500; }
.ahv-modal-head .x { border: 0; background: transparent; font-size: 22px; color: var(--ahv-ink-muted); cursor: pointer; width: 32px; height: 32px; border-radius: 8px; }
.ahv-modal-head .x:hover { background: var(--ahv-bg-alt); color: var(--ahv-ink); }
.ahv-modal-body { overflow-y: auto; padding: 8px 12px 12px; }
.ahv-ver { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; }
.ahv-ver.is-current { background: var(--ahv-primary-faint); }
.ahv-ver .v-num { flex: none; width: 42px; height: 42px; border-radius: 11px; background: var(--ahv-bg-alt); color: var(--ahv-ink); font-size: 13px; font-weight: 600; display: grid; place-items: center; }
.ahv-ver.is-current .v-num { background: var(--ahv-primary); color: #fff; }
.ahv-ver .v-meta { flex: 1; min-width: 0; }
.ahv-ver .v-name { font-size: 14px; font-weight: 500; color: var(--ahv-ink); }
.ahv-ver .v-name .cur { font-size: 11px; font-weight: 600; color: var(--ahv-primary-text); background: #fff; border: 1px solid var(--ahv-primary-soft); border-radius: 999px; padding: 1px 7px; margin-left: 6px; }
.ahv-ver .v-sub { font-size: 12px; color: var(--ahv-ink-muted); margin-top: 3px; line-height: 1.45; }
.ahv-ver .v-restore { flex: none; font: inherit; font-size: 12.5px; font-weight: 500; color: var(--ahv-primary-text); background: #fff; border: 1px solid var(--ahv-primary-soft); border-radius: 8px; padding: 7px 13px; cursor: pointer; }
.ahv-ver .v-restore:hover { background: var(--ahv-primary); color: #fff; }
.ahv-ver .v-restore:disabled { opacity: .5; cursor: default; }

/* ---- file preview (detail modal) ---- */
.ahv-doc { cursor: pointer; }
.ahv-doc:focus-visible { outline: 2px solid var(--ahv-primary); outline-offset: 2px; }

.ahv-detail-modal { position: fixed; inset: 0; z-index: 68; background: rgba(16,24,40,.42); display: grid; place-items: center; padding: 22px; animation: ahv-fade .18s ease; }
.ahv-detail-card { width: min(1040px, 95vw); height: min(88vh, 780px); background: #fff; border-radius: 18px; overflow: hidden; box-shadow: 0 28px 72px rgba(0,0,0,.22); animation: ahv-pop .2s cubic-bezier(.16,1,.3,1); }
@keyframes ahv-pop { from { opacity: 0; transform: translateY(10px) scale(.99); } to { opacity: 1; transform: none; } }

.ahv-detail { display: flex; height: 100%; }

/* left: preview */
.ahv-detail .dt-preview { flex: 1 1 auto; min-width: 0; background: var(--ahv-bg-alt); display: flex; align-items: flex-start; justify-content: center; padding: 26px; overflow-y: auto; }
.ahv-detail .dt-page { width: 100%; max-width: 620px; background: #fff; border-radius: 6px; box-shadow: 0 4px 22px rgba(16,24,40,.10); padding: 48px 54px; }
.ahv-detail .dt-page p { font-size: 13.5px; line-height: 1.85; color: #3A4046; margin: 0 0 13px; white-space: pre-wrap; word-break: break-word; }
.ahv-detail .dt-page p:first-child { font-size: 15px; font-weight: 600; color: var(--tint); margin-bottom: 16px; }
.ahv-detail .dt-page p.muted { color: var(--ahv-ink-faint); font-weight: 400; }
.ahv-detail .dt-image { width: 100%; height: 100%; display: grid; place-items: center; }
.ahv-detail .dt-image img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; box-shadow: 0 6px 26px rgba(16,24,40,.14); background: #fff; }

/* real document viewer (PDF.js / docx-preview / SheetJS) fills the preview column */
.ahv-detail .dt-preview:has(.dt-viewer) { padding: 0; overflow: hidden; align-items: stretch; }
.ahv-detail .dt-viewer { width: 100%; height: 100%; display: flex; overflow: auto; }
.ahv-detail .dv-stage { flex: 1; min-width: 0; width: 100%; overflow: auto; }
.ahv-detail .dv-stage.is-loading { display: grid; place-items: center; }
.ahv-detail .dv-spin { width: 30px; height: 30px; border: 3px solid var(--ahv-border); border-top-color: var(--ahv-primary); border-radius: 50%; animation: ahv-spin .7s linear infinite; }
/* PDF — page canvases on a dark stage, like a real PDF viewer */
.ahv-detail .dv-stage.is-pdf { background: #52565A; padding: 20px; display: flex; flex-direction: column; align-items: center; gap: 16px; }
.ahv-detail .dv-page { border-radius: 3px; box-shadow: 0 3px 18px rgba(0,0,0,.4); background: #fff; max-width: 100%; height: auto; }
/* DOCX — docx-preview renders white pages with real formatting */
.ahv-detail .dv-stage.is-docx { background: var(--ahv-bg-alt); padding: 22px; }
.ahv-detail .dv-stage.is-docx .docx { margin: 0 auto 18px; background: #fff; box-shadow: 0 3px 18px rgba(16,24,40,.14); }
/* XLSX — SheetJS HTML table styled as a spreadsheet grid */
.ahv-detail .dv-stage.is-xlsx { background: #fff; padding: 0; display: flex; flex-direction: column; }
.ahv-detail .dv-tabs { display: flex; gap: 2px; padding: 8px 10px 0; background: #F1F3F4; border-bottom: 1px solid var(--ahv-border-muted); flex: none; }
.ahv-detail .dv-tabs button { font: inherit; font-size: 12px; color: var(--ahv-ink-muted); background: transparent; border: 0; padding: 7px 13px; border-radius: 6px 6px 0 0; cursor: pointer; }
.ahv-detail .dv-tabs button.active { background: #fff; color: #0F6E56; font-weight: 600; }
.ahv-detail .dv-sheet { flex: 1; overflow: auto; }
.ahv-detail .dv-sheet table { border-collapse: collapse; font-size: 12.5px; }
.ahv-detail .dv-sheet td { border: 1px solid #E7EAED; padding: 6px 12px; color: #3A4046; white-space: nowrap; }
.ahv-detail .dv-sheet tr:first-child td { background: #E9F6EF; color: #0F6E56; font-weight: 600; position: sticky; top: 0; }
.ahv-detail .dv-sheet td:first-child { color: #16223D; font-weight: 500; }

.ahv-detail .dt-sheet { width: 100%; max-width: 640px; background: #fff; border-radius: 8px; box-shadow: 0 4px 22px rgba(16,24,40,.10); overflow: hidden; }
.ahv-detail .dt-sheet .tabbar { display: flex; gap: 2px; background: #F1F3F4; padding: 7px 10px 0; }
.ahv-detail .dt-sheet .tab { font-size: 11px; color: var(--ahv-ink-muted); padding: 6px 12px; border-radius: 6px 6px 0 0; }
.ahv-detail .dt-sheet .tab.active { background: #fff; color: #0F6E56; font-weight: 600; }
.ahv-detail .dt-sheet table { width: 100%; border-collapse: collapse; }
.ahv-detail .dt-sheet th, .ahv-detail .dt-sheet td { text-align: left; padding: 9px 12px; border: 1px solid #EEF1F4; font-size: 12px; white-space: nowrap; }
.ahv-detail .dt-sheet th { background: #E9F6EF; color: #0F6E56; font-weight: 600; }
.ahv-detail .dt-sheet td { color: #5A6169; }
.ahv-detail .dt-sheet td:first-child { color: #16223D; font-weight: 500; }
.ahv-detail .dt-sheet td.pos { color: var(--ahv-success); font-weight: 600; }

/* right: details */
.ahv-detail .dt-side { flex: none; width: 400px; display: flex; flex-direction: column; border-left: 1px solid var(--ahv-border-muted); }
.ahv-detail .dt-bar { flex: none; display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; }
.ahv-detail .dt-bar .left, .ahv-detail .dt-bar .right { display: flex; align-items: center; gap: 6px; }
.ahv-detail .dt-ico { width: 32px; height: 32px; border: 0; background: transparent; border-radius: 8px; color: var(--ahv-ink-faint); font-size: 19px; display: grid; place-items: center; cursor: pointer; transition: background .15s, color .15s; }
.ahv-detail .dt-ico:hover { background: var(--ahv-bg-alt); color: var(--ahv-primary-text); }
.ahv-detail .dt-share { font: inherit; font-size: 13.5px; font-weight: 500; color: #fff; background: var(--ahv-accent); border: 0; border-radius: 8px; padding: 7px 16px; cursor: pointer; }
.ahv-detail .dt-share:hover { background: #33353A; }

.ahv-detail .dt-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 0 26px; }
.ahv-detail .dt-name { margin: 4px 18px 0; display: flex; align-items: center; gap: 12px; border-radius: 14px; padding: 13px 15px; background: rgba(135,128,231,.09); }
.ahv-detail .dt-name .ic { flex: none; width: 30px; height: 30px; border-radius: 9px; background: #fff; color: #7A72E8; display: grid; place-items: center; font-size: 17px; }
.ahv-detail .dt-name .t { font-size: 14px; font-weight: 600; color: var(--ahv-ink); line-height: 1.35; word-break: break-word; }
.ahv-detail .dt-name .o { font-size: 12px; color: var(--ahv-ink-muted); margin-top: 2px; }
.ahv-detail .dt-idas { font-size: 13.5px; color: var(--ahv-ink-muted); padding: 16px 20px 6px; }
.ahv-detail .dt-idas b { color: var(--ahv-ink); font-weight: 600; }
.ahv-detail .dt-summary { margin: 6px 20px 0; border: 1px solid var(--ahv-border-muted); border-radius: 10px; padding: 14px 16px; }
.ahv-detail .lbl { font-size: 12px; font-weight: 600; color: var(--ahv-ink-faint); margin: 0 0 7px; }
.ahv-detail .dt-summary p { font-size: 13.5px; line-height: 1.6; color: var(--ahv-ink-muted); margin: 0 0 6px; }
.ahv-detail .dt-summary p.bul { display: flex; gap: 7px; }
.ahv-detail .dt-summary p.bul span:first-child { color: var(--ahv-primary-text); }
.ahv-detail .dt-sec { padding: 16px 20px 0; }
.ahv-detail .chips { display: flex; flex-wrap: wrap; gap: 7px; }
.ahv-detail .chip { font-size: 12.5px; color: var(--ahv-ink-muted); background: #fff; border: 1px solid var(--ahv-border); border-radius: 999px; padding: 4px 11px; display: inline-flex; align-items: center; gap: 5px; }
.ahv-detail .chip .at { color: var(--ahv-primary-text); font-weight: 500; }
.ahv-detail .chip.tag { color: var(--ahv-ink-muted); }
.ahv-detail .chip.tag .ti { font-size: 13px; color: var(--ahv-ink-faint); }
.ahv-detail .dt-meta { padding: 22px 20px 0; }
.ahv-detail .dt-meta h4 { font-size: 13px; font-weight: 600; color: var(--ahv-ink); margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
.ahv-detail .dt-meta .ext { font-size: 10px; font-weight: 500; color: var(--ahv-ink-faint); background: var(--ahv-bg-alt); border-radius: 4px; padding: 2px 6px; letter-spacing: .04em; }
.ahv-detail .dt-meta .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 20px; }
.ahv-detail .dt-meta .k { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--ahv-ink-faint); margin: 0; }
.ahv-detail .dt-meta .v { font-size: 13px; color: var(--ahv-ink); margin: 3px 0 0; word-break: break-word; }

/* ---- Features tab ---- */
.ahv-features { max-width: 860px; margin: 0 auto; padding: 44px 28px 80px; }
.ahv-features h2 { font-size: 30px; font-weight: 700; letter-spacing: -.02em; margin: 0 0 6px; }
.ahv-features .lede { font-size: 17px; color: var(--ahv-ink-muted); line-height: 1.6; margin: 0 0 34px; }
.ahv-feat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-bottom: 34px; }
.ahv-feat { background: #fff; border: 1px solid var(--ahv-border-muted); border-radius: 14px; padding: 20px; box-shadow: var(--ahv-shadow); }
.ahv-feat .ic { width: 40px; height: 40px; border-radius: 11px; background: var(--ahv-primary-faint); color: var(--ahv-primary-text); display: grid; place-items: center; font-size: 21px; margin-bottom: 13px; }
.ahv-feat h3 { font-size: 16px; font-weight: 600; margin: 0 0 6px; }
.ahv-feat p { font-size: 13.5px; color: var(--ahv-ink-muted); line-height: 1.6; margin: 0; }
.ahv-steps { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin: 8px 0 34px; }
.ahv-step { text-align: center; }
.ahv-step .n { width: 30px; height: 30px; margin: 0 auto 8px; border-radius: 50%; background: var(--ahv-primary); color: #fff; font-size: 13px; font-weight: 600; display: grid; place-items: center; }
.ahv-step b { font-size: 13px; font-weight: 600; display: block; }
.ahv-step span { font-size: 12px; color: var(--ahv-ink-muted); }
.ahv-note { background: var(--ahv-primary-faint); border: 1px solid var(--ahv-primary-soft); border-radius: 12px; padding: 15px 18px; font-size: 13.5px; color: var(--ahv-ink-muted); line-height: 1.6; }
.ahv-note b { color: var(--ahv-primary-text); }

@media (max-width: 900px) {
  .ahv-hives { grid-template-columns: repeat(2, 1fr); }
  .ahv-grid { grid-template-columns: repeat(2, 1fr); }
  .ahv-search { display: none; }
  .ahv-feat-grid { grid-template-columns: 1fr; }
  .ahv-steps { grid-template-columns: repeat(2, 1fr); }
  /* stack the file preview above the details so both stay usable in a narrow pane */
  .ahv-detail { flex-direction: column; }
  .ahv-detail .dt-preview { flex: none; height: 44%; padding: 16px; }
  .ahv-detail .dt-page { padding: 26px 28px; }
  .ahv-detail .dt-side { width: 100%; flex: 1; min-height: 0; border-left: 0; border-top: 1px solid var(--ahv-border-muted); }
  .ahv-detail-card { height: min(92vh, 900px); }
  /* tight panes: drop the always-empty "shared with" and the tags column so the file name gets room */
  .ahv-list .c-share, .ahv-list .c-tag { display: none; }
  .ahv-list .c-ent { width: 210px; }
  .ahv-list .c-type { width: 108px; }
}
@media (max-width: 560px) {
  .ahv-grid { grid-template-columns: 1fr; }
  .ahv-hives { grid-template-columns: 1fr; }
  .ahv-chat { width: 100%; }
}
