:root {
  --bg: #f3efe6;
  --paper: #fffcf7;
  --ink: #161410;
  --muted: #6f675c;
  --line: #e6dfd2;
  --side: #14110e;
  --gold: #d4a017;
  --gold-2: #f0c14b;
  --ok: #0f766e;
  --err: #b42318;
  --chat: #fff6e0;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden; }
body {
  font-family: "IBM Plex Sans", sans-serif;
  background: var(--bg);
  color: var(--ink);
}
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--muted); font-size: 13px; }
.err { color: var(--err); min-height: 1.2em; font-size: 13px; }
.brand { font-weight: 700; letter-spacing: -.04em; font-size: 28px; }
.brand span { color: var(--gold); }
.co { margin: 6px 0 0; font-size: 13px; color: #c4b8a4; }
.side-co { margin: 0 10px 14px; font-size: 11px; line-height: 1.35; color: #9a9084; }

.auth {
  min-height: 100%;
  overflow: auto;
  display: grid;
  place-items: center;
  background: radial-gradient(800px 400px at 20% 0%, #3a2a10, var(--side));
  color: #fff;
}
.auth-card {
  width: min(400px, calc(100% - 32px));
  background: #1c1814;
  border: 1px solid #3a3228;
  padding: 28px;
  border-radius: 16px;
}
.auth-card .brand { color: #fff; }
.auth-card form, .inline, .note-edit { display: grid; gap: 10px; }
.auth-card input, .pad input, .pad select, .pad textarea, .composer input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font: inherit;
}
.auth-card input { background: #2a241e; color: #fff; border-color: #4a4034; }

.btn {
  background: var(--gold);
  color: #1a1408;
  border: 0;
  font-weight: 700;
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  font: inherit;
}
.btn:hover { background: var(--gold-2); }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: inherit; }
.icon { border: 0; background: transparent; cursor: pointer; font-size: 18px; }

.app { display: grid; grid-template-columns: 220px 1fr; height: 100%; overflow: hidden; }
.main { min-width: 0; height: 100%; overflow: hidden; position: relative; }
.tab { display: none; overflow: auto; background: var(--bg); height: 100%; }
.tab.on { display: block; }
#tab-chat.tab.on {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  flex: 1;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}
.people {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  border-right: 1px solid var(--line);
  background: var(--paper);
}
.people-label {
  flex-shrink: 0;
  padding: 14px 12px 10px 16px;
  font-weight: 700;
  font-size: 16px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.people-new { padding: 4px 8px; font-size: 12px; white-space: nowrap; }
.people-sub {
  margin: 0;
  padding: 10px 14px 4px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: .04em;
  text-transform: uppercase;
}
.pick-checks { display: grid; gap: 6px; max-height: 40vh; overflow: auto; margin: 10px 0; }
.pick-checks .check { font-size: 14px; }
.people-scroll { flex: 1; min-height: 0; overflow-y: auto; }
.side {
  background: var(--side);
  color: #ece7dc;
  display: flex;
  flex-direction: column;
  padding: 18px 12px;
}
.side-brand { font-size: 22px; padding: 4px 10px 18px; }
.side nav { display: grid; gap: 4px; }
.side nav button {
  text-align: left;
  background: transparent;
  color: #cfc6b6;
  border: 0;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  font: inherit;
}
.side nav button.on, .side nav button:hover { background: #2a241c; color: #fff; }
.side-user { margin-top: auto; padding: 12px; display: flex; gap: 10px; align-items: center; }
.side-user-meta { display: grid; gap: 4px; min-width: 0; }
.side-user .btn { color: #1a1408; }
.avatar {
  border-radius: 50%;
  object-fit: cover;
  background: #2a241c;
  color: var(--gold-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  overflow: hidden;
  flex-shrink: 0;
  line-height: 1;
}
img.avatar { display: block; background: #1c1814; }
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }
.avatar.md { width: 40px; height: 40px; font-size: 14px; }
.avatar.xl { width: 88px; height: 88px; font-size: 28px; }
.avatar.ph { background: #2a241c; }
.profile-photo { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; margin: 12px 0 28px; }
.profile-photo form { display: grid; gap: 10px; min-width: 200px; }
.pad { padding: 22px 24px 40px; }
.narrow { max-width: 560px; }
.row-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.inline { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inline input, .inline select { width: auto; min-width: 140px; }

.person {
  display: flex; width: 100%; text-align: left; gap: 8px; align-items: center;
  padding: 12px 14px; border: 0; background: transparent; cursor: pointer; font: inherit;
  min-width: 0;
}
.person-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-row { display: flex; align-items: stretch; border-bottom: 1px solid var(--line); }
.call-mini {
  border: 0; background: var(--gold); color: #1a1408; font-weight: 700;
  padding: 0 12px; cursor: pointer; font-size: 12px;
}
.call-mini:disabled { opacity: .35; cursor: not-allowed; }
.call-ov { position: fixed; inset: 0; background: rgba(20,16,10,.55); z-index: 200; display: grid; place-items: center; }
.call-card { background: var(--paper); padding: 28px 32px; border-radius: 16px; text-align: center; min-width: 280px; }
.call-card h2 { margin: 8px 0 0; }
.person.on { background: #fff3d1; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #bbb; }
.dot.on { background: #12b886; }
.chat-main {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  height: 100%;
  overflow: hidden;
}
.chat-head {
  flex-shrink: 0;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.msgs {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.bubble {
  max-width: 72%;
  padding: 8px 12px;
  border-radius: 12px;
  background: var(--paper);
  border: 1px solid var(--line);
}
.bubble.mine { align-self: flex-end; background: var(--chat); }
.bubble small { display: block; color: var(--muted); font-size: 11px; margin-bottom: 4px; }
.bubble .meta { display: flex; justify-content: flex-end; gap: 6px; font-size: 11px; color: var(--muted); margin-top: 6px; }
.ticks { color: #53bdeb; letter-spacing: -2px; }
.bubble.media { padding: 6px 6px 8px; max-width: 280px; }
.media-card { overflow: hidden; border-radius: 10px; background: #111; }
.img-preview { display: block; width: 100%; padding: 0; border: 0; background: #111; cursor: zoom-in; }
.img-preview img { display: block; width: 100%; max-height: 320px; object-fit: cover; }
.media-foot { display: flex; justify-content: space-between; gap: 8px; padding: 6px 8px; font-size: 11px; background: rgba(0,0,0,.45); color: #eee; }
.media-foot a { color: var(--gold-2); }
.bubble .cap { padding: 6px 8px 0; }
.file-card { display: flex; gap: 10px; align-items: center; padding: 10px; border-radius: 10px; background: #f3efe6; border: 1px solid var(--line); }
.file-ico { font-size: 22px; }
.img-view { position: fixed; inset: 0; z-index: 220; background: rgba(10,8,6,.92); display: grid; place-items: center; padding: 24px; }
.img-view img { max-width: min(96vw, 1100px); max-height: 90vh; object-fit: contain; border-radius: 8px; }
.img-view-x { position: absolute; top: 16px; right: 18px; background: transparent; border: 0; color: #fff; font-size: 28px; cursor: pointer; }
.composer {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--line);
  background: var(--paper);
  position: relative;
  flex-shrink: 0;
}
.composer input[id="chatInput"] { flex: 1; }
.plus { width: 36px; height: 36px; border-radius: 50%; background: var(--gold); color: #1a1408; font-size: 22px; font-weight: 700; line-height: 1; }
.attach-sheet {
  position: absolute; left: 10px; bottom: 58px; z-index: 40;
  background: #1f2c33; color: #e9edef; border-radius: 16px;
  padding: 16px 14px 12px; display: grid; grid-template-columns: repeat(4, 76px); gap: 14px 8px;
  box-shadow: 0 10px 30px rgba(0,0,0,.35);
}
.attach-item {
  display: grid; justify-items: center; gap: 6px; background: none; border: 0; color: #e9edef;
  font: inherit; font-size: 11px; cursor: pointer; line-height: 1.2; text-align: center;
}
.attach-ico { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; font-size: 22px; color: #fff; }
.c-doc { background: #7f66ff; }
.c-media { background: #007bfc; }
.c-cam { background: #d3396d; }
.c-audio { background: #f26522; }
.c-contact { background: #00a5f4; }
.c-poll { background: #ffb300; }
.c-loc { background: #1faa61; }
.c-live { background: #0d9f5f; }
.pick-ov { position: fixed; inset: 0; z-index: 210; background: rgba(10,8,6,.45); display: grid; place-items: center; padding: 20px; }
.pick-card { background: var(--paper); border-radius: 14px; padding: 16px; width: min(420px, 100%); max-height: 80vh; overflow: auto; }
.loc-card { display: block; text-decoration: none; color: inherit; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #eef6f0; }
.loc-card .loc-pin { padding: 18px 12px 8px; font-size: 28px; }
.loc-card p { margin: 0 12px 12px; }
.loc-card.live { background: #e7f8ee; }
.poll-opt { display: block; width: 100%; text-align: left; margin: 6px 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: pointer; font: inherit; }
.poll-opt.on { border-color: var(--gold); background: #fff6e0; }
.contact-card { padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: #f6f3ec; }
.chat-audio { width: 100%; margin-top: 6px; }
.chat-video { width: 100%; max-height: 280px; border-radius: 10px; background: #111; }

.cards { display: grid; gap: 10px; margin-top: 16px; }
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
}
.st {
  font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em;
  padding: 4px 10px; border-radius: 999px; color: #fff;
}
.st.open { background: #d97706; }
.st.doing { background: #2563eb; }
.st.done { background: #0f766e; }
.card.status-open { border-left: 6px solid #d97706; background: #fff8ee; }
.card.status-doing { border-left: 6px solid #2563eb; background: #eef4ff; }
.card.status-done { border-left: 6px solid #0f766e; background: #eefaf6; }
.tid { font-family: ui-monospace, monospace; font-weight: 800; color: #7c5c12; }
.task-body { white-space: pre-wrap; margin: 8px 0; }
.late { color: #b42318; font-weight: 700; }
.task-legend { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 4px; }
.task-form { display: grid; gap: 10px; margin: 12px 0 8px; max-width: 720px; }
.task-form textarea { width: 100%; min-height: 110px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font: inherit; resize: vertical; }
.due-lab { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.totp-box { margin-top: 14px; display: grid; gap: 10px; }
.totp-box img { width: 180px; height: 180px; background: #fff; border-radius: 12px; }
.totp-row { display: flex; align-items: center; gap: 18px; margin: 12px 0; }
.totp-code {
  font-size: 42px; font-weight: 800; letter-spacing: .18em; font-family: ui-monospace, monospace;
  background: transparent; border: 0; padding: 0; cursor: pointer; color: inherit;
}
.totp-ring { width: 42px; height: 42px; }
.amz-codes { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.amz-card { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.amz-card .totp-code { font-size: 28px; letter-spacing: .14em; padding: 6px 0; width: 100%; text-align: left; }
.totp-code.copied { color: #0f766e; }
.amz-card header { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.amz-actions { display: flex; gap: 6px; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }
.amz-actions .btn { padding: 6px 10px; font-size: 12px; }
.amz-store { font-size: 15px; line-height: 1.3; padding-top: 4px; }
.amz-share { margin-top: 10px; font-size: 13px; }
.amz-share-by { margin: 8px 0 0; }
.amz-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .02em;
  background: var(--gold);
  color: #1a1408;
  padding: 2px 6px;
  border-radius: 6px;
  vertical-align: middle;
}
.copy-txt { background: transparent; border: 0; padding: 0; font: inherit; cursor: pointer; text-align: left; word-break: break-all; }
.note-item { display: block; width: 100%; text-align: left; padding: 10px; border: 1px solid var(--line); background: var(--paper); border-radius: 10px; margin: 6px 0; cursor: pointer; font: inherit; }
.notes-layout { display: grid; grid-template-columns: 280px 1fr; gap: 18px; }
.note-edit textarea { min-height: 280px; resize: vertical; }
.check { display: flex; gap: 8px; align-items: center; font-size: 14px; }
.file-table { margin-top: 14px; display: grid; gap: 8px; }
.file-row, .user-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: center;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
}
.user-row { grid-template-columns: auto 1fr 1fr auto auto; }
.sounds { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.sounds button {
  padding: 10px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--paper); cursor: pointer; font: inherit;
}
.sounds button.on { background: var(--gold); border-color: var(--gold); font-weight: 700; }
.row { display: flex; gap: 8px; }

@media (max-width: 860px) {
  .app {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
  }
  .side { flex-direction: row; flex-wrap: wrap; height: auto; }
  .side nav { display: flex; overflow: auto; }
  .side-user { margin: 0 0 0 auto; flex-direction: row; align-items: center; }
  .chat-layout { grid-template-columns: 148px minmax(0, 1fr); }
  .notes-layout, .user-row { grid-template-columns: 1fr; }
  .call-mini { display: none; }
}
