:root {
  --bg: #0b1220;
  --card: #111a2e;
  --text: #e8eefc;
  --muted: #9bb0d1;
  --accent: #5b8cff;
  --accent2: #2dd4bf;
  --border: rgba(255, 255, 255, 0.1);
  --bg-gradient-start: #13214a;
  --surface-soft: rgba(255, 255, 255, 0.04);
  --input-bg: rgba(255, 255, 255, 0.08);
  --card-elevated: rgba(17, 26, 46, 0.86);
  --overlay-bg: rgba(17, 26, 46, 0.95);
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f3f6ff;
  --card: #ffffff;
  --text: #14223d;
  --muted: #5a6f93;
  --accent: #2f6bff;
  --accent2: #00a58f;
  --border: rgba(20, 34, 61, 0.16);
  --bg-gradient-start: #dce8ff;
  --surface-soft: rgba(20, 34, 61, 0.05);
  --input-bg: rgba(255, 255, 255, 0.94);
  --card-elevated: rgba(255, 255, 255, 0.93);
  --overlay-bg: rgba(255, 255, 255, 0.96);
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial,
    "Apple Color Emoji", "Segoe UI Emoji";
  background-color: var(--bg);
  background-image: radial-gradient(1200px 800px at 10% 10%, var(--bg-gradient-start), var(--bg));
  color: var(--text);
  -webkit-user-select: none;
  user-select: none;
}

input,
textarea,
select,
[contenteditable="true"] {
  -webkit-user-select: text;
  user-select: text;
}

a,
button,
input,
textarea,
select {
  touch-action: manipulation;
}

body.schedule-modal-open {
  overflow: hidden;
}

body.schedule-modal-open .schedule-calendar {
  overflow: hidden !important;
}

html,
body {
  height: 100%;
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}

.chat-page {
  height: 100vh;
  overflow: hidden;
  overflow-x: hidden;
  overscroll-behavior-x: none;
  touch-action: pan-y;
}

@supports (height: 100dvh) {
  .chat-page {
    height: 100dvh;
  }
}

.notification-prompt {
  position: fixed;
  left: 50%;
  bottom: 90px;
  transform: translateX(-50%);
  background: var(--overlay-bg);
  border: 1px solid var(--border);
  padding: 10px 12px;
  border-radius: 12px;
  display: flex;
  gap: 8px;
  align-items: center;
  z-index: 12;
  box-shadow: 0 12px 30px rgba(3, 8, 20, 0.4);
}

.notification-prompt button {
  padding: 8px 10px;
}

.with-bottom-nav {
  padding-bottom: 0;
}

.container.with-bottom-nav {
  padding: 0;
  overflow-x: hidden;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 8px;
  min-height: 100vh;
}

.chat-page .container {
  min-height: 0;
  height: 100%;
  overflow-x: hidden;
}

@supports (height: 100dvh) {
  .container {
    min-height: 100dvh;
  }
  .chat-page .container {
    min-height: 0;
    height: 100%;
  }
}

.chat-page .container {
  padding: 0;
  max-width: none;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

.chat-page .card {
  margin: 0;
  border-radius: 0;
  padding: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  position: relative;
  min-height: 0;
  overflow-x: hidden;
}

.chat-page .nav-top {
  padding: 4px 8px;
  min-height: 44px;
}

.chat-page .chat-top-nav {
  display: grid;
  gap: 8px;
  align-items: stretch;
}

.chat-page .chat-top-main {
  min-height: 36px;
}

.chat-page .chat-top-actions {
  gap: 6px;
  align-items: center;
  justify-content: flex-end;
  flex: 0 0 auto;
}

.chat-page .chat-top-actions .icon-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.chat-page .chat-top-actions .icon-btn-glyph {
  width: 19px;
  height: 19px;
}

@media (max-width: 520px) {
  .chat-page .chat-top-actions {
    gap: 4px;
  }

  .chat-page .chat-top-actions .icon-btn {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    font-size: 14px;
  }

  .chat-page .chat-top-actions .icon-btn-glyph {
    width: 17px;
    height: 17px;
  }
}

.chat-search-head input[type="search"] {
  min-width: 0;
  width: 100%;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--input-bg);
  color: var(--text);
  padding: 0 10px;
  font-size: 16px;
}

.chat-search-nav {
  border: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--text);
  border-radius: 8px;
  width: 34px;
  height: 34px;
  cursor: pointer;
}

.chat-search-close {
  border: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--text);
  border-radius: 8px;
  width: 34px;
  height: 34px;
  cursor: pointer;
}

.chat-search-count {
  min-width: 40px;
  text-align: left;
  font-size: 11px;
  color: var(--muted);
}

.chat-search-overlay[hidden] {
  display: none !important;
}

.chat-search-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
}

.chat-search-overlay-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(3, 8, 20, 0.38);
}

.chat-search-panel {
  position: absolute;
  left: 8px;
  right: 8px;
  top: max(8px, env(safe-area-inset-top));
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(17, 26, 46, 0.98);
  padding: 8px;
  display: grid;
  gap: 8px;
}

.chat-search-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  gap: 6px;
  align-items: center;
}

.chat-search-meta {
  min-height: 14px;
}

.chat-search-results[hidden] {
  display: none !important;
}

.chat-search-results {
  max-height: min(52vh, 420px);
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
}

.chat-search-result-item {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
  display: grid;
  gap: 3px;
}

.chat-search-result-item:last-child {
  border-bottom: 0;
}

.chat-search-result-item .meta {
  font-size: 11px;
  color: var(--muted);
}

.chat-search-result-highlight {
  background: rgba(91, 140, 255, 0.35);
  border-radius: 4px;
  padding: 0 1px;
}

.chat-shortcut-rail {
  --chat-shortcut-top: calc(env(safe-area-inset-top) + 56px);
  --chat-shortcut-bottom: calc(env(safe-area-inset-bottom) + 84px);
  position: fixed;
  left: max(0px, env(safe-area-inset-left));
  top: var(--chat-shortcut-top);
  bottom: var(--chat-shortcut-bottom);
  width: 114px;
  z-index: 74;
  pointer-events: none;
  overflow: hidden;
}

.chat-shortcut-toggle {
  position: absolute;
  left: 10px;
  right: auto;
  top: auto;
  bottom: 10px;
  transform: none;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 0;
  background: rgba(17, 26, 46, 0.92);
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
  pointer-events: auto;
  transition: color 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.chat-shortcut-rail.is-open .chat-shortcut-toggle {
  color: var(--text);
  background: var(--overlay-bg);
  box-shadow: inset 0 0 0 1px rgba(91, 140, 255, 0.55);
}

.chat-shortcut-panel {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 108px;
  max-height: none;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 14px 56px;
  border: 0;
  border-radius: 0;
  background: #0b1220;
  box-shadow: none;
  display: grid;
  align-content: start;
  justify-items: center;
  gap: 10px;
  pointer-events: auto;
  transform: translateX(calc(-100% - 10px));
  transition: transform 0.2s ease;
}

.chat-shortcut-rail.is-open .chat-shortcut-panel {
  transform: translateX(0);
}

.chat-shortcut-rail:not(.is-open) .chat-shortcut-panel {
  pointer-events: none;
}

.chat-shortcut-panel[hidden] {
  display: grid !important;
}

.chat-shortcut-item {
  width: 56px;
  height: 56px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #1a2742;
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
  padding: 0;
  display: grid;
  place-items: center;
  position: relative;
  cursor: pointer;
  overflow: visible;
  margin: 0 auto;
}

.chat-shortcut-item.is-current {
  border-color: rgba(91, 140, 255, 0.9);
  box-shadow: 0 0 0 2px rgba(91, 140, 255, 0.28);
}

.chat-shortcut-item .chat-shortcut-avatar {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  border-radius: inherit;
  overflow: hidden;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  display: block;
  background-color: #1a2742;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  object-fit: cover;
}

.chat-shortcut-item-badge {
  position: absolute;
  top: -2px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: rgba(91, 140, 255, 0.9);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.chat-shortcut-item-pin {
  position: absolute;
  right: -4px;
  bottom: -4px;
  font-size: 12px;
  line-height: 1;
  background: rgba(91, 140, 255, 0.2);
  border-radius: 999px;
  padding: 2px;
  border: 1px solid rgba(91, 140, 255, 0.45);
}

.chat-shortcut-empty {
  font-size: 10px;
  color: var(--muted);
  text-align: center;
  padding: 8px 0;
}

.chat-page .nav-top,
.chat-page .nav-top * {
  -webkit-user-select: none;
  user-select: none;
}

.nav-top-dashboard,
.nav-top-dashboard * {
  -webkit-user-select: none;
  user-select: none;
}

.nav-top-dashboard input,
.nav-top-dashboard textarea {
  -webkit-user-select: text;
  user-select: text;
}

.chat-page .nav-top h1,
.chat-page .chat-input-row .icon-btn,
.chat-page .chat-input-row .btn {
  -webkit-user-select: none;
  user-select: none;
}

.chat-page .nav-top h1 {
  font-size: 1rem;
  margin: 0;
}

.chat-page .nav-top .avatar-small {
  width: 28px;
  height: 28px;
}

.chat-page .chat-input-row {
  padding: 8px 10px 10px;
  position: sticky;
  bottom: 0;
  background: rgba(11, 18, 32, 0.96);
  border-top: 1px solid var(--border);
  z-index: 5;
  width: 100%;
}

.chat-page .chat-input-row,
.chat-page .chat-input-row * {
  -webkit-user-select: none;
  user-select: none;
}

.chat-input-row textarea {
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  line-height: 1.4;
  -webkit-user-select: text;
  user-select: text;
}

.chat-ad,
.chat-ad * {
  -webkit-user-select: none;
  user-select: none;
}

.chat-announcements,
.chat-announcements * {
  -webkit-user-select: none;
  user-select: none;
}

.chat-input-row textarea.expanded {
  white-space: pre-wrap;
  overflow-y: auto;
}

.chat-mention-menu {
  position: fixed;
  z-index: 70;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(13, 20, 36, 0.96);
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.35);
  display: grid;
  gap: 2px;
  padding: 6px;
  max-height: min(260px, 46vh);
  overflow-y: auto;
}

.chat-mention-menu[hidden] {
  display: none !important;
}

.chat-mention-item {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  border-radius: 9px;
  padding: 7px 9px;
  display: grid;
  gap: 2px;
  cursor: pointer;
}

.chat-mention-item:hover,
.chat-mention-item.is-active {
  background: rgba(91, 140, 255, 0.24);
}

.chat-mention-item-title {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
}

.chat-mention-item-subtitle {
  font-size: 11px;
  line-height: 1.2;
  color: var(--muted);
}

.chat-mention-highlight {
  color: #8fb8ff;
  font-weight: 700;
  background: rgba(91, 140, 255, 0.18);
  border-radius: 6px;
  padding: 0 2px;
}

.card {
  background: var(--card-elevated);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0;
  margin: 8px 0;
  backdrop-filter: blur(10px);
}

.row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.row.wrap {
  flex-wrap: wrap;
}

.file-row {
  flex-wrap: wrap;
}

.file-row input[type="file"],
.file-row select,
.file-row input[type="text"],
.file-row input[type="search"] {
  flex: 1 1 240px;
  min-width: 0;
}

.file-row .btn {
  flex: 0 0 auto;
}

.row-between {
  justify-content: space-between;
}

.settings-card {
  padding: 12px;
}

.settings-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.settings-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-soft);
}

.settings-title {
  font-weight: 600;
}

.schedule-photo-setting-group {
  display: grid;
  gap: 8px;
  padding: 8px 0;
}

.schedule-photo-setting-label {
  font-size: 12px;
  color: var(--text);
  font-weight: 600;
}

.schedule-photo-setting-palette {
  display: flex;
  gap: 8px;
  align-items: center;
}

.schedule-photo-setting-swatch {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--preset-color, #ffffff);
  cursor: pointer;
}

.schedule-photo-setting-swatch.is-selected {
  box-shadow: 0 0 0 2px rgba(91, 140, 255, 0.82);
}

.schedule-photo-setting-actions {
  display: flex;
  gap: 8px;
}

  .permission-grid {
    grid-template-columns: 1fr;
  }

  .permission-select {
    width: 100%;
  }

  .permission-btn-primary,
  .permission-btn-compact {
    width: 100%;
  }
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap: 10px;
}

label {
  display: grid;
  gap: 6px;
  margin: 10px 0;
}

input,
textarea,
select,
button {
  font: inherit;
}

input,
textarea,
select {
  -webkit-user-select: text;
  user-select: text;
}

.password-input {
  position: relative;
  display: flex;
  align-items: center;
}

.password-input input {
  width: 100%;
  padding-right: 44px;
}

.password-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  display: grid;
  place-items: center;
  cursor: pointer;
}

input,
textarea,
select {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

textarea {
  resize: none;
  min-height: 40px;
  max-height: calc(1.4em * 5 + 20px);
  overflow-y: hidden;
}

.input-full {
  width: 100%;
}

.btn {
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(91, 140, 255, 0.5);
  background: linear-gradient(
    135deg,
    rgba(91, 140, 255, 0.9),
    rgba(45, 212, 191, 0.35)
  );
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
}

.btn-secondary {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
}

.muted {
  color: var(--muted);
}

.messages {
  height: 220px;
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.12);
  margin: 10px 0;
}

.chat-thread {
  display: flex;
  flex-direction: column;
  gap: 6px;
  height: auto;
  flex: 1 1 auto;
  min-height: 0;
  margin: 0;
  padding: 6px 12px 6px 2px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-gutter: stable;
  overflow-anchor: none;
  overscroll-behavior: contain;
  overscroll-behavior-x: none;
  touch-action: pan-y;
}

#dmMessages,
#groupMessages {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden !important;
  overscroll-behavior-x: none;
  touch-action: pan-y;
}

.chat-scroll-bottom {
  position: absolute;
  right: 12px;
  bottom: calc(128px + env(safe-area-inset-bottom, 0px));
  transform: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: rgba(17, 26, 46, 0.92);
  color: var(--text);
  font-size: 20px;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 20;
  pointer-events: auto;
  -webkit-user-select: none;
  user-select: none;
}

.chat-scroll-bottom.show {
  display: flex;
}

.chat-message {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
}

.chat-message.is-mine {
  flex-direction: row-reverse;
}

.chat-message.compact .chat-avatar {
  visibility: hidden;
}

.chat-message.has-media > .chat-avatar {
  display: none;
}

.chat-avatar-inline {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(91, 140, 255, 0.9), rgba(45, 212, 191, 0.5));
  display: grid;
  place-items: center;
  font-weight: 700;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  color: #fff;
  margin: 0 6px 0 0;
}

.chat-message.has-media .chat-body {
  align-items: flex-start;
  width: min(72vw, 360px);
  max-width: calc(100vw - 84px);
}

.chat-message.is-mine.has-media .chat-body {
  align-items: flex-end;
}

.chat-message.is-mine .chat-avatar-inline {
  align-self: flex-end;
}

.chat-line.media-line {
  align-items: flex-start;
}

.chat-message.name-hidden .chat-name {
  display: none;
}

.chat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(91, 140, 255, 0.9), rgba(45, 212, 191, 0.5));
  display: grid;
  place-items: center;
  font-weight: 700;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  color: #fff;
  flex-shrink: 0;
}

.chat-avatar.has-image {
  color: transparent;
}

.chat-avatar.is-external-bridge {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(87, 196, 255, 0.45);
  background: linear-gradient(135deg, rgba(24, 55, 108, 0.95), rgba(25, 132, 153, 0.78));
  color: #dff6ff;
}

.chat-avatar.is-external-bridge.bridge-provider-line {
  border-color: rgba(8, 213, 101, 0.52);
  background: linear-gradient(135deg, rgba(2, 87, 49, 0.95), rgba(16, 172, 98, 0.74));
}

.chat-avatar.is-external-bridge.bridge-provider-discord {
  border-color: rgba(136, 152, 255, 0.58);
  background: linear-gradient(135deg, rgba(67, 81, 196, 0.92), rgba(106, 124, 255, 0.74));
}

.chat-avatar-provider-label {
  font-size: 10px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: 0.3px;
}

.chat-avatar-inline .chat-avatar-provider-label {
  font-size: 9px;
}

.chat-avatar-external-badge {
  position: absolute;
  right: -2px;
  bottom: -2px;
  min-width: 14px;
  height: 14px;
  padding: 0 3px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(7, 12, 24, 0.92);
  color: #d5e6ff;
  font-size: 7px;
  font-weight: 800;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.chat-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: min(78%, 520px);
  min-width: 0;
}

.chat-message.is-mine .chat-body {
  align-items: flex-end;
}

.chat-name {
  font-size: 12px;
  color: var(--muted);
}

.chat-bubble {
  padding: 6px 8px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.08);
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.chat-reply {
  border-left: 2px solid rgba(255, 255, 255, 0.3);
  padding-left: 6px;
  margin-bottom: 6px;
  display: grid;
  gap: 4px;
}

.chat-reply-header {
  display: flex;
  align-items: center;
  gap: 6px;
}

.chat-reply-avatar {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background-size: cover;
  background-position: center;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.chat-reply-name {
  font-size: 11px;
  color: var(--muted);
}

.chat-reply-text {
  font-size: 12px;
  color: var(--text);
  opacity: 0.8;
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-line {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
}

.chat-line.media-line {
  align-items: flex-start;
}

.chat-message.is-mine .chat-line {
  justify-content: flex-end;
  flex-direction: row-reverse;
}

.chat-message.is-mine .chat-bubble {
  background: linear-gradient(
    135deg,
    rgba(91, 140, 255, 0.9),
    rgba(45, 212, 191, 0.35)
  );
  border-color: rgba(91, 140, 255, 0.6);
}

.chat-bubble.link {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.2);
}

.chat-link-wrapper {
  display: grid;
  gap: 8px;
}

.chat-link {
  color: var(--accent2);
  text-decoration: underline;
  word-break: break-all;
}

.link-preview-list {
  display: grid;
  gap: 8px;
}

.link-preview {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  height: 54px;
  min-height: 54px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  text-decoration: none;
  overflow: hidden;
}

.link-preview-head {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
}

.link-preview-icon {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border);
  flex: 0 0 auto;
}

.link-preview.loading {
  opacity: 0.7;
}

.link-preview-title {
  font-weight: 600;
  font-size: 0.9rem;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.reply-preview {
  margin: 8px 12px 0;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.16);
  display: none;
  align-items: center;
  gap: 8px;
}

.reply-preview.show {
  display: flex;
}

.reply-preview .reply-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border);
  background-size: cover;
  background-position: center;
  flex: 0 0 auto;
}

.reply-preview .reply-body {
  flex: 1 1 auto;
  min-width: 0;
}

.reply-preview .reply-name {
  font-size: 12px;
  color: var(--muted);
}

.reply-preview .reply-text {
  font-size: 12px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.reply-preview .reply-cancel {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  border-radius: 8px;
  width: 28px;
  height: 28px;
  cursor: pointer;
  flex: 0 0 auto;
}

.chat-announcements {
  margin: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card);
  padding: 0;
  display: none;
  flex: 0 0 auto;
  flex-direction: column;
  gap: 0;
  position: relative;
  top: auto;
  z-index: 12;
  min-height: 0;
  overflow: hidden;
}

.chat-announcements.show {
  display: flex;
}

.chat-announcements-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  padding: 5px 8px;
  border-bottom: 1px solid var(--border);
}

.chat-announcements .announcement-list {
  display: block;
  max-height: 36vh;
  overflow: auto;
  border-top: 0;
}

.chat-announcements-header button {
  margin-left: auto;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  border-radius: 8px;
  width: 28px;
  height: 28px;
  cursor: pointer;
}

.announcement-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 0;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

.announcement-item:last-child {
  border-bottom: 0;
}

.announcement-item .announcement-text {
  flex: 1 1 auto;
  font-size: 12px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.announcement-item .announcement-remove {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  border-radius: 6px;
  width: 24px;
  height: 24px;
  cursor: pointer;
}

.chat-highlight {
  box-shadow: none;
}

.chat-message.chat-highlight .chat-bubble,
.chat-message.chat-highlight .chat-link-wrapper,
.chat-message.chat-highlight .chat-media-expired,
.chat-system.chat-highlight {
  box-shadow: 0 0 0 2px rgba(91, 140, 255, 0.75);
  border-radius: 14px;
}

.chat-message.chat-search-hit .chat-bubble,
.chat-message.chat-search-hit .chat-link-wrapper,
.chat-message.chat-search-hit .chat-media-expired,
.chat-system.chat-search-hit {
  box-shadow: 0 0 0 2px rgba(91, 140, 255, 0.42);
  border-radius: 14px;
}

.chat-message.chat-search-current .chat-bubble,
.chat-message.chat-search-current .chat-link-wrapper,
.chat-message.chat-search-current .chat-media-expired,
.chat-system.chat-search-current {
  box-shadow: 0 0 0 2px rgba(45, 212, 191, 0.78);
  border-radius: 14px;
}

.chat-reply.is-clickable,
.chat-system.is-clickable {
  cursor: pointer;
}

.chat-bubble.media {
  padding: 4px;
  width: 100%;
  max-width: 100%;
}

.chat-media-box {
  position: relative;
  width: 100%;
  max-width: 100%;
  min-height: 112px;
  height: auto;
  aspect-ratio: var(--chat-media-aspect-ratio, 4 / 3);
  overflow-anchor: none;
  max-height: min(62vh, 420px);
  background: rgba(255, 255, 255, 0.04);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-media-box .chat-media {
  position: static;
  width: 100%;
  height: auto;
  max-width: 100%;
  max-height: min(62vh, 420px);
  object-fit: contain;
}

.chat-media-box.is-loaded {
  aspect-ratio: auto;
  min-height: 0;
}

.chat-media-box.is-error .chat-media {
  display: none;
}

.chat-media-error {
  display: grid;
  min-height: 112px;
  width: 100%;
  place-items: center;
  border: 1px dashed rgba(148, 163, 184, 0.45);
  border-radius: 10px;
  color: rgba(226, 232, 240, 0.78);
  background: rgba(15, 23, 42, 0.58);
  font-size: 0.86rem;
}

.chat-media,
.media-viewer-img {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
  max-height: 320px;
  border-radius: 10px;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  -webkit-user-drag: none;
}

.ios .media-viewer-img {
  -webkit-touch-callout: default;
  -webkit-user-select: auto;
  user-select: auto;
}

.media-viewer-download,
.media-viewer-download-all {
  display: none !important;
}

.chat-media-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  width: 100%;
  max-width: 100%;
}

.chat-media-expired {
  display: grid;
  gap: 6px;
  width: 100%;
  max-width: 100%;
}

.chat-media-expired-note {
  font-size: 11px;
  color: var(--muted);
}

.media-viewer {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
}

.media-viewer.open {
  display: block;
}

.media-viewer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 10, 20, 0.7);
}

.media-viewer-panel {
  position: absolute;
  inset: 40px;
  background: rgba(17, 26, 46, 0.95);
  border: 1px solid var(--border);
  border-radius: 14px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: 12px;
}

.media-viewer-close {
  justify-self: end;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 6px 10px;
  cursor: pointer;
}

.media-viewer-body {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
}

.media-viewer-img {
  max-width: 100%;
  max-height: 60vh;
  margin: 0 auto;
  border-radius: 12px;
  transition: transform 0.2s ease;
}

.media-viewer-img.zoomed {
  transform: scale(1.6);
}

.media-viewer-nav {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 6px 10px;
  cursor: pointer;
}

.media-viewer-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

@media (max-width: 420px) {
  .chat-media-grid {
    grid-template-columns: 1fr;
  }

  .media-viewer-panel {
    inset: 16px;
  }
}

.attach-menu[hidden] {
  display: none !important;
}

.list li > div:nth-child(2) {
  flex: 1 1 auto;
  min-width: 0;
}

.list li .title,
.list li .preview {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-input-row {
  align-items: center;
}

.chat-gif-btn {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
}

.attach-wrapper {
  position: relative;
}

.attach-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  min-width: 200px;
  background: rgba(17, 26, 46, 0.95);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px;
  display: grid;
  gap: 6px;
  z-index: 6;
  box-shadow: 0 12px 30px rgba(3, 8, 20, 0.45);
}

.attach-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
}

.attach-item:hover {
  border-color: rgba(91, 140, 255, 0.7);
  background: rgba(91, 140, 255, 0.12);
}

.attach-item.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.chat-quick-sheet[hidden] {
  display: none !important;
}

.chat-quick-sheet {
  position: relative;
  margin: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px));
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(17, 26, 46, 0.96);
  padding: 10px;
  z-index: 4;
  box-shadow: 0 10px 24px rgba(3, 8, 20, 0.34);
}

.chat-quick-sheet-title {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
}

.chat-quick-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.chat-quick-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
  min-height: 68px;
  padding: 8px;
  text-align: center;
  font-size: 13px;
  line-height: 1.35;
}

.chat-gif-picker[hidden] {
  display: none !important;
}

.chat-gif-picker {
  position: fixed;
  left: var(--chat-gif-picker-left, 10px);
  right: var(--chat-gif-picker-right, 10px);
  bottom: var(--chat-gif-picker-bottom, 72px);
  max-height: var(--chat-gif-picker-max-height, min(72vh, 460px));
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(17, 26, 46, 0.97);
  padding: 10px;
  z-index: 60;
  box-shadow: 0 10px 24px rgba(3, 8, 20, 0.34);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.chat-gif-picker-head {
  display: flex;
  gap: 8px;
  align-items: center;
}

.chat-gif-search {
  flex: 1 1 auto;
  min-width: 0;
  height: 38px;
}

.chat-gif-close {
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
  font-size: 20px;
  line-height: 1;
}

.chat-gif-suggestions {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 8px 0;
  scrollbar-width: thin;
}

.chat-gif-suggestion {
  flex: 0 0 auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
  padding: 7px 10px;
  font-size: 12px;
}

.chat-gif-status {
  min-height: 18px;
  color: var(--muted);
  font-size: 12px;
}

.chat-gif-results {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 6px;
  flex: 1 1 auto;
  min-height: 112px;
  max-height: none;
  overflow-y: auto;
  padding: 4px 0;
  min-width: 0;
}

.chat-gif-result {
  position: relative;
  display: block;
  flex: 0 0 clamp(96px, calc((100% - 30px) / 6), 132px);
  min-width: 0;
  min-height: 0;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 8px;
  padding: 0;
  background: rgba(255, 255, 255, 0.05);
}

.chat-gif-result:disabled {
  opacity: 0.62;
}

.chat-gif-result img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.chat-gif-load-more {
  width: 100%;
  min-height: 36px;
  margin-top: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(91, 140, 255, 0.14);
  color: var(--text);
}

.chat-gif-attribution {
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
  text-align: right;
}

@media (max-width: 640px) {
  .chat-gif-picker {
    left: var(--chat-gif-picker-left, 8px);
    right: var(--chat-gif-picker-right, 8px);
    max-height: var(--chat-gif-picker-max-height, calc(72vh - env(safe-area-inset-bottom, 0px)));
  }

  .chat-gif-results {
  }

  .chat-gif-result {
    flex-basis: calc((100% - 12px) / 3);
  }
}

.chat-settlement-chooser {
  position: fixed;
  inset: 0;
  z-index: 120;
}

.chat-settlement-chooser-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 8, 20, 0.54);
}

.chat-settlement-chooser-panel {
  position: absolute;
  left: 50%;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  width: min(92vw, 360px);
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(17, 26, 46, 0.98);
  box-shadow: 0 12px 30px rgba(3, 8, 20, 0.5);
  padding: 12px;
  display: grid;
  gap: 10px;
}

.chat-settlement-chooser-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.chat-settlement-chooser-actions {
  display: grid;
  gap: 8px;
}

.chat-settlement-chooser-actions button {
  min-height: 42px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-weight: 600;
}

.chat-quick-item:active {
  transform: translateY(1px);
}

.chat-meta {
  display: inline-flex;
  gap: 6px;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  align-items: center;
}

.chat-message.is-mine .chat-meta {
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.chat-line.media-line .chat-meta {
  align-self: flex-end;
  margin-left: auto;
}

.chat-read {
  color: var(--accent2);
  font-weight: 600;
  font-size: 10px;
}

.chat-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
  font-size: 14px;
}

.chat-reactions.is-under-bubble {
  margin-left: 46px;
}

.reaction-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  user-select: none;
}

.reaction-pill.active {
  border-color: rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.18);
}

.reaction-count {
  font-size: 11px;
  opacity: 0.8;
}

.reaction-picker {
  position: fixed;
  z-index: 120;
  display: none;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(10, 18, 38, 0.98);
  border: 1px solid var(--border);
  box-shadow: 0 10px 30px rgba(3, 8, 20, 0.45);
}

.reaction-picker.show {
  display: flex;
}

.reaction-picker button {
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 18px;
  cursor: pointer;
}

.reaction-toast {
  position: fixed;
  z-index: 130;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(12, 20, 40, 0.95);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 12px;
  max-width: 240px;
  display: none;
  box-shadow: 0 8px 20px rgba(3, 8, 20, 0.4);
}

.reaction-toast.show {
  display: block;
}

.context-menu {
  --context-menu-columns: 4;
  position: fixed;
  z-index: 100;
  background: rgba(17, 26, 46, 0.96);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 6px;
  display: none;
  box-shadow: 0 12px 30px rgba(3, 8, 20, 0.45);
  width: min(
    calc(100vw - 24px),
    calc(var(--context-menu-columns) * 76px + 12px + ((var(--context-menu-columns) - 1) * 6px))
  );
}

.context-menu.show {
  display: grid;
  grid-template-columns: repeat(var(--context-menu-columns), minmax(0, 1fr));
  gap: 6px;
}

.context-menu.mine {
  right: 12px;
  left: auto;
}

.context-menu.other {
  left: 12px;
  right: auto;
}

.context-menu button {
  background: transparent;
  color: var(--text);
  border: none;
  min-width: 0;
  min-height: 64px;
  padding: 8px 6px;
  text-align: center;
  cursor: pointer;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 6px;
  border-radius: 10px;
}

.context-menu button:hover {
  background: rgba(255, 255, 255, 0.08);
}

.context-menu-icon {
  width: 18px;
  height: 18px;
  display: block;
}

.list-context-menu {
  --context-menu-columns: 4;
  z-index: 112;
}

.list-context-menu-icon {
  background: currentColor;
  -webkit-mask: var(--icon-url) center / contain no-repeat;
  mask: var(--icon-url) center / contain no-repeat;
  pointer-events: none;
}

.context-menu-label {
  font-size: 11px;
  line-height: 1.2;
  white-space: nowrap;
}

.context-forward {
  position: fixed;
  inset: 0;
  background: rgba(3, 8, 20, 0.6);
  display: grid;
  place-items: center;
  z-index: 120;
}

.context-forward .card {
  max-width: 320px;
  width: 90%;
}

.context-forward-item {
  padding: 8px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

.context-forward-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.list-preview-toast {
  position: fixed;
  left: 8px;
  top: 8px;
  background: rgba(17, 26, 46, 0.96);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  display: none;
  gap: 10px;
  align-items: stretch;
  flex-direction: column;
  z-index: 111;
  width: min(360px, calc(100vw - 16px));
  max-height: min(460px, calc(100vh - 16px));
  box-shadow: 0 14px 36px rgba(3, 8, 20, 0.5);
  overflow: hidden;
}

.list-preview-toast.show {
  display: flex;
}

.schedule-mode-toast {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 96px);
  transform: translateX(-50%);
  min-width: 180px;
  max-width: min(86vw, 420px);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.26);
  background: rgba(8, 17, 36, 0.92);
  color: #fff;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 10px 14px;
  z-index: 180;
  pointer-events: none;
  opacity: 0;
  transition: opacity 160ms ease;
}

.schedule-mode-toast.show {
  opacity: 1;
}

.list-preview-body {
  font-size: 13px;
  color: var(--text);
  max-height: min(420px, calc(100vh - 36px));
  overflow: auto;
  white-space: normal;
  display: grid;
  gap: 10px;
}

.list-preview-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 0 2px 8px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

.list-preview-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 800;
}

.list-preview-sub {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.list-preview-thread {
  display: grid;
  gap: 8px;
  padding: 2px;
}

.list-preview-message {
  display: grid;
  justify-items: start;
  gap: 3px;
}

.list-preview-message.is-alt {
  justify-items: end;
}

.list-preview-sender {
  max-width: 80%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 11px;
  padding: 0 6px;
}

.list-preview-bubble,
.list-preview-empty {
  max-width: 86%;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 14px;
  padding: 8px 10px;
  background: rgba(30, 41, 59, 0.78);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.list-preview-message.is-alt .list-preview-bubble {
  background: rgba(59, 130, 246, 0.2);
  border-color: rgba(96, 165, 250, 0.25);
}

.list-preview-empty {
  color: var(--muted);
  max-width: 100%;
}

.chat-toast {
  position: fixed;
  left: 50%;
  bottom: 90px;
  transform: translateX(-50%);
  background: rgba(17, 26, 46, 0.95);
  border: 1px solid var(--border);
  padding: 10px 14px;
  border-radius: 999px;
  display: flex;
  gap: 10px;
  align-items: center;
  color: var(--text);
  z-index: 10;
  box-shadow: 0 12px 30px rgba(3, 8, 20, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.chat-toast.show {
  opacity: 1;
  pointer-events: auto;
}

.chat-call-toast {
  bottom: calc(28px + env(safe-area-inset-bottom));
  z-index: 1300;
}

.chat-call-nav-btn.is-active {
  box-shadow: 0 0 0 1px rgba(95, 180, 255, 0.55), 0 0 18px rgba(95, 180, 255, 0.24);
}

.chat-call-nav-btn.is-ringing {
  box-shadow: 0 0 0 1px rgba(255, 168, 77, 0.58), 0 0 18px rgba(255, 168, 77, 0.28);
}

.chat-call-type-modal {
  position: fixed;
  inset: 0;
  z-index: 1500;
  display: grid;
  place-items: center;
  padding: max(18px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right))
    max(18px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
  background: rgba(3, 8, 20, 0.58);
  backdrop-filter: blur(8px);
}

.chat-call-type-dialog {
  width: min(340px, 100%);
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(130, 170, 255, 0.2);
  border-radius: 16px;
  background: rgba(10, 18, 35, 0.98);
  color: var(--text);
  box-shadow: 0 18px 38px rgba(3, 8, 20, 0.42);
}

.chat-call-type-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.chat-call-type-title {
  padding: 2px 4px 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.chat-call-type-close {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(130, 170, 255, 0.16);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.chat-call-type-choice {
  min-height: 54px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  width: 100%;
  border: 1px solid rgba(130, 170, 255, 0.16);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.chat-call-type-choice:hover,
.chat-call-type-choice:focus-visible {
  border-color: rgba(130, 170, 255, 0.38);
  background: rgba(95, 180, 255, 0.14);
  outline: none;
}

.chat-call-type-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: rgba(95, 180, 255, 0.16);
  color: #b9d8ff;
  font-size: 17px;
}

.chat-call-type-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.chat-call-type-label {
  font-size: 14px;
  font-weight: 800;
  line-height: 1.2;
}

.chat-call-type-hint {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
}

.chat-call-panel {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: calc(88px + env(safe-area-inset-bottom));
  z-index: 1200;
  width: min(360px, calc(100vw - 24px));
  display: grid;
  gap: 12px;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(130, 170, 255, 0.18);
  background: linear-gradient(180deg, rgba(11, 20, 40, 0.96), rgba(9, 16, 33, 0.98));
  box-shadow: 0 18px 38px rgba(3, 8, 20, 0.42);
  backdrop-filter: blur(14px);
}

.chat-call-panel[hidden] {
  display: none !important;
}

.call-host-window {
  height: 100vh;
  min-height: 100vh;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  padding: 0;
  overflow: hidden;
}

.call-host-window .chat-call-panel {
  position: relative;
  left: auto;
  top: auto;
  right: auto;
  bottom: auto;
  transform: none;
  width: 100%;
  max-width: none;
  height: 100%;
  min-height: 100%;
  z-index: auto;
  align-content: start;
  padding: calc(16px + env(safe-area-inset-top)) calc(16px + env(safe-area-inset-right))
    calc(16px + env(safe-area-inset-bottom)) calc(16px + env(safe-area-inset-left));
  border: 0;
  border-radius: 0;
  box-shadow: none;
  overflow: auto;
}

.call-host-window .chat-call-panel.has-video {
  width: 100%;
}

.call-host-window .chat-call-nav-btn {
  display: none !important;
}

.call-shell-page {
  display: block;
  height: 100vh;
  min-height: 100vh;
  overflow: hidden;
  position: relative;
}

.call-shell-page.call-host-window {
  padding: 0;
}

@supports (height: 100dvh) {
  .call-shell-page {
    height: 100dvh;
    min-height: 100dvh;
  }
}

.call-shell-frame-wrap {
  position: fixed;
  inset: 0;
  min-height: 100vh;
  height: 100vh;
  border-radius: 0;
  overflow: hidden;
  border: 0;
  background: rgba(11, 18, 35, 0.98);
  z-index: 1;
}

.call-shell-host-wrap {
  position: fixed;
  inset: 0;
  z-index: 4;
  width: 100vw;
  height: 100vh;
  border-radius: 0;
  overflow: hidden;
  box-shadow: none;
  background: rgba(8, 14, 27, 0.96);
}

.call-shell-host-wrap[hidden] {
  display: none !important;
}

.call-shell-host-frame {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: transparent;
}

.call-shell-backdrop {
  position: fixed;
  inset: 0;
  border: 0;
  background: rgba(3, 8, 20, 0.42);
  z-index: 3;
}

.call-shell-backdrop[hidden] {
  display: none !important;
}

.call-shell-frame {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: transparent;
}

.call-shell-page .chat-call-panel {
  position: fixed;
  inset: 0;
  transform: none;
  right: auto;
  bottom: auto;
  width: 100vw;
  max-width: none;
  height: 100vh;
  margin: 0;
  gap: 10px;
  padding: calc(16px + env(safe-area-inset-top)) calc(16px + env(safe-area-inset-right))
    calc(16px + env(safe-area-inset-bottom)) calc(16px + env(safe-area-inset-left));
  border-radius: 0;
  z-index: 4;
  box-shadow: none;
  overflow: auto;
}

.call-shell-page .chat-call-panel.has-video {
  width: 100vw;
}

.call-shell-page .chat-call-head {
  align-items: center;
}

.chat-meta-time-trigger {
  border: 0;
  background: rgba(91, 140, 255, 0.12);
  color: var(--text);
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
}

.chat-meta-time-trigger:hover {
  background: rgba(91, 140, 255, 0.2);
}

.call-shell-page .chat-call-participants {
  max-height: min(28vh, 220px);
  overflow-y: auto;
}

.call-shell-page .chat-call-actions {
  flex-wrap: wrap;
}

.call-shell-page .chat-call-action {
  min-width: 110px;
}

.chat-call-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.chat-call-head-main {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.chat-call-title {
  font-size: 14px;
  font-weight: 700;
  color: #f5f8ff;
}

.chat-call-status {
  font-size: 12px;
  color: rgba(223, 233, 255, 0.78);
}

.chat-call-close {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: #f5f8ff;
}

.chat-call-participants {
  display: grid;
  gap: 8px;
  max-height: min(40vh, 260px);
  overflow-y: auto;
}

.chat-call-video-stage {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 8px;
}

.chat-call-video-stage[hidden] {
  display: none !important;
}

.chat-call-video-tile {
  position: relative;
  min-height: 140px;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: 14px;
  border: 1px solid rgba(130, 170, 255, 0.16);
  background: #070d1b;
}

.chat-call-video-tile[hidden] {
  display: none !important;
}

.chat-call-video-tile.is-self {
  border-color: rgba(95, 180, 255, 0.34);
}

.chat-call-video-tile video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  background: #070d1b;
}

.chat-call-video-tile.is-self video {
  transform: scaleX(-1);
}

.chat-call-video-label {
  position: absolute;
  left: 8px;
  bottom: 8px;
  max-width: calc(100% - 16px);
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(3, 8, 20, 0.72);
  color: #f5f8ff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-call-empty {
  padding: 12px 10px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 12px;
  color: rgba(223, 233, 255, 0.72);
}

.chat-call-participant {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
}

.chat-call-participant.is-self {
  background: rgba(95, 180, 255, 0.12);
}

.chat-call-participant.is-speaking {
  box-shadow: 0 0 0 1px rgba(95, 255, 173, 0.55), 0 0 18px rgba(95, 255, 173, 0.2);
  background: rgba(95, 255, 173, 0.09);
}

.chat-call-avatar {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 999px;
  overflow: hidden;
  background: linear-gradient(135deg, #5b8cff, #2bc2ff);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
}

.chat-call-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.chat-call-participant-meta {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.chat-call-participant-name {
  font-size: 13px;
  font-weight: 600;
  color: #f5f8ff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-call-participant-tag {
  font-size: 11px;
  color: rgba(223, 233, 255, 0.68);
}

.chat-call-volume {
  margin-left: auto;
  display: grid;
  gap: 4px;
  width: 92px;
  font-size: 10px;
  color: rgba(223, 233, 255, 0.68);
}

.chat-call-volume input {
  width: 100%;
}

.chat-call-actions {
  display: flex;
  gap: 8px;
}

.chat-call-action {
  min-height: 38px;
  flex: 1 1 0;
  border-radius: 12px;
  border: 1px solid rgba(130, 170, 255, 0.18);
  background: rgba(255, 255, 255, 0.05);
  color: #f5f8ff;
  font-size: 13px;
  font-weight: 600;
}

.chat-call-action-primary {
  background: linear-gradient(135deg, rgba(91, 140, 255, 0.84), rgba(43, 194, 255, 0.84));
  border-color: rgba(95, 180, 255, 0.45);
}

.chat-call-action-danger {
  background: linear-gradient(135deg, rgba(255, 96, 96, 0.82), rgba(255, 134, 96, 0.82));
  border-color: rgba(255, 134, 96, 0.42);
}

.chat-call-audio-rack {
  display: none;
}

.global-call-indicator {
  position: fixed;
  right: max(14px, env(safe-area-inset-right));
  bottom: calc(88px + env(safe-area-inset-bottom));
  z-index: 1250;
  width: 46px;
  height: 46px;
  border-radius: 999px;
  border: 1px solid rgba(95, 180, 255, 0.38);
  background: linear-gradient(135deg, rgba(19, 29, 54, 0.96), rgba(11, 18, 35, 0.98));
  color: #f5f8ff;
  box-shadow: 0 14px 28px rgba(3, 8, 20, 0.42);
}

.global-call-indicator-icon {
  font-size: 19px;
}

.global-call-indicator-dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #67ff9f;
  box-shadow: 0 0 10px rgba(103, 255, 159, 0.45);
}

.global-call-modal {
  position: fixed;
  inset: 0;
  z-index: 1300;
}

.global-call-modal[hidden] {
  display: none !important;
}

.global-call-modal-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(3, 8, 20, 0.54);
}

.global-call-modal-sheet {
  position: absolute;
  right: max(12px, env(safe-area-inset-right));
  bottom: calc(142px + env(safe-area-inset-bottom));
  width: min(360px, calc(100vw - 24px));
  display: grid;
  gap: 12px;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid rgba(130, 170, 255, 0.18);
  background: linear-gradient(180deg, rgba(11, 20, 40, 0.98), rgba(9, 16, 33, 0.98));
  box-shadow: 0 18px 38px rgba(3, 8, 20, 0.42);
}

.global-call-modal.is-frame-open .global-call-modal-sheet {
  width: min(560px, calc(100vw - 24px));
}

.global-call-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.global-call-modal-title {
  font-size: 15px;
  font-weight: 700;
  color: #f5f8ff;
}

.global-call-modal-close {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: #f5f8ff;
}

.global-call-modal-status {
  font-size: 12px;
  color: rgba(223, 233, 255, 0.78);
}

.global-call-modal-participants {
  display: grid;
  gap: 8px;
}

.global-call-modal-participant {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
}

.global-call-modal-participant.is-speaking {
  box-shadow: 0 0 0 1px rgba(95, 255, 173, 0.55), 0 0 18px rgba(95, 255, 173, 0.2);
  background: rgba(95, 255, 173, 0.09);
}

.global-call-modal-avatar {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  border-radius: 999px;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #5b8cff, #2bc2ff);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

.global-call-modal-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.global-call-modal-meta {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.global-call-modal-name {
  color: #f5f8ff;
  font-size: 13px;
  font-weight: 600;
}

.global-call-modal-tag,
.global-call-modal-empty {
  font-size: 11px;
  color: rgba(223, 233, 255, 0.7);
}

.global-call-modal-actions {
  display: flex;
  justify-content: flex-end;
}

.global-call-modal-frame-wrap {
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(130, 170, 255, 0.14);
  background: rgba(8, 14, 27, 0.96);
  min-height: 360px;
}

.global-call-modal-frame {
  width: 100%;
  height: 70vh;
  min-height: 360px;
  border: 0;
  display: block;
  background: transparent;
}

@media (max-width: 720px) {
  .chat-call-panel {
    left: max(12px, env(safe-area-inset-left));
    right: max(12px, env(safe-area-inset-right));
    width: auto;
    bottom: calc(82px + env(safe-area-inset-bottom));
  }

  .global-call-indicator {
    bottom: calc(82px + env(safe-area-inset-bottom));
  }

  .global-call-modal-sheet {
    left: max(12px, env(safe-area-inset-left));
    right: max(12px, env(safe-area-inset-right));
    width: auto;
    bottom: calc(138px + env(safe-area-inset-bottom));
  }

  .global-call-modal-frame {
    height: min(72vh, 560px);
  }

  .call-shell-host-wrap {
    width: 100vw;
    height: 100vh;
  }

  .call-shell-host-frame {
    height: 100%;
  }
}

@supports (height: 100dvh) {
  .call-host-window,
  .call-shell-host-wrap,
  .call-shell-page .chat-call-panel {
    height: 100dvh;
  }
}

.chat-date-divider {
  align-self: center;
  font-size: 11px;
  color: var(--muted);
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
}

.chat-system {
  align-self: center;
  font-size: 11px;
  color: var(--muted);
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  max-width: min(88%, 620px);
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.chat-date-divider-trigger {
  border: 1px solid rgba(91, 140, 255, 0.28);
  background: rgba(91, 140, 255, 0.08);
  color: var(--text);
  cursor: pointer;
}

.chat-date-divider-trigger:hover {
  background: rgba(91, 140, 255, 0.16);
}

.chat-call-status-message {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 14px;
  border-color: rgba(91, 140, 255, 0.45);
  background: rgba(91, 140, 255, 0.12);
  color: var(--text);
}

.chat-call-status-message-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}

.chat-call-status-message-btn {
  border: 1px solid rgba(91, 140, 255, 0.55);
  background: rgba(91, 140, 255, 0.16);
  color: var(--text);
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 11px;
  cursor: pointer;
}

.chat-call-status-message-btn:hover {
  background: rgba(91, 140, 255, 0.24);
}

.context-menu,
.context-menu *,
.chat-system,
.chat-system *,
.chat-date-divider,
.chat-date-divider * {
  -webkit-user-select: none;
  user-select: none;
}

.chat-typing {
  font-size: 12px;
  color: var(--muted);
  padding: 4px 8px;
  margin: 2px 0 6px;
}

.chat-message,
.chat-message *,
#friendList,
#friendList * {
  -webkit-user-select: none;
  user-select: none;
}

.chat-message.allow-select,
.chat-message.allow-select * {
  -webkit-user-select: text;
  user-select: text;
}

.msg {
  padding: 8px 10px;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.1);
}

.msg .meta {
  font-size: 12px;
  color: var(--muted);
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.tab {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
}

.tab.active {
  border-color: rgba(91, 140, 255, 0.7);
  background: linear-gradient(
    135deg,
    rgba(91, 140, 255, 0.9),
    rgba(45, 212, 191, 0.35)
  );
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

#personalTab {
  padding-bottom: calc(78px + env(safe-area-inset-bottom) + 8px);
  overflow-x: hidden;
}

#groupTab {
  padding-bottom: calc(78px + 90px);
  overflow-x: hidden;
}

#groupTab.is-photo-mode {
  padding-bottom: calc(78px + 90px + 40vh);
}

#groupTab.is-time-scroll-only {
  padding-bottom: 0;
  overflow: hidden;
}

.avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(91, 140, 255, 0.9), rgba(45, 212, 191, 0.5));
  display: grid;
  place-items: center;
  font-weight: 700;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  color: #fff;
}

.avatar.has-image {
  color: transparent;
}

.avatar-small {
  width: 36px;
  height: 36px;
  font-size: 14px;
}
.list {
  list-style: none;
  padding: 0;
  margin: 0;
  max-width: 100%;
  overflow-x: hidden;
}

#friendList {
  padding-bottom: calc(78px + env(safe-area-inset-bottom) + 8px);
  overflow-x: hidden;
  overscroll-behavior-x: none;
  touch-action: pan-y;
  scrollbar-gutter: stable;
  max-width: 100%;
}

#friendList::-webkit-scrollbar:horizontal {
  height: 0 !important;
}

.list li {
  padding: 10px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  position: relative;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.list li .title {
  font-weight: 600;
}

.list li .preview {
  color: var(--muted);
  font-size: 12px;
}

.list-action {
  margin-left: auto;
  flex-shrink: 0;
}

.chat-list-item {
  transition: transform 0.2s ease;
  will-change: transform;
  width: 100%;
  max-width: 100%;
  overflow-x: clip;
  position: relative;
  --chat-list-action-width: min(38vw, 152px);
  --chat-list-swipe-x: 0px;
}

.chat-list-item.swiping {
  transition: none;
}

.chat-list-item.actions-open {
  --chat-list-swipe-x: calc(-1 * var(--chat-list-action-width));
}

.chat-list-item > .list-avatar,
.chat-list-item > .list-main {
  position: relative;
  z-index: 1;
  transform: translateX(var(--chat-list-swipe-x));
  transition: transform 0.2s ease;
}

.chat-list-item.swiping > .list-avatar,
.chat-list-item.swiping > .list-main {
  transition: none;
}

.list-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.chat-list-item .list-actions {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: var(--chat-list-action-width);
  height: 100%;
  margin-left: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  transform: none;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s ease;
  z-index: 0;
  overflow: hidden;
  border-radius: 0;
}

.chat-list-item.actions-open .list-actions,
.chat-list-item.swipe-revealing .list-actions {
  opacity: 1;
  pointer-events: auto;
}

.chat-list-item .list-side {
  margin-left: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  min-width: 70px;
  max-width: 100%;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.chat-list-item.actions-open .list-side {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.list-avatar {
  position: relative;
  flex-shrink: 0;
}

.list-pin {
  position: absolute;
  right: -2px;
  bottom: -2px;
  background: rgba(15, 21, 38, 0.85);
  border-radius: 999px;
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.list-main {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.list-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.title-block {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1 1 auto;
}

.title-badge {
  margin-left: auto;
}

.list-title-row .title {
  min-width: 0;
}

.title-count {
  font-size: 12px;
  color: var(--muted);
  flex-shrink: 0;
}

.title-notify-off {
  width: 16px;
  height: 16px;
  display: inline-grid;
  place-items: center;
  opacity: 0.7;
  flex-shrink: 0;
}

.list-preview-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.list-preview-row .preview {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-preview-meta {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  flex-shrink: 0;
}

.list-preview-date {
  font-size: 11px;
  color: var(--muted);
  flex-shrink: 0;
  margin-left: auto;
}

.list-status {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-end;
}

.status-pill {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.status-pill.status-calendar {
  min-width: 28px;
  height: 24px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

.status-pill-icon {
  width: 14px;
  height: 14px;
  display: block;
  pointer-events: none;
}

.status-pill.has-color {
  border-color: var(--status-color);
  color: var(--status-color);
}

@media (max-width: 520px) {
  .list-actions {
    gap: 0;
  }

  .list li .preview {
    max-width: 52vw;
  }

  .chat-list-item .list-side {
    min-width: 72px;
  }
}

.badge {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: rgba(91, 140, 255, 0.85);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.icon-toggle {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border-radius: 8px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  cursor: pointer;
  line-height: 1;
  font-size: 14px;
}

.list-actions .icon-toggle {
  width: 100%;
  height: 100%;
  min-height: 72px;
  border-radius: 0;
  border-top: 0;
  border-bottom: 0;
  border-right: 0;
  border-left: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(37, 57, 99, 0.92);
}

.list-actions .icon-toggle:first-child {
  border-left: 1px solid rgba(91, 140, 255, 0.24);
  background: linear-gradient(135deg, rgba(91, 140, 255, 0.94), rgba(45, 117, 212, 0.62));
}

.list-actions .icon-toggle.off {
  opacity: 1;
  background: linear-gradient(135deg, rgba(93, 103, 126, 0.92), rgba(33, 42, 61, 0.92));
}

.list-action-icon,
.list-state-icon {
  display: block;
  width: 20px;
  height: 20px;
  background: currentColor;
  -webkit-mask: var(--icon-url) center / contain no-repeat;
  mask: var(--icon-url) center / contain no-repeat;
  pointer-events: none;
}

.list-actions .list-action-icon {
  width: 28px;
  height: 28px;
}

.list-pin .list-state-icon,
.title-notify-off .list-state-icon {
  width: 13px;
  height: 13px;
}

.icon-toggle.active {
  border-color: rgba(91, 140, 255, 0.8);
  color: var(--accent);
}

.icon-toggle.off {
  opacity: 0.6;
}

.nav-bottom {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(17, 26, 46, 0.95);
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 78px;
}

.bottom-btn {
  background: none;
  border: none;
  color: var(--text);
  padding: 20px 12px;
  font: inherit;
  cursor: pointer;
}

.bottom-btn.active {
  background: linear-gradient(
    135deg,
    rgba(91, 140, 255, 0.7),
    rgba(45, 212, 191, 0.3)
  );
}

.nav-top {
  position: sticky;
  top: 0;
  backdrop-filter: blur(10px);
  z-index: 2;
}

.nav-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.nav-top-row[hidden] {
  display: none !important;
}

.nav-title {
  font-weight: 700;
  font-size: 18px;
}

.nav-search {
  width: clamp(200px, 60vw, 420px);
  border-radius: 999px;
  padding-right: 44px;
}

.nav-top-dashboard {
  gap: 12px;
}

.nav-search-action {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text);
  display: grid;
  place-items: center;
  text-decoration: none;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  padding: 0;
}

.nav-top-search.has-left-icon .nav-search {
  padding-left: 44px;
}

.nav-top-search.has-right-icons .nav-search {
  padding-right: 84px;
}

.nav-search-embed {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  text-decoration: none;
  background: transparent;
}

.nav-search-embed-glyph {
  width: 16px;
  height: 16px;
  display: block;
  pointer-events: none;
  user-select: none;
}

.nav-top-search.has-right-icons .nav-search-embed {
  left: auto;
  right: 44px;
}

.nav-search-action-glyph {
  width: 16px;
  height: 16px;
  display: block;
  pointer-events: none;
  user-select: none;
}

.nav-search-action-glyph {
  width: 16px;
  height: 16px;
  display: block;
  pointer-events: none;
  user-select: none;
}

#navTopChat {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: stretch;
  gap: 8px;
}

#navTopChat .nav-top-actions {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-width: 0;
  overflow-x: hidden;
}

#navTopChat .nav-top-icons,
#navTopChat .nav-top-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
}

#navTopChat .nav-top-right {
  justify-content: flex-end;
  margin-left: auto !important;
  order: 1;
  flex: 0 0 auto;
}

#navTopChat .nav-top-filter {
  order: 0;
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
}

#navTopChat .nav-top-actions .icon-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  display: grid;
  place-items: center;
  font-size: 16px;
}

#navTopChat .nav-top-actions .icon-btn .icon-btn-glyph {
  width: 18px;
  height: 18px;
}

#navTopChat .nav-top-actions #accountMenuBtn {
  width: 36px;
  height: 36px;
}

#navTopChat .nav-top-search {
  width: 100%;
}

#navTopChat .nav-search {
  width: 100%;
  max-width: 100%;
}

.nav-top-filter {
  min-width: 0;
  max-width: 100%;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  overflow: hidden;
}

#chatListFilter {
  display: none;
}

.chat-list-filter-btn {
  width: 100%;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(20, 31, 56, 0.82);
  color: var(--text);
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}

.chat-list-filter-btn.active {
  border-color: rgba(91, 140, 255, 0.5);
  background: rgba(91, 140, 255, 0.24);
}

.chat-list-filter-btn:active {
  transform: scale(0.98);
}

.nav-top-search {
  position: relative;
  transition: opacity 0.2s ease, transform 0.2s ease, max-height 0.2s ease;
}

.nav-top-search.is-hidden {
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  pointer-events: none;
  transform: translateY(-4px);
}

.nav-top-left,
.nav-top-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.nav-top-search {
  flex: 1 1 auto;
  min-width: 0;
}

.nav-top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.nav-top-left {
  flex: 1 1 auto;
  min-width: 0;
}

.nav-top-icons {
  display: flex;
  gap: 8px;
}

#navTopSchedule {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.schedule-top-left,
.schedule-top-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
}

.schedule-top-center {
  min-width: 0;
  display: block;
  position: relative;
}

.schedule-owner-menu {
  position: relative;
}

.schedule-owner-current {
  width: 100%;
  min-width: 0;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(20, 31, 56, 0.82);
  color: var(--text);
  padding: 8px 34px 8px 12px;
  font-size: 12px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.schedule-owner-current::after {
  content: "▾";
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  color: var(--muted);
  transition: transform 0.16s ease;
}

.schedule-owner-menu.is-open .schedule-owner-current::after {
  transform: translateY(-50%) rotate(180deg);
}

.schedule-owner-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  display: grid;
  gap: 8px;
  padding: 8px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(12, 20, 38, 0.96);
  box-shadow: 0 12px 24px rgba(3, 8, 20, 0.45);
  z-index: 16;
}

.schedule-owner-panel[hidden] {
  display: none !important;
}

.schedule-owner-select {
  width: 100%;
  min-width: 0;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(20, 31, 56, 0.82);
  color: var(--text);
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
}

.schedule-owner-select-list {
  border-radius: 12px;
  min-height: 210px;
  max-height: 280px;
  padding: 6px;
  overflow-y: auto;
  display: grid;
  gap: 6px;
}

.schedule-owner-option {
  width: 100%;
  text-align: left;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  background: rgba(20, 31, 56, 0.82);
  color: var(--text);
  padding: 7px 9px;
  font-size: 12px;
  line-height: 1.35;
  cursor: pointer;
}

.schedule-owner-option.is-active {
  border-color: rgba(91, 140, 255, 0.56);
  background: rgba(91, 140, 255, 0.2);
}

.schedule-owner-option mark {
  background: rgba(255, 210, 94, 0.28);
  color: #ffe7a8;
  border-radius: 4px;
  padding: 0 2px;
}

.schedule-owner-option-empty {
  border: 1px dashed rgba(255, 255, 255, 0.18);
  border-radius: 10px;
  color: var(--muted);
  font-size: 12px;
  padding: 9px 10px;
}

.schedule-status-order-btn {
  min-width: 62px;
  min-height: 42px;
  border-radius: 10px;
  border: none;
  background: rgba(20, 31, 56, 0.8);
  color: var(--text);
  font-size: 11px;
  padding: 0 8px;
}

.schedule-owner-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
}

.schedule-owner-search,
.schedule-owner-kind-filter {
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(20, 31, 56, 0.82);
  color: var(--text);
  padding: 6px 10px;
  font-size: 11px;
}

.schedule-owner-kind-filter {
  min-width: 92px;
}

@media (max-width: 720px) {
  .nav-top {
    flex-wrap: wrap;
    gap: 8px;
  }

  .nav-top-row {
    flex: 1 1 100%;
    flex-wrap: wrap;
    justify-content: space-between;
  }

  .nav-search {
    flex: 1 1 100%;
    min-width: 0;
  }

  .nav-top-dashboard {
    align-items: stretch;
  }

  .nav-top-left,
  .nav-top-right {
    width: 100%;
    justify-content: flex-end;
    flex-wrap: nowrap;
  }

  .nav-top-icons {
    justify-content: flex-start;
  }

  .nav-top-actions {
    width: 100%;
    justify-content: space-between;
    flex-wrap: nowrap;
  }

  #navTopChat .nav-top-actions {
    width: 100%;
  }

  #navTopChat .nav-top-right {
    width: auto;
    justify-content: flex-end;
  }

  #navTopSchedule {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 8px;
  }

  .schedule-top-left,
  .schedule-top-right {
    width: auto;
    flex-wrap: nowrap;
  }

  .schedule-top-right {
    justify-content: flex-end;
  }

  .schedule-top-center {
    min-width: 0;
  }

  .schedule-owner-select {
    font-size: 11px;
    padding: 7px 10px;
  }

  .schedule-owner-current {
    font-size: 11px;
    padding: 7px 30px 7px 10px;
  }

  .schedule-owner-panel {
    top: calc(100% + 4px);
    padding: 7px;
    gap: 7px;
  }

  .schedule-owner-search,
  .schedule-owner-kind-filter {
    font-size: 10px;
    padding: 6px 8px;
  }

  .nav-top-search {
    width: 100%;
  }

  .nav-top-right {
    justify-content: flex-end;
  }

  .file-row {
    flex-direction: column;
    align-items: stretch;
  }

  .file-row .btn {
    width: 100%;
  }
}

.icon-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 10px;
  cursor: pointer;
  text-decoration: none;
}

.icon-btn:visited,
.icon-btn:hover {
  text-decoration: none;
}

.icon-btn--glyph {
  width: 38px;
  height: 38px;
  padding: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon-btn-glyph {
  width: 20px;
  height: 20px;
  display: block;
  pointer-events: none;
  user-select: none;
}

.chat-ad {
  border: 1px dashed rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 10px;
  background: rgba(255, 255, 255, 0.03);
  min-height: 148px;
}

.chat-ad.is-hidden {
  display: none;
}

.chat-ad-title {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.chat-ad-body {
  font-size: 13px;
  color: var(--text);
}

.chat-ad-slot {
  width: 100%;
  min-height: 90px;
}

.menu-wrapper {
  position: relative;
  z-index: 24;
}

.menu {
  position: fixed;
  top: 0;
  left: 0;
  min-width: 220px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(3, 8, 20, 0.45);
  padding: 8px;
  display: none;
  gap: 6px;
  z-index: 1200;
  overflow: visible;
}

.menu.open {
  display: grid;
}

.menu-item {
  text-align: left;
  width: 100%;
  background: #1a2742;
  border: 1px solid transparent;
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
}

.menu-item:hover {
  border-color: rgba(91, 140, 255, 0.7);
  background: rgba(91, 140, 255, 0.12);
}

.menu-switch {
  display: grid;
  gap: 6px;
  padding: 6px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.12);
  position: absolute;
  top: 0;
  right: calc(100% + 10px);
  width: 240px;
  z-index: 2;
}

.menu-switch[hidden] {
  display: none;
}

.menu-switch .menu-logout-btn {
  margin-top: 6px;
}

@media (max-width: 600px) {
  .menu-switch {
    position: static;
    width: 100%;
  }
}

.menu-account {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  cursor: pointer;
  position: relative;
}

.menu-account-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.menu-account-row .menu-account {
  flex: 1 1 auto;
}

.menu-account-remove {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  cursor: pointer;
  line-height: 1;
  font-size: 16px;
}

.switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.12);
  border: 1px solid var(--border);
  transition: 0.2s;
  border-radius: 999px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 2px;
  background-color: #fff;
  transition: 0.2s;
  border-radius: 50%;
}

.switch input:checked + .slider {
  background: linear-gradient(135deg, rgba(91, 140, 255, 0.9), rgba(45, 212, 191, 0.35));
  border-color: rgba(91, 140, 255, 0.6);
}

.switch input:checked + .slider:before {
  transform: translateX(20px);
}

.menu-account:hover {
  border-color: rgba(45, 212, 191, 0.6);
  background: rgba(45, 212, 191, 0.12);
}

.menu-account small {
  color: var(--muted);
  display: block;
  font-size: 11px;
}

.menu-account-badge {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: rgba(91, 140, 255, 0.95);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#accountMenuBtn {
  position: relative;
}

.icon-btn#headerNotificationBtn {
  position: relative;
}

.notification-total-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: rgba(91, 140, 255, 0.95);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.4);
}

.notification-total-badge[hidden] {
  display: none !important;
}

.account-total-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: rgba(91, 140, 255, 0.95);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.4);
}

.account-total-badge[hidden] {
  display: none !important;
}

.dropdown {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.12);
}

.dropdown > summary {
  list-style: none;
  cursor: pointer;
}

.dropdown > summary::-webkit-details-marker {
  display: none;
}

.dropdown-panel {
  margin-top: 12px;
  display: grid;
  gap: 10px;
}

.small {
  font-size: 12px;
}

.schedule-card {
  display: grid;
  gap: 14px;
  padding: 0;
}

.schedule-row {
  display: grid;
  gap: 10px;
}

.schedule-view-switch {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(17, 26, 46, 0.75);
  padding: 3px;
  backdrop-filter: blur(12px);
}

.schedule-view-btn {
  background: transparent;
  border: none;
  color: var(--text);
  border-radius: 999px;
  padding: 8px 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: background 0.2s ease, color 0.2s ease;
}

.schedule-view-btn.active {
  background: linear-gradient(135deg, rgba(122, 165, 255, 0.45), rgba(91, 140, 255, 0.3));
  color: #fff;
}

.schedule-add-btn {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: linear-gradient(145deg, rgba(122, 165, 255, 0.92), rgba(66, 118, 255, 0.82));
  color: #fff;
  box-shadow: 0 10px 22px rgba(41, 93, 230, 0.45);
}

.schedule-add-btn.is-mode-pulse {
  animation: scheduleAddPulse 0.35s ease;
}

@keyframes scheduleAddPulse {
  0% {
    transform: scale(1);
  }
  45% {
    transform: scale(1.12);
  }
  100% {
    transform: scale(1);
  }
}

.schedule-upload-label {
  display: grid;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.schedule-upload-label input[type="file"] {
  padding: 8px;
}

.schedule-upload-grid {
  display: flex;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  gap: 8px;
  padding: 2px 2px 4px;
}

.schedule-upload-input {
  position: fixed;
  left: -9999px;
  top: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.schedule-upload-thumb {
  width: 80px;
  min-width: 80px;
  height: 80px;
  padding: 0;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  background-size: contain;
  background-position: center center;
  background-repeat: no-repeat;
  position: relative;
  scroll-snap-align: start;
  cursor: pointer;
}

.schedule-upload-add {
  width: 80px;
  min-width: 80px;
  height: 80px;
  border-radius: 12px;
  border: 1px dashed rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 26px;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.schedule-upload-add {
  display: grid;
  place-items: center;
  color: var(--text);
  font-size: 24px;
  background: rgba(91, 140, 255, 0.18);
  border-style: dashed;
  text-decoration: none;
}

.schedule-upload-thumb.is-selected {
  border-color: rgba(45, 212, 191, 0.88);
  box-shadow: 0 0 0 2px rgba(45, 212, 191, 0.35);
}

.schedule-upload-remove {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.26);
  background: rgba(8, 13, 24, 0.84);
  color: #fff;
  font-size: 11px;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 2;
}

.schedule-upload-edit {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.26);
  background: rgba(8, 13, 24, 0.84);
  color: #fff;
  font-size: 10px;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 2;
}

.schedule-action-fab {
  width: 52px;
  height: 52px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(20, 31, 56, 0.82);
  color: var(--text);
  font-size: 20px;
  display: grid;
  place-items: center;
  box-shadow: 0 10px 20px rgba(3, 8, 20, 0.4);
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.schedule-action-fab .icon-btn-glyph {
  width: 24px;
  height: 24px;
}

.schedule-action-fab.is-open {
  transform: scale(1.35);
}

.schedule-action-bar {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(78px + 12px);
  z-index: 30;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 0;
  border: none;
  border-radius: 18px;
  background: transparent;
  backdrop-filter: blur(14px);
  box-shadow: 0 14px 28px rgba(3, 8, 20, 0.45);
}

.schedule-action-panel {
  position: fixed;
  inset: auto 12px calc(78px + 12px + 64px) 12px;
  z-index: 32;
  border: 1px solid var(--border);
  background: rgba(11, 18, 32, 0.96);
  padding: 12px;
  display: grid;
  gap: 12px;
  max-height: min(60vh, 520px);
  overflow: auto;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.schedule-action-panel.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.schedule-action-panel.is-photo-mode {
  inset: auto 4px calc(78px + 8px + 64px) 4px;
  height: 44vh;
  max-height: 44vh;
  border-radius: 12px;
  padding: 4px;
}

.schedule-action-panel.is-photo-mode .schedule-action-header {
  display: none;
}

.schedule-action-panel.is-photo-mode .schedule-action-body {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto auto;
  gap: 4px;
  min-height: 0;
}

.schedule-photo-stage {
  position: relative;
  border-radius: 8px;
  border: 0;
  background: #050911;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  min-height: 120px;
  touch-action: pan-y;
}

.schedule-photo-grid-toggle {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 3;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(8, 13, 24, 0.78);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.schedule-photo-grid-toggle .icon-btn-glyph {
  width: 14px;
  height: 14px;
}

.schedule-photo-grid-toggle.is-active {
  border-color: rgba(45, 212, 191, 0.9);
  box-shadow: 0 0 0 2px rgba(45, 212, 191, 0.25);
}

.schedule-photo-grid {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.38) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.38) 1px, transparent 1px);
  background-size: 24px 24px;
}

.schedule-photo-grid.is-dark {
  background-image:
    linear-gradient(to right, rgba(0, 0, 0, 0.42) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(0, 0, 0, 0.42) 1px, transparent 1px);
}

.schedule-photo-grid.is-light {
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.42) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.42) 1px, transparent 1px);
}

.schedule-photo-preview {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center center;
  transform-origin: center center;
  transform: translate(var(--photo-pan-x, 0px), var(--photo-pan-y, 0px))
    scale(var(--photo-zoom, 1));
  transition: transform 0.04s linear;
  will-change: transform;
}

.schedule-photo-stage.is-panning .schedule-photo-preview {
  transition: none;
}

.schedule-upload-toggle {
  width: 100%;
  min-height: 30px;
  border: 1px solid var(--border);
  background: rgba(17, 26, 46, 0.92);
  color: var(--text);
  border-radius: 8px;
  padding: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.schedule-upload-toggle .icon-btn-glyph {
  width: 14px;
  height: 14px;
  transition: transform 0.16s ease;
}

.schedule-upload-toggle[aria-expanded="true"] .icon-btn-glyph {
  transform: rotate(90deg);
}

.schedule-upload-section {
  display: grid;
  gap: 8px;
  min-height: 0;
}

.schedule-upload-section.is-collapsed {
  display: none;
}

.schedule-photo-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 12px;
  color: var(--muted);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0));
  pointer-events: none;
}

.schedule-photo-empty[hidden] {
  display: none !important;
}

.schedule-details {
  border-top: none;
  padding: 10px;
  display: grid;
  gap: 10px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(9, 16, 30, 0.5);
  margin-top: 4px;
}

.schedule-details-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 2px;
}

.schedule-details-date {
  font-size: 13px;
  color: var(--text);
  font-weight: 700;
}

.schedule-details-count {
  font-size: 11px;
  color: var(--muted);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  padding: 2px 8px;
}

.schedule-detail-list {
  display: grid;
  gap: 0;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.schedule-detail-item {
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 8px 10px;
  background: transparent;
  font-size: 12px;
}

.schedule-detail-item:first-child {
  border-top: none;
}

.schedule-detail-item.is-empty {
  text-align: center;
  color: var(--muted);
}

.schedule-detail-item-event {
  cursor: pointer;
}

.schedule-detail-group {
  margin-top: 10px;
  display: grid;
  gap: 6px;
}

.schedule-detail-group-title {
  font-size: 12px;
  color: var(--text);
  padding: 0 10px;
}

.schedule-detail-group-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.schedule-detail-status-inline {
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.58);
  background: var(--status-color, rgba(91, 140, 255, 0.84));
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.2;
  padding: 2px 6px;
  white-space: nowrap;
}

.schedule-detail-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.schedule-detail-title {
  flex: 1;
  font-weight: 600;
  text-align: right;
}

.schedule-detail-time {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
  flex-shrink: 0;
}

.schedule-detail-reminder-check {
  width: 22px;
  height: 22px;
  border: 1px solid rgba(45, 212, 191, 0.45);
  border-radius: 999px;
  background: rgba(45, 212, 191, 0.16);
  color: #b8ffe9;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
}

.schedule-detail-reminder-check:active {
  transform: scale(0.96);
}

.schedule-detail-reminder-check.is-checked {
  border-color: rgba(45, 212, 191, 0.8);
  background: rgba(45, 212, 191, 0.36);
  color: #ffffff;
}

.schedule-detail-meta {
  color: var(--muted);
  font-size: 11px;
  margin-top: 2px;
}

.schedule-detail-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 4px 0 8px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 11px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.schedule-detail-status-label {
  color: var(--muted);
}

.schedule-detail-status-value {
  font-weight: 700;
  color: #fff;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--status-color, rgba(91, 140, 255, 0.7));
}

.schedule-week-corner {
  background: rgba(255, 255, 255, 0.2);
  position: sticky;
  top: 0;
  left: 0;
  z-index: 6;
}

.schedule-week-header {
  padding: 6px 4px;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  background: rgba(255, 255, 255, 0.24);
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  white-space: nowrap;
  cursor: pointer;
  position: sticky;
  top: 0;
  z-index: 5;
}

.schedule-week-header.is-static {
  cursor: default;
}

.schedule-week-header.is-sun {
  color: #ff9aa2;
}

.schedule-week-header.is-sat {
  color: #8fb6ff;
}

.schedule-week-header.is-hidden-day {
  font-size: 0;
  color: transparent;
}

.schedule-week-header.is-selected {
  background: rgba(91, 140, 255, 0.2);
  box-shadow: inset 0 0 0 2px rgba(91, 140, 255, 0.6);
}

.schedule-week-time {
  text-align: right;
  padding: 4px 6px;
  font-size: 11px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.05);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.schedule-week-time.is-alt {
  background: rgba(255, 255, 255, 0.08);
}

.schedule-week-time.is-selected-hour {
  color: var(--text);
  background: rgba(91, 140, 255, 0.18);
}

.schedule-week-slot {
  background: rgba(255, 255, 255, 0.03);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  z-index: 1;
}

.schedule-week-slot.is-alt {
  background: rgba(255, 255, 255, 0.06);
}

.schedule-week-slot.is-selected {
  background: rgba(91, 140, 255, 0.08);
}

.schedule-week-slot.is-selected-hour {
  background: rgba(91, 140, 255, 0.18);
}

.schedule-calendar.is-day-grid .schedule-week-time,
.schedule-calendar.is-day-grid .schedule-week-slot {
  border-top-color: rgba(255, 255, 255, 0.16);
}

.schedule-week-event {
  border-radius: 4px;
  color: #fff;
  font-size: 11px;
  padding: 4px 6px;
  margin: 0 2px;
  overflow: hidden;
  display: grid;
  gap: 2px;
  z-index: 2;
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.25);
  position: relative;
  justify-self: stretch;
  pointer-events: auto;
  cursor: pointer;
}

.schedule-week-event.is-event-entry {
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.94),
    0 6px 12px rgba(0, 0, 0, 0.25);
}

.schedule-week-event.is-dragging {
  opacity: 0.35;
}

.schedule-week-event.is-preview {
  pointer-events: none;
  opacity: 0.55;
  border: 1px dashed rgba(255, 255, 255, 0.6);
}

.schedule-week-event-title {
  font-weight: 600;
  line-height: 1.2;
}

.schedule-week-event-time {
  opacity: 0.85;
  font-size: 10px;
}

.schedule-week-event-travel {
  opacity: 0.52;
  font-size: 10px;
  line-height: 1.15;
}

.schedule-drag-range-hint {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 6;
}

.schedule-drag-range-time {
  position: absolute;
  transform: translate(-50%, -100%);
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(8, 14, 26, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 10px;
  line-height: 1.2;
  white-space: nowrap;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
}

.schedule-drag-range-time-end {
  transform: translate(-50%, 0);
}

.schedule-context-menu {
  position: fixed;
  z-index: 280;
  display: grid;
  gap: 4px;
  min-width: 170px;
  padding: 6px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(14, 23, 43, 0.96);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(10px);
}

.schedule-context-menu-item {
  border: 1px solid transparent;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  text-align: left;
  padding: 8px 10px;
  font-size: 12px;
  cursor: pointer;
}

.schedule-context-menu-item:hover {
  background: rgba(91, 140, 255, 0.22);
}

.schedule-context-menu-item.is-danger {
  color: #ffb4b4;
  background: rgba(255, 107, 107, 0.14);
}

.schedule-event-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  display: grid;
  align-items: end;
  justify-items: center;
  padding: 0 16px;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 240ms ease;
}

.schedule-event-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.schedule-event-sheet {
  width: min(100%, 980px);
  max-height: min(94dvh, 860px);
  background: linear-gradient(180deg, rgba(11, 18, 32, 0.98), rgba(17, 26, 46, 0.98));
  color: var(--text);
  border-radius: 16px 16px 0 0;
  padding: calc(8px + env(safe-area-inset-top, 0px)) 0 calc(8px + env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
  border: 0;
  box-shadow: 0 -10px 28px rgba(0, 0, 0, 0.18);
  transform: translateY(24px);
  transition:
    transform 240ms ease,
    max-height 280ms cubic-bezier(0.22, 1, 0.36, 1),
    min-height 280ms cubic-bezier(0.22, 1, 0.36, 1);
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.schedule-event-sheet,
.schedule-event-sheet button,
.schedule-event-sheet label,
.schedule-event-sheet input,
.schedule-event-sheet select,
.schedule-event-sheet textarea {
  -webkit-tap-highlight-color: transparent;
}

.schedule-event-overlay.open .schedule-event-sheet {
  transform: translateY(0);
}

.schedule-event-handle {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: rgba(60, 60, 67, 0.36);
  margin: 0 auto 8px;
}

.schedule-event-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: 0 16px;
  margin-bottom: 6px;
  position: relative;
}

.schedule-event-title {
  font-weight: 600;
  font-size: 17px;
  color: var(--text);
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  max-width: calc(100% - 220px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
  pointer-events: none;
}

.schedule-event-header-left,
.schedule-event-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  position: relative;
  z-index: 1;
}

.schedule-event-header-left {
  margin-right: auto;
}

.schedule-event-header-actions {
  margin-left: auto;
}

.schedule-event-error {
  color: #d70015;
  font-size: 12px;
  min-height: 18px;
  margin: 0 16px 4px;
}

.schedule-event-form {
  display: grid;
  gap: 16px;
  padding: 0 16px 8px;
  max-height: 70dvh;
  opacity: 1;
  transform: translateY(0);
  transition:
    opacity 220ms ease,
    transform 220ms ease,
    max-height 260ms cubic-bezier(0.22, 1, 0.36, 1),
    padding 220ms ease;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
}

.schedule-event-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
}

.schedule-event-row-label {
  color: var(--text);
  font-size: 15px;
  white-space: nowrap;
}

.schedule-event-row-fields {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
  justify-self: end;
  width: min(100%, 280px);
}

.schedule-event-date-field,
.schedule-event-time-field {
  min-width: 0;
}

.schedule-event-time-field.is-time-hidden {
  display: none;
}

.schedule-event-row-fields:has(.schedule-event-time-field.is-time-hidden) {
  grid-template-columns: minmax(0, 1fr);
  width: min(100%, 170px);
}

.schedule-event-shortcuts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 8px 16px;
  min-height: 44px;
}

.schedule-event-shortcuts-label {
  font-size: 11px;
  color: var(--muted);
  margin-right: 4px;
}

.schedule-event-shortcut {
  min-height: 32px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  border-radius: 16px;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
}

.schedule-event-shortcut:active {
  background: rgba(255, 255, 255, 0.16);
}

.schedule-event-color-block {
  display: grid;
  gap: 0;
}

.schedule-event-color-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 8px 16px;
}

.schedule-event-color-preset {
  width: 28px;
  height: 28px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--preset-color, #ffffff);
  cursor: pointer;
}

.schedule-event-color-preset.is-selected {
  box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.38);
}

.schedule-event-color-picker-btn,
.schedule-event-color-reset {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
}

.schedule-event-all-day {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}

.schedule-event-actions {
  display: flex;
  justify-content: flex-start;
  padding: 0 16px;
}

.schedule-event-delete {
  min-height: 44px;
  border-color: rgba(215, 0, 21, 0.24);
  color: #d70015;
  background: rgba(215, 0, 21, 0.08);
  border-radius: 10px;
}

.schedule-event-header-ios {
  margin-bottom: 8px;
}

.schedule-event-nav-btn {
  min-width: 44px;
  min-height: 44px;
  border-radius: 12px;
  border: 0;
  background: rgba(255, 255, 255, 0.08);
  color: #007aff;
  font-size: 20px;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px var(--border);
}

.schedule-event-delete-top {
  color: #ff6b6b;
}

.schedule-event-delete-top[hidden] {
  display: none !important;
}

.schedule-event-overlay.is-intake-list-mode .schedule-event-mode-switch {
  opacity: 0;
  transform: translateY(-8px);
  max-height: 0;
  margin: 0 16px 0;
  padding-top: 0;
  padding-bottom: 0;
  pointer-events: none;
}

.schedule-event-overlay.is-intake-list-mode .schedule-event-form {
  opacity: 0;
  transform: translateY(10px);
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  pointer-events: none;
}

.schedule-event-overlay.is-intake-list-mode .schedule-event-sheet {
  --schedule-intake-sheet-height: min(52dvh, 440px);
  min-height: var(--schedule-intake-sheet-height);
  max-height: var(--schedule-intake-sheet-height);
}

.schedule-event-overlay.is-intake-list-mode .schedule-event-intake-panel {
  min-height: calc(var(--schedule-intake-sheet-height) - 118px);
  max-height: calc(var(--schedule-intake-sheet-height) - 118px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
}

.schedule-event-mode-switch {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  margin: 0 16px 16px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 4px;
  box-shadow: inset 0 0 0 1px var(--border);
  max-height: 64px;
  opacity: 1;
  transform: translateY(0);
  transform-origin: top;
  transition:
    opacity 200ms ease,
    transform 200ms ease,
    max-height 240ms cubic-bezier(0.22, 1, 0.36, 1),
    margin 200ms ease,
    padding 200ms ease;
  overflow: hidden;
}

.schedule-event-mode-btn {
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  min-height: 44px;
  font-weight: 600;
  cursor: pointer;
  font-size: 15px;
}

.schedule-event-mode-btn.is-active {
  background: rgba(91, 140, 255, 0.3);
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(91, 140, 255, 0.7);
}

.schedule-event-mode-panel {
  display: grid;
  gap: 16px;
}

.schedule-event-mode-panel[hidden] {
  display: none !important;
}

.schedule-event-block {
  display: grid;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
  padding: 8px 0;
}

.schedule-event-block > * {
  position: relative;
}

.schedule-event-block > * + *::before {
  content: "";
  position: absolute;
  top: 0;
  left: 16px;
  right: 0;
  height: 1px;
  background: rgba(255, 255, 255, 0.12);
}

.schedule-event-block > *:active {
  background: rgba(91, 140, 255, 0.1);
}

.schedule-event-block > label:not(.schedule-event-inline-field):not(.schedule-event-switch):not(.schedule-reminder-time-row) {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 16px;
}

.schedule-event-block > label:not(.schedule-event-inline-field):not(.schedule-event-switch):not(.schedule-reminder-time-row):has(textarea) {
  align-items: stretch;
}

.schedule-event-inline-field {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 0 16px;
}

.schedule-event-inline-field > span {
  color: var(--text);
  font-size: 15px;
  white-space: nowrap;
}

.schedule-event-inline-field > input,
.schedule-event-inline-field > select {
  text-align: right;
}

.schedule-event-switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 44px;
  padding: 0 16px;
  font-size: 15px;
  color: var(--text);
}

.schedule-event-switch input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.schedule-event-switch-ui {
  width: 51px;
  height: 31px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.14);
  position: relative;
  transition: background 0.2s ease;
}

.schedule-event-switch-ui::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
  transition: transform 0.2s ease;
}

.schedule-event-switch input:checked + .schedule-event-switch-ui {
  background: #34c759;
  border-color: #34c759;
}

.schedule-event-switch input:checked + .schedule-event-switch-ui::after {
  transform: translateX(20px);
}

.schedule-event-block input,
.schedule-event-block select,
.schedule-event-block textarea {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  padding: 0;
  font: inherit;
  outline: 0;
}

.schedule-event-block textarea {
  min-height: 100px;
  resize: vertical;
  padding-top: 10px;
  padding-bottom: 10px;
}

.schedule-event-photo-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 16px;
  min-height: 44px;
}

.schedule-event-photo-empty {
  min-height: 34px;
  display: grid;
  place-items: center;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px dashed var(--border);
  color: var(--muted);
  font-size: 12px;
  width: 100%;
}

.schedule-event-photo-item {
  position: relative;
  width: 68px;
  height: 68px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.schedule-event-photo-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.schedule-event-photo-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 999px;
  background: rgba(28, 28, 30, 0.85);
  color: #fff;
  line-height: 1;
  cursor: pointer;
}

.schedule-event-save-top[hidden] {
  display: none !important;
}

.schedule-event-chip-input {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  min-height: 44px;
  padding: 0 16px;
}

.schedule-event-chip-input button {
  min-height: 34px;
  min-width: 40px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  cursor: pointer;
}

.schedule-event-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 16px;
  min-height: 44px;
}

.schedule-event-chip {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(91, 140, 255, 0.2);
  color: var(--text);
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

@media (max-width: 520px) {
  .schedule-event-overlay {
    padding: 0;
  }

  .schedule-event-sheet {
    width: 100%;
  }

  .schedule-event-row-fields {
    width: min(100%, 240px);
  }

  .schedule-event-inline-field:has(input[type="date"]),
  .schedule-event-inline-field:has(input[type="time"]) {
    grid-template-columns: minmax(56px, auto) minmax(0, 1fr);
  }
}

.schedule-action-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.schedule-action-icon {
  width: 64px;
  height: 64px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-size: 28px;
}

.schedule-action-icon .icon-btn-glyph {
  width: 28px;
  height: 28px;
}

.schedule-action-close {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  padding: 8px 12px;
}

.schedule-action-body {
  display: grid;
  gap: 12px;
}

.schedule-row-nav {
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  position: sticky;
  top: 0;
  z-index: 18;
  background: rgba(11, 18, 32, 0.99);
  border: none;
  border-radius: 16px;
  padding: 0;
  backdrop-filter: blur(10px);
}

.schedule-row-nav.has-status-order {
  grid-template-columns: auto 1fr auto auto;
}

.schedule-nav-btn {
  min-width: 42px;
  min-height: 42px;
  border-radius: 12px;
  border: none;
  background: rgba(22, 35, 64, 0.82);
  color: var(--text);
}

.schedule-nav-btn .icon-btn-glyph {
  width: 18px;
  height: 18px;
}

.schedule-add-btn .icon-btn-glyph,
.dashboard-chat-pane-open .icon-btn-glyph {
  width: 20px;
  height: 20px;
}

.schedule-month {
  display: grid;
  gap: 6px;
  justify-items: center;
}

.schedule-month-input {
  border-radius: 12px;
  padding: 8px 12px;
  border: none;
  background: rgba(22, 35, 64, 0.82);
  color: var(--text);
  text-align: center;
  font-weight: 600;
}

.schedule-weekdays {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0;
  position: sticky;
  top: 52px;
  z-index: 17;
  background: rgba(11, 18, 32, 0.99);
}

.schedule-weekdays[hidden] {
  display: none !important;
}

.schedule-weekdays.is-photo-mode {
  grid-template-columns: 80px repeat(6, minmax(0, 1fr));
}

.schedule-weekday {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

.schedule-weekday-category {
  color: rgba(45, 212, 191, 0.92);
}

.schedule-calendar {
  display: grid;
  gap: 0;
}

.schedule-calendar.is-gesture-locked {
  overflow: hidden;
  touch-action: none;
}

.schedule-calendar.is-sliding-next {
  animation: schedule-slide-next 0.24s ease;
}

.schedule-calendar.is-sliding-prev {
  animation: schedule-slide-prev 0.24s ease;
}

@keyframes schedule-slide-next {
  from {
    transform: translateX(18px);
    opacity: 0.6;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes schedule-slide-prev {
  from {
    transform: translateX(-18px);
    opacity: 0.6;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.schedule-calendar.is-month-grid {
  grid-template-columns: repeat(7, minmax(0, 1fr));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.schedule-calendar.is-group-month-grid {
  grid-template-columns: minmax(120px, 0.7fr) repeat(31, minmax(72px, 1fr));
  overflow-x: auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: rgba(255, 255, 255, 0.02);
}

.schedule-group-corner {
  background: rgba(255, 255, 255, 0.04);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.schedule-group-day {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  font-size: 12px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  border-right: 1px solid rgba(255, 255, 255, 0.04);
  min-height: 44px;
  padding: 0 16px 0 8px;
}

.schedule-group-day-sort-btn {
  position: absolute;
  right: 2px;
  top: 2px;
  width: 18px;
  height: 18px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: rgba(232, 238, 252, 0.72);
  font-size: 11px;
  line-height: 1;
  padding: 0;
  cursor: pointer;
}

.schedule-group-day-sort-btn:active {
  background: rgba(91, 140, 255, 0.22);
}

.schedule-group-day.is-sun {
  color: rgba(255, 154, 162, 0.92);
}

.schedule-group-day.is-sat {
  color: rgba(143, 182, 255, 0.92);
}

.schedule-group-day.is-selected {
  background: rgba(91, 140, 255, 0.2);
}

.schedule-group-member {
  padding: 6px 10px;
  display: flex;
  align-items: center;
  font-size: 13px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.schedule-group-member.is-selected {
  background: rgba(91, 140, 255, 0.2);
  color: var(--text);
}

.schedule-group-cell {
  min-height: 84px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  border-right: 1px solid rgba(255, 255, 255, 0.04);
  background: rgba(255, 255, 255, 0.02);
  padding: 4px 4px 6px;
  overflow: hidden;
}

.schedule-group-cell.is-selected {
  background: rgba(91, 140, 255, 0.08);
}

.schedule-group-cell,
.schedule-week-status-cell {
  position: relative;
}

.schedule-group-cell::before,
.schedule-week-status-cell::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--schedule-status-bg, transparent);
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms ease;
  z-index: 0;
}

.schedule-group-cell.has-status::before,
.schedule-week-status-cell.has-status::before {
  opacity: 0.38;
}

.schedule-group-events {
  display: grid;
  gap: 2px;
  position: relative;
  z-index: 1;
}

.schedule-group-status {
  font-size: 10px;
  line-height: 1.15;
  border: none;
  border-radius: 0;
  background: transparent;
  color: #fff;
  padding: 1px 2px;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

.schedule-group-event {
  font-size: 10px;
  line-height: 1.3;
  color: #fff;
  background: var(--event-color, rgba(91, 140, 255, 0.7));
  border-left: none;
  border-radius: 6px;
  padding: 2px 4px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.schedule-group-event.is-event-entry {
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.95),
    0 4px 10px rgba(0, 0, 0, 0.25);
}

.schedule-group-more {
  font-size: 10px;
  color: var(--muted);
  padding: 2px 4px;
}

.schedule-calendar.is-month-grid.is-photo-month-grid {
  grid-template-columns: 80px repeat(6, minmax(0, 1fr));
}

.schedule-calendar.is-month-grid.is-photo-month-single {
  grid-template-columns: minmax(0, 1fr);
  overflow-x: auto;
  overflow-y: auto;
  overscroll-behavior-x: contain;
  padding-bottom: 4px;
  touch-action: pan-x pan-y;
}

.schedule-calendar.is-week-grid {
  grid-template-columns: 44px repeat(var(--schedule-days, 7), minmax(0, 1fr));
  grid-template-rows: var(--schedule-header-height, 28px) var(--schedule-status-height, 24px)
    repeat(24, var(--schedule-hour-height, 34px));
  border-radius: 12px;
  overflow-y: auto;
  overflow-x: hidden;
  background: rgba(255, 255, 255, 0.08);
  padding-bottom: 0;
  height: var(--schedule-grid-height, min(72dvh, 640px));
  max-height: var(--schedule-grid-height, min(72dvh, 640px));
  position: relative;
  --schedule-header-height: 28px;
  --schedule-status-height: 24px;
  --schedule-hour-height: 34px;
  touch-action: pan-y;
  overscroll-behavior-x: contain;
}

.schedule-week-events-layer {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: 44px repeat(var(--schedule-days, 7), minmax(0, 1fr));
  grid-template-rows: var(--schedule-header-height, 28px) var(--schedule-status-height, 24px)
    repeat(24, var(--schedule-hour-height, 34px));
  pointer-events: auto;
  z-index: 3;
  touch-action: pan-y;
}

.schedule-week-status-label {
  text-align: center;
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.2);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  border-right: 1px solid rgba(255, 255, 255, 0.12);
  display: grid;
  place-items: center;
  position: sticky;
  top: var(--schedule-header-height, 28px);
  left: 0;
  z-index: 5;
}

.schedule-week-status-cell {
  display: grid;
  align-items: stretch;
  justify-items: stretch;
  background: rgba(255, 255, 255, 0.16);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  overflow: hidden;
  position: sticky;
  top: var(--schedule-header-height, 28px);
  z-index: 4;
}

.schedule-week-status-cell.is-editable {
  cursor: pointer;
}

.schedule-status-badge {
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  padding: 0 6px;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  white-space: nowrap;
  width: 100%;
  height: 100%;
  display: grid;
  align-items: center;
  justify-items: center;
  position: relative;
  z-index: 1;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

.schedule-week-events-layer.is-dragging {
  cursor: grabbing;
}

.schedule-week-events-layer.is-pointer-active {
  touch-action: none;
  overscroll-behavior: contain;
}

.schedule-day {
  min-height: 84px;
  border-radius: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  display: grid;
  grid-template-rows: auto 1fr;
  align-items: start;
  padding: 4px 4px 6px;
  font-size: 13px;
  color: var(--text);
  gap: 0;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.schedule-day::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--schedule-status-bg, transparent);
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms ease;
  z-index: 0;
}

.schedule-day.has-status::before {
  opacity: 0.4;
}

.schedule-day-head,
.schedule-day-events {
  position: relative;
  z-index: 1;
}

.schedule-day.is-photo-single {
  min-height: 72px;
  min-width: 96px;
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
  align-items: start;
  gap: 2px;
  padding: 6px 6px 8px;
}

.schedule-day.is-photo-single .schedule-day-number {
  padding: 0 2px 2px;
  text-align: left;
}

.schedule-photo-category-cell {
  min-height: 84px;
  border: none;
  border-radius: 0;
  background: rgba(45, 212, 191, 0.12);
  color: rgba(45, 212, 191, 0.95);
  font-size: 12px;
  font-weight: 700;
  display: grid;
  grid-template-rows: auto 1fr;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  min-width: 80px;
}

.schedule-photo-category-header {
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(45, 212, 191, 0.18);
  color: inherit;
  font-size: 11px;
  font-weight: 700;
  padding: 6px 4px;
  cursor: pointer;
}

.schedule-photo-category-list {
  overflow-y: auto;
  display: grid;
  align-content: start;
}

.schedule-photo-category-row {
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: transparent;
  color: var(--text);
  font-size: 11px;
  padding: 3px 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}

.schedule-photo-category-badge {
  color: rgba(45, 212, 191, 0.95);
  font-weight: 700;
  font-size: 10px;
}

.schedule-day.is-muted {
  color: rgba(155, 176, 209, 0.38);
  background: rgba(255, 255, 255, 0.02);
}

.schedule-day.is-muted .schedule-day-number {
  color: rgba(155, 176, 209, 0.5);
}

.schedule-day.is-weekend-sun .schedule-day-number {
  color: #ff9aa2;
}

.schedule-day.is-weekend-sat .schedule-day-number {
  color: #8fb6ff;
}

.schedule-day.has-status.is-weekend-sun .schedule-day-number,
.schedule-day.has-status.is-weekend-sat .schedule-day-number {
  -webkit-text-stroke: 0.35px rgba(255, 255, 255, 0.92);
  text-shadow:
    0 0 0.7px rgba(255, 255, 255, 0.95),
    0 0 1.6px rgba(255, 255, 255, 0.8);
}

.schedule-day.is-muted.is-weekend-sun .schedule-day-number,
.schedule-day.is-muted.is-weekend-sat .schedule-day-number {
  opacity: 1;
}

.schedule-day.is-muted.is-weekend-sun .schedule-day-number {
  color: rgba(255, 154, 162, 0.42);
}

.schedule-day.is-muted.is-weekend-sat .schedule-day-number {
  color: rgba(143, 182, 255, 0.42);
}

.schedule-day-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  min-width: 0;
}

.schedule-day-number {
  font-weight: 600;
  padding: 0 2px 2px;
  text-align: left;
  min-width: 1.2em;
  flex: 0 0 auto;
}

.schedule-day-status-inline {
  max-width: none;
  flex: 1 1 auto;
  margin-left: 4px;
  min-width: 0;
  font-size: clamp(8px, 1.75vw, 10px);
  line-height: 1.15;
  padding: 1px 2px;
  border: none;
  border-radius: 0;
  background: transparent;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: right;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

.schedule-day-events {
  display: grid;
  gap: 2px;
}

.schedule-day-events.is-muted .schedule-day-event {
  opacity: 0.56;
  filter: saturate(0.72);
}

.schedule-day-events.is-muted .schedule-day-more {
  opacity: 0.72;
}

.schedule-day-event {
  font-size: 10px;
  line-height: 1.3;
  padding: 2px 4px;
  border-radius: 6px;
  border-left: none;
  background: rgba(91, 140, 255, 0.7);
  color: #fff;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: default;
}

.schedule-day-event.is-event-entry {
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.95),
    0 4px 10px rgba(0, 0, 0, 0.25);
}

.schedule-day-more {
  font-size: 10px;
  color: var(--muted);
  padding: 2px 4px;
}

.schedule-day-slots {
  display: grid;
  grid-template-rows: repeat(5, minmax(0, 1fr));
  gap: 0;
}

.schedule-day-slot {
  height: 6px;
  border: none;
  background: rgba(255, 255, 255, 0.06);
}

.schedule-day-slot.has-event {
  background: rgba(91, 140, 255, 0.7);
}

.schedule-day.is-today {
  box-shadow: inset 0 0 0 2px rgba(91, 140, 255, 0.6);
}

.schedule-day.is-selected {
  outline: 2px solid rgba(45, 212, 191, 0.7);
  outline-offset: -2px;
}

.schedule-weekdays:not(.is-photo-mode) > :nth-child(7n + 1),
.schedule-calendar.is-month-grid:not(.is-photo-month-grid):not(.is-photo-month-single) > :nth-child(7n + 1) {
  color: #ff9aa2;
}

.schedule-weekdays:not(.is-photo-mode) > :nth-child(7n),
.schedule-calendar.is-month-grid:not(.is-photo-month-grid):not(.is-photo-month-single) > :nth-child(7n) {
  color: #8fb6ff;
}

.schedule-weekdays.is-photo-mode > :nth-child(7n + 2),
.schedule-calendar.is-month-grid.is-photo-month-grid > :nth-child(7n + 2) {
  color: #ff9aa2;
}

.schedule-weekdays.is-photo-mode > :nth-child(7n),
.schedule-calendar.is-month-grid.is-photo-month-grid > :nth-child(7n) {
  color: #8fb6ff;
}

@media (max-width: 640px) {
  .schedule-action-panel {
    inset: auto 8px calc(96px + 8px) 8px;
  }
}

.chat-event-card {
  display: grid;
  gap: 8px;
  min-width: min(280px, 78vw);
}

.chat-event-card-title {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.82);
}

.chat-event-card-body {
  display: grid;
  gap: 4px;
}

.chat-event-card-name {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
}

.chat-event-card-meta,
.chat-event-card-diff {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.78);
  line-height: 1.35;
}

.chat-event-card-diff {
  color: rgba(255, 234, 168, 0.95);
}

.chat-event-card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chat-event-card-actions .btn {
  flex: 1;
  min-width: 120px;
  min-height: 34px;
  padding: 6px 10px;
  font-size: 12px;
}

:root[data-theme="light"] .nav-top,
:root[data-theme="light"] .nav-bottom,
:root[data-theme="light"] .menu,
:root[data-theme="light"] .chat-input-row,
:root[data-theme="light"] .chat-system,
:root[data-theme="light"] .schedule-action-panel,
:root[data-theme="light"] .schedule-owner-panel,
:root[data-theme="light"] .schedule-intake-sheet,
:root[data-theme="light"] .dashboard-console-card,
:root[data-theme="light"] .dashboard-chat-pane {
  background: rgba(255, 255, 255, 0.95) !important;
  border-color: var(--border) !important;
}

:root[data-theme="light"] .icon-btn,
:root[data-theme="light"] .btn,
:root[data-theme="light"] .chat-input,
:root[data-theme="light"] .nav-search,
:root[data-theme="light"] input,
:root[data-theme="light"] textarea,
:root[data-theme="light"] select {
  background: var(--input-bg);
  color: var(--text);
  border-color: var(--border);
}

:root[data-theme="light"] .chat-bubble.themine {
  background: linear-gradient(135deg, #4b82ff, #32b9af);
  color: #ffffff;
}

:root[data-theme="light"] .container,
:root[data-theme="light"] .card,
:root[data-theme="light"] .nav-title,
:root[data-theme="light"] .title,
:root[data-theme="light"] .settings-title,
:root[data-theme="light"] .chat-search-count {
  color: var(--text);
}

:root[data-theme="light"] .muted {
  color: var(--muted) !important;
}

:root[data-theme="light"] input::placeholder,
:root[data-theme="light"] textarea::placeholder {
  color: var(--muted);
  opacity: 1;
}

:root[data-theme="light"] .schedule-group-status,
:root[data-theme="light"] .schedule-day-status-inline,
:root[data-theme="light"] .schedule-status-badge {
  color: var(--text);
  text-shadow: none;
}
