:root {
  font-family: Inter, -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
  color: #172033;
  background: #eef2f7;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body { min-height: 100vh; min-height: 100dvh; overflow: hidden; }
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; }

.ios-app-icon {
  border-radius: 22.5%;
  clip-path: inset(0 round 22.5%);
  overflow: hidden;
  background: #f2f3f5;
  box-shadow: 0 5px 16px rgba(15, 23, 42, .16);
}

#app {
  height: 100vh;
  height: 100dvh;
  display: grid;
  grid-template-columns: minmax(290px, 350px) minmax(0, 1fr);
  background: #fff;
}

aside {
  z-index: 3;
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  border-right: 1px solid #e5e9f0;
  background: rgba(248, 250, 252, .96);
}

.brand { display: flex; align-items: center; gap: 12px; padding: 16px 17px 12px; }
.brand img, .center-card > img { width: 54px; height: 54px; object-fit: cover; flex: none; }
.brand > div { min-width: 0; display: flex; flex: 1; flex-direction: column; }
.brand strong { font-size: 20px; letter-spacing: -.02em; }
.brand small { overflow: hidden; margin-top: 3px; color: #748094; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.home-button { display: grid; width: 36px; height: 36px; place-items: center; border: 1px solid #dde3eb; border-radius: 12px; background: #fff; color: #64748b; font-size: 19px; }

.page-tabs { display: grid; grid-template-columns: 1fr 1.2fr; gap: 6px; margin: 0 14px 11px; padding: 4px; border-radius: 15px; background: #e9edf3; }
.page-tab { position: relative; display: flex; min-width: 0; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 11px; background: transparent; color: #697586; padding: 9px 8px; font-size: 12px; font-weight: 750; }
.page-tab.active { background: #fff; color: #1f5fd0; box-shadow: 0 3px 9px rgba(23, 32, 51, .09); }
.page-tab b { display: grid; min-width: 18px; height: 18px; place-items: center; padding: 0 5px; border-radius: 99px; background: #ef4444; color: #fff; font-size: 9px; }

.home-button:hover { border-color: #bfcce0; background: #f6f9ff; color: #2464d9; }

.sidebar-page { display: flex; min-height: 0; flex: 1; flex-direction: column; }
.tools { display: flex; gap: 7px; padding: 0 12px 10px; }
.tools input, #people-search, #group-name, #info-title, #info-message, #info-priority {
  min-width: 0;
  width: 100%;
  border: 1px solid #dce2eb;
  border-radius: 13px;
  outline: none;
  background: #fff;
  color: #172033;
  padding: 11px 13px;
  transition: border-color .16s, box-shadow .16s;
}
input:focus, textarea:focus, select:focus { border-color: #75a2ef !important; box-shadow: 0 0 0 3px rgba(36, 107, 232, .12); }
.tools input { flex: 1; }
.tools button { display: flex; align-items: center; gap: 3px; border: 0; border-radius: 13px; background: #e6efff; color: #2464d9; padding: 0 10px; font-size: 16px; font-weight: 850; }
.tools button span { font-size: 11px; }

.scroll-list { min-height: 0; flex: 1; overflow: auto; overscroll-behavior: contain; padding: 0 9px 8px; scrollbar-width: thin; }
.conversation, .person, .quick-info-row { width: 100%; display: flex; align-items: center; gap: 11px; border: 0; border-radius: 15px; background: transparent; padding: 10px; color: inherit; text-align: left; }
.conversation:hover, .conversation.active, .person:hover, .quick-info-row:hover, .quick-info-row.active { background: #eaf1fc; }
.avatar { display: grid; width: 43px; height: 43px; flex: none; place-items: center; border-radius: 50%; background: linear-gradient(135deg, #3478f6, #7b61ff); color: #fff; font-size: 13px; font-weight: 850; box-shadow: inset 0 0 0 1px rgba(255,255,255,.2); }
.conversation-copy, .quick-info-copy { min-width: 0; flex: 1; }
.conversation-copy strong, .conversation-copy span, .quick-info-copy strong, .quick-info-copy span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conversation-copy strong, .quick-info-copy strong { font-size: 13px; }
.conversation-copy span, .quick-info-copy span { margin-top: 3px; color: #7b8797; font-size: 11px; }
.badge { display: grid; min-width: 22px; height: 22px; place-items: center; padding: 0 6px; border-radius: 99px; background: #ef4444; color: #fff; font-size: 10px; font-weight: 850; }
.priority-dot { width: 10px; height: 10px; flex: none; border-radius: 50%; background: #8793a5; }
.priority-dot.important { background: #f59e0b; }
.priority-dot.urgent { background: #ef4444; box-shadow: 0 0 0 4px rgba(239,68,68,.1); }

.primary { border: 0; border-radius: 14px; background: #246be8; color: #fff; padding: 12px; font-weight: 800; transition: transform .12s, background .12s; }
.primary:hover { background: #185fcf; }
.primary:active { transform: scale(.98); }
.sidebar-action { margin: 10px 12px max(12px, env(safe-area-inset-bottom)); }

.info-filter { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin: 0 12px 10px; padding: 3px; border: 1px solid #e2e7ee; border-radius: 12px; background: #fff; }
.info-filter button { border: 0; border-radius: 9px; background: transparent; color: #748094; padding: 7px; font-size: 11px; font-weight: 750; }
.info-filter button.active { background: #eaf1fc; color: #2464d9; }

.content-page { min-width: 0; min-height: 0; }
.chat { display: flex; flex-direction: column; background: #fff; }
.chat-head { min-height: 78px; display: flex; flex: none; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 23px; border-bottom: 1px solid #e8ecf2; background: rgba(255,255,255,.9); backdrop-filter: blur(12px); }
.chat-heading { min-width: 0; flex: 1; }
.chat-head h2 { overflow: hidden; margin: 0 0 4px; font-size: 19px; letter-spacing: -.02em; text-overflow: ellipsis; white-space: nowrap; }
.chat-head small { color: #748094; }
.app-switches { display: flex; flex: none; align-items: center; gap: 16px; }
.app-switches a { display: inline-flex; width: 58px; min-width: 58px; height: 58px; flex: 0 0 58px; flex-direction: column; align-items: center; justify-content: center; gap: 4px; border: 0; background: transparent; color: #334155; box-shadow: none; transition: opacity .16s; }
.app-switches a:hover { opacity: .8; }
.app-switches img { display: block; width: 32px; height: 32px; object-fit: contain; }
.app-switches span { display: block; font-size: 10px; font-weight: 500; line-height: 1; letter-spacing: -.01em; white-space: nowrap; }
.delete-conversation { flex: none; border: 1px solid #fecaca; border-radius: 12px; background: #fff1f2; color: #be123c; padding: 9px 12px; font-size: 11px; font-weight: 800; cursor: pointer; }
.delete-conversation:hover { background: #ffe4e6; }
.delete-conversation:disabled { cursor: wait; opacity: .55; }
.mobile-back { display: none; width: 38px; height: 38px; flex: none; place-items: center; border: 1px solid #e1e6ed; border-radius: 12px; background: #fff; color: #33506f; font-size: 28px; line-height: 1; }

.messages { min-height: 0; flex: 1; overflow: auto; overscroll-behavior: contain; padding: 22px clamp(14px, 3vw, 34px); background: radial-gradient(circle at 20% 0, #f3f7ff, transparent 35%), #fafbfd; }
.messenger-row { display: flex !important; width: fit-content !important; height: auto !important; min-height: 0 !important; max-height: none !important; max-width: min(72%, 600px); margin: 6px 0; padding: 0 !important; flex-direction: column; align-items: flex-start; justify-content: flex-start !important; border: 0 !important; background: transparent !important; box-shadow: none !important; }
.messenger-row.mine { margin-left: auto; align-items: flex-end; }
.messenger-bubble { width: fit-content; min-width: 0; max-width: 100%; padding: 9px 13px; border-radius: 18px 18px 18px 5px; background: #e4e6eb; color: #172033; font-size: 14px; line-height: 1.35; overflow-wrap: anywhere; white-space: pre-wrap; box-shadow: none; }
.messenger-row.mine .messenger-bubble { border-radius: 18px 18px 5px 18px; background: #0a7cff; color: #fff; }
.messenger-row small { display: block; margin: 3px 7px 0; color: #7b8797; font-size: 10px; line-height: 1.2; white-space: nowrap; }
.message-date { margin: 16px auto 8px; color: #8a94a3; text-align: center; font-size: 10px; font-weight: 700; }

.empty-state { min-height: 100%; display: flex; align-items: center; justify-content: center; flex-direction: column; color: #718096; text-align: center; }
.empty-state strong { margin-top: 14px; color: #334155; font-size: 17px; }
.empty-state p { max-width: 330px; margin: 6px 0 0; font-size: 13px; line-height: 1.5; }
.empty-icon { display: grid; width: 76px; height: 76px; place-items: center; }
.empty-icon img { width: 100%; height: 100%; object-fit: cover; }
.empty-symbol { display: grid; width: 60px; height: 60px; place-items: center; border-radius: 20px; background: #eaf1fc; color: #246be8; font-size: 28px; font-weight: 900; }
.list-empty { padding: 42px 18px; color: #8a94a3; text-align: center; font-size: 12px; line-height: 1.5; }

#composer { display: flex; flex: none; gap: 9px; padding: 13px 18px max(13px, env(safe-area-inset-bottom)); border-top: 1px solid #e8ecf2; background: #fff; }
#composer input { min-width: 0; flex: 1; border: 1px solid #dce2eb; border-radius: 16px; outline: none; padding: 12px 15px; }
#composer button { border: 0; border-radius: 14px; background: #246be8; color: #fff; padding: 0 19px; font-weight: 800; }
#composer button:disabled { cursor: not-allowed; opacity: .4; }

.info-page { display: flex; min-width: 0; flex-direction: column; background: #fafbfd; }
.info-detail { min-height: 0; flex: 1; overflow: auto; padding: clamp(18px, 4vw, 42px); }
.info-card { max-width: 760px; margin: 0 auto; border: 1px solid #e1e7ef; border-radius: 24px; background: #fff; padding: clamp(20px, 4vw, 34px); box-shadow: 0 16px 45px rgba(30,50,80,.09); }
.info-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.info-card h3 { margin: 12px 0 9px; font-size: 25px; letter-spacing: -.025em; }
.info-card p { color: #475569; line-height: 1.65; white-space: pre-wrap; }
.info-meta { color: #8490a2; font-size: 12px; }
.priority-pill { display: inline-flex; border-radius: 99px; background: #eef2f6; color: #596679; padding: 6px 10px; font-size: 10px; font-weight: 850; text-transform: uppercase; }
.priority-pill.important { background: #fff3d7; color: #9a6200; }
.priority-pill.urgent { background: #fee2e2; color: #b91c1c; }
.ack-button { width: 100%; margin-top: 22px; border: 0; border-radius: 15px; background: #1f7a4c; color: #fff; padding: 13px; font-weight: 850; }
.ack-button:disabled { background: #e7f5ed; color: #26734c; cursor: default; }
.progress-box { margin-top: 22px; border-radius: 17px; background: #f5f8fc; padding: 16px; }
.progress-stats { display: flex; justify-content: space-between; gap: 10px; color: #536176; font-size: 12px; }
.progress-track { height: 8px; overflow: hidden; margin: 10px 0 0; border-radius: 99px; background: #dfe6ef; }
.progress-track span { display: block; height: 100%; border-radius: inherit; background: #246be8; }
.ack-names { margin-top: 11px; color: #758196; font-size: 11px; line-height: 1.55; }

.center-card { max-width: 440px; margin: 16vh auto; padding: 35px; border: 1px solid rgba(210,218,229,.8); border-radius: 28px; background: #fff; box-shadow: 0 25px 70px rgba(120,140,170,.3); text-align: center; }
.center-card h1 { margin: 15px 0 7px; }
.center-card p { color: #718096; line-height: 1.5; }
.status-card { display: flex; align-items: center; flex-direction: column; }
.spinner { width: 38px; height: 38px; border: 4px solid #dbe5f4; border-top-color: #246be8; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.login-actions { display: flex; justify-content: center; gap: 8px; margin-top: 18px; }
.primary-link, .secondary-link { display: inline-block; border-radius: 13px; padding: 11px 16px; font-weight: 800; }
.primary-link { background: #246be8; color: #fff; }
.secondary-link { border: 1px solid #dbe1e9; background: #fff; color: #4c5b70; }

dialog { width: min(520px, calc(100vw - 24px)); max-height: min(760px, calc(100dvh - 24px)); overflow: hidden; border: 0; border-radius: 24px; padding: 0; box-shadow: 0 30px 90px rgba(23,32,51,.4); }
dialog::backdrop { background: rgba(23,32,51,.48); backdrop-filter: blur(5px); }
.modal-form { max-height: min(760px, calc(100dvh - 24px)); display: flex; flex-direction: column; padding: 19px; }
.modal-form header { display: flex; flex: none; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.modal-form h3 { margin: 0; font-size: 19px; }
.modal-form header p { margin: 4px 0 0; color: #7b8797; font-size: 11px; line-height: 1.4; }
.modal-form header button { width: 35px; height: 35px; flex: none; border: 0; border-radius: 50%; background: #eef1f5; color: #526174; font-size: 20px; }
.field-label { margin: 11px 2px 6px; color: #536176; font-size: 11px; font-weight: 800; }
.modal-list { min-height: 90px; max-height: 45vh; overflow: auto; margin-top: 10px; overscroll-behavior: contain; }
.selectable-list { border: 1px solid #e4e8ee; border-radius: 15px; }
.person input { width: 18px; height: 18px; accent-color: #246be8; }
.person > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal-submit { width: 100%; flex: none; margin-top: 14px; }
.recipient-heading { display: flex; align-items: center; justify-content: space-between; margin: 14px 2px 0; font-size: 11px; }
.recipient-heading button { border: 0; background: transparent; color: #246be8; font-size: 11px; font-weight: 750; }

.toast { position: fixed; z-index: 100; left: 50%; bottom: max(22px, env(safe-area-inset-bottom)); max-width: min(420px, calc(100vw - 28px)); transform: translateX(-50%); border-radius: 14px; background: #172033; color: #fff; padding: 11px 16px; box-shadow: 0 12px 35px rgba(15,23,42,.28); font-size: 12px; font-weight: 700; }
.toast.error { background: #b42318; }

@media (max-width: 760px) {
  .app-switches { gap: 6px; }
  .app-switches a { width: 48px; min-width: 48px; height: 52px; flex-basis: 48px; }
  .app-switches img { width: 28px; height: 28px; }
  .app-switches span { font-size: 9px; }
  #app { position: relative; display: block; }
  aside, .content-page { position: absolute; inset: 0; border: 0; }
  aside { width: 100%; }
  .content-page { z-index: 4; display: none; }
  #app.mobile-detail-open aside { display: none; }
  #app.mobile-detail-open .content-page:not([hidden]) { display: flex; }
  .brand { padding-top: max(12px, env(safe-area-inset-top)); }
  .switches { display: none; }
  .page-tabs { margin-top: 2px; }
  .tools { padding-top: 2px; }
  .tools button span { display: inline; }
  .mobile-back { display: grid; }
  .chat-head { min-height: 70px; padding: max(10px, env(safe-area-inset-top)) 12px 10px; }
  .messenger-row { max-width: 84%; }
  .messenger-bubble { padding: 8px 12px; font-size: 14px; }
  .info-detail { padding: 14px; }
  .info-card { border-radius: 19px; padding: 20px; }
  .center-card { width: calc(100% - 24px); margin: 9vh 12px; padding: 28px 18px; }
  .login-actions { width: 100%; }
  .login-actions a { min-width: 0; flex: 1; padding-inline: 8px; font-size: 12px; }
  dialog { border-radius: 20px; }
}

@media (max-width: 380px) {
  .page-tab { font-size: 11px; }
  .tools button span { display: none; }
  .chat-head h2 { font-size: 16px; }
  .delete-conversation { padding: 8px 9px; font-size: 10px; }
  #composer { padding-inline: 10px; }
  #composer button { padding-inline: 13px; }
}
