/* #region zone:desk.style.account-groups — เมนูบัญชีแบ่งกลุ่ม ไอคอนครบทุกแถว วงโฟกัสบาง */
/* Three groups (account and settings / apps / theme and sign out). A group with no visible row disappears, and the
   line between groups is drawn by the group itself, so a hidden group never leaves a double line. */
.account-group {
  display: flex;
  flex-direction: column;
  gap: var(--u-space-2);
}
.account-group[hidden],
.account-group:not(:has(> [role='menuitem']:not([hidden]))) {
  display: none;
}
.account-group + .account-group {
  margin-top: var(--sp-2);
  padding-top: var(--sp-2);
  border-top: 1px solid var(--line);
}
.account-panel .account-panel-item {
  width: 100%;
  height: auto;
  min-height: var(--u-tap);
  margin: 0;
  padding: var(--u-space-2) var(--u-space-3);
  border-radius: var(--u-radius-inner);
  font-size: var(--u-body);
}
/* DUI-21: the head block starts at the same x as the row icons (the rows' own inline padding). */
.account-panel .account-panel-head {
  padding-inline: var(--u-space-3);
}
.account-panel .account-panel-item:active {
  background: var(--u-press);
}
.account-panel .account-panel-danger {
  color: var(--u-danger);
}
.account-panel .account-panel-item-icon {
  width: 16px;
  height: 16px;
}
/* Inset 1px ring on the item's own radius; no ring at all after a pointer press (same rule as the dialogs). */
.account-panel .account-panel-item:focus-visible {
  background: var(--hover);
  box-shadow: inset 0 0 0 1px var(--accent);
}
:root[data-desk-focus-input='pointer'] .account-panel .account-panel-item:focus-visible {
  box-shadow: none;
}
.account-panel .account-panel-danger .account-panel-item-icon {
  color: var(--down);
}
.account-panel-item .notice-badge-row {
  margin-left: auto;
}
/* #endregion */

/* #region zone:desk.style.notice-bell — กระดิ่งในหัวเว็บและป้ายจำนวนที่ยังไม่อ่าน */
.qt-notice-btn {
  position: relative;
}
.notice-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 var(--sp-1);
  box-sizing: border-box;
  border-radius: var(--r-pill);
  background: var(--accent);
  color: var(--on-accent);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.notice-badge[hidden] {
  display: none;
}
.qt-notice-btn .notice-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  pointer-events: none;
}
/* #endregion */

/* #region zone:desk.style.notice-panel — กล่องแจ้งเตือน: ป๊อปโอเวอร์ใต้กระดิ่งบนจอใหญ่ แผ่นล่างบนมือถือ */
.notice-scrim {
  position: fixed;
  inset: 0;
  z-index: 56;
  background: var(--scrim);
}
.notice-panel {
  position: fixed;
  z-index: 57;
  top: calc(var(--head-h, 56px) + var(--sp-2));
  right: var(--sp-4);
  width: min(380px, calc(100vw - 2 * var(--sp-4)));
  max-height: min(70vh, 560px);
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  padding: var(--sp-3);
  border: 1px solid var(--line);
  border-radius: var(--r-inner);
  background: var(--u-sheet);
  color: var(--text);
  box-shadow: var(--pop-shadow);
}
.notice-panel[hidden],
.notice-scrim[hidden] {
  display: none;
}
.notice-head {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.notice-title {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  outline: none;
}
.notice-head .icon-btn,
.notice-text-btn,
.notice-x {
  min-width: var(--tap-min);
  min-height: var(--tap-min);
}
.notice-text-btn {
  padding: 0 var(--sp-2);
  border: 0;
  border-radius: var(--r-control);
  background: transparent;
  color: var(--accent-text);
  font-size: var(--fs-md);
  font-weight: 600;
}
/* DUI-19: with a mouse the text buttons share the 32px icon-button height of the head row. */
@media (min-width: 481px) and (pointer: fine) {
  html:root .notice-head .notice-text-btn.u-btn,
  html:root .notice-statusbar .notice-text-btn.u-btn {
    height: 32px;
    min-height: 0;
  }
}
.notice-text-btn:disabled {
  opacity: 0.45;
}
.notice-text-btn:not(:disabled):hover {
  background: var(--hover);
}
.notice-statusbar {
  display: flex;
  margin-top: var(--sp-2);
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  min-height: 20px;
  margin-bottom: var(--sp-2);
}
.notice-status {
  font-family: var(--font-sans);
  font-size: 11.5px;
  color: var(--muted);
}
.notice-list {
  margin: 0;
  padding: 0;
  list-style: none;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
.notice-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: var(--sp-2);
  border: 1px solid var(--line);
  border-radius: var(--r-control);
  background: var(--panel2);
}
.notice-row.is-unread {
  border-color: var(--acc-ring);
  background: var(--acc-soft);
}
.notice-main {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--sp-1);
  min-width: 0;
  min-height: var(--tap-min);
  padding: var(--sp-3);
  border: 0;
  border-radius: var(--r-control);
  background: transparent;
  color: var(--text);
  text-align: left;
}
.notice-main:hover {
  background: var(--hover);
}
.notice-main:focus-visible,
.notice-x:focus-visible,
.notice-text-btn:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 1px var(--accent);
}
.notice-row-head {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  min-width: 0;
  font-size: var(--u-text-sm);
  font-weight: 700;
}
.notice-row-title,
.notice-row-body {
  overflow-wrap: anywhere;
}
.notice-row-body {
  font-size: var(--fs-md);
  line-height: 1.5;
  color: var(--muted);
  white-space: pre-line;
}
.notice-row-meta {
  font-size: 11px;
  color: var(--faint);
}
.notice-dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}
.notice-x {
  margin: 0;
  align-self: start;
}
.notice-empty {
  margin: var(--sp-4) 0;
  text-align: center;
  font-size: var(--u-text-sm);
  color: var(--muted);
}
@media (min-width: 768px) {
  .notice-scrim {
    display: none;
  }
}
@media (max-width: 767px) {
  .notice-panel {
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    width: auto;
    max-height: 80vh;
    border-radius: var(--r-inner) var(--r-inner) 0 0;
    border-bottom: 0;
    padding-bottom: calc(var(--sp-3) + env(safe-area-inset-bottom, 0px));
  }
}
@supports (height: 100dvh) {
  @media (max-width: 767px) {
    .notice-panel {
      max-height: 80dvh;
    }
  }
}
/* #endregion */

/* #region zone:desk.style.notice-settings — ตั้งค่าแจ้งเตือน: กล่องกลางจอ ปุ่มเลือกช่องทางต่อหัวข้อ */
.notice-dialog {
  width: min(520px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
}
.notice-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
}
.notice-dialog-head .desk-dialog-title {
  margin: 0;
}
.notice-section {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  padding: var(--sp-3) 0;
  border-top: 1px solid var(--line);
}
.notice-section:first-child {
  border-top: 0;
  padding-top: 0;
}
.notice-section-title {
  margin: 0;
  font-size: 13.5px;
  font-weight: 700;
}
.notice-help {
  margin: 0;
  font-size: var(--u-text-xs);
  line-height: 1.55;
  color: var(--muted);
}
.notice-topic {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
.notice-topic-name {
  font-size: var(--u-text-sm);
}
.notice-seg {
  height: auto;
  width: 100%;
  box-sizing: border-box;
}
.notice-seg .seg-btn {
  flex: 1;
  min-height: var(--tap-min);
  padding: 0 var(--sp-2);
  font-size: var(--u-text-sm);
}
.notice-hours {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-3);
}
.notice-field {
  margin-top: 0;
}
.notice-field .input {
  width: 100%;
  box-sizing: border-box;
  font-family: var(--font-mono);
}
.notice-dialog .desk-dialog-error:empty {
  display: none;
}
.notice-dialog .desk-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-2);
  margin-top: var(--sp-3);
}
.notice-dialog .desk-dialog-btn,
.notice-dialog .icon-btn {
  min-height: var(--tap-min);
  min-width: var(--tap-min);
}
/* #endregion */

/* #region zone:desk.style.notice-motion — การเคลื่อนไหว: แผ่นขยายจากกระดิ่ง ป้ายนับตัวเลข กระดิ่งสั่น ทอสต์ซ้อน */
.notice-panel:not([hidden]) {
  transform-origin: top right;
  animation: noticeIn 0.18s ease-out;
}
@keyframes noticeIn {
  from {
    opacity: 0;
    transform: scale(0.94) translateY(-6px);
  }
}
@media (max-width: 767px) {
  .notice-panel:not([hidden]) {
    transform-origin: bottom center;
    animation-name: noticeUp;
  }
  @keyframes noticeUp {
    from {
      opacity: 0;
      transform: translateY(24px);
    }
  }
}
.qt-notice-btn.is-ringing svg:first-child {
  transform-origin: 50% 10%;
  animation: noticeRing 0.7s ease-in-out;
}
@keyframes noticeRing {
  15% {
    transform: rotate(14deg);
  }
  30% {
    transform: rotate(-12deg);
  }
  45% {
    transform: rotate(8deg);
  }
  60% {
    transform: rotate(-5deg);
  }
  75% {
    transform: rotate(2deg);
  }
}
@media (prefers-reduced-motion: reduce) {
  .notice-panel:not([hidden]),
  .qt-notice-btn.is-ringing svg {
    animation: none;
  }
}
/* #endregion */
