/* Chat floating shell v1 · visual-only.
   One soft-glass grammar for the header, composer and clicked surfaces.
   No controls, markup behavior or chat logic are replaced here. */
:root {
  --chat-float-bg: linear-gradient(145deg, rgba(29, 36, 50, .76), rgba(23, 29, 41, .62));
  --chat-float-edge: rgba(255, 255, 255, .16);
  --chat-float-hi: rgba(255, 255, 255, .10);
  --chat-float-shadow: 0 2px 5px rgba(5, 10, 18, .13), 0 16px 36px rgba(5, 10, 18, .18);
  --chat-float-press: rgba(255, 255, 255, .09);
  --chat-pop-bg: linear-gradient(150deg, rgba(31, 39, 54, .9), rgba(22, 28, 41, .84));
  --chat-inner-bg: rgba(255, 255, 255, .045);
}

[data-theme="day"] {
  --chat-float-bg: linear-gradient(145deg, rgba(248, 251, 255, .77), rgba(232, 239, 249, .64));
  --chat-float-edge: rgba(255, 255, 255, .72);
  --chat-float-hi: rgba(255, 255, 255, .78);
  --chat-float-shadow: 0 2px 5px rgba(65, 82, 106, .08), 0 16px 36px rgba(65, 82, 106, .14);
  --chat-float-press: rgba(139, 162, 194, .14);
  --chat-pop-bg: linear-gradient(150deg, rgba(248, 251, 255, .94), rgba(230, 238, 249, .89));
  --chat-inner-bg: rgba(255, 255, 255, .34);
}

/* Top and bottom are the same two floating rails. */
header::before,
footer .line {
  background: var(--chat-float-bg);
  border: 1px solid var(--chat-float-edge);
  box-shadow: inset 0 1px 0 var(--chat-float-hi), var(--chat-float-shadow);
  -webkit-backdrop-filter: blur(24px) saturate(1.14);
  backdrop-filter: blur(24px) saturate(1.14);
}

header::before {
  left: 10px;
  right: 10px;
  border-radius: 27px;
}

/* The rail is the surface; controls inside it do not each grow a second box. */
header .icon-btn,
[data-theme="day"] header .icon-btn {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  border-radius: 50%;
}

header .icon-btn:active,
footer .icon-btn:active,
footer .send:active {
  background: var(--chat-float-press);
  transition: none;
}

footer .line,
.in-shell footer .line,
html[data-theme="day"].in-shell footer .line {
  gap: 7px;
  padding: 5px 7px;
  border-radius: 28px;
}

/* Tabler icons are visually steady; their labels should not fall away like captions. */
.dock3 a {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", sans-serif;
  font-size: 12.5px;
  font-weight: 650;
  letter-spacing: .012em;
}

/* Only the secondary sound and permission groups fold away by default. */
#panel .panel-fold {
  margin: 8px 0 0;
  border-bottom: 1px solid rgba(159, 180, 210, .12);
}

#panel .panel-fold + .panel-fold { margin-top: 2px; }

#panel .panel-fold > summary {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 12px 2px;
  cursor: pointer;
  list-style: none;
  color: color-mix(in srgb, #9fb4d2 64%, var(--ink-faint));
  font: 11.5px/1 var(--serif);
  letter-spacing: .28em;
  -webkit-user-select: none;
  user-select: none;
}

#panel .panel-fold > summary::-webkit-details-marker { display: none; }

#panel .panel-fold > summary::before {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: linear-gradient(135deg, #d69aae, #9fb4d2);
  box-shadow: 0 0 0 4px rgba(159, 180, 210, .07);
  content: "";
}

#panel .panel-fold > summary i {
  margin-left: auto;
  color: var(--ink-faint);
  font-size: 14px;
  transition: transform .22s ease, color .22s ease;
}

#panel .panel-fold[open] > summary i {
  color: color-mix(in srgb, #d69aae 64%, var(--ink));
  transform: rotate(180deg);
}

#panel .panel-fold-body {
  margin: 0 0 7px 2px;
  padding: 1px 0 3px 12px;
  border-left: 1px solid rgba(159, 180, 210, .18);
}

#panel .panel-fold-body .rowline:last-child { border-bottom: 0; }

/* The first settings groups read as two related modules instead of one long list. */
#panel .panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 1px 0 15px;
  padding: 2px 2px 0;
}

#panel .panel-heading small,
#panel .panel-heading strong { display: block; }

#panel .panel-heading small {
  color: color-mix(in srgb, #9fb4d2 68%, var(--ink-faint));
  font-size: 8px;
  letter-spacing: .2em;
}

#panel .panel-heading strong {
  margin-top: 4px;
  color: var(--ink);
  font: 500 18px/1.2 var(--serif);
  letter-spacing: .08em;
}

#panel .panel-heading > i {
  display: grid;
  place-items: center;
  width: 35px;
  height: 35px;
  border: 1px solid var(--chat-float-edge);
  border-radius: 13px;
  background: var(--chat-inner-bg);
  color: color-mix(in srgb, #9fb4d2 72%, var(--ink));
  font-size: 17px;
  box-shadow: inset 0 1px 0 var(--chat-float-hi);
}

#panel .panel-cluster {
  position: relative;
  margin: 0 0 15px;
  padding: 3px 1px 5px 14px;
  border: 0;
  border-radius: 0;
  background: linear-gradient(90deg, rgba(159, 180, 210, .075), transparent 84%);
  box-shadow: none;
}

#panel .panel-cluster::before {
  content: "";
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 7px;
  width: 2px;
  border-radius: 999px;
  background: linear-gradient(180deg, #d69aae, rgba(159, 180, 210, .48));
}

#panel .panel-cluster .group-t {
  margin: 0 0 5px;
  font-size: 10.5px;
}

#panel .panel-cluster .rowline { padding: 8px 0; }
#panel .panel-cluster .rowline:last-child { border-bottom: 0; }

#panel #sigState {
  margin: 2px 0 3px;
  padding: 7px 0;
  border-bottom: 1px solid rgba(159, 180, 210, .1);
  border-radius: 0;
  background: transparent;
  color: var(--ink-faint);
  font: 11px/1.65 var(--serif);
  letter-spacing: .035em;
}

/* Long-press actions are controls, never selectable page copy on iOS. */
.conv,
.conv *,
.sheet h3,
.sheet-list,
.sheet-list *,
.sheet-btns,
.sheet-btns * {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.sheet .rename-input {
  -webkit-user-select: text;
  user-select: text;
  -webkit-touch-callout: default;
}

footer .line .field,
footer .line .field:focus-within,
[data-theme="day"] footer .line .field,
[data-theme="day"] footer .line .field:focus-within,
.in-shell footer .line .field,
.in-shell footer .line .field:focus-within {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

footer .line .field {
  transition: background .22s ease, border-color .22s ease, box-shadow .22s ease;
}

footer .line .field:focus-within,
.in-shell footer .line .field:focus-within {
  background: rgba(255, 255, 255, .065);
  border-color: rgba(180, 202, 231, .17);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .075), 0 4px 14px rgba(5, 10, 18, .07);
}

[data-theme="day"] footer .line .field:focus-within,
html[data-theme="day"].in-shell footer .line .field:focus-within {
  background: rgba(255, 255, 255, .38);
  border-color: rgba(147, 170, 202, .27);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .72), 0 4px 14px rgba(65, 82, 106, .07);
}

footer .icon-btn.plus,
footer .hv-dock,
.in-shell footer .icon-btn.plus,
.in-shell footer .hv-dock {
  width: 40px;
  height: 40px;
  border-color: transparent;
  border-radius: 50%;
  background: transparent;
  box-shadow: none;
}

footer .icon-btn.plus .ti {
  display: block;
  transform: rotate(0deg);
  transition: transform .3s cubic-bezier(.22, 1, .36, 1);
}

footer .icon-btn.plus.open .ti { transform: rotate(45deg); }

/* The expanded attachment row is one small companion bubble, not five boxes. */
.attach-row.open {
  width: max-content;
  max-width: 100%;
  height: 52px;
  padding: 4px;
  border: 1px solid var(--chat-float-edge);
  border-radius: 22px;
  background: var(--chat-float-bg);
  box-shadow: inset 0 1px 0 var(--chat-float-hi), 0 10px 25px rgba(5, 10, 18, .13);
  -webkit-backdrop-filter: blur(22px) saturate(1.12);
  backdrop-filter: blur(22px) saturate(1.12);
}

.attach-row .icon-btn,
[data-theme="day"] .attach-row .icon-btn {
  border-color: transparent;
  border-radius: 50%;
  background: transparent;
  box-shadow: none;
}

/* Softer contact + ambient shadow: keep the accepted blue/berry palette intact. */
.row.him:not(.proactive) .bubble:not(.cut-end):not(.cont),
.row.her .bubble:not(.cut-end):not(.cont) {
  border-radius: 21px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .08),
    0 2px 5px rgba(5, 10, 18, .10),
    0 15px 32px rgba(5, 10, 18, .14);
}

.row.him:not(.proactive) .bubble:not(.cut-end):not(.cont) { border-top-left-radius: 7px; }
.row.her .bubble:not(.cut-end):not(.cont) { border-top-right-radius: 7px; }

[data-theme="day"] .row.him:not(.proactive) .bubble:not(.cut-end):not(.cont),
[data-theme="day"] .row.her .bubble:not(.cut-end):not(.cont) {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .62),
    0 2px 5px rgba(61, 80, 107, .08),
    0 15px 32px rgba(61, 80, 107, .12);
}

/* Every surface opened by a click uses one material and one corner family. */
.menu,
.sheet,
.hv-card {
  background: var(--chat-pop-bg);
  border-color: var(--chat-float-edge);
  border-radius: 20px;
  box-shadow: inset 0 1px 0 var(--chat-float-hi), var(--chat-float-shadow);
  -webkit-backdrop-filter: blur(28px) saturate(1.14);
  backdrop-filter: blur(28px) saturate(1.14);
}

[data-theme="day"] .menu,
[data-theme="day"] .sheet,
[data-theme="day"] .hv-card {
  background: var(--chat-pop-bg);
}

.drawer .mind,
.drawer .new-chat,
.drawer .tool-grid a,
[data-theme="day"] .drawer .mind,
[data-theme="day"] .drawer .new-chat,
[data-theme="day"] .drawer .tool-grid a {
  background: var(--chat-inner-bg);
  border-color: var(--chat-float-edge);
  border-radius: 17px;
  box-shadow: inset 0 1px 0 var(--chat-float-hi);
}

.menu button,
.sheet-list button,
.sheet-btns button,
.hv-acts button {
  border-radius: 13px;
}

.menu button:active,
.sheet-list button:active,
.sheet-btns button:active,
.hv-acts button:active,
.drawer .mind:active,
.drawer .new-chat:active,
.drawer .tool-grid a:active {
  background: var(--chat-float-press);
  transition: none;
}

/* Keep semantic state colors: heart-voice lit and primary confirmation still glow. */
.hv-acts .hv-ok:active,
.sheet-btns .keep:active {
  filter: brightness(.96);
}

.hv-acts .hv-ok:active { background: var(--gold); }

@media (prefers-reduced-motion: reduce) {
  header .icon-btn,
  footer .icon-btn,
  footer .send,
  .attach-row,
  .menu,
  .sheet,
  .hv-card {
    transition: none;
  }
  footer .icon-btn.plus .ti { transition: none; }
}
