:root {
  color-scheme: light;
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #f1f3f8;
  --sidebar: #ffffff;
  --line: #e2e5ee;
  --text: #1f2433;
  --muted: #676f83;
  --brand: #6c5ce7;
  --brand-strong: #5847d6;
  --brand-tint: rgba(108, 92, 231, 0.12);
  --ok: #00a65f;
  --danger: #d83a52;
  --hover: rgba(31, 36, 51, 0.05);
  --shadow: 0 12px 40px rgba(31, 36, 51, 0.14);
  --on-color: #ffffff;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;
    --bg: #0f1117;
    --surface: #181b24;
    --surface-2: #1f2330;
    --sidebar: #141720;
    --line: #2c3141;
    --text: #e8eaf1;
    --muted: #9aa1b5;
    --brand: #8b7cf6;
    --brand-strong: #a497ff;
    --brand-tint: rgba(139, 124, 246, 0.16);
    --ok: #34d399;
    --danger: #f2667c;
    --hover: rgba(255, 255, 255, 0.06);
    --shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

a {
  color: var(--brand-strong);
}

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

input,
select,
textarea {
  min-width: 0;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 1px;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.2;
}

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

.small {
  font-size: 0.85rem;
}

.ok {
  color: var(--ok);
  font-weight: 600;
}

.right {
  text-align: right;
}

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

.row.end {
  justify-content: flex-end;
}

.loading {
  padding: 48px 16px;
  color: var(--muted);
  text-align: center;
}

/* ------------------------------------------------------------ buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.btn:hover {
  background: var(--hover);
}

.btn.primary {
  border-color: var(--brand);
  background: var(--brand);
  color: var(--on-color);
}

.btn.primary:hover {
  background: var(--brand-strong);
}

.btn.danger {
  border-color: var(--danger);
  color: var(--danger);
}

.btn.ghost {
  border-color: transparent;
  background: transparent;
}

.btn.small {
  padding: 4px 10px;
  font-size: 0.85rem;
}

.btn.big {
  padding: 12px 22px;
  font-size: 1rem;
}

.btn:disabled {
  opacity: 0.6;
  cursor: progress;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  height: 28px;
  padding: 0 6px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.icon-btn:hover {
  background: var(--hover);
  color: var(--text);
}

.pill {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.pill-staff,
.pill.role-owner {
  background: var(--brand-tint);
  color: var(--brand-strong);
}

.avatar {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--brand);
  color: var(--on-color);
  font-size: 0.8rem;
  font-weight: 700;
}

.avatar.small {
  width: 22px;
  height: 22px;
  font-size: 0.7rem;
  vertical-align: middle;
}

/* ------------------------------------------------------------ shell */

.shell {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  height: 100vh;
  padding: 16px 12px;
  overflow-y: auto;
  border-right: 1px solid var(--line);
  background: var(--sidebar);
}

.brand {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 4px 8px;
  color: var(--text);
  font-size: 1.05rem;
  text-decoration: none;
}

.brand b {
  color: var(--brand-strong);
}

.brand-mark {
  display: block;
  width: 24px;
  height: 24px;
}

.brand-mark.big {
  width: 56px;
  height: 56px;
}

.nav-label {
  display: block;
  margin: 8px 8px 4px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.ws-picker select {
  width: 100%;
}

.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar nav a,
.nav-add {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 7px 8px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--text);
  text-align: left;
  text-decoration: none;
  overflow-wrap: anywhere;
  cursor: pointer;
}

.sidebar nav a:hover,
.nav-add:hover {
  background: var(--hover);
}

.sidebar nav a[aria-current='page'] {
  background: var(--brand-tint);
  color: var(--brand-strong);
  font-weight: 600;
}

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

.nav-icon {
  width: 18px;
  text-align: center;
}

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  gap: 12px;
  align-items: center;
  min-height: 52px;
  padding: 8px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.crumb {
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-right {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-left: auto;
}

.menu-toggle {
  display: none;
}

.content {
  width: 100%;
  max-width: 1600px;
  padding: 24px;
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 18px;
}

.page-head h1 {
  font-size: 1.6rem;
}

.page-head p {
  margin: 4px 0 0;
  color: var(--muted);
}

.panel {
  margin-bottom: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.panel-head {
  display: flex;
  gap: 8px;
  align-items: baseline;
  margin-bottom: 12px;
}

.panel.empty {
  padding: 40px 18px;
  text-align: center;
}

.panel.empty p {
  max-width: 460px;
  margin: 8px auto 16px;
  color: var(--muted);
}

/* ------------------------------------------------------------ welcome */

.welcome {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px 16px;
  text-align: center;
  grid-column: 1 / -1;
}

.welcome h1 {
  font-size: clamp(2rem, 6vw, 3rem);
}

.welcome h1 b {
  color: var(--brand-strong);
}

.welcome p {
  max-width: 520px;
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
}

/* ------------------------------------------------------------ workspaces */

.ws-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.ws-card {
  display: flex;
  gap: 12px;
  align-items: center;
  margin: 0;
  color: var(--text);
  text-decoration: none;
}

a.ws-card:hover {
  border-color: var(--brand);
}

.ws-card b,
.ws-card small {
  display: block;
}

.ws-card small {
  color: var(--muted);
}

.ws-card.new {
  flex-direction: column;
  align-items: stretch;
  border-style: dashed;
}

.ws-card.new input {
  flex: 1;
}

.ws-mark {
  display: grid;
  flex: none;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  color: var(--on-color);
  font-weight: 800;
}

/* ------------------------------------------------------------ team */

.invite-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
}

.list-table {
  width: 100%;
  border-collapse: collapse;
}

.list-table th,
.list-table td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.list-table th {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.danger-zone {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.danger-zone p {
  margin: 2px 0 0;
}

/* ------------------------------------------------------------ board */

.board-head {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.board-title {
  flex: 1 1 260px;
  padding: 4px 8px;
  border-color: transparent;
  background: transparent;
  font-size: 1.6rem;
  font-weight: 700;
}

.board-title:hover,
.group-title:hover,
.drawer-title:hover {
  border-color: var(--line);
}

.board-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.segmented {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
}

.segmented a {
  padding: 4px 12px;
  border-radius: 6px;
  color: var(--muted);
  font-weight: 600;
  text-decoration: none;
}

.segmented a[aria-current='page'] {
  background: var(--brand-tint);
  color: var(--brand-strong);
}

.search {
  width: 180px;
}

.group {
  margin-bottom: 22px;
}

.group-head {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-bottom: 6px;
}

.group-head .icon-btn:first-child {
  color: var(--group);
}

.group-title {
  width: auto;
  max-width: 100%;
  padding: 3px 6px;
  border-color: transparent;
  background: transparent;
  color: var(--group);
  font-size: 1.05rem;
  font-weight: 700;
}

.table-scroll {
  overflow-x: auto;
}

.board-table {
  width: max-content;
  min-width: 100%;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
  border-left: 5px solid var(--group);
  border-radius: 8px;
  background: var(--surface);
  overflow: hidden;
}

.board-table th,
.board-table td {
  height: 38px;
  padding: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-align: center;
}

.board-table th {
  background: var(--surface);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
}

.board-table th:last-child,
.board-table td:last-child {
  border-right: 0;
}

.board-table .name-col {
  position: sticky;
  left: 0;
  z-index: 1;
  width: 280px;
  background: var(--surface);
  text-align: left;
}

.name-wrap {
  display: flex;
  align-items: center;
  height: 37px;
}

.board-table th.name-col {
  padding: 0 12px;
}

.board-table .add-col {
  width: 44px;
}

.board-table .type-status {
  width: 140px;
}

.board-table .type-date {
  width: 150px;
}

.board-table .type-person {
  width: 210px;
}

.board-table .type-number {
  width: 120px;
}

.board-table .type-text {
  width: 220px;
}

.board-table .add-row .name-col {
  position: static;
}

.col-head {
  width: 100%;
  height: 100%;
  min-height: 38px;
  padding: 0 8px;
  border: 0;
  background: none;
  color: inherit;
  font-weight: 600;
  cursor: pointer;
}

.col-head:hover {
  background: var(--hover);
}

.cell-input {
  width: 100%;
  height: 100%;
  min-height: 37px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 0;
  background: transparent;
  text-align: center;
}

.cell-input:hover {
  border-color: var(--line);
}

.cell-input.name {
  flex: 1;
  text-align: left;
}

.cell-input.num {
  text-align: right;
}

.open-item {
  flex: none;
  padding: 0 10px;
  color: var(--muted);
  font-size: 0.82rem;
  text-decoration: none;
  white-space: nowrap;
}

.open-item:hover {
  color: var(--brand-strong);
}

.status-cell {
  width: 100%;
  height: 100%;
  min-height: 37px;
  border: 0;
  background: var(--status);
  color: var(--on-color);
  font-weight: 600;
  cursor: pointer;
}

.fields .status-cell.empty::after {
  content: 'Select…';
  color: var(--muted);
  font-weight: 400;
}

.status-cell:hover {
  filter: brightness(0.95);
  box-shadow: inset 0 0 0 1px var(--line);
}

.add-row td {
  border-right: 0;
}

.add-row form {
  display: flex;
  width: 100%;
}

.add-row input {
  flex: 1;
  height: 37px;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.add-group {
  margin-bottom: 24px;
}

/* ------------------------------------------------------------ kanban */

.lane-by {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
  color: var(--muted);
}

.kanban {
  display: grid;
  grid-auto-columns: minmax(310px, 1fr);
  grid-auto-flow: column;
  gap: 18px;
  padding-bottom: 16px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
}

/* Lanes fill the screen height so there's room to drop cards anywhere. */
.lane {
  display: flex;
  flex-direction: column;
  min-height: max(420px, calc(100vh - 210px));
  border: 1px solid var(--line);
  border-top: 5px solid var(--status);
  border-radius: 14px;
  background: var(--surface-2);
  scroll-snap-align: start;
}

.lane.drop {
  outline: 2px dashed var(--brand);
}

.lane h2 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 12px;
  font-size: 1.05rem;
}

.lane h2 span {
  min-width: 26px;
  padding: 1px 9px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
}

.lane-cards {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 12px;
  padding: 0 14px 16px;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 96px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--status);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(31, 36, 51, 0.06);
  color: var(--text);
  font-size: 1rem;
  line-height: 1.4;
  text-decoration: none;
  cursor: grab;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.card:hover {
  border-color: var(--brand);
  box-shadow: 0 6px 18px rgba(31, 36, 51, 0.12);
  transform: translateY(-1px);
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-top: auto;
  color: var(--muted);
  font-size: 0.88rem;
}

.card-meta .avatar.small {
  width: 26px;
  height: 26px;
  font-size: 0.75rem;
}

/* ------------------------------------------------------------ item drawer */

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(15, 17, 23, 0.35);
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 21;
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: min(720px, 100%);
  padding: 24px 28px;
  overflow-y: auto;
  border-left: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.drawer-head {
  display: flex;
  gap: 8px;
  align-items: center;
}

.drawer-title {
  flex: 1;
  border-color: transparent;
  background: transparent;
  font-size: 1.5rem;
  font-weight: 700;
}

.fields {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 10px 16px;
  align-items: center;
  margin: 0;
}

.fields dt {
  color: var(--muted);
  font-size: 0.85rem;
}

.fields dd {
  margin: 0;
}

.fields .cell-input,
.fields select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: left;
}

.fields .status-cell {
  border-radius: 8px;
  background: var(--status);
  box-shadow: inset 0 0 0 1px var(--line);
}

.drawer h3 {
  margin-top: 6px;
}

.update-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
}

.update-form textarea {
  width: 100%;
  resize: vertical;
}

.updates {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.updates li {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.updates p {
  margin: 8px 0 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.update-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.update-meta time {
  color: var(--muted);
  font-size: 0.8rem;
}

.drawer > .btn.danger {
  align-self: flex-start;
  margin-top: auto;
}

/* ------------------------------------------------------------ menus, dialogs, toasts */

.menu {
  position: absolute;
  z-index: 40;
  display: flex;
  flex-direction: column;
  min-width: 180px;
  max-height: 320px;
  padding: 6px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.menu button {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 7px 10px;
  border: 0;
  border-radius: 6px;
  background: none;
  text-align: left;
  cursor: pointer;
}

.menu button:hover,
.menu button:focus-visible {
  background: var(--hover);
}

.menu button.danger {
  color: var(--danger);
}

.swatch {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  background: var(--status);
}

.dialog {
  width: min(440px, calc(100% - 32px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

.dialog::backdrop {
  background: rgba(15, 17, 23, 0.45);
}

.dialog form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px;
}

.dialog label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 600;
}

.dialog p {
  margin: 0;
}

.label-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px;
  gap: 8px;
}

.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  z-index: 50;
  max-width: calc(100% - 32px);
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--text);
  color: var(--bg);
  box-shadow: var(--shadow);
  transform: translateX(-50%);
}

/* ------------------------------------------------------------ mail */

.sidebar nav .nav-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.count {
  padding: 0 7px;
  border-radius: 999px;
  background: var(--brand);
  color: var(--on-color);
  font-size: 0.72rem;
  font-weight: 700;
}

.mail-layout {
  display: grid;
  grid-template-columns: 190px minmax(300px, 400px) minmax(0, 1fr);
  min-height: calc(100vh - 190px);
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
}

.thread-list {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  overflow-y: auto;
}

.segmented.tabs {
  margin: 10px;
  align-self: flex-start;
}

.thread-row {
  display: grid;
  gap: 2px;
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  border-left: 3px solid transparent;
  color: var(--text);
  text-decoration: none;
}

.thread-row:hover {
  background: var(--hover);
}

.thread-row[aria-current='true'] {
  border-left-color: var(--brand);
  background: var(--brand-tint);
}

.thread-row.unread .thread-top b,
.thread-row.unread .thread-subject {
  font-weight: 800;
}

.thread-row.unread .thread-top b::before {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--brand);
  content: '';
  vertical-align: middle;
}

.thread-top {
  display: flex;
  gap: 8px;
  justify-content: space-between;
}

.thread-top b {
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thread-top time {
  flex: none;
  color: var(--muted);
  font-size: 0.8rem;
}

.thread-subject,
.thread-snippet {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thread-snippet {
  color: var(--muted);
  font-size: 0.85rem;
}

.thread-tags {
  display: flex;
  gap: 6px;
  align-items: center;
  min-height: 0;
}

.thread-tags:empty {
  display: none;
}

.load-more {
  margin: 10px;
}

.empty-list {
  margin: 0;
  padding: 40px 16px;
  color: var(--muted);
  text-align: center;
}

.conversation {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow-y: auto;
}

.convo-head {
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--line);
}

.convo-head h2 {
  margin-bottom: 10px;
  font-size: 1.25rem;
  overflow-wrap: anywhere;
}

.convo-head p {
  margin: 8px 0 0;
}

.convo-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.back-to-list {
  display: none;
  margin-bottom: 8px;
}

.messages {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 18px;
}

.message {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.message.out {
  border-color: var(--brand-tint);
  background: color-mix(in srgb, var(--brand-tint) 40%, var(--surface));
}

.message header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  margin-bottom: 12px;
  overflow-wrap: anywhere;
}

.message-text {
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.mail-frame {
  display: block;
  width: 100%;
  height: 40px; /* grows to fit once loaded (mail.js afterRender) */
  border: 0;
  border-radius: 6px;
  background: #fff;
}

.warning,
.callout {
  border-color: var(--warn-line, #f0b45b);
  background: var(--warn-bg, rgba(245, 158, 11, 0.08));
}

.warning {
  margin: 0 0 10px;
  padding: 8px 10px;
  border: 1px solid #f0b45b;
  border-radius: 8px;
  font-size: 0.88rem;
}

.callout p {
  margin: 8px 0 0;
}

.warn-text {
  color: var(--danger);
  font-weight: 600;
}

.images-note {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.85rem;
}

.link-btn {
  padding: 0;
  border: 0;
  background: none;
  color: var(--brand-strong);
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
}

.attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.attachment {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  cursor: pointer;
}

.attachment:hover {
  border-color: var(--brand);
}

.reply-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: auto;
  padding: 14px 18px 18px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.reply-box label {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 0.85rem;
}

.reply-box textarea {
  resize: vertical;
}

.mailbox-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.address-input {
  display: flex;
  gap: 4px;
  align-items: center;
}

.address-input input {
  flex: 1;
}

.check {
  display: flex;
  gap: 8px;
  align-items: center;
}

.dialog.wide {
  width: min(600px, calc(100% - 32px));
}

.dialog textarea {
  width: 100%;
  resize: vertical;
}

.dialog label.check {
  flex-direction: row;
  font-weight: 400;
}

/* ------------------------------------------------------------ small screens */

@media (max-width: 860px) {
  .mail-layout {
    grid-template-columns: minmax(0, 1fr);
    min-height: 0;
  }

  .mail-layout.has-thread .thread-list,
  .mail-layout:not(.has-thread) .conversation {
    display: none;
  }

  .thread-list {
    border-right: 0;
  }

  .back-to-list {
    display: inline-flex;
  }

  .shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 30;
    width: 260px;
    box-shadow: var(--shadow);
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }

  .shell.sidebar-open .sidebar {
    transform: none;
  }

  .menu-toggle {
    display: inline-grid;
  }

  .topbar {
    padding: 8px 16px;
  }

  .content {
    padding: 16px;
  }

  .board-tools {
    width: 100%;
  }

  .search {
    flex: 1 1 100%;
    order: -1;
    width: auto;
  }

  .board-tools .btn.primary {
    margin-left: auto;
  }

  .board-table .name-col {
    width: 200px;
  }
}

@media (max-width: 560px) {
  .invite-form {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .invite-form .btn {
    grid-column: 1 / -1;
  }

  .fields {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
  }

  .fields dd {
    margin-bottom: 8px;
  }

  /* Just the shield on phones; it still opens the admin console. */
  .topbar .pill-staff {
    padding: 4px 9px;
    font-size: 1rem;
  }

  .topbar .pill-label {
    display: none;
  }


  .kanban {
    grid-auto-columns: 85%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar {
    transition: none;
  }
}

/* ------------------------------------------------------------ sign-in (signin.js) */

.welcome.auth {
  justify-content: flex-start;
  padding-top: max(48px, 8vh);
}

.auth-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: min(420px, 100%);
  margin: 12px 0 4px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: left;
}

.btn.google {
  width: 100%;
  gap: 10px;
}

.auth-or {
  display: flex;
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-size: 0.85rem;
}

.auth-or::before,
.auth-or::after {
  content: '';
  flex: 1;
  border-top: 1px solid var(--line);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-form h2 {
  font-size: 1.15rem;
}

.welcome .auth-form p {
  font-size: 0.9rem;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-weight: 600;
}

.auth-field input {
  padding: 10px 12px;
  font-size: 1rem;
  font-weight: 400;
}

.auth-form .btn.big {
  width: 100%;
}

.auth-links {
  text-align: center;
}

.link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--brand-strong);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.link:hover {
  text-decoration: underline;
}

.auth-error,
.auth-notice {
  margin: 0;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 0.9rem;
}

.auth-error {
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  color: var(--danger);
}

.auth-notice {
  background: var(--brand-tint);
  color: var(--brand-strong);
}

.code-input {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 1.3rem !important;
  letter-spacing: 0.35em;
}

/* ------------------------------------------------------------ profile (account.js) */

.profile-grid {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.profile-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
  text-align: center;
}

.profile-card h2 {
  margin-top: 8px;
  font-size: 1.25rem;
}

.profile-card .muted {
  margin: 0 0 6px;
  word-break: break-all;
}

.avatar.huge {
  width: 88px;
  height: 88px;
  background: linear-gradient(135deg, #8b6bff, #00c2ff);
  font-size: 2.2rem;
}

.facts {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px 12px;
  width: 100%;
  margin: 16px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  text-align: left;
}

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

.facts dd {
  margin: 0;
  font-weight: 600;
  text-align: right;
}

.profile-main .panel h2,
.data-table + .muted,
.panel-head h2 {
  font-size: 1.05rem;
}

.panel-head.spread {
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 520px;
  margin-bottom: 10px;
}

.stack label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-weight: 600;
}

.stack input,
.stack textarea {
  font-weight: 400;
}

.badge {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.badge.ok {
  background: color-mix(in srgb, var(--ok) 15%, transparent);
  color: var(--ok);
}

.badge.warn {
  background: color-mix(in srgb, #f59e0b 18%, transparent);
  color: #b45309;
}

.toggle {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  font-weight: 600;
  cursor: pointer;
}

.toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
}

.dot {
  width: 8px;
  height: 8px;
  margin-left: auto;
  border-radius: 50%;
  background: #f59e0b;
}

.banner {
  display: flex;
  gap: 14px;
  align-items: center;
  border-color: color-mix(in srgb, var(--brand) 35%, var(--line));
  background: linear-gradient(90deg, var(--brand-tint), transparent 70%), var(--surface);
  color: var(--text);
  text-decoration: none;
}

.banner > span:first-child {
  font-size: 1.6rem;
}

.banner > span:nth-child(2) {
  display: flex;
  flex: 1;
  flex-direction: column;
}

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

/* ------------------------------------------------------------ admin console (account.js) */

.admin-tabs a {
  padding: 7px 16px;
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.stat-row .stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
}

.stat span {
  color: var(--muted);
  font-size: 0.85rem;
}

.stat b {
  font-size: 1.8rem;
  line-height: 1.1;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.data-table th {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.data-table tbody tr:hover {
  background: var(--hover);
}

.data-table tr.is-disabled td {
  opacity: 0.55;
}

.user-cell {
  display: flex;
  gap: 10px;
  align-items: center;
  min-width: 200px;
}

.user-cell > span:last-child {
  display: flex;
  flex-direction: column;
}

.user-cell small {
  color: var(--muted);
}

@media (max-width: 860px) {
  .profile-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .kanban {
    grid-auto-columns: minmax(82vw, 1fr);
  }

  .lane {
    min-height: 360px;
  }

  .drawer {
    padding: 18px;
  }
}

/* ------------------------------------------------------------ avatars with photos (avatar.js) */

.avatar {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #8b6bff, #00c2ff);
}

.avatar > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-link {
  display: inline-flex;
  border-radius: 50%;
}

.avatar-link:hover .avatar,
.avatar-link:focus-visible .avatar {
  box-shadow: 0 0 0 3px var(--brand-tint);
}

a.pill-staff {
  text-decoration: none;
}

a.pill-staff:hover {
  background: var(--brand);
  color: var(--on-color);
}

.photo-edit {
  position: relative;
}

.photo-button {
  position: absolute;
  right: -2px;
  bottom: -2px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 3px solid var(--surface);
  border-radius: 50%;
  background: var(--brand);
  font-size: 0.95rem;
  cursor: pointer;
}

.photo-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin: 6px 0 2px;
}

.photo-actions label.btn {
  cursor: pointer;
}

.avatar.huge {
  width: 112px;
  height: 112px;
  font-size: 2.6rem;
}

/* ------------------------------------------------------------ mail folders, toolbar and selection (mail.js) */

.mail-folders {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 8px;
  border-right: 1px solid var(--line);
  background: var(--surface-2);
}

.mail-folders a {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}

.mail-folders a:hover {
  background: var(--hover);
}

.mail-folders a[aria-current='page'] {
  background: var(--brand-tint);
  color: var(--brand-strong);
}

.folder-icon {
  width: 20px;
  text-align: center;
}

.folder-count {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.8rem;
}

.folder-count.strong {
  padding: 0 8px;
  border-radius: 999px;
  background: var(--brand);
  color: var(--on-color);
  font-weight: 700;
}

.mail-toolbar {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.mail-toolbar .row {
  flex-wrap: wrap;
  min-height: 32px;
}

.mail-search {
  flex: 1;
  min-width: 120px;
}

.folder-note {
  margin: 0;
  padding: 8px 14px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.82rem;
}

.thread-item {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  border-top: 1px solid var(--line);
}

.thread-item .thread-row {
  border-top: 0;
  padding-left: 4px;
}

.thread-item.selected {
  background: var(--brand-tint);
}

.thread-check {
  display: grid;
  place-items: center;
  width: 36px;
  min-height: 32px;
  cursor: pointer;
}

.thread-check input {
  width: 17px;
  height: 17px;
  accent-color: var(--brand);
  cursor: pointer;
}

.convo-empty {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.convo-empty span {
  font-size: 2.6rem;
  opacity: 0.5;
}

@media (max-width: 1100px) and (min-width: 861px) {
  .mail-layout {
    grid-template-columns: 64px minmax(260px, 340px) minmax(0, 1fr);
  }

  .mail-folders a {
    justify-content: center;
    padding: 10px 0;
  }

  .mail-folders a > span:not(.folder-icon) {
    display: none;
  }
}

/* Phones: folders become a row of chips above the list. */
@media (max-width: 860px) {
  .mail-folders {
    flex-direction: row;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .mail-folders a {
    flex: none;
    padding: 7px 12px;
  }

  .mail-layout.has-thread .mail-folders {
    display: none;
  }
}

/* ------------------------------------------------------------ workspace cards with delete */

.ws-card-wrap {
  position: relative;
}

.ws-card-wrap .ws-card {
  height: 100%;
  margin: 0;
  padding-right: 48px;
}

.ws-delete {
  position: absolute;
  top: 10px;
  right: 10px;
  opacity: 0.55;
}

.ws-card-wrap:hover .ws-delete,
.ws-delete:focus-visible {
  opacity: 1;
}

.ws-delete:hover {
  background: color-mix(in srgb, var(--danger) 14%, transparent);
  color: var(--danger);
}

/* ------------------------------------------------------------ messages (chat.js) */

.content.wide {
  max-width: none;
}

.chat-layout {
  display: grid;
  grid-template-columns: minmax(250px, 320px) minmax(0, 1fr);
  height: calc(100vh - 190px);
  min-height: 460px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
}

.chat-list {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: var(--surface-2);
  overflow-y: auto;
}

.chat-new {
  display: flex;
  gap: 6px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.chat-new select {
  flex: 1;
  min-width: 0;
}

.chat-section {
  margin: 14px 14px 6px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.chat-none {
  margin: 0 14px;
}

.chat-conv {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 0 6px;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
}

.chat-conv:hover {
  background: var(--hover);
}

.chat-conv[aria-current='page'] {
  background: var(--brand-tint);
}

.chat-conv-icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, #8b6bff, #00c2ff);
  color: #fff;
  font-weight: 800;
}

.chat-conv-text {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.chat-conv-text b,
.chat-conv-text small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-conv-text b {
  font-weight: 600;
}

.chat-conv-text small,
.chat-conv time {
  color: var(--muted);
  font-size: 0.78rem;
}

.chat-conv.unread b {
  font-weight: 800;
}

.chat-conv.unread time::after {
  display: block;
  width: 8px;
  height: 8px;
  margin: 4px 0 0 auto;
  border-radius: 50%;
  background: var(--brand);
  content: '';
}

.chat-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.chat-head {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.chat-head > div {
  flex: 1;
  min-width: 0;
}

.chat-head h2 {
  font-size: 1.05rem;
}

.chat-messages {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 6px;
  padding: 16px;
  overflow-y: auto;
}

.chat-day {
  align-self: center;
  margin: 10px 0 4px;
  padding: 2px 12px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.78rem;
}

.chat-msg {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  max-width: min(640px, 85%);
}

.chat-msg.mine {
  align-self: flex-end;
}

.chat-bubble {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 12px;
  border-radius: 14px 14px 14px 4px;
  background: var(--surface-2);
}

.chat-msg.mine .chat-bubble {
  border-radius: 14px 14px 4px 14px;
  background: var(--brand);
  color: var(--on-color);
}

.chat-msg.mine .chat-bubble a {
  color: inherit;
}

.chat-bubble p {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.chat-author {
  color: var(--brand-strong);
  font-size: 0.78rem;
  font-weight: 700;
}

.chat-bubble time {
  align-self: flex-end;
  opacity: 0.65;
  font-size: 0.7rem;
}

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

.chat-meeting > span:first-child {
  font-size: 1.5rem;
}

.chat-meeting > span:nth-child(2) {
  display: flex;
  flex-direction: column;
}

.chat-compose {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
}

.chat-compose textarea {
  flex: 1;
  min-height: 42px;
  max-height: 160px;
  resize: none;
}

/* ------------------------------------------------------------ meetings (meet.js) */

.meetings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 420px);
  gap: 20px;
  align-items: start;
}

.section-title {
  margin: 4px 0 12px;
  font-size: 1rem;
}

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

.meeting-row.cancelled {
  opacity: 0.6;
}

.meeting-date {
  display: flex;
  flex: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 12px;
  background: var(--brand-tint);
  color: var(--brand-strong);
}

.meeting-date b {
  font-size: 1.35rem;
  line-height: 1;
}

.meeting-date span {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.meeting-main {
  flex: 1;
  min-width: 0;
}

.meeting-main h3 {
  font-size: 1.05rem;
}

.meeting-main p {
  margin: 2px 0 6px;
}

.meeting-people {
  display: flex;
  gap: 4px;
  align-items: center;
}

.meeting-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.meeting-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.meeting-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-weight: 600;
}

.meeting-form input,
.meeting-form select {
  font-weight: 400;
}

.meeting-form .wide {
  grid-column: 1 / -1;
}

.meeting-form label.check {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.contact-picks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  padding: 3px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.82rem;
  cursor: pointer;
}

.chip:disabled {
  opacity: 0.45;
}

.lobby {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  max-width: 620px;
  margin: 24px auto;
  padding: 36px 24px;
  text-align: center;
}

.lobby-icon {
  font-size: 3rem;
}

.lobby-buttons,
.lobby-links {
  flex-wrap: wrap;
  justify-content: center;
}

.call-return {
  display: block;
  width: 100%;
  margin-bottom: 14px;
  padding: 10px 14px;
  border: 0;
  border-radius: 10px;
  background: #0a8f5a;
  color: #fff;
  font: inherit;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

/* ------------------------------------------------------------ the call room (meet.js) */

#call-root {
  position: fixed;
  inset: 0;
  z-index: 50;
}

#call-root.minimized {
  inset: auto 16px 16px auto;
  width: min(340px, calc(100vw - 32px));
  height: 230px;
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}

.call {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #0b0c14;
  color: #f1f0ff;
}

.call-head {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 10px 16px;
  padding-top: max(10px, env(safe-area-inset-top));
}

.call-head .muted {
  color: #a9a7c8;
}

.call-min {
  margin-left: auto;
  color: #f1f0ff;
}

.rec-indicator {
  padding: 2px 10px;
  border-radius: 999px;
  background: #d0263e;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
}

.call-stage {
  display: grid;
  flex: 1;
  gap: 10px;
  min-height: 0;
  padding: 0 12px;
}

.call-stage.with-content {
  grid-template-columns: minmax(0, 3fr) minmax(180px, 1fr);
}

.call-content {
  position: relative;
  min-height: 0;
  border-radius: 12px;
  background: #000;
  overflow: hidden;
}

.call-content video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.call-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  grid-auto-rows: minmax(140px, 1fr);
  min-height: 0;
  overflow-y: auto;
}

.call-stage.with-content .call-grid {
  grid-template-columns: 1fr;
  grid-auto-rows: minmax(110px, 160px);
}

.call-tile {
  position: relative;
  display: grid;
  place-items: center;
  border: 2px solid transparent;
  border-radius: 12px;
  background: #1c1d2e;
  overflow: hidden;
}

.call-tile.speaking {
  border-color: #00c2ff;
}

.call-tile video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  visibility: hidden;
}

.call-tile video.mirror {
  transform: scaleX(-1);
}

.call-tile.has-video video {
  visibility: visible;
}

.call-tile.has-video .tile-avatar {
  visibility: hidden;
}

.tile-avatar {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, #8b6bff, #00c2ff);
  font-size: 1.8rem;
  font-weight: 800;
}

.tile-name {
  position: absolute;
  bottom: 8px;
  left: 8px;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.55);
  font-size: 0.82rem;
}

.call-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  padding: 12px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
}

.call-btn {
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: center;
  min-width: 74px;
  padding: 8px 10px;
  border: 0;
  border-radius: 12px;
  background: #26283c;
  color: #f1f0ff;
  font: inherit;
  font-size: 1.15rem;
  cursor: pointer;
}

.call-btn span {
  font-size: 0.72rem;
}

.call-btn:hover {
  background: #33364f;
}

.call-btn.off {
  background: #3a2430;
}

.call-btn.active {
  background: #5034ff;
}

.call-btn.leave {
  background: #d0263e;
}

.call-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

#call-root.minimized .call-controls,
#call-root.minimized .call-head > :not(.call-title):not(.call-min):not(.rec-indicator) {
  display: none;
}

#call-root.minimized .call-grid {
  grid-auto-rows: 1fr;
}

@media (max-width: 860px) {
  .chat-layout {
    grid-template-columns: minmax(0, 1fr);
    height: calc(100vh - 170px);
  }

  .chat-layout.has-conv .chat-list,
  .chat-layout:not(.has-conv) .chat-pane {
    display: none;
  }

  .meetings-grid {
    grid-template-columns: minmax(0, 1fr);
  }

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

  .meeting-actions {
    justify-content: flex-start;
    width: 100%;
  }

  .call-stage.with-content {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 2fr) minmax(0, 1fr);
  }

  .call-btn {
    min-width: 58px;
  }
}

/* ------------------------------------------------------------ chat groups and the people picker */

.chat-new .btn {
  flex: 1;
}

.chat-conv-icon.group {
  background: linear-gradient(135deg, #00c875, #00c2ff);
  font-size: 1rem;
}

.chat-head-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.chat-system {
  align-self: center;
  margin: 4px 0;
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
}

.people-dialog form {
  max-height: min(80vh, 640px);
}

.people-search {
  width: 100%;
}

.people-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 340px;
  margin-top: 4px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.dialog label.person-option {
  display: flex;
  flex-direction: row;
  gap: 10px;
  align-items: center;
  padding: 8px 12px;
  font-weight: 400;
  cursor: pointer;
}

.person-option:hover {
  background: var(--hover);
}

.person-option[hidden] {
  display: none;
}

.person-option input {
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
}

.person-option > span:last-child {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.person-option small {
  color: var(--muted);
}

@media (max-width: 860px) {
  .chat-head {
    flex-wrap: wrap;
  }

  .chat-head-actions {
    width: 100%;
    justify-content: flex-start;
  }
}

/* ------------------------------------------------------------ conversation view (conversation.js) */

.chat-cv-host,
.call-chat-host {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

.cv {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

.cv-messages {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 2px;
  padding: 16px;
  overflow-y: auto;
}

.cv .chat-msg {
  max-width: min(680px, 88%);
  margin-top: 8px;
}

.cv .chat-msg.continued {
  margin-top: 0;
}

.cv .chat-msg .avatar.small:empty {
  visibility: hidden;
}

.cv-bubble-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.chat-msg.mine .cv-bubble-wrap {
  align-items: flex-end;
}

.cv-line {
  display: flex;
  gap: 4px;
  align-items: center;
}

.chat-msg.mine .cv-line {
  flex-direction: row-reverse;
}

.cv .chat-bubble {
  max-width: 100%;
}

.chat-bubble.big-emoji {
  padding: 0;
  background: none !important;
  color: inherit !important;
  font-size: 2.4rem;
  line-height: 1.15;
}

.chat-bubble.unsent {
  border: 1px solid var(--line);
  background: transparent !important;
  color: var(--muted) !important;
}

.cv-unsent {
  font-style: italic;
}

.cv-more {
  padding: 2px 6px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 1.1rem;
  cursor: pointer;
  opacity: 0;
}

.chat-msg:hover .cv-more,
.cv-more:focus-visible {
  opacity: 1;
}

@media (hover: none) {
  .cv-more {
    opacity: 0.6;
  }
}

.cv-quote {
  display: flex;
  flex-direction: column;
  margin-bottom: 4px;
  padding: 4px 10px;
  border-left: 3px solid currentColor;
  border-radius: 6px;
  background: rgba(127, 127, 127, 0.15);
  color: inherit;
  font-size: 0.82rem;
  text-decoration: none;
  opacity: 0.9;
}

.cv-quote b {
  font-size: 0.75rem;
}

.cv-images {
  display: grid;
  gap: 3px;
  margin: 2px 0 4px;
  overflow: hidden;
  border-radius: 10px;
}

.cv-images.n2 {
  grid-template-columns: 1fr 1fr;
}

.cv-images.n3 {
  grid-template-columns: 1fr 1fr 1fr;
}

.cv-images img {
  display: block;
  width: 100%;
  max-width: 320px;
  max-height: 320px;
  object-fit: cover;
}

.cv-images.n2 img,
.cv-images.n3 img {
  aspect-ratio: 1;
}

.cv-file {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 2px 0 4px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(127, 127, 127, 0.15);
  color: inherit !important;
  text-decoration: none;
}

.cv-file > span:first-child {
  font-size: 1.4rem;
}

.cv-file > span:last-child {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.cv-file b {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cv-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: -6px;
  padding: 0 6px;
  z-index: 1;
}

.cv-reaction {
  padding: 1px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

.cv-reaction.mine {
  border-color: var(--brand);
  background: var(--brand-tint);
}

.cv-menu {
  position: absolute;
  top: 100%;
  z-index: 5;
  display: flex;
  flex-direction: column;
  min-width: 190px;
  margin-top: 4px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.chat-msg.mine .cv-menu {
  right: 0;
}

.chat-msg:not(.mine) .cv-menu {
  left: 0;
}

.cv-menu > button {
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.cv-menu > button:hover {
  background: var(--hover);
}

.cv-menu > button.danger {
  color: var(--danger);
}

.cv-react-bar {
  display: flex;
  justify-content: space-between;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 4px;
}

.cv-react-bar button {
  padding: 4px;
  border: 0;
  border-radius: 50%;
  background: none;
  font-size: 1.3rem;
  cursor: pointer;
  transition: transform 0.12s;
}

.cv-react-bar button:hover {
  transform: scale(1.3);
}

.cv-seen {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.72rem;
}

.chat-msg.flash .chat-bubble {
  outline: 3px solid var(--brand);
}

.cv-status {
  min-height: 22px;
  padding: 0 16px;
}

.cv-typing {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 0.8rem;
}

.dots {
  display: inline-flex;
  gap: 3px;
  padding: 6px 9px;
  border-radius: 999px;
  background: var(--surface-2);
}

.dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
  animation: typing 1.2s infinite ease-in-out;
}

.dots i:nth-child(2) {
  animation-delay: 0.15s;
}

.dots i:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes typing {
  0%,
  60%,
  100% {
    opacity: 0.3;
    transform: translateY(0);
  }
  30% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

.cv-compose {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
}

.cv-compose-row {
  display: flex;
  gap: 6px;
  align-items: flex-end;
}

.cv-compose textarea {
  flex: 1;
  min-height: 40px;
  max-height: 140px;
  padding: 9px 14px;
  border-radius: 20px;
  background: var(--surface-2);
  resize: none;
}

.cv-compose .icon-btn {
  height: 40px;
  font-size: 1.2rem;
  cursor: pointer;
}

.cv-send {
  min-width: 44px;
  height: 40px;
  border-radius: 20px;
}

.cv-send.quick {
  border: 0;
  background: none;
  font-size: 1.6rem;
  cursor: pointer;
}

.cv-context {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  border-left: 3px solid var(--brand);
  border-radius: 6px;
  background: var(--surface-2);
  font-size: 0.85rem;
}

.cv-context span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cv-pending {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.cv-pending-file {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  font-size: 1.4rem;
}

.cv-pending-file img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cv-pending-file small {
  max-width: 64px;
  overflow: hidden;
  font-size: 0.6rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cv-pending-file button {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 0.7rem;
  cursor: pointer;
}

.cv-emoji {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(36px, 1fr));
  max-height: 170px;
  padding: 6px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.cv-emoji button {
  padding: 4px;
  border: 0;
  border-radius: 8px;
  background: none;
  font-size: 1.35rem;
  cursor: pointer;
}

.cv-emoji button:hover {
  background: var(--hover);
}

.chat-conv-icon {
  position: relative;
}

.chat-conv-icon .online {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 12px;
  height: 12px;
  border: 2px solid var(--surface-2);
  border-radius: 50%;
  background: #31c46d;
}

/* ------------------------------------------------------------ the call's chat panel (meet.js) */

.call-body {
  display: flex;
  flex: 1;
  gap: 10px;
  min-height: 0;
  padding-right: 12px;
}

.call-body .call-stage {
  flex: 1;
  padding-right: 0;
}

.call-chat {
  display: flex;
  flex-direction: column;
  width: min(380px, 40vw);
  min-height: 0;
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  overflow: hidden;
}

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

.call-chat > header {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.call-chat > header a {
  margin-left: auto;
  color: var(--brand-strong);
}

.call-chat .cv .chat-msg {
  max-width: 92%;
}

.call-btn {
  position: relative;
}

.call-badge {
  position: absolute;
  top: 2px;
  right: 8px;
  min-width: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #d0263e;
  color: #fff;
  font-size: 0.7rem;
}

#call-root.minimized .call-chat {
  display: none;
}

@media (max-width: 860px) {
  /* On phones the chat covers the video; the controls stay below it. */
  .call.chat-open .call-stage {
    display: none;
  }

  .call-chat {
    width: 100%;
  }

  .call-body {
    padding: 0 8px;
  }
}

/* ------------------------------------------------------------ invitee field and picker extras (people.js) */

.invitee-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 600;
}

.invitee-label .row {
  flex-wrap: wrap;
  font-weight: 400;
}

.invitee-field {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  min-height: 42px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  cursor: text;
}

.invitee-field:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-tint);
}

.invitee-chips {
  display: contents;
}

.invitee-chip {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  padding: 3px 4px 3px 10px;
  border-radius: 999px;
  background: var(--brand-tint);
  color: var(--brand-strong);
  font-size: 0.85rem;
  font-weight: 600;
}

.invitee-chip button {
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  font-size: 0.7rem;
  cursor: pointer;
}

.invitee-chip button:hover {
  background: var(--brand);
  color: var(--on-color);
}

.invitee-input {
  flex: 1;
  min-width: 140px;
  padding: 4px;
  border: 0 !important;
  outline: 0;
  background: transparent;
  box-shadow: none !important;
  font-weight: 400;
}

.invitee-suggest {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  left: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  max-height: 300px;
  padding: 4px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.invitee-suggest[hidden] {
  display: none;
}

.invitee-option {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 7px 10px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.invitee-option > span:last-child {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.invitee-option small {
  color: var(--muted);
}

.invitee-option.active,
.invitee-option:hover {
  background: var(--brand-tint);
}

.people-picked {
  margin: 0;
}

.person-option.new-email .avatar {
  background: #0a8f5a;
}

.invite-link-row {
  display: flex;
  gap: 6px;
  align-items: center;
  margin: 0;
}

/* ------------------------------------------------------------ contacts (contacts.js) */

.contacts-layout {
  display: grid;
  grid-template-columns: minmax(270px, 360px) minmax(0, 1fr);
  height: calc(100vh - 190px);
  min-height: 460px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
}

.contacts-list {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--line);
  background: var(--surface-2);
}

.contacts-tools {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 10px 6px;
}

.contacts-search {
  width: 100%;
}

.contacts-bulk {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  justify-content: space-between;
  min-height: 38px;
  padding: 4px 12px 8px;
  border-bottom: 1px solid var(--line);
  font-size: 0.85rem;
}

.contacts-items {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.contact-letter {
  position: sticky;
  top: 0;
  z-index: 1;
  margin: 0;
  padding: 4px 14px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
}

.contact-row {
  display: flex;
  gap: 4px;
  align-items: center;
  padding-left: 10px;
}

.contact-row.current,
.contact-row:hover {
  background: var(--hover);
}

.contact-row.current {
  box-shadow: inset 3px 0 var(--brand);
}

.contact-row > a {
  display: flex;
  flex: 1;
  gap: 10px;
  align-items: center;
  min-width: 0;
  padding: 8px 12px 8px 4px;
  color: inherit;
  text-decoration: none;
}

.contact-row-text {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.contact-row-text b,
.contact-row-text small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contact-row-text small {
  color: var(--muted);
}

.contact-star {
  color: #f5a623;
}

.contact-more {
  padding: 10px 14px;
}

.contact-avatar {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: #fff;
  font-weight: 700;
}

.contact-avatar.big {
  width: 64px;
  height: 64px;
  font-size: 1.6rem;
}

.contact-detail {
  min-width: 0;
  min-height: 0;
  padding: 20px 24px;
  overflow-y: auto;
}

.contacts-empty-icon {
  display: block;
  font-size: 2.4rem;
}

.contact-head {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
}

.contact-head h2 {
  font-size: 1.4rem;
  overflow-wrap: anywhere;
}

.contact-head p {
  margin: 4px 0 0;
}

.contact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0 6px;
}

.contact-action {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  align-items: center;
  min-width: 74px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
}

.contact-action span {
  font-size: 1.2rem;
}

.contact-action:hover {
  background: var(--hover);
}

.contact-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 12px 0 8px;
}

.contact-section {
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.contact-section h3 {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.contact-section p {
  margin: 0;
}

.contact-values {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.contact-values li {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: baseline;
  overflow-wrap: anywhere;
}

.contact-values.social li {
  align-items: center;
}

.contact-values.social li > span:last-child {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.social-icon {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--surface-2);
  font-weight: 700;
}

.social-icon.net-facebook,
.import-icon.f { background: #1877f2; color: #fff; }
.social-icon.net-linkedin,
.import-icon.in { background: #0a66c2; color: #fff; }
.social-icon.net-instagram { background: linear-gradient(45deg, #f58529, #dd2a7b, #8134af); color: #fff; }
.social-icon.net-whatsapp { background: #25d366; color: #fff; }
.social-icon.net-telegram { background: #229ed9; color: #fff; }
.social-icon.net-x,
.social-icon.net-threads,
.social-icon.net-tiktok,
.social-icon.net-github { background: #111; color: #fff; }
.social-icon.net-youtube { background: #ff0000; color: #fff; }
.import-icon.g { background: #fff; color: #4285f4; border: 1px solid var(--line); }

.contact-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.contact-notes {
  white-space: pre-wrap;
}

.contact-meta {
  margin-top: 16px;
}

.contacts-dialog {
  max-height: calc(100vh - 32px);
}

.contacts-dialog > form,
.contacts-dialog > div {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px;
}

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

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

fieldset.multi,
fieldset.choice {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
}

fieldset.multi legend,
fieldset.choice legend {
  padding: 0 4px;
  font-weight: 600;
}

fieldset.multi > .btn {
  align-self: flex-start;
}

.multi-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

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

.multi-row select {
  flex: none;
  width: 118px;
}

.multi-row input {
  flex: 1;
}

.dialog label.check.format {
  align-items: flex-start;
}

.dialog label.check.format span {
  display: flex;
  flex-direction: column;
  font-weight: 400;
}

.import-sources {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
  gap: 8px;
}

.import-source {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  text-align: left;
  cursor: pointer;
}

.import-source.active {
  border-color: var(--brand);
  background: var(--brand-tint);
}

.import-source small {
  grid-column: 2;
  color: var(--muted);
  font-size: 0.78rem;
}

.import-icon {
  display: grid;
  grid-row: span 2;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--surface-2);
  font-weight: 800;
}

.import-help {
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--surface-2);
  font-size: 0.9rem;
}

.import-help ol,
.import-help ul,
.export-help ul {
  margin: 6px 0;
  padding-left: 20px;
}

.import-help p {
  margin: 4px 0;
}

.import-drop {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
  padding: 22px 12px;
  border: 2px dashed var(--line);
  border-radius: 12px;
  font-weight: 400 !important;
  text-align: center;
  cursor: pointer;
}

.import-drop.drop {
  border-color: var(--brand);
  background: var(--brand-tint);
}

.import-sample,
.dupe-group ul {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.import-sample li,
.dupe-group li {
  display: flex;
  gap: 10px;
  align-items: center;
}

.import-sample li > span,
.dupe-group li > span {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.import-sample small,
.dupe-group small {
  color: var(--muted);
}

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

.import-progress progress {
  flex: 1;
}

.export-help summary {
  cursor: pointer;
  font-weight: 600;
}

.export-help {
  font-size: 0.9rem;
}

.dupes-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 55vh;
  overflow-y: auto;
}

.dupe-group {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.dupe-group.merged {
  opacity: 0.55;
}

@media (max-width: 860px) {
  .contacts-layout {
    grid-template-columns: minmax(0, 1fr);
    height: calc(100vh - 170px);
  }

  .contacts-layout.has-detail .contacts-list,
  .contacts-layout:not(.has-detail) .contact-detail {
    display: none;
  }

  .contacts-list {
    border-right: 0;
  }

  .contact-detail {
    padding: 14px 16px;
  }

  .form-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .multi-row select {
    width: 96px;
  }

  .contact-action {
    flex: 1;
    min-width: 0;
  }
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

@media (hover: hover) {
  .import-source:hover,
  .import-drop:hover {
    border-color: var(--brand);
    background: var(--brand-tint);
  }
}

/* ------------------------------------------------------------ marketing (marketing.js) */

.mkt-tabs {
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.mkt-tabs a {
  padding: 7px 14px;
}

.mkt-page .spacer,
.mkt-editor-head .spacer,
.mkt-send-bar .spacer,
.mkt-dialog .spacer {
  flex: 1;
}

.mkt-h2 {
  margin: 0 0 10px;
  font-size: 1.05rem;
}

.mkt-page .panel-head.spread,
.mkt-section-head {
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}

.mkt-section-head p {
  margin: 0;
}

.mkt-page .stat small {
  font-size: 0.8rem;
}

.mkt-steps {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.mkt-steps li {
  display: flex;
  gap: 10px;
  align-items: center;
}

.mkt-steps li span {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--brand-tint);
  color: var(--brand-strong);
  font-weight: 700;
  font-size: 0.8rem;
}

.mkt-steps li.done a {
  color: var(--muted);
  text-decoration: line-through;
}

.mkt-steps li.done span {
  background: color-mix(in srgb, var(--ok) 18%, transparent);
  color: var(--ok);
}

.mkt-tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
}

.mkt-tag-list .chip {
  text-decoration: none;
}

.mkt-table .num,
.mkt-page .data-table .num {
  text-align: right;
  white-space: nowrap;
}

.mkt-camp-link {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 180px;
  color: inherit;
  text-decoration: none;
}

.mkt-camp-link:hover b {
  color: var(--brand-strong);
}

.mkt-status {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  white-space: nowrap;
  background: var(--hover);
  color: var(--muted);
}

.mkt-status-scheduled {
  background: color-mix(in srgb, #579bfc 18%, transparent);
  color: #2f6fd1;
}

.mkt-status-sending {
  background: color-mix(in srgb, #f59e0b 18%, transparent);
  color: #b45309;
}

.mkt-status-sent,
.mkt-sub-subscribed {
  background: color-mix(in srgb, var(--ok) 15%, transparent);
  color: var(--ok);
}

.mkt-status-cancelled,
.mkt-sub-bounced,
.mkt-sub-complained {
  background: color-mix(in srgb, var(--danger) 14%, transparent);
  color: var(--danger);
}

.mkt-empty {
  text-align: center;
  padding: 40px 20px;
}

.mkt-empty-icon {
  font-size: 2.4rem;
}

.mkt-empty-row {
  padding: 28px 12px !important;
  text-align: center !important;
}

/* editor */

.mkt-editor-head {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
}

.mkt-name {
  flex: 1 1 240px;
  min-width: 0;
  padding: 6px 10px;
  border-color: transparent;
  background: transparent;
  font-size: 1.35rem;
  font-weight: 700;
}

.mkt-name:hover,
.mkt-name:focus {
  border-color: var(--line);
  background: var(--surface);
}

.mkt-title {
  margin: 0;
  font-size: 1.4rem;
}

.mkt-report-meta {
  margin: -6px 0 14px;
}

.mkt-editor,
.mkt-report {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.mkt-compose {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.mkt-compose > label,
.mkt-settings label,
.mkt-copy {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 600;
}

.mkt-audience {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 10px 12px 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.mkt-audience legend {
  padding: 0 4px;
  font-weight: 600;
}

.mkt-audience .check {
  font-weight: 400;
}

.mkt-tag-picks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-left: 26px;
}

.mkt-tag-picks[hidden] {
  display: none;
}

.chip-check {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  padding: 3px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.85rem;
  cursor: pointer;
}

.chip-check:has(input:checked) {
  border-color: var(--brand);
  background: var(--brand-tint);
}

.mkt-aud-size {
  margin: 0;
}

.mkt-body-label {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: -6px;
  font-weight: 600;
}

.mkt-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
}

.mkt-toolbar .icon-btn {
  min-width: 32px;
  font-size: 0.9rem;
}

.mkt-body {
  width: 100%;
  min-height: 340px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9rem;
  line-height: 1.55;
}

.mkt-help summary {
  color: var(--muted);
  cursor: pointer;
}

.mkt-help code,
.mkt-dialog code {
  padding: 1px 4px;
  border-radius: 4px;
  background: var(--hover);
}

.mkt-preview-panel {
  position: sticky;
  top: 12px;
}

.small-seg button {
  padding: 4px 10px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--muted);
  font-weight: 600;
  cursor: pointer;
}

.small-seg button[aria-pressed='true'] {
  background: var(--brand-tint);
  color: var(--brand-strong);
}

.mkt-inbox-line {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin-bottom: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 0.9rem;
}

.mkt-preview-pre {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  max-width: 100%;
}

.mkt-frame-wrap {
  overflow: hidden;
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f4f4fa;
  transition: max-width 0.2s;
}

.mkt-frame-wrap.desktop {
  max-width: 100%;
}

.mkt-frame-wrap.mobile {
  max-width: 375px;
}

.mkt-frame {
  display: block;
  width: 100%;
  height: 640px;
  border: 0;
}

.mkt-send-bar {
  position: sticky;
  bottom: 0;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 4px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  background: var(--bg);
}

.mkt-note {
  margin-top: 0;
}

.mkt-progress {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mkt-bar {
  overflow: hidden;
  height: 10px;
  border-radius: 999px;
  background: var(--hover);
}

.mkt-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--brand);
  transition: width 0.4s;
}

.mkt-url {
  max-width: 360px;
  overflow-wrap: anywhere;
}

/* audience */

.mkt-audience-tools,
.mkt-bulk {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.mkt-bulk {
  min-height: 36px;
  margin: 12px 0 4px;
}

.mkt-search {
  flex: 1 1 220px;
  max-width: 340px;
}

.mkt-chip {
  display: inline-block;
  margin: 1px 0;
  cursor: default;
}

.mkt-sub-email {
  font-weight: 600;
  text-align: left;
  overflow-wrap: break-word;
}

.mkt-sub-rows td:nth-child(2) {
  min-width: 190px;
}

/* forms and settings */

.mkt-form-card .row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.mkt-copy {
  margin-top: 12px;
}

.mkt-copy input {
  flex: 1 1 260px;
  min-width: 0;
}

.mkt-copy textarea {
  width: 100%;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.8rem;
}

.mkt-settings form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 760px;
}

.mkt-settings h2 {
  margin: 6px 0 0;
}

.mkt-color {
  width: 52px;
  height: 36px;
  padding: 2px;
}

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

.mkt-dialog .check {
  display: flex;
  flex-direction: row;
  gap: 8px;
  align-items: center;
  font-weight: 400;
}

.mkt-dialog [hidden] {
  display: none;
}

.mkt-import-tabs {
  align-self: flex-start;
  flex-wrap: wrap;
}

.mkt-dialog textarea {
  width: 100%;
}

@media (max-width: 1100px) {
  .mkt-editor,
  .mkt-report {
    grid-template-columns: minmax(0, 1fr);
  }

  .mkt-preview-panel {
    position: static;
  }

  .mkt-frame {
    height: 560px;
  }
}

@media (max-width: 560px) {
  .mkt-tabs {
    display: flex;
  }

  .mkt-tabs a {
    flex: 1 1 auto;
    padding: 6px 8px;
    text-align: center;
  }

  .mkt-send-bar .btn {
    flex: 1 1 auto;
  }

  .mkt-name {
    font-size: 1.15rem;
  }

  /* Phones: subscriber, tags and status only. */
  .mkt-sub-table th:nth-child(n + 5),
  .mkt-sub-table td:nth-child(n + 5) {
    display: none;
  }

  .mkt-sub-rows td:nth-child(2) {
    min-width: 0;
    max-width: 52vw;
  }
}

/* ============================================================ 2026 refresh: type, surfaces, motion
   Layered over everything above: a bolder, larger typeface, softer cards, gradient accents and
   animations. Interactive pieces (palette, theme switch, ripples, count-up) live in ui.js. */

:root {
  --brand: #6247ea;
  --brand-strong: #4f35d8;
  --brand-2: #a855f7;
  --brand-tint: rgba(98, 71, 234, 0.11);
  --brand-grad: linear-gradient(135deg, #6247ea 0%, #8b5cf6 55%, #c026d3 100%);
  --bg: #f4f5fb;
  --surface-2: #f0f1f8;
  --line: #e3e5f0;
  --text: #161a2e;
  --muted: #5f6680;
  --radius: 14px;
  --shadow-sm: 0 1px 2px rgba(22, 26, 46, 0.05), 0 2px 6px rgba(22, 26, 46, 0.04);
  --shadow-md: 0 6px 20px rgba(22, 26, 46, 0.09), 0 2px 6px rgba(22, 26, 46, 0.05);
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

/* Dark: chosen with the theme switch, or following the device. */
:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #0d0f17;
  --surface: #161925;
  --surface-2: #1d2131;
  --sidebar: #121521;
  --line: #2a2f43;
  --text: #eceef7;
  --muted: #9ca3bd;
  --brand: #8b7cff;
  --brand-strong: #a99dff;
  --brand-tint: rgba(139, 124, 255, 0.16);
  --ok: #34d399;
  --danger: #f2667c;
  --hover: rgba(255, 255, 255, 0.06);
  --shadow: 0 16px 48px rgba(0, 0, 0, 0.55);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 8px 26px rgba(0, 0, 0, 0.45);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #0d0f17;
    --surface: #161925;
    --surface-2: #1d2131;
    --sidebar: #121521;
    --line: #2a2f43;
    --text: #eceef7;
    --muted: #9ca3bd;
    --brand: #8b7cff;
    --brand-strong: #a99dff;
    --brand-tint: rgba(139, 124, 255, 0.16);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 8px 26px rgba(0, 0, 0, 0.45);
  }
}

:root[data-theme='light'] {
  color-scheme: light;
}

html,
body {
  font-family: var(--font);
  font-size: 15.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

b,
strong {
  font-weight: 700;
}

h1,
h2,
h3 {
  font-weight: 800;
  letter-spacing: -0.02em;
}

.page-head {
  margin-bottom: 22px;
}

.page-head h1 {
  font-size: clamp(1.6rem, 1.2rem + 1.4vw, 2.15rem);
  font-weight: 800;
  letter-spacing: -0.03em;
}

.page-head p {
  font-size: 1rem;
}

.panel h2,
.mkt-h2 {
  font-size: 1.12rem;
  font-weight: 800;
}

::selection {
  background: color-mix(in srgb, var(--brand) 28%, transparent);
}

* {
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--muted) 45%, transparent) transparent;
}

/* ---------- controls */

input,
select,
textarea {
  padding: 9px 12px;
  border-radius: 10px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  outline: none;
  box-shadow: 0 0 0 4px var(--brand-tint);
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
}

.btn {
  position: relative;
  overflow: hidden;
  padding: 9px 16px;
  border-radius: 11px;
  font-weight: 700;
  letter-spacing: -0.005em;
  box-shadow: var(--shadow-sm);
  transition: transform 0.12s, box-shadow 0.15s, background 0.15s, border-color 0.15s;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn:active:not(:disabled) {
  transform: translateY(0) scale(0.98);
}

.btn.primary {
  border-color: transparent;
  background: var(--brand-grad);
  box-shadow: 0 6px 18px color-mix(in srgb, var(--brand) 32%, transparent);
}

.btn.primary:hover:not(:disabled) {
  background: var(--brand-grad);
  filter: brightness(1.06);
  box-shadow: 0 10px 24px color-mix(in srgb, var(--brand) 40%, transparent);
}

.btn.ghost {
  box-shadow: none;
}

.btn.small {
  padding: 6px 12px;
  border-radius: 9px;
  font-size: 0.86rem;
}

.btn.danger:hover:not(:disabled) {
  background: color-mix(in srgb, var(--danger) 10%, transparent);
}

.ripple {
  position: absolute;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.18;
  pointer-events: none;
  transform: scale(0);
  animation: ripple 0.6s ease-out forwards;
}

@keyframes ripple {
  to {
    opacity: 0;
    transform: scale(1);
  }
}

.icon-btn {
  min-width: 34px;
  height: 34px;
  border-radius: 9px;
  transition: background 0.15s, color 0.15s, transform 0.12s;
}

.icon-btn:active {
  transform: scale(0.94);
}

/* ---------- shell */

.shell {
  grid-template-columns: 264px minmax(0, 1fr);
}

.sidebar {
  gap: 10px;
  padding: 18px 14px;
  background:
    radial-gradient(120% 60% at 0% 0%, color-mix(in srgb, var(--brand) 9%, transparent), transparent 60%),
    var(--sidebar);
}

.brand {
  padding: 6px 8px 10px;
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand b {
  background: var(--brand-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand-mark {
  width: 30px;
  height: 30px;
}

.nav-label {
  margin: 12px 10px 6px;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.09em;
}

.sidebar nav a,
.nav-add {
  gap: 10px;
  padding: 9px 10px;
  border-radius: 11px;
  font-weight: 600;
  font-size: 0.97rem;
  transition: background 0.15s, color 0.15s, transform 0.15s;
}

.sidebar nav a:hover,
.nav-add:hover {
  transform: translateX(2px);
}

.sidebar nav a[aria-current='page'] {
  background: linear-gradient(90deg, var(--brand-tint), color-mix(in srgb, var(--brand-2) 8%, transparent));
  box-shadow: inset 3px 0 0 var(--brand);
  font-weight: 800;
}

.nav-icon {
  width: 22px;
  font-size: 1.05rem;
}

.count {
  padding: 1px 8px;
  margin-left: auto;
  background: var(--brand-grad);
  font-size: 0.74rem;
  font-weight: 800;
  box-shadow: 0 2px 8px color-mix(in srgb, var(--brand) 35%, transparent);
}

.topbar {
  min-height: 62px;
  padding: 10px 24px;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
}

.crumb {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.content {
  padding: 28px 30px 40px;
}

.page-enter {
  animation: page-enter 0.38s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes page-enter {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

/* ---------- surfaces */

.panel {
  border-radius: 18px;
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
}

.stat-row {
  gap: 16px;
}

.stat-row .stat {
  position: relative;
  overflow: hidden;
  gap: 6px;
  transition: transform 0.18s, box-shadow 0.18s;
}

.stat-row .stat::before {
  content: '';
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: var(--brand-grad);
  opacity: 0.85;
}

.stat-row .stat:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.stat span {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.stat b {
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.ws-grid {
  gap: 18px;
}

a.ws-card,
.ws-card {
  border-radius: 18px;
  transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s;
}

a.ws-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.ws-card b {
  font-size: 1.08rem;
  font-weight: 800;
}

.data-table th,
.list-table th {
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.07em;
}

.data-table td {
  padding: 12px;
}

.data-table tbody tr {
  transition: background 0.12s;
}

.chip,
.pill,
.badge,
.mkt-status {
  font-weight: 700;
}

.segmented {
  padding: 4px;
  border-radius: 13px;
  box-shadow: var(--shadow-sm);
}

.segmented a,
.small-seg button {
  border-radius: 9px;
  transition: background 0.15s, color 0.15s;
}

.segmented a[aria-current='page'] {
  background: var(--brand-grad);
  color: #fff;
  box-shadow: 0 4px 12px color-mix(in srgb, var(--brand) 30%, transparent);
}

.segmented a:not([aria-current='page']):hover {
  background: var(--hover);
  color: var(--text);
}

/* ---------- dialogs and toasts */

.dialog {
  border-radius: 20px;
  border-color: color-mix(in srgb, var(--line) 70%, transparent);
}

.dialog[open] {
  animation: dialog-in 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.dialog::backdrop {
  background: rgba(13, 15, 30, 0.42);
  backdrop-filter: blur(4px);
}

.dialog form {
  gap: 16px;
  padding: 24px;
}

.dialog h2 {
  font-size: 1.3rem;
}

@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.97);
  }
}

.toast {
  padding: 12px 18px;
  border-radius: 14px;
  font-weight: 700;
  border-left: 4px solid var(--brand-2);
  animation: toast-in 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), toast-out 0.35s ease-in 2.85s forwards;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translate(-50%, 16px);
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translate(-50%, 10px);
  }
}

/* ---------- topbar: jump-to button, theme switch */

.palette-btn {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  gap: 10px;
  align-items: center;
  min-width: 240px;
  margin-left: 12px;
  padding: 8px 10px 8px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--muted);
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.palette-btn:hover {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px var(--brand-tint);
}

.palette-btn kbd {
  margin-left: auto;
}

kbd {
  display: inline-block;
  min-width: 22px;
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  font: 700 0.74rem/1.5 var(--font);
  text-align: center;
}

.theme-btn {
  font-size: 1.1rem;
}

/* ---------- command palette (ui.js) */

.palette-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  align-items: start;
  justify-items: center;
  padding: 12vh 16px 16px;
  background: rgba(13, 15, 30, 0.45);
  backdrop-filter: blur(5px);
  animation: fade-in 0.15s;
}

.palette {
  display: flex;
  flex-direction: column;
  width: min(620px, 100%);
  max-height: 70vh;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow);
  animation: dialog-in 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.palette-input {
  padding: 18px 20px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  font-size: 1.1rem;
  font-weight: 600;
  background: transparent;
}

.palette-input:focus {
  box-shadow: none;
}

.palette-list {
  flex: 1;
  margin: 0;
  padding: 8px;
  overflow-y: auto;
  list-style: none;
}

.palette-group {
  padding: 10px 12px 4px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.palette-item {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 11px;
  font-weight: 600;
  cursor: pointer;
}

.palette-item small {
  margin-left: auto;
  color: var(--muted);
  font-weight: 500;
}

.palette-item.active {
  background: var(--brand-tint);
  color: var(--brand-strong);
  box-shadow: inset 3px 0 0 var(--brand);
}

.palette-icon {
  width: 24px;
  text-align: center;
}

.palette-empty {
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.palette-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin: 0;
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.8rem;
}

.shortcuts {
  width: 100%;
  border-collapse: collapse;
}

.shortcuts td {
  padding: 7px 4px;
  border-bottom: 1px solid var(--line);
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

/* ---------- Mail window: mailbox tabs and profile (mail.js) */

.mail-window {
  margin-bottom: 16px;
}

.mail-tabs {
  display: flex;
  gap: 8px;
  padding: 6px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  scroll-snap-type: x proximity;
}

.mail-tab {
  display: flex;
  flex: none;
  gap: 10px;
  align-items: center;
  max-width: 260px;
  padding: 8px 12px 8px 8px;
  border-radius: 13px;
  color: var(--text);
  text-decoration: none;
  scroll-snap-align: start;
  transition: background 0.15s, transform 0.15s;
}

.mail-tab:hover {
  background: var(--hover);
}

.mail-tab[aria-current='page'] {
  background: linear-gradient(135deg, var(--brand-tint), color-mix(in srgb, var(--brand-2) 10%, transparent));
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--brand) 45%, transparent);
}

.mail-tab-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.25;
}

.mail-tab-text b,
.mail-tab-text small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mail-tab-text b {
  font-weight: 800;
}

.mail-tab-text small {
  color: var(--muted);
  font-size: 0.78rem;
}

.mail-tab-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--surface-2);
}

.mail-tab .count {
  margin-left: 4px;
}

.box-av {
  display: inline-flex;
  flex: none;
}

.box-av .avatar {
  background: var(--box, transparent);
}

.box-av:not([style*='#']) .avatar {
  background: linear-gradient(135deg, #8b6bff, #00c2ff);
}

.box-av.tiny .avatar {
  width: 30px;
  height: 30px;
  font-size: 0.85rem;
}

.box-av.huge .avatar {
  width: 84px;
  height: 84px;
  font-size: 2rem;
  font-weight: 800;
  box-shadow: 0 0 0 4px var(--surface), 0 8px 24px rgba(0, 0, 0, 0.18);
}

.mail-profile {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  align-items: center;
  margin: 16px 0;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background:
    radial-gradient(80% 140% at 0% 0%, color-mix(in srgb, var(--box, var(--brand)) 20%, transparent), transparent 70%),
    var(--surface);
  box-shadow: var(--shadow-sm);
}

.mail-profile-photo {
  position: relative;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  cursor: pointer;
  transition: transform 0.18s;
}

.mail-profile-photo:hover {
  transform: scale(1.04);
}

.photo-badge {
  position: absolute;
  right: -2px;
  bottom: -2px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 3px solid var(--surface);
  border-radius: 50%;
  background: var(--brand-grad);
  font-size: 0.85rem;
}

.mail-profile-text {
  flex: 1 1 240px;
  min-width: 0;
}

.mail-profile-text h1 {
  font-size: clamp(1.4rem, 1.1rem + 1vw, 1.9rem);
  overflow-wrap: anywhere;
}

.mail-profile-text p {
  margin: 4px 0 0;
}

.mail-profile-address {
  color: var(--muted);
  font-weight: 600;
}

.mail-layout {
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
}

.profile-photo-row {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  align-items: center;
}

.profile-photo-row .stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
}

.profile-photo-row label.btn {
  cursor: pointer;
}

.mail-profile-dialog input[type='color'] {
  height: 42px;
  padding: 3px;
}

.signature-preview {
  margin: -8px 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--muted);
  font: 0.85rem/1.5 var(--font);
  white-space: pre-wrap;
}

.error-text {
  margin: 0;
  color: var(--danger);
  font-weight: 600;
}

/* ---------- phones */

@media (max-width: 860px) {
  .shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    width: 280px;
  }

  .palette-btn {
    min-width: 0;
    margin-left: auto;
  }

  .palette-btn-text,
  .palette-btn kbd {
    display: none;
  }

  .content {
    padding: 18px 16px 32px;
  }

  .topbar {
    padding: 8px 14px;
  }

  .mail-profile {
    padding: 18px;
  }

  .mail-profile .page-actions {
    width: 100%;
  }

  .mail-profile .page-actions .btn {
    flex: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .page-enter,
  .dialog[open],
  .toast,
  .palette,
  .palette-backdrop {
    animation: none;
  }

  .btn,
  .stat-row .stat,
  a.ws-card {
    transition: none;
  }
}

/* Contacts: Lyr Chat and Meeting next to Call / Text / WhatsApp / Email */
button.contact-action {
  background: var(--surface);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.contact-action.lyr {
  border-color: color-mix(in srgb, var(--brand) 35%, var(--line));
  background: linear-gradient(135deg, var(--brand-tint), color-mix(in srgb, var(--brand-2) 8%, transparent));
  color: var(--brand-strong);
}

.contact-action.lyr:hover:not(:disabled) {
  border-color: var(--brand);
  transform: translateY(-1px);
}

.contact-action:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.meet-choice {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

/* Contacts: choose email or phone, and send links by WhatsApp / SMS */
.channel-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.channel-option {
  display: flex !important;
  flex-direction: row !important;
  gap: 12px !important;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-weight: 400 !important;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.channel-option:has(input:checked) {
  border-color: var(--brand);
  background: var(--brand-tint);
}

.channel-option span:last-child {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow-wrap: anywhere;
}

.channel-icon {
  font-size: 1.2rem;
}

.share-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.share-row .btn {
  flex: 1 1 110px;
}

.share-wa {
  border-color: #25d366;
  color: #128c4b;
}

/* Contacts: one-tap app buttons (Instagram, Messenger, X, Discord, Snapchat, Telegram, WeChat …) */
.social-icon.net-messenger { background: linear-gradient(45deg, #0099ff, #a033ff, #ff5280); color: #fff; }
.social-icon.net-snapchat { background: #fffc00; color: #111; }
.social-icon.net-discord { background: #5865f2; color: #fff; }
.social-icon.net-wechat { background: #07c160; color: #fff; }
.social-icon.net-viber { background: #7360f2; color: #fff; }
.social-icon.net-signal { background: #3a76f0; color: #fff; }
.social-icon.net-skype { background: #00aff0; color: #fff; }
.social-icon.net-line { background: #06c755; color: #fff; }
.social-icon.net-kakaotalk { background: #fee500; color: #3c1e1e; }
.social-icon.net-imo { background: #1a73e8; color: #fff; }
.social-icon.net-pinterest { background: #e60023; color: #fff; }
.social-icon.net-reddit { background: #ff4500; color: #fff; }
.social-icon.net-twitch { background: #9146ff; color: #fff; }
.social-icon.net-bluesky { background: #1185fe; color: #fff; }

.contact-apps {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 4px 0 12px;
}

.app-btn {
  display: inline-flex;
  gap: 9px;
  align-items: center;
  padding: 6px 12px 6px 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.15s, border-color 0.15s;
}

.app-btn:hover {
  border-color: color-mix(in srgb, var(--brand) 40%, var(--line));
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.app-btn:active {
  transform: scale(0.97);
}

.app-btn .social-icon {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  font-size: 0.95rem;
}

.app-btn-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  text-align: left;
}

.app-btn-text b {
  font-size: 0.86rem;
}

.app-btn-text small {
  color: var(--muted);
  font-size: 0.72rem;
}

.app-btn.add {
  border-style: dashed;
}

.app-btn.add .social-icon {
  background: var(--brand-tint);
  color: var(--brand-strong);
}

.apps-h {
  margin: 4px 0 -6px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.network-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
  gap: 6px;
}

.network-pick {
  display: flex !important;
  flex-direction: row !important;
  gap: 8px !important;
  align-items: center;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 0.85rem;
  cursor: pointer;
}

.network-pick input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.network-pick .social-icon {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  font-size: 0.8rem;
}

.network-pick:has(input:checked) {
  border-color: var(--brand);
  background: var(--brand-tint);
  box-shadow: inset 0 0 0 1px var(--brand);
}

.network-pick:has(input:focus-visible) {
  outline: 2px solid var(--brand);
}

/* Contacts: Google Meet and Microsoft Teams */
.social-icon.net-gmeet { background: #fff; border: 1px solid var(--line); }
.social-icon.net-teams { background: #5059c9; color: #fff; font-weight: 800; }

.dialog h2 .social-icon {
  width: 28px;
  height: 28px;
  margin-right: 6px;
  vertical-align: -6px;
}

button.app-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

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

.link-row {
  display: flex;
  gap: 8px;
}

.link-row input {
  flex: 1;
  min-width: 0;
}

/* Contacts: Find on social */
.find-results { display: grid; gap: 8px; }
.find-person { display: flex; align-items: center; gap: 10px; margin: 0; }
.find-person img { border-radius: 50%; }
.find-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.find-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.find-list li > span:not(.social-icon) { flex: 1; min-width: 0; display: grid; }
.find-list a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.find-by { margin: 6px 0 4px; }

/* Conversations: voice messages and call bubbles (shared by Messages and Lyr Chat) */
.cv-quick-group { display: inline-flex; align-items: center; min-width: 0; height: auto; }
.cv-mic { font-size: 1.35rem !important; }
.cv-recording { align-items: center; gap: 10px; padding: 2px 0; }
.cv-recording .cv-send { margin-left: auto; }
.cv-rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: cv-blink 1s infinite; }
.cv-rec-time { font-variant-numeric: tabular-nums; font-weight: 700; }
@keyframes cv-blink { 50% { opacity: 0.25; } }
.cv-voice { display: flex; align-items: center; gap: 6px; }
.cv-voice audio { width: min(260px, 60vw); height: 40px; }
.chat-call { display: flex; align-items: center; gap: 10px; min-width: 200px; }
.chat-call > span:nth-child(2) { display: flex; flex-direction: column; }
.chat-call small { opacity: 0.75; font-size: 0.78rem; }
.chat-call-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--brand-tint); font-size: 1.05rem; }
.chat-call.missed b { color: var(--danger); }
.chat-msg.mine .chat-call.missed b { color: inherit; }
.chat-msg.mine .chat-call .btn { border-color: rgba(255, 255, 255, 0.6); background: rgba(255, 255, 255, 0.18); color: #fff; }
.chat-msg.mine .chat-call-icon { background: rgba(255, 255, 255, 0.2); }

/* Sidebar link to Lyr Chat (opens the app in its own tab) */
.nav-ext { margin-left: auto; color: var(--muted); font-size: 0.8rem; }

/* Lyr Chat inside Lyrsoft Work: the frame sits over this slot (app.js placeLyrChat). */
.content.lyrchat-content { padding: 0; }
.lyrchat-slot { height: calc(100dvh - 53px); }
.lyrchat-frame { position: fixed; z-index: 4; border: 0; background: var(--surface); }
.lyrchat-frame.parked { visibility: hidden; pointer-events: none; }

/* ------------------------------------------------------------ Lyrsoft HR (hr.js) */

.hr-tabs {
  margin-bottom: 16px;
  overflow-x: auto;
}
.hr-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.hr-body > .panel,
.hr-body > .stat-row,
.hr-body > p {
  margin: 0;
}
.hr-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
}
.hr-grid > .panel {
  margin: 0;
}
.hr-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.hr-toolbar .row,
.hr-toolbar label.row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.hr-toolbar input[type='date'],
.hr-toolbar input[type='month'],
.hr-toolbar select,
.hr-search {
  min-height: 36px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}
.hr-search {
  flex: 1 1 260px;
  max-width: 420px;
}
.hr-toolbar .spacer,
.hr-profile-head .spacer,
.hr-dialog .spacer,
.dialog .row .spacer {
  flex: 1;
}
.hr-h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
}
.hr-pad {
  margin: 0;
  padding: 14px 16px 6px;
}
.panel.flush {
  padding: 0;
  overflow: hidden;
}
.hr-table td,
.hr-table th {
  white-space: nowrap;
}
.hr-table td small {
  white-space: normal;
}
.data-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.hr-table tfoot th {
  border-top: 2px solid var(--line);
  color: var(--text);
  text-transform: none;
  font-size: 0.9rem;
}
.hr-click {
  cursor: pointer;
}
.hr-person {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.hr-person > span:last-child {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.hr-person small {
  color: var(--muted);
}
.hr-avatar {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), #a25ddc);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
}
.hr-avatar.big {
  width: 64px;
  height: 64px;
  font-size: 1.3rem;
}

/* status colours */
.hr-badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}
.hr-present,
.hr-pay-paid,
.hr-lv-approved {
  --hr-c: #00a65f;
}
.hr-late,
.hr-half,
.hr-pending,
.hr-lv-pending,
.hr-pay-draft {
  --hr-c: #e08a00;
}
.hr-absent,
.hr-lv-rejected {
  --hr-c: #d83a52;
}
.hr-leave,
.hr-unpaid,
.hr-pay-final {
  --hr-c: #579bfc;
}
.hr-holiday {
  --hr-c: #a25ddc;
}
.hr-off,
.hr-lv-cancelled {
  --hr-c: #8a90a2;
}
.hr-badge[class*='hr-'] {
  background: color-mix(in srgb, var(--hr-c, var(--muted)) 15%, transparent);
  color: var(--hr-c, var(--muted));
}
.hr-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
}

/* overview */
.hr-tile.hr-tone-ok b {
  color: var(--ok);
}
.hr-tile.hr-tone-warn b {
  color: #e08a00;
}
.hr-tile small {
  font-size: 0.8rem;
}
.hr-body .stat-row {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}
.hr-tile b {
  font-size: clamp(1.25rem, 2.2vw, 1.8rem);
  overflow-wrap: anywhere;
}
.hr-pay td:nth-child(3) small {
  white-space: nowrap;
}
.hr-cal-day.hr-untracked {
  opacity: 0.45;
}
.hr-welcome ol {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 20px;
}
.hr-meter {
  display: flex;
  gap: 3px;
  height: 14px;
  margin: 8px 0;
  border-radius: 99px;
  overflow: hidden;
}
.hr-seg {
  min-width: 6px;
}
.hr-seg-present { background: #00a65f; }
.hr-seg-late { background: #fdab3d; }
.hr-seg-leave { background: #579bfc; }
.hr-seg-notIn { background: #c4c8d4; }
.hr-seg-absent { background: #e2445c; }
.hr-seg-off,
.hr-seg-empty { background: var(--surface-2); }
.hr-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  color: var(--muted);
  font-size: 0.8rem;
}
.hr-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: -6px;
  border-radius: 50%;
}
.hr-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.hr-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.hr-list.plain li {
  justify-content: flex-start;
}
.hr-big {
  margin: 4px 0;
  font-size: 1.7rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.hr-empty {
  padding: 32px 20px;
  text-align: center;
}

/* employee page */
.hr-profile-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}
.hr-profile-head h2,
.hr-profile-head p {
  margin: 0;
}
.hr-cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 18px;
}
.hr-facts {
  margin: 0;
}
.hr-facts h3 {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.hr-facts div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 5px 0;
  border-bottom: 1px dashed var(--line);
}
.hr-facts dt {
  color: var(--muted);
}
.hr-facts dd {
  margin: 0;
  text-align: right;
  overflow-wrap: anywhere;
}
.hr-notes {
  margin: 14px 0 0;
  white-space: pre-wrap;
  color: var(--muted);
}

/* month calendar */
.hr-cal {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}
.hr-cal-head {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  text-align: center;
  text-transform: uppercase;
}
.hr-cal-day {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 64px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--hr-c, var(--line));
  border-radius: 10px;
  background: color-mix(in srgb, var(--hr-c, transparent) 7%, var(--surface));
  color: var(--text);
  font: inherit;
  text-align: left;
}
button.hr-cal-day {
  cursor: pointer;
}
button.hr-cal-day:hover {
  border-color: var(--brand);
}
.hr-cal-day.is-today {
  outline: 2px solid var(--brand);
  outline-offset: 1px;
}
.hr-cal-day small {
  color: var(--muted);
  font-size: 0.72rem;
}
.hr-cal-day i {
  color: var(--ok);
  font-size: 0.7rem;
  font-style: normal;
  font-weight: 700;
}
.hr-cal-day em {
  position: absolute;
  top: 4px;
  right: 6px;
  color: var(--muted);
  font-size: 0.7rem;
  font-style: normal;
}
.hr-cal-day.hr-upcoming,
.hr-cal-day.hr-none {
  opacity: 0.55;
}

/* monthly report */
.hr-report td,
.hr-report th {
  padding: 7px 4px;
}
.hr-report td:first-child,
.hr-report th:first-child {
  padding-left: 14px;
}
.hr-mark-h,
.hr-mark {
  min-width: 26px;
  text-align: center !important;
  font-size: 0.72rem;
}
.hr-mark {
  color: var(--hr-c, var(--muted));
  font-weight: 700;
}
.hr-mark.hr-present {
  color: var(--ok);
}

/* my time */
.hr-punch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}
.hr-punch p {
  margin: 0;
}
.hr-clock {
  font-size: 2.6rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}
.hr-punch-btn {
  display: grid;
  place-items: center;
  width: 156px;
  height: 156px;
  margin: 8px 0;
  border: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #34d399, #00a65f);
  box-shadow: 0 12px 30px color-mix(in srgb, #00a65f 40%, transparent), inset 0 -6px 0 rgba(0, 0, 0, 0.12);
  color: #fff;
  font: inherit;
  font-size: 1.15rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.15s;
}
.hr-punch-btn.out {
  background: radial-gradient(circle at 30% 30%, #ff7a8c, #d83a52);
  box-shadow: 0 12px 30px color-mix(in srgb, #d83a52 40%, transparent), inset 0 -6px 0 rgba(0, 0, 0, 0.12);
}
.hr-punch-btn:hover {
  transform: scale(1.04);
}
.hr-punch-btn:active {
  transform: scale(0.97);
}
.hr-punch-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}
.hr-times {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 18px;
  color: var(--muted);
}
.hr-times b {
  display: block;
  color: var(--text);
  font-size: 1.1rem;
}
.hr-balances {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}
.hr-balances div {
  display: flex;
  flex-direction: column;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface-2);
}
.hr-balances b {
  font-size: 1.5rem;
}

/* forms */
.hr-dialog form {
  max-height: calc(100vh - 48px);
  overflow-y: auto;
}
.hr-dialog fieldset,
.hr-settings fieldset {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.hr-dialog legend,
.hr-settings legend {
  padding: 0 6px;
  color: var(--muted);
  font-weight: 700;
}
.hr-settings {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.hr-settings h2 {
  margin: 0;
}
.hr-settings label,
.hr-dialog label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 600;
}
.hr-settings label.check,
.hr-dialog label.check {
  flex-direction: row;
  align-items: center;
  font-weight: 400;
}
.hr-settings input:not([type='checkbox']),
.hr-settings select,
.hr-settings textarea,
.hr-dialog input:not([type='checkbox']),
.hr-dialog select,
.hr-dialog textarea {
  width: 100%;
  min-height: 38px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 400;
}
.hr-salary {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}
.hr-gross {
  margin: 0;
  text-align: right;
}
.hr-settings .hr-days label.chip-check {
  flex-direction: row;
  align-items: center;
  gap: 6px;
  font-weight: 500;
}
.hr-days {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
}
.hr-cell {
  width: 90px;
  min-height: 32px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  text-align: right;
}
.hr-cell:focus {
  border-color: var(--brand);
  outline: none;
}
.hr-key {
  display: block;
  padding: 10px;
  border-radius: 8px;
  background: var(--surface-2);
  overflow-wrap: anywhere;
  user-select: all;
}
.hr-api pre {
  padding: 12px;
  border-radius: 10px;
  background: var(--surface-2);
  overflow-x: auto;
  font-size: 0.82rem;
}
.hr-api summary {
  cursor: pointer;
  font-weight: 600;
}
.segmented.small a {
  padding: 5px 12px;
  font-size: 0.85rem;
  cursor: pointer;
}

@media (max-width: 640px) {
  .hr-cal {
    gap: 3px;
  }
  .hr-cal-day {
    min-height: 48px;
    padding: 4px;
    border-left-width: 3px;
  }
  .hr-cal-day small,
  .hr-cal-day i {
    font-size: 0.6rem;
  }
  .hr-clock {
    font-size: 2rem;
  }
  .hr-dialog .form-grid,
  .hr-settings .form-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .hr-search {
    max-width: none;
  }
}

/* ------------------------------------------------------------ Ads & budget (growth.js) */

.gr-month b {
  min-width: 130px;
  text-align: center;
}
.gr-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.gr-dot {
  display: inline-block;
  flex: none;
  width: 10px;
  height: 10px;
  margin-right: 6px;
  border-radius: 50%;
}
.gr-ch {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}
.gr-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin: 0;
}
.gr-bar {
  display: block;
  height: 8px;
  margin: 6px 0 4px;
  border-radius: 99px;
  background: var(--surface-2);
  overflow: hidden;
}
.gr-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), #a25ddc);
}
.gr-bar.warn i {
  background: linear-gradient(90deg, #fdab3d, #e2445c);
}
.gr-bar.ok i {
  background: linear-gradient(90deg, #34d399, #00a65f);
}
.gr-bar.none i {
  background: repeating-linear-gradient(45deg, var(--line) 0 6px, transparent 6px 12px);
}
td .gr-bar {
  min-width: 90px;
}
.gr-channels,
.gr-audience {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.gr-audience li {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 2px 10px;
}
.gr-audience b {
  font-size: 1.25rem;
}
.gr-audience small {
  grid-column: 1 / -1;
}
.gr-chart svg {
  display: block;
  width: 100%;
  height: 180px;
}
.gr-col {
  fill: var(--brand);
}
.gr-col:hover {
  fill: #a25ddc;
}
.gr-col.future {
  fill: var(--surface-2);
}
.gr-budget-line {
  stroke: #e2445c;
  stroke-width: 1.5;
  stroke-dasharray: 5 4;
}
.gr-axis {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.75rem;
}
.gr-plan-mini {
  padding: 8px 0;
  border-bottom: 1px dashed var(--line);
}
.gr-plans {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 16px;
}
.gr-plan {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
}
.gr-plan h3,
.gr-plan p {
  margin: 0;
}
.gr-notes {
  color: var(--muted);
  white-space: pre-wrap;
}
.gr-st-idea { --hr-c: #8a90a2; }
.gr-st-planned { --hr-c: #579bfc; }
.gr-st-live { --hr-c: #00a65f; }
.gr-st-paused { --hr-c: #e08a00; }
.gr-st-done { --hr-c: #a25ddc; }
.gr-timeline {
  --lab: 180px;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.gr-tl-months {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin-left: var(--lab);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}
.gr-tl-today {
  position: absolute;
  top: 18px;
  bottom: 0;
  width: 2px;
  background: #e2445c;
  transform: translateX(-1px);
  pointer-events: none;
}
.gr-tl-row {
  display: grid;
  grid-template-columns: 170px 1fr;
  align-items: center;
  gap: 10px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.gr-tl-name {
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.gr-tl-track {
  position: relative;
  height: 26px;
  border-radius: 8px;
  background: var(--surface-2);
}
.gr-tl-bar {
  position: absolute;
  top: 3px;
  bottom: 3px;
  display: flex;
  align-items: center;
  padding: 0 6px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--c) 75%, transparent);
  overflow: hidden;
}
.gr-tl-bar.gr-st-idea,
.gr-tl-bar.gr-st-planned {
  background: repeating-linear-gradient(45deg, color-mix(in srgb, var(--c) 45%, transparent) 0 6px, color-mix(in srgb, var(--c) 25%, transparent) 6px 12px);
}
.gr-tl-bar .gr-dot {
  width: 8px;
  height: 8px;
  margin-right: 3px;
  border: 1px solid #fff;
}
.gr-tl-row:hover .gr-tl-bar {
  outline: 2px solid var(--brand);
}
.gr-pick {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
}
.hr-dialog .gr-pick label.chip-check {
  flex-direction: row;
  align-items: center;
  gap: 4px;
  font-weight: 500;
}
.gr-quiet td {
  opacity: 0.6;
}
.gr-platforms {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.gr-platform {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
}
.gr-platform.is-connected {
  border-color: color-mix(in srgb, var(--ok) 45%, var(--line));
}
.gr-platform.is-error {
  border-color: color-mix(in srgb, var(--danger) 45%, var(--line));
}
.gr-platform header {
  display: flex;
  align-items: center;
  gap: 10px;
}
.gr-platform header > div {
  flex: 1;
  min-width: 0;
}
.gr-platform h3,
.gr-platform p {
  margin: 0;
}
.gr-logo {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  color: #fff;
  font-size: 1.15rem;
  font-weight: 800;
  vertical-align: middle;
}
.gr-error {
  color: var(--danger);
  font-size: 0.85rem;
}
@media (max-width: 640px) {
  .gr-timeline {
    --lab: 100px;
  }
  .gr-tl-row {
    grid-template-columns: 90px 1fr;
  }
}

/* ------------------------------------------------------------ charts (charts.js) and Costs & analytics (finance.js) */

/* Categorical slots in fixed order (validated on these surfaces: light #fff, dark #161925). */
:root {
  --viz-1: #2a78d6;
  --viz-2: #eb6834;
  --viz-3: #1baf7a;
  --viz-4: #eda100;
  --viz-5: #e87ba4;
  --viz-6: #008300;
  --viz-muted: #a3a29b;
  --viz-pos: #2a78d6;
  --viz-neg: #e34948;
  --viz-grid: #e1e0d9;
  --viz-axis: #c3c2b7;
  --viz-good: #006300;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme='light'])) {
    --viz-1: #3987e5;
    --viz-2: #d95926;
    --viz-3: #199e70;
    --viz-4: #c98500;
    --viz-5: #d55181;
    --viz-6: #008300;
    --viz-muted: #6e6d68;
    --viz-pos: #3987e5;
    --viz-neg: #e66767;
    --viz-grid: #2c2c2a;
    --viz-axis: #383835;
    --viz-good: #0ca30c;
  }
}
:root[data-theme='dark'] {
  --viz-1: #3987e5;
  --viz-2: #d95926;
  --viz-3: #199e70;
  --viz-4: #c98500;
  --viz-5: #d55181;
  --viz-6: #008300;
  --viz-muted: #6e6d68;
  --viz-pos: #3987e5;
  --viz-neg: #e66767;
  --viz-grid: #2c2c2a;
  --viz-axis: #383835;
  --viz-good: #0ca30c;
}

.viz {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  min-width: 0;
}
.viz-head {
  display: flex;
  flex-direction: column;
}
.viz-head b {
  font-size: 1.02rem;
}
.viz-head span {
  color: var(--muted);
  font-size: 0.85rem;
}
.viz-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin: 0;
  padding: 0;
  color: var(--muted);
  font-size: 0.85rem;
  list-style: none;
}
.viz-legend li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.viz-key {
  display: inline-block;
  flex: none;
  background: var(--c);
}
.viz-key.rect {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}
.viz-key.line {
  width: 14px;
  height: 2px;
  border-radius: 2px;
}
.viz-body {
  position: relative;
  height: 240px;
  margin: 0 0 22px 44px;
}
.viz-grid,
.viz-plot {
  position: absolute;
  inset: 0;
}
.viz-gl {
  position: absolute;
  right: 0;
  left: 0;
  border-top: 1px solid var(--viz-grid);
}
.viz-gl.zero {
  border-color: var(--viz-axis);
}
.viz-gl em {
  position: absolute;
  right: calc(100% + 8px);
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 0.72rem;
  font-style: normal;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.viz-x {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  left: 0;
  height: 16px;
}
.viz-x span {
  position: absolute;
  transform: translateX(-50%);
  color: var(--muted);
  font-size: 0.72rem;
  white-space: nowrap;
}
.viz-x span.minor {
  display: none;
}
.viz-plot svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.viz-line {
  fill: none;
  stroke: var(--c);
  stroke-width: 2px;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.viz-line.dashed {
  stroke-dasharray: 5 5;
}
.viz-area {
  fill: var(--c);
  opacity: 0.1;
}
.viz-dot {
  position: absolute;
  width: 10px;
  height: 10px;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--c);
  transform: translate(-50%, 50%);
  box-sizing: content-box;
}
.viz-end {
  position: absolute;
  left: calc(100% + 8px);
  transform: translateY(50%);
  color: var(--text);
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}
.viz-plot.line {
  cursor: crosshair;
}
.viz-plot:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 4px;
  border-radius: 4px;
}
.viz-cross {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--viz-axis);
  pointer-events: none;
}
.viz-col {
  position: absolute;
  top: 0;
  bottom: 0;
  padding: 0;
  border: 0;
  background: none;
  transform: translateX(-50%);
  cursor: default;
}
.viz-col:hover,
.viz-col.is-hot,
.viz-col:focus-visible {
  background: color-mix(in srgb, var(--text) 5%, transparent);
  outline: none;
}
.viz-stack {
  position: absolute;
  left: 50%;
  display: flex;
  flex-direction: column-reverse;
  gap: 2px;
  width: min(24px, 64%);
  transform: translateX(-50%);
}
.viz-stack.neg {
  flex-direction: column;
}
.viz-seg {
  display: block;
  min-height: 1px;
  background: var(--c);
}
.viz-stack:not(.neg) .viz-seg:last-child {
  border-radius: 4px 4px 0 0;
}
.viz-stack.neg .viz-seg:last-child {
  border-radius: 0 0 4px 4px;
}
.viz-tip {
  position: absolute;
  top: 6px;
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 140px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
  font-size: 0.8rem;
  pointer-events: none;
}
.viz-tip[hidden] {
  display: none;
}
.viz-tip > b {
  color: var(--muted);
  font-weight: 600;
}
.viz-tip > span {
  display: flex;
  align-items: center;
  gap: 6px;
}
.viz-tip strong {
  font-variant-numeric: tabular-nums;
}
.viz-tip small {
  color: var(--muted);
}
.viz-bars {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.viz-bars li {
  display: grid;
  grid-template-columns: minmax(90px, 34%) 1fr auto;
  align-items: center;
  gap: 10px;
  border-radius: 6px;
}
.viz-bars li:hover,
.viz-bars li.is-hot,
.viz-bars li:focus-visible {
  background: color-mix(in srgb, var(--text) 4%, transparent);
  outline: none;
}
.viz-body:has(.viz-bars),
.viz-body:has(.viz-segbar) {
  height: auto;
  margin: 0;
}
.viz-bar-name {
  overflow: hidden;
  font-size: 0.88rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.viz-flag {
  color: var(--danger);
  font-size: 0.75rem;
  font-weight: 700;
}
.viz-bar-track {
  position: relative;
  height: 16px;
}
.viz-bar {
  position: absolute;
  top: 2px;
  bottom: 2px;
  left: 0;
  min-width: 2px;
  border-radius: 0 4px 4px 0;
  background: var(--c);
}
.viz-target {
  position: absolute;
  top: -2px;
  bottom: -2px;
  width: 2px;
  margin-left: -1px;
  border-radius: 2px;
  background: var(--text);
}
.viz-bar-val {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  white-space: nowrap;
}
.viz-bar-val small {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 400;
}
.viz-segbar {
  display: flex;
  gap: 2px;
  height: 28px;
}
.viz-part {
  display: flex;
  align-items: center;
  min-width: 2px;
  padding-left: 6px;
  border-radius: 4px;
  background: var(--c);
  color: var(--ink, #fff);
  font-size: 0.75rem;
  font-weight: 700;
  overflow: hidden;
  white-space: nowrap;
}
.viz-part:hover,
.viz-part.is-hot,
.viz-part:focus-visible {
  filter: brightness(1.12);
  outline: none;
}
.viz-table summary {
  color: var(--muted);
  font-size: 0.8rem;
  cursor: pointer;
}
.viz-table table {
  margin-top: 8px;
  font-size: 0.85rem;
}

.fin-grid {
  display: grid;
  gap: 16px;
}
.fin-grid.two {
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
}
.fin-grid.three {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}
.fin-grid > .panel,
.hr-body > .panel {
  margin: 0;
  min-width: 0;
}
.fin .viz-body:not(:has(.viz-bars, .viz-segbar)) {
  margin-right: 70px;
}
.fin-delta {
  font-size: 0.8rem;
  font-weight: 700;
}
.fin-delta.good {
  color: var(--viz-good);
}
.fin-delta.bad {
  color: var(--danger);
}
.fin-neg {
  color: var(--danger);
}
.fin-in {
  color: var(--viz-good);
}
.fin-meter {
  display: block;
  height: 8px;
  margin: 4px 0;
  border-radius: 99px;
  background: color-mix(in srgb, var(--viz-1) 18%, transparent);
  overflow: hidden;
}
.fin-meter i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--viz-1);
}
.fin-meter.warn i {
  background: #fab219;
}
.fin-meter.over i {
  background: #d03b3b;
}
.fin-h3 {
  margin: 18px 0 8px;
  font-size: 0.95rem;
}
.fin-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.fin-list li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 6px;
  border-bottom: 1px dashed var(--line);
}
.fin-filters {
  margin-bottom: 16px;
}
.fin-settings td input:not([type='hidden']):not(.hr-cell),
.fin-settings td select {
  min-height: 34px;
}
.hr-dialog .segmented label {
  padding: 5px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
}
.hr-dialog .segmented label[aria-current] {
  background: var(--brand-tint);
  color: var(--brand-strong);
}
@media (max-width: 640px) {
  .fin-grid.two,
  .fin-grid.three {
    grid-template-columns: minmax(0, 1fr);
  }
  .viz-body {
    height: 200px;
    margin-left: 38px;
  }
  .viz-x span.mid {
    display: none;
  }
  .fin .viz-body {
    margin-right: 56px;
  }
}

/* ------------------------------------------------------------ collapsible sidebar groups */

.sidebar nav.nav-group {
  gap: 0;
}
.sidebar .nav-items {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  width: calc(100% - 8px);
  padding: 4px 6px 4px 0;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  text-align: left;
  cursor: pointer;
}
.nav-toggle:hover {
  color: var(--text);
}
.nav-toggle:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}
.nav-caret {
  width: 7px;
  height: 7px;
  margin-right: 4px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  transition: transform 0.15s;
}
.nav-group.collapsed .nav-caret {
  transform: rotate(-45deg);
}
/* Folded: everything hides except the page you're on. */
.nav-group.collapsed .nav-items > :not([aria-current='page']) {
  display: none;
}
/* A folded group with unread counts in it gets a dot on its heading. */
.nav-group.collapsed:has(.count:not([hidden]):not(:empty)) .nav-toggle span::after {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-left: 6px;
  border-radius: 50%;
  background: var(--brand);
  vertical-align: middle;
}
@media (prefers-reduced-motion: reduce) {
  .nav-caret {
    transition: none;
  }
}

/* ------------------------------------------------------------ Performance & maintenance (ops.js) */

.ops {
  --ops-up: #00a65f;
  --ops-slow: #e08a00;
  --ops-down: #d83a52;
  --ops-maint: #579bfc;
  --ops-off: #8a90a2;
}
.ops-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ops-c, var(--ops-off)) 15%, transparent);
  color: var(--ops-c, var(--ops-off));
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
  vertical-align: middle;
}
.ops-badge i {
  font-style: normal;
  font-size: 0.7rem;
}
.ops-up { --ops-c: var(--ops-up); }
.ops-slow { --ops-c: var(--ops-slow); }
.ops-down { --ops-c: var(--ops-down); }
.ops-maint { --ops-c: var(--ops-maint); }
.ops-paused { --ops-c: var(--ops-off); }
.ops-txt-down { color: var(--ops-down, #d83a52); font-weight: 700; }
.ops-txt-slow { color: var(--ops-slow, #e08a00); font-weight: 700; }

.ops-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px 16px;
  margin: 0 0 14px;
  padding: 12px 16px;
  border: 1px solid color-mix(in srgb, var(--ops-c) 35%, var(--line));
  border-radius: 14px;
  background: color-mix(in srgb, var(--ops-c) 10%, var(--surface));
}
.ops-banner b {
  color: var(--ops-c);
  font-size: 1.05rem;
}
.ops-banner.good { --ops-c: var(--ops-up); }
.ops-banner.warn { --ops-c: var(--ops-slow); }
.ops-banner.bad { --ops-c: var(--ops-down); }

.ops-warn {
  border-color: color-mix(in srgb, var(--ops-slow) 45%, var(--line));
}
.ops-warn h2 {
  margin-top: 0;
  font-size: 1rem;
}
.ops-maint-note p {
  margin: 4px 0;
}

.ops-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  gap: 14px;
}
.ops-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  border-top: 3px solid var(--ops-c, var(--line));
}
.ops-card header,
.ops-card footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 10px;
}
.ops-card-title {
  display: flex;
  flex-direction: column;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}
.ops-card-title b {
  font-size: 1.02rem;
}
.ops-card-title small {
  color: var(--muted);
  overflow-wrap: anywhere;
}
.ops-card-title:hover b {
  text-decoration: underline;
}
.ops-facts {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin: 0;
}
.ops-facts div {
  min-width: 0;
}
.ops-facts dt {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.ops-facts dd {
  margin: 2px 0 0;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.ops-exp {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 2px 10px;
}
.ops-exp-item {
  font-style: normal;
}
.ops .segmented.small {
  width: fit-content;
  max-width: 100%;
}
.ops-problem {
  margin: 0;
  padding: 6px 10px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--ops-down) 10%, transparent);
  color: var(--ops-down);
  font-size: 0.88rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

/* Status strip: one bar per check, height = response time; failures are full-height in red. */
.ops-strip {
  display: grid;
  grid-template-columns: repeat(60, 1fr);
  align-items: end;
  gap: 1px;
  height: 34px;
}
.ops-strip.empty {
  display: flex;
  align-items: center;
}
.ops-strip i {
  height: var(--h, 100%);
  min-height: 3px;
  border-radius: 2px 2px 0 0;
  background: var(--ops-c, var(--ops-up));
}
.ops-strip i.none {
  height: 3px;
  background: var(--line);
}
.ops-strip i.ops-up {
  background: color-mix(in srgb, var(--ops-up) 75%, transparent);
}

.ops-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.ops-head h2 {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 0 0 4px;
}
.ops-head p {
  margin: 4px 0;
  overflow-wrap: anywhere;
}
.ops .segmented.small {
  margin: 0 0 14px;
}
.ops-h2 {
  margin: 18px 0 8px;
  font-size: 1.1rem;
}
.ops .hr-toolbar .ops-h2 {
  margin: 0;
}
.ops-pick {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin: 0;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.ops-pick p {
  flex-basis: 100%;
  margin: 0;
}
.ops-log {
  margin: 0;
  padding: 0;
  list-style: none;
}
.ops-log li {
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 10px;
  padding: 10px 16px;
  border-top: 1px solid var(--line);
}
.ops-log li:first-child {
  border-top: 0;
}
.ops-log time {
  color: var(--muted);
  font-size: 0.85rem;
}
@media (max-width: 640px) {
  .ops-facts {
    grid-template-columns: repeat(2, 1fr);
  }
  .ops-log li {
    grid-template-columns: 1fr;
    gap: 2px;
  }
}

/* ------------------------------------------------------------ SEO (seo.js) */

.seo {
  --seo-pass: #00a65f;
  --seo-warn: #c27400;
  --seo-fail: #d83a52;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .seo {
    --seo-pass: #3ddc97;
    --seo-warn: #ffb547;
    --seo-fail: #ff7a8a;
  }
}
:root[data-theme='dark'] .seo {
  --seo-pass: #3ddc97;
  --seo-warn: #ffb547;
  --seo-fail: #ff7a8a;
}
.seo-pass { --seo-c: var(--seo-pass); color: var(--seo-pass); }
.seo-warn { --seo-c: var(--seo-warn); color: var(--seo-warn); }
.seo-fail { --seo-c: var(--seo-fail); color: var(--seo-fail); }
.seo-ring {
  --size: 54px;
  display: inline-grid;
  flex: none;
  place-items: center;
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  background: conic-gradient(var(--seo-c, var(--muted)) calc(var(--p) * 1%), color-mix(in srgb, var(--muted) 18%, transparent) 0);
}
.seo-ring::before {
  content: '';
  grid-area: 1 / 1;
  width: calc(var(--size) - 10px);
  height: calc(var(--size) - 10px);
  border-radius: 50%;
  background: var(--surface, #fff);
}
.seo-ring b {
  grid-area: 1 / 1;
  position: relative;
  color: var(--text);
  font-size: calc(var(--size) * 0.34);
}
.seo-ring.big { --size: 96px; }
.seo-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  gap: 14px;
}
.seo-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
}
.seo-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}
.seo-card-head span {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.seo-card-head small {
  color: var(--muted);
  overflow-wrap: anywhere;
}
.seo-card-head:hover b { text-decoration: underline; }
.seo-card footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: auto;
}
.seo-card p { margin: 0; }
.seo-areas {
  display: grid;
  gap: 5px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.85rem;
}
.seo-areas li {
  display: grid;
  grid-template-columns: 9.5em 1fr 2.2em;
  align-items: center;
  gap: 8px;
}
.seo-areas b { text-align: right; }
.seo-bar {
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--seo-c) var(--w), color-mix(in srgb, var(--muted) 18%, transparent) var(--w));
}
.seo-kw-list { display: flex; flex-wrap: wrap; gap: 4px; }
.seo-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
}
.seo-hero > div:nth-child(2) { flex: 1 1 220px; min-width: 0; }
.seo-hero h2, .seo-hero p { margin: 0 0 4px; overflow-wrap: anywhere; }
.seo-area-row .hr-tile b { font-size: 1.6rem; }
.seo-alert { border-left: 4px solid var(--seo-fail); }
.seo-checks {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}
.seo-checks li {
  display: grid;
  grid-template-columns: 6.5em 1fr;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  color: var(--text);
}
.seo-checks li:first-child { border-top: 0; }
.seo-level {
  display: inline-flex;
  align-items: center;
  align-self: start;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--seo-c) 14%, transparent);
  color: var(--seo-c);
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}
.seo-level i { font-style: normal; }
.seo-detail {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  overflow-wrap: anywhere;
}
.seo-fix { margin: 4px 0 0; font-size: 0.9rem; }
.seo-serp {
  max-width: 600px;
  margin: 0 0 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-family: Arial, Helvetica, sans-serif;
}
.seo-serp small { color: var(--muted); overflow-wrap: anywhere; }
.seo-serp b {
  display: block;
  margin: 2px 0;
  overflow: hidden;
  color: #1a0dab;
  font-size: 1.15rem;
  font-weight: 400;
  text-overflow: ellipsis;
  white-space: nowrap;
}
:root[data-theme='dark'] .seo-serp b { color: #8ab4f8; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .seo-serp b { color: #8ab4f8; }
}
.seo-serp p {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.88rem;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.seo-facts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
  gap: 10px 18px;
  margin: 0 0 10px;
}
.seo-facts dt {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.seo-facts dd { margin: 2px 0 0; overflow-wrap: anywhere; }
.seo-outline { margin: 8px 0 0; padding-left: 0; list-style: none; font-size: 0.9rem; }
.seo-outline li { padding: 2px 0; overflow-wrap: anywhere; }
.seo-outline li.h2 { padding-left: 1.5em; }
.seo-outline b { color: var(--muted); font-size: 0.75rem; }
.seo-quick .row input[name='url'] { flex: 2 1 240px; }
.seo-quick .row input[name='keyword'] { flex: 1 1 160px; }
.seo-kw td, .seo-kw th { text-align: center; }
.seo-kw td:first-child, .seo-kw th:first-child { text-align: left; }
@media (max-width: 640px) {
  .seo-checks li { grid-template-columns: 1fr; gap: 4px; }
  .seo-areas li { grid-template-columns: 8em 1fr 2em; }
}

/* Mail: workspaces linked to a domain; Messages: delete a notice (super admin) */
.check-list { display: grid; gap: 6px; max-height: 50vh; overflow: auto; }
.cv-sys-del {
  margin-left: 6px;
  padding: 0 5px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.cv-sys-del:hover { color: var(--danger, #d83a52); }
