[hidden] { display: none !important; }
html { scroll-snap-type: none; }
body.deskapp { background: #FFFFFF; overflow-x: hidden; }
.deskmain { display: flex; flex-direction: column; align-items: center; min-height: var(--page-h); padding: clamp(14px, 2vw, 28px) clamp(12px, 2.4vw, 32px); }
.who { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 18px; margin-left: auto; }
.linkbtn { padding: 2px 0; border: 0; background: none; color: inherit; font: 500 14px/1.3 var(--body); cursor: pointer; text-decoration: none; }
.linkbtn:hover { text-decoration: underline; text-underline-offset: 3px; }

.authcard { width: 100%; max-width: 420px; margin-top: clamp(16px, 8vh, 80px); padding: 32px 30px; }
.authcard > * { position: relative; z-index: 1; }
.authcard h1 { margin-bottom: 16px; font: 800 30px/1.05 var(--head); font-stretch: 118%; letter-spacing: -.02em; color: var(--on-glass); text-shadow: none; }
.authcard label, .dlg label { display: block; margin-bottom: 12px; font-size: 13px; color: var(--on-glass-2); }
.authcard input, .dlg input { display: block; width: 100%; margin-top: 4px; padding: 10px 11px; background: var(--well); border: 1px solid var(--edge-soft); border-radius: var(--radius); outline: 0; color: var(--on-glass); font: 400 15px/1.2 var(--body); }
.authcard input:focus, .dlg input:focus, .compose textarea:focus { border-color: var(--brass); }
.authcard .btn-brass { width: 100%; padding: 12px 14px; font-size: 15px; }
.authcard .btn-brass::before, .compose .btn-brass::before, .dlg .btn-brass::before { background-size: 1600px 12px, 100% 100%; }
.authalt { margin-top: 12px; text-align: center; color: var(--on-glass-2); }
.authok { margin-bottom: 12px; color: var(--edge); font-weight: 500; }

.work { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); width: 100%; max-width: 1400px; height: calc(100vh - var(--head-h) - clamp(28px, 4vw, 56px)); min-height: 480px; overflow: hidden; }
.work > * { position: relative; z-index: 1; }
.chat { display: flex; flex-direction: column; min-height: 0; padding: 16px; border-right: 1px solid var(--edge-soft); }
.log { flex: 1; min-height: 0; overflow-y: auto; padding-right: 4px; }
.m { max-width: 92%; margin-bottom: 10px; padding: 9px 12px; border-radius: var(--radius); font-size: 15px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.m.user { margin-left: auto; background: rgba(123, 255, 198, .14); border: 1px solid var(--edge-soft); }
.m.assistant { background: rgba(2, 30, 23, .55); border: 1px solid var(--rule); }
.m.error { background: var(--brass); color: #2A200C; font-weight: 500; }
.m.wait { color: var(--on-glass-2); background: none; border: 0; font: 400 13px/1.3 var(--mono); }
.compose { display: flex; gap: 8px; align-items: stretch; margin-top: 10px; }
.compose textarea { flex: 1; min-width: 0; resize: none; padding: 9px 11px; background: var(--well); border: 1px solid var(--edge-soft); border-radius: var(--radius); outline: 0; color: var(--on-glass); font: 400 15px/1.35 var(--body); }
.compose textarea::placeholder { color: var(--on-glass-2); }
.compose .btn-brass { align-self: stretch; padding: 0 18px; font-size: 14px; }
.chat .tag { margin-top: 8px; font-size: 12px; }

.panel { display: flex; flex-direction: column; min-height: 0; padding: 16px; background: linear-gradient(176deg, #1C8A67 0, #157C5B 26%, #0F6D4F 58%, #0D6549 100%); }
.rlist { flex: 1; min-height: 0; overflow-y: auto; }
.rempty { margin-top: 8px; color: var(--on-glass); }
.rcard { margin-bottom: 12px; padding: 13px 15px; background: rgba(3, 40, 31, .78); border: 1px solid var(--edge-soft); border-radius: var(--radius); }
.rtop { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; margin-bottom: 8px; }
.rtop h3 { font: 800 16px/1.2 var(--head); font-stretch: 108%; }
.rcard .seg { margin: 0; }
.rcard .said { margin-bottom: 8px; font-size: 15px; }
.rcard .stats { margin: 0 0 10px; padding: 0; border: 0; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.rcard .stats dd { font-size: 18px; }
.rcard .stats .lead dd { font-size: 26px; }
.rcard details { font-size: 13px; }
.rcard summary { cursor: pointer; color: var(--on-glass-2); font: 400 12px/1.5 var(--mono); }
.rcard .tablewrap { max-height: 240px; margin-top: 8px; }
.rcard .ledger { margin-top: 8px; }

.dlg { width: min(460px, calc(100vw - 24px)); padding: 24px; color: var(--on-glass); }
.dlg::backdrop { background: rgba(3, 40, 31, .5); }
.dlg > * { position: relative; z-index: 1; }
.dlg h2 { margin-bottom: 8px; font: 800 24px/1.1 var(--head); font-stretch: 112%; }
.dlg h3 { margin: 18px 0 6px; font: 800 16px/1.1 var(--head); font-stretch: 108%; }
.dlg p { margin-bottom: 12px; font-size: 14px; line-height: 1.45; color: var(--on-glass-2); }
.dlg .row { display: flex; align-items: center; gap: 16px; margin-top: 4px; }
.dlg .btn-brass, .btn-danger { padding: 9px 18px; font-size: 14px; }
.btn-danger { border: 1px solid #F0E3C0; border-radius: var(--radius); background: none; color: #F4E8C6; font: 700 14px/1 var(--head); cursor: pointer; }
.btn-danger:hover { background: rgba(240, 227, 192, .14); }
.secretish { -webkit-text-security: disc; font-family: var(--mono) !important; }
.keys { margin: 0 0 12px; padding: 0; list-style: none; }
.keys li { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--rule); font: 400 13px/1.3 var(--mono); }

.menubtn { display: none; }

@media (max-width: 860px) {
  .deskmain { padding: 8px; min-height: 0; }
  .menubtn { display: block; margin-left: auto; min-height: 40px; padding: 0 4px; font-size: 15px; }
  .top { position: sticky; }
  .who { position: absolute; top: 100%; right: 0; left: 0; z-index: 20; display: none; flex-direction: column; align-items: stretch; gap: 0; margin: 0; padding: 4px 16px 8px; color: var(--on-glass); text-shadow: none; background: #06402F; border-bottom: 1px solid var(--edge); box-shadow: 0 14px 24px -10px rgba(3, 40, 28, .6); }
  .who.open { display: flex; }
  .who .linkbtn { min-height: 44px; text-align: left; font-size: 16px; border-bottom: 1px solid var(--rule); }
  .who .linkbtn:last-child { border-bottom: 0; }

  .work { display: block; height: calc(100vh - var(--head-h) - 16px); height: calc(100svh - var(--head-h) - 16px); min-height: 360px; }
  .chat { height: 100%; padding: 10px; border-right: 0; }
  .panel { display: none; }
  .log { min-height: 0; padding-right: 2px; }
  .m { max-width: 100%; }
  .log .rcard { margin-bottom: 10px; }
  .rcard .stats .lead { grid-column: 1 / -1; }
  .rcard .seg button { min-height: 34px; }
  .compose textarea, .authcard input, .dlg input, .dlg select { font-size: 16px; }
  .compose .btn-brass { padding: 0 14px; }
  .authcard { margin-top: 12px; padding: 24px 20px; }
  .dlg { padding: 18px; }
  .dlg .row { flex-wrap: wrap; }
  .dlg .linkbtn, .keys .linkbtn { min-height: 40px; }
}
.log::-webkit-scrollbar, .rlist::-webkit-scrollbar { width: 10px; }
.log::-webkit-scrollbar-track, .rlist::-webkit-scrollbar-track { background: rgba(2, 30, 23, .55); }
.log::-webkit-scrollbar-thumb, .rlist::-webkit-scrollbar-thumb { background: linear-gradient(90deg, #F1E6C9, #D3BE8D 48%, #A28A58 52%, #C4AD7C); border: 2px solid transparent; border-radius: var(--radius); background-clip: padding-box; }
@supports not selector(::-webkit-scrollbar) {
  .log, .rlist { scrollbar-width: thin; scrollbar-color: #D3BE8D rgba(2, 30, 23, .55); }
}
.newkey { padding: 8px 10px; background: var(--well); border: 1px solid var(--rule); font: 400 12px/1.4 var(--mono); overflow-wrap: anywhere; user-select: all; }
