/* SiChatFish — kerangka halaman mandiri: sidebar (bisa dilipat), bilah atas (Masuk/profil), dialog Pengaturan.
 * Dipakai /, /hitung, /ukur, /kesehatan, /peta. Tidak dipakai /embed (iframe/widget).
 * Memakai variabel warna dari chat.css. */
.sh-body { overflow: hidden; }
.sh { display: grid; grid-template-columns: 240px minmax(0, 1fr); height: 100vh; height: 100dvh; }
.sh.sh-collapsed { grid-template-columns: 64px minmax(0, 1fr); }

/* ------------------------------------------------ sidebar */
.sh-side { display: flex; flex-direction: column; min-height: 0; background: var(--sc-bg-soft);
  border-right: 1px solid var(--sc-line); padding: 10px 8px; gap: 4px; }
.sh-brand { display: flex; align-items: center; gap: 8px; padding: 4px 6px 12px; min-height: 44px; }
.sh-brand-name { font-weight: 700; font-size: 16px; white-space: nowrap; overflow: hidden; }
.sh-fold { margin-left: auto; }
.sh-nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; min-height: 0; }
.sh-bottom { display: flex; flex-direction: column; gap: 2px; border-top: 1px solid var(--sc-line); padding-top: 8px; }
.sh-item { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 42px; padding: 8px 12px;
  border: 0; border-radius: 10px; background: transparent; color: var(--sc-ink); font: inherit; font-size: 14.5px;
  text-decoration: none; cursor: pointer; text-align: left; white-space: nowrap; }
.sh-item:hover { background: var(--sc-line); }
.sh-item[aria-current="page"] { background: var(--sc-user); color: var(--sc-accent); font-weight: 600; }
.sh-item:focus-visible, .sh-icon-btn:focus-visible { outline: 2px solid var(--sc-accent); outline-offset: 1px; }
.sh-item[hidden] { display: none; }
.sh-ico { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round; }
.sh-label { overflow: hidden; text-overflow: ellipsis; }
.sh-new { border: 1px solid var(--sc-line); margin-bottom: 6px; background: var(--sc-bg); }
.sh-logout { color: #b42318; }
.sh-collapsed .sh-label, .sh-collapsed .sh-brand-name { display: none; }
.sh-collapsed .sh-item { justify-content: center; padding: 8px 0; }
.sh-collapsed .sh-brand { flex-direction: column; padding: 4px 0 10px; }
.sh-collapsed .sh-fold { margin-left: 0; }
.sh-collapsed .sh-fold .sh-ico { transform: rotate(180deg); }

.sh-icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px;
  border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--sc-ink-soft); cursor: pointer; }
.sh-icon-btn:hover { background: var(--sc-line); color: var(--sc-ink); }

/* ------------------------------------------------ area utama */
.sh-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.sh-top { display: flex; align-items: center; gap: 8px; min-height: 56px; padding: 8px 16px;
  border-bottom: 1px solid var(--sc-line); background: var(--sc-bg); }
.sh-title { font-size: 17px; font-weight: 600; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sh-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.sh-menu { display: none; }
.sh-profile { display: inline-flex; align-items: center; gap: 8px; max-width: 260px; border: 1px solid var(--sc-line);
  background: var(--sc-bg); color: var(--sc-ink); border-radius: 999px; padding: 3px 12px 3px 3px; font: inherit;
  font-size: 14px; cursor: pointer; }
.sh-profile[hidden], .sh-login[hidden] { display: none; }
.sh-avatar { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; flex: none;
  border-radius: 50%; background: var(--sc-accent); color: var(--sc-accent-ink); font-weight: 700; font-size: 13px; }
.sh-pname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sh-content { flex: 1; min-height: 0; overflow-y: auto; }
.sh-page-chat .sh-content, .sh-page-peta .sh-content { overflow: hidden; display: flex; flex-direction: column; }

/* Kartu "silakan masuk" di halaman alat */
.sh-need-login { max-width: 560px; margin: 32px auto; padding: 20px; text-align: center; background: var(--sc-bg-soft);
  border: 1px solid var(--sc-line); border-radius: var(--sc-radius); }
.sh-need-login[hidden] { display: none; }
.sh-need-login h2 { font-size: 17px; margin: 0 0 6px; }
.sh-need-login p { margin: 0; color: var(--sc-ink-soft); }

/* ------------------------------------------------ dialog Pengaturan */
.sh-dialog { width: min(520px, calc(100vw - 24px)); max-height: calc(100vh - 48px); border: 1px solid var(--sc-line);
  border-radius: 14px; padding: 0; background: var(--sc-bg); color: var(--sc-ink); }
.sh-dialog::backdrop { background: rgba(10, 20, 30, 0.45); }
.sh-dlg-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px;
  border-bottom: 1px solid var(--sc-line); }
.sh-dlg-head h2 { font-size: 17px; margin: 0; }
.sh-dlg-body { padding: 8px 16px 16px; overflow-y: auto; }
.sh-set { padding: 12px 0; border-bottom: 1px solid var(--sc-line); }
.sh-set:last-child { border-bottom: 0; }
.sh-set h3 { font-size: 14px; margin: 0 0 8px; color: var(--sc-ink-soft); text-transform: uppercase; letter-spacing: .04em; }
.sh-opt { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; font-size: 14.5px; cursor: pointer; }
.sh-opt small { display: block; color: var(--sc-ink-soft); font-size: 12.5px; }
.sh-kv { display: grid; grid-template-columns: 90px 1fr; gap: 4px 10px; font-size: 14px; }
.sh-kv dt { color: var(--sc-ink-soft); }
.sh-kv dd { margin: 0; overflow-wrap: anywhere; }
.sh-muted { color: var(--sc-ink-soft); font-size: 13px; margin: 6px 0 0; }

/* ------------------------------------------------ ponsel: sidebar jadi laci */
.sh-backdrop { display: none; }
@media (max-width: 760px) {
  .sh, .sh.sh-collapsed { grid-template-columns: minmax(0, 1fr); }
  .sh-side { position: fixed; z-index: 1200; inset: 0 auto 0 0; width: 260px; transform: translateX(-105%);
    transition: transform .2s ease; box-shadow: 0 0 24px rgba(0, 0, 0, .2); }
  .sh.sh-open .sh-side { transform: none; }
  .sh.sh-open .sh-backdrop { display: block; position: fixed; inset: 0; z-index: 1100; background: rgba(10, 20, 30, .4); }
  /* Di ponsel sidebar selalu lengkap (label terlihat) saat dibuka. */
  .sh-collapsed .sh-label, .sh-collapsed .sh-brand-name { display: inline; }
  .sh-collapsed .sh-item { justify-content: flex-start; padding: 8px 12px; }
  .sh-collapsed .sh-brand { flex-direction: row; }
  .sh-fold { display: none; }
  .sh-menu { display: inline-flex; }
  .sh-top { padding: 6px 10px; min-height: 52px; }
  .sh-pname { display: none; }
  .sh-profile { padding: 3px; }
}
@media (prefers-reduced-motion: reduce) { .sh-side { transition: none; } }
.sh-collapsed .sh-brand .sc-ring-sm { --ring-size: 42px; }

/* Animasi proses (SC.busy): logo SiChatFish dalam cincin berputar + teks tunggu. */
.sh-busy { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center;
  background: rgba(15, 23, 32, .45); padding: 16px; }
.sh-busy[hidden] { display: none; }
.sh-busy-card { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center;
  background: var(--sc-bg); color: var(--sc-ink); border-radius: 16px; padding: 24px 22px; max-width: 320px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .3); }
.sh-busy-ring { --ring-size: 92px; --ring-w: 3px; --ring-dot: 11px; background: #fff; }
.sh-busy-ring > .sc-logo { width: 64px; height: 64px; }
.sh-busy-card b { font-size: 15px; }
.sh-busy-detail { font-size: 13px; color: var(--sc-ink-soft); }

/* ------------------------------------------------ grup Tools + riwayat (sichatfish-hist-v1) */
.sh-group { justify-content: flex-start; }
.sh-chev { margin-left: auto; display: inline-flex; transition: transform .15s ease; }
.sh-group[aria-expanded="true"] .sh-chev { transform: rotate(180deg); }
.sh-sub { display: flex; flex-direction: column; gap: 2px; margin: 0 0 4px 10px; padding-left: 6px;
  border-left: 1px solid var(--sc-line); }
.sh-sub[hidden], .sh-hist[hidden], .sh-hi-menu[hidden] { display: none; }
.sh-collapsed .sh-chev, .sh-collapsed .sh-hist { display: none; }
.sh-collapsed .sh-sub { margin-left: 0; padding-left: 0; border-left: 0; }
.sh-hist { margin: 2px 0 6px; }
.sh-hist-head { padding: 6px 12px 2px; font-size: 11.5px; font-weight: 600; letter-spacing: .03em;
  text-transform: uppercase; color: var(--sc-muted, #667085); }
.sh-hist-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1px; }
.sh-hi { position: relative; display: flex; align-items: center; border-radius: 8px; }
.sh-hi:hover, .sh-hi-cur { background: var(--sc-line); }
.sh-hi-main { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--sc-ink); font: inherit;
  font-size: 13.5px; text-align: left; padding: 8px 4px 8px 12px; cursor: pointer; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; border-radius: 8px; }
.sh-hi-cur .sh-hi-main { font-weight: 600; color: var(--sc-accent); }
.sh-hi-more { flex: none; width: 30px; height: 30px; border: 0; border-radius: 8px; background: transparent;
  color: inherit; font-size: 18px; line-height: 1; cursor: pointer; opacity: .7; }
.sh-hi-more:hover, .sh-hi-more[aria-expanded="true"] { background: var(--sc-bg); opacity: 1; }
.sh-hi-menu { position: absolute; right: 34px; top: 50%; transform: translateY(-50%); z-index: 5;
  background: var(--sc-bg); border: 1px solid var(--sc-line); border-radius: 8px; padding: 3px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .15); }
.sh-hi-del { border: 0; background: transparent; color: #b42318; font: inherit; font-size: 13.5px;
  padding: 6px 12px; border-radius: 6px; cursor: pointer; }
.sh-hi-del:hover { background: var(--sc-line); }
.sh-hi-main:focus-visible, .sh-hi-more:focus-visible, .sh-hi-del:focus-visible { outline: 2px solid var(--sc-accent); outline-offset: 1px; }
.sh-confirm { width: min(420px, calc(100vw - 32px)); border: 1px solid var(--sc-line); border-radius: 14px;
  background: var(--sc-bg); color: var(--sc-ink); padding: 18px 20px; }
.sh-confirm::backdrop { background: rgba(10, 20, 30, 0.45); }
.sh-confirm h3 { margin: 0 0 8px; font-size: 16px; }
.sh-confirm p { margin: 0 0 16px; font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.sh-confirm-row { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.sh-cbtn { border: 1px solid var(--sc-line); border-radius: 10px; background: var(--sc-bg-soft); color: var(--sc-ink);
  font: inherit; font-size: 14px; padding: 8px 14px; cursor: pointer; }
.sh-cbtn-danger { background: #b42318; border-color: #b42318; color: #fff; }
.sh-cbtn:focus-visible { outline: 2px solid var(--sc-accent); outline-offset: 2px; }
@media (max-width: 760px) {
  .sh-collapsed .sh-chev { display: inline-flex; }
  .sh-collapsed .sh-hist { display: block; }
  .sh-collapsed .sh-sub { margin-left: 10px; padding-left: 6px; border-left: 1px solid var(--sc-line); }
}
