:root { color-scheme: dark; font: 16px system-ui,sans-serif; background: #13121e; color: #f5f2ff; }
* { box-sizing: border-box; }
body { margin: 0; }
main { max-width: 820px; margin: auto; padding: clamp(16px, 5vw, 36px); }
header, .toolbar { display: flex; align-items: center; gap: 12px; }
header { font-size: 1.2rem; font-weight: 700; }
.segments, #app-menu { margin-left: auto; }
#app-menu { position: relative; }
#app-menu summary {
  display: grid; place-items: center; width: 44px; height: 44px; list-style: none;
  color: inherit; border: 1px solid #57506f; border-radius: 9px; background: #29243b; cursor: pointer;
}
#app-menu summary::-webkit-details-marker { display: none; }
#app-menu summary span {
  width: 19px; height: 2px; border-radius: 1px; background: currentColor;
  box-shadow: 0 -6px currentColor, 0 6px currentColor;
}
#app-menu nav {
  position: absolute; z-index: 2; top: calc(100% + 8px); right: 0; width: max-content;
  padding: 6px; border: 1px solid #57506f; border-radius: 12px;
  background: #1d1a2a; box-shadow: 0 10px 28px #0008; font-size: 1rem;
}
#app-menu nav, #navigation { display: grid; gap: 4px; }
#app-menu button { text-align: left; }
#startup-retry { color: inherit; }
h1 { font-size: clamp(1.7rem, 6vw, 2.55rem); margin: 1.4rem 0 1rem; }
section { border: 1px solid #39334b; background: #1d1a2a; border-radius: 18px; padding: clamp(13px, 4vw, 25px); }
button, .login { font: inherit; color: inherit; min-height: 44px; border-radius: 9px; border: 1px solid #57506f; background: #29243b; }
.login { display: inline-flex; align-items: center; padding: 6px 12px; text-decoration: none; }
button { padding: 6px 12px; cursor: pointer; }
button[aria-pressed=true], .login { background: #51407e; }
#password-form { max-width: 410px; }
#password-form label { display: block; margin-bottom: 4px; }
#password-form input { width: 100%; min-height: 44px; margin-bottom: 13px; padding: 8px 12px;
  font: inherit; color: inherit; background: #29243b; border: 1px solid #57506f; border-radius: 9px; }
.login-actions { display: flex; flex-wrap: wrap; gap: 8px; }
#password-submit { background: #51407e; }
#google-login { margin-top: 12px; }
.toolbar strong { font-size: 1.8rem; }
.caption, .toolbar span, summary, #status { color: #c6bdd8; }
canvas { width: 100%; height: clamp(235px, 42vw, 350px); display: block; }
.legend { display: flex; flex-wrap: wrap; gap: 7px; margin: 15px 0; }
.legend button { background: transparent; text-align: left; }
.legend button[aria-pressed=false] { opacity: .55; text-decoration: line-through; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 7px; }
.table-scroll { overflow: auto; }
table { border-collapse: collapse; width: 100%; margin-top: 10px; }
td, th { padding: 8px; border-bottom: 1px solid #39334b; white-space: nowrap; text-align: right; }
td:first-child, th:first-child { text-align: left; }
[hidden] { display: none !important; }
nav { display: flex; gap: 8px; margin-top: 16px; }
nav { flex-wrap: wrap; }
#chat { padding: 0; overflow: hidden; }
#messages { height: min(62dvh, 580px); min-height: 245px; overflow: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
#messages > * { flex-shrink: 0; }
#messages { overflow-anchor: none; }
#older-messages { display: block; margin: 0 auto; }
.bubble { max-width: min(92%, 570px); margin: 0; padding: 11px 13px; border-radius: 15px; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble.bot { align-self: flex-start; background: #29243b; }
.bubble.user { align-self: flex-end; background: #493672; }
.bubble.rich { white-space: normal; }
.bubble.rich td, .bubble.rich th { padding: 4px 6px; }
.bubble blockquote { margin: 0; border-left: 3px solid #bb9ae8; padding-left: 9px; }
.chat-choices { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chat-choices [data-style=primary] { background: #243d88; }
.chat-choices [data-style=success] { background: #205a43; }
.chat-choices [data-style=danger] { background: #7e293f; }
.chat-choice:disabled { opacity: .55; cursor: default; }
.bubble a { color: #c8b5ff; }
.order-photos { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 130px), 1fr)); gap: 10px; }
.order-photos figure { margin: 0; padding: 8px; border: 1px solid #57506f; border-radius: 9px; }
.order-photos img { display: block; width: 100%; max-height: 240px; object-fit: contain; }
#chat-status { margin: 0; color: #c6bdd8; padding: 0 14px; }
#chat-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; padding: 12px; border-top: 1px solid #39334b; }
#chat-form textarea, .edit-customer input, .edit-customer select {
  flex: 1; min-width: 145px; padding: 8px; border: 1px solid #57506f; border-radius: 9px;
  color: inherit; background: #1d1a2a; font: inherit;
}
#chat-form textarea { resize: vertical; }
#chat-form button { display: inline-grid; place-items: center; min-width: 44px; padding: 0; }
#chat-form button svg { width: 22px; height: 22px; }
#record-audio .stop-icon, #record-audio[data-recording] .mic-icon { display: none; }
#record-audio[data-recording] .stop-icon { display: block; }
.edit-customer { display: grid; gap: 6px; margin-top: 12px; }
.edit-customer label { display: grid; gap: 4px; min-width: 0; }
.edit-customer input, .edit-customer select { width: 100%; }
#user-admin h2 { margin-top: 0; }
#user-admin h3 { margin-bottom: 8px; }
#user-admin td, #user-admin th { text-align: left; }
#user-admin td:first-child { white-space: normal; min-width: 130px; }
#user-admin small { display: block; color: #c6bdd8; overflow-wrap: anywhere; }
#user-rights { margin-top: 16px; }
#user-rights input { width: 20px; height: 20px; vertical-align: middle; }
#user-rights label { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; cursor: pointer; }
