/* ───────── Tokens ───────── */
:root {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-2: #fafafc;
  --fill: rgba(0, 0, 0, 0.06);
  --ink: #1d1d1f;
  --ink-2: #515154;
  --ink-3: #86868b;
  --line: rgba(0, 0, 0, 0.08);
  --line-strong: rgba(0, 0, 0, 0.16);
  --glass: rgba(255, 255, 255, 0.72);

  --blue: #0071e3;
  --blue-hover: #0077ed;
  --blue-soft: rgba(0, 113, 227, 0.12);
  --green: #248a3d;
  --green-dot: #30d158;
  --green-soft: rgba(48, 209, 88, 0.16);
  --red: #d70015;
  --red-solid: #ff3b30;
  --red-soft: rgba(255, 59, 48, 0.12);
  --amber: #a35a00;
  --amber-dot: #ff9f0a;

  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.05);
  --shadow-2: 0 2px 8px rgba(0, 0, 0, 0.06), 0 30px 70px rgba(0, 0, 0, 0.14);
  --ease: cubic-bezier(0.22, 0.9, 0.28, 1);

  color-scheme: light dark;
  font-family:
    -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", Inter,
    "Segoe UI", Roboto, system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --surface: #1c1c1e;
    --surface-2: #232326;
    --fill: rgba(255, 255, 255, 0.09);
    --ink: #f5f5f7;
    --ink-2: #c7c7cc;
    --ink-3: #8e8e93;
    --line: rgba(255, 255, 255, 0.1);
    --line-strong: rgba(255, 255, 255, 0.2);
    --glass: rgba(28, 28, 30, 0.68);

    --blue: #2997ff;
    --blue-hover: #4aa8ff;
    --blue-soft: rgba(41, 151, 255, 0.18);
    --green: #30d158;
    --green-soft: rgba(48, 209, 88, 0.18);
    --red: #ff6961;
    --red-soft: rgba(255, 69, 58, 0.18);
    --amber: #ffb340;

    --shadow-1: 0 0 0 1px rgba(255, 255, 255, 0.04);
    --shadow-2: 0 30px 80px rgba(0, 0, 0, 0.6);
  }
}

* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
}
body {
  min-height: 100vh;
  background: var(--bg);
}
.hidden {
  display: none !important;
}
button,
input {
  font: inherit;
  color: inherit;
}
button {
  border: 0;
  background: none;
  cursor: pointer;
}
small {
  display: block;
  color: var(--ink-3);
  font-size: 12.5px;
  margin-top: 2px;
}
code {
  font:
    500 12.5px ui-monospace,
    "SF Mono",
    Menlo,
    Consolas,
    monospace;
}
:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--blue) 55%, transparent);
  outline-offset: 2px;
}

.ico {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

/* ───────── Buttons ───────── */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  padding: 0 20px;
  border-radius: 999px;
  font-size: 14.5px;
  font-weight: 600;
  white-space: nowrap;
  transition:
    background-color 0.2s,
    transform 0.15s var(--ease),
    opacity 0.2s;
}
.btn:active {
  transform: scale(0.97);
}
.btn:disabled {
  opacity: 0.6;
  cursor: default;
}
.btn-sm {
  height: 32px;
  padding: 0 14px;
  font-size: 13px;
}
.btn-lg {
  height: 52px;
  font-size: 17px;
  width: 100%;
  margin-top: 8px;
}
.btn-primary {
  background: var(--blue);
  color: #fff;
  --spin: #fff;
}
.btn-primary:hover {
  background: var(--blue-hover);
}
.btn-ghost {
  background: var(--fill);
  --spin: var(--ink);
}
.btn-ghost:hover {
  background: color-mix(in srgb, var(--fill) 70%, var(--ink) 10%);
}
.btn-soft-danger {
  background: var(--red-soft);
  color: var(--red);
  --spin: var(--red);
}
.btn-soft-danger:hover {
  background: color-mix(in srgb, var(--red-soft) 70%, var(--red-solid) 18%);
}
.btn-danger {
  background: var(--red-solid);
  color: #fff;
  --spin: #fff;
}
.btn-danger:hover {
  background: #ff5247;
}
.btn.loading {
  pointer-events: none;
  color: transparent;
}
.btn.loading::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 18px;
  height: 18px;
  border: 2px solid color-mix(in srgb, var(--spin) 30%, transparent);
  border-top-color: var(--spin);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ───────── Logo mark ───────── */
.mark {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: linear-gradient(150deg, #5ab4ff, #0071e3 58%, #0050b3);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.45),
    0 10px 30px rgba(0, 113, 227, 0.35);
  color: #fff;
  font-weight: 700;
  font-size: 22px;
  letter-spacing: 0.02em;
}
.mark.small {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  font-size: 13px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.4),
    0 4px 12px rgba(0, 113, 227, 0.3);
}

/* ───────── Login ───────── */
.login-shell {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 24px 0;
}
.orbs i {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.55;
  will-change: transform;
}
.orbs i:nth-child(1) {
  width: 52vmax;
  height: 52vmax;
  left: -14vmax;
  top: -18vmax;
  background: #3d9bff;
  animation: drift1 26s ease-in-out infinite alternate;
}
.orbs i:nth-child(2) {
  width: 44vmax;
  height: 44vmax;
  right: -12vmax;
  top: 8vmax;
  background: #7ee0ff;
  animation: drift2 30s ease-in-out infinite alternate;
  opacity: 0.45;
}
.orbs i:nth-child(3) {
  width: 40vmax;
  height: 40vmax;
  left: 20vw;
  bottom: -24vmax;
  background: #b58cff;
  animation: drift3 34s ease-in-out infinite alternate;
  opacity: 0.4;
}
@media (prefers-color-scheme: dark) {
  .orbs i {
    opacity: 0.32;
  }
  .orbs i:nth-child(2),
  .orbs i:nth-child(3) {
    opacity: 0.24;
  }
}

.login-card {
  position: relative;
  width: min(420px, calc(100% - 32px));
  padding: 48px 36px 36px;
  text-align: center;
  background: var(--glass);
  backdrop-filter: saturate(180%) blur(32px);
  -webkit-backdrop-filter: saturate(180%) blur(32px);
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 32px;
  box-shadow: var(--shadow-2);
  animation: rise 1s var(--ease) both;
}
@media (prefers-color-scheme: dark) {
  .login-card {
    border-color: rgba(255, 255, 255, 0.08);
  }
}
.login-card .mark {
  margin: 0 auto 26px;
  animation: settle 1.1s var(--ease) 0.15s both;
}
.login-card h1 {
  margin: 0;
  font-size: 32px;
  line-height: 1.1;
  letter-spacing: -0.03em;
  font-weight: 700;
}
.lead {
  margin: 10px 0 28px;
  color: var(--ink-2);
  font-size: 17px;
}
.login-card.shake {
  animation: shake 0.45s;
}

.field {
  position: relative;
  margin-top: 12px;
  text-align: left;
}
.field input {
  width: 100%;
  height: 58px;
  padding: 24px 16px 6px;
  border-radius: 14px;
  font-size: 17px;
  outline: 0;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}
.field label {
  position: absolute;
  left: 17px;
  top: 18px;
  color: var(--ink-3);
  font-size: 17px;
  pointer-events: none;
  transform-origin: left top;
  transition:
    transform 0.25s var(--ease),
    color 0.2s;
}
.field input:focus + label,
.field input:not(:placeholder-shown) + label,
.field input:-webkit-autofill + label {
  transform: translateY(-11px) scale(0.76);
}
.field input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px var(--blue-soft);
}
.field input:focus + label {
  color: var(--blue);
}
.error {
  min-height: 22px;
  margin: 12px 0 0;
  color: var(--red);
  font-size: 14px;
}

/* ───────── App shell ───────── */
.app {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
  animation: fade 0.5s var(--ease) both;
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 20;
  display: flex;
  flex-direction: column;
  padding: 22px 14px;
  background: var(--glass);
  backdrop-filter: saturate(180%) blur(28px);
  -webkit-backdrop-filter: saturate(180%) blur(28px);
  border-right: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px;
  margin-bottom: 36px;
}
.brand b {
  font-size: 16px;
  letter-spacing: -0.01em;
}
#nav {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 12px;
  border-radius: 12px;
  color: var(--ink-2);
  font-size: 15px;
  font-weight: 500;
  text-align: left;
  transition:
    color 0.25s,
    background-color 0.2s;
}
.nav:hover {
  color: var(--ink);
}
.nav.active {
  color: var(--blue);
}
.nav-pill {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--w, 0);
  height: var(--h, 0);
  border-radius: 12px;
  background: var(--blue-soft);
  transform: translate(var(--x, 0), var(--y, 0));
}
.nav-pill.ready {
  transition:
    transform 0.5s var(--ease),
    width 0.5s var(--ease),
    height 0.5s var(--ease);
}
.sidebar #clock {
  margin-top: auto;
  padding: 0 12px 14px;
}
.logout {
  margin-top: 0;
}
.logout:hover {
  background: var(--fill);
}

.workspace {
  min-width: 0;
  padding: 44px clamp(20px, 4vw, 64px) 96px;
}
.topbar,
.workspace > section {
  max-width: 1120px;
  margin-inline: auto;
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  margin-bottom: 32px;
}
.titles h2 {
  margin: 0;
  font-size: clamp(30px, 4vw, 44px);
  line-height: 1.08;
  font-weight: 700;
  letter-spacing: -0.035em;
}
.sub {
  margin: 8px 0 0;
  min-height: 1.4em;
  color: var(--ink-3);
  font-size: 17px;
}
#clock {
  display: block;
  color: var(--ink-3);
  font-size: 13px;
  line-height: 1.35;
  font-variant-numeric: tabular-nums;
}
.live {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 38px;
  padding: 0 5px 0 14px;
  margin-bottom: -7px;
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow-1);
  color: var(--ink-2);
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  transition: transform 0.15s var(--ease);
}
.live:active {
  transform: scale(0.97);
}
.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green-dot);
  box-shadow: 0 0 0 3px var(--green-soft);
  transition:
    background-color 0.4s,
    box-shadow 0.4s;
}
.live.stale .live-dot {
  background: var(--amber-dot);
  box-shadow: 0 0 0 3px rgba(255, 159, 10, 0.2);
}
.live-ico {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--fill);
  color: var(--ink-2);
  transition: background-color 0.2s;
}
.live:hover .live-ico {
  background: var(--blue-soft);
  color: var(--blue);
}
.live-ico .ico {
  width: 16px;
  height: 16px;
}
.live.spin .live-ico .ico {
  animation: spin 0.8s linear infinite;
}
.back {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin: 0 0 10px -6px;
  padding: 4px 8px 4px 2px;
  border-radius: 8px;
  color: var(--blue);
  font-size: 15px;
  font-weight: 500;
  transition: background-color 0.2s;
}
.back:hover {
  background: var(--blue-soft);
}

/* ───────── Projects ───────── */
#projects {
  display: grid;
  gap: 20px;
}
.project {
  display: grid;
  grid-template-columns: 1fr 240px;
  overflow: hidden;
  background: var(--surface);
  border-radius: 24px;
  box-shadow: var(--shadow-1);
}
.project-main {
  padding: 30px 34px;
}
.project-head {
  display: flex;
  align-items: center;
  gap: 12px;
}
.project h3 {
  margin: 0;
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -0.02em;
}
.pulse {
  position: relative;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--green-dot);
}
.pulse::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--green-dot);
  animation: ping 2.6s ease-out infinite;
}
.pulse.off {
  background: var(--red-solid);
}
.pulse.off::after {
  display: none;
}
.pill {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  background: var(--green-soft);
  color: var(--green);
}
.pill.off {
  background: var(--red-soft);
  color: var(--red);
}
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-top: 30px;
}
.stat b {
  display: block;
  font-size: 44px;
  line-height: 1;
  font-weight: 700;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}
.stat b.warn {
  color: var(--red);
}
.stat span {
  display: block;
  margin-top: 10px;
  color: var(--ink-3);
  font-size: 14px;
}
.meter {
  height: 6px;
  margin-top: 28px;
  border-radius: 3px;
  background: var(--fill);
  overflow: hidden;
}
.meter i {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--green-dot), #64e8a0);
  transform-origin: left;
  transform: scaleX(var(--p));
}
.meter-cap {
  margin: 10px 0 0;
  color: var(--ink-3);
  font-size: 13px;
}
.project-actions {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  padding: 28px;
  background: var(--surface-2);
  border-left: 1px solid var(--line);
}
.project-actions .btn {
  width: 100%;
}

.enter .project {
  animation: cardIn 0.8s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 100ms + 120ms);
}
.enter .meter i {
  animation: grow 1.1s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 100ms + 450ms);
}

/* ───────── Clients ───────── */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 18px;
}
.search {
  position: relative;
  flex: 1 1 280px;
  max-width: 420px;
  display: block;
}
.search .ico {
  position: absolute;
  left: 13px;
  top: 11px;
  width: 18px;
  height: 18px;
  color: var(--ink-3);
  pointer-events: none;
}
.search input {
  width: 100%;
  height: 40px;
  padding: 0 14px 0 40px;
  border-radius: 12px;
  outline: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}
.search input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px var(--blue-soft);
}
.seg {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  border-radius: 12px;
  background: var(--fill);
}
.seg button {
  height: 34px;
  padding: 0 14px;
  border-radius: 9px;
  color: var(--ink-2);
  font-size: 13.5px;
  font-weight: 500;
  transition:
    background-color 0.2s,
    color 0.2s,
    box-shadow 0.2s;
}
.seg button em {
  font-style: normal;
  margin-left: 6px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
.seg button.on {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.table-wrap {
  overflow: auto;
  background: var(--surface);
  border-radius: 24px;
  box-shadow: var(--shadow-1);
}
table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
}
th,
td {
  text-align: left;
  padding: 15px 16px;
  font-size: 14px;
  vertical-align: middle;
}
th {
  padding-block: 13px;
  color: var(--ink-3);
  background: var(--surface-2);
  font-size: 13px;
  font-weight: 600;
  border-bottom: 1px solid var(--line);
}
td {
  border-bottom: 1px solid var(--line);
}
tbody tr:last-child td {
  border-bottom: 0;
}
tbody tr {
  transition: background-color 0.15s;
}
tbody tr:hover {
  background: color-mix(in srgb, var(--fill) 45%, transparent);
}
td.act,
th.act {
  text-align: right;
}
td b {
  font-weight: 600;
}
.t-clients th,
.t-clients td {
  white-space: nowrap;
}
.st-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}
.st-wrap .pill {
  margin: 0;
}
.t-clients td.act .btn {
  min-width: 142px;
}

.who {
  display: flex;
  align-items: center;
  gap: 12px;
}
.avatar {
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 650;
  background: hsl(var(--h, 215) 85% 55% / 0.16);
  color: hsl(var(--h, 215) 65% 38%);
}
.avatar.none {
  background: var(--fill);
  color: var(--ink-3);
}
@media (prefers-color-scheme: dark) {
  .avatar {
    color: hsl(var(--h, 215) 90% 74%);
  }
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  color: var(--ink-3);
}
.status::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ink-3);
  opacity: 0.55;
}
.status.online {
  color: var(--green);
}
.status.online::before {
  background: var(--green-dot);
  opacity: 1;
  box-shadow: 0 0 0 3px var(--green-soft);
}
.status.recent {
  color: var(--amber);
}
.status.recent::before {
  background: var(--amber-dot);
  opacity: 1;
}
td .pill {
  display: flex;
  width: max-content;
  margin-top: 6px;
}
.t-clients td,
.t-clients th {
  white-space: nowrap;
}
th:first-child,
td:first-child {
  padding-left: 24px;
}
th:last-child,
td:last-child {
  padding-right: 24px;
}
.copy {
  padding: 4px 8px;
  margin: -4px -8px;
  border-radius: 8px;
  color: var(--ink-2);
  transition: background-color 0.2s;
}
.copy:hover {
  background: var(--fill);
}
.is-blocked .avatar {
  filter: grayscale(1);
  opacity: 0.7;
}

.empty {
  padding: 72px 24px;
  text-align: center;
  color: var(--ink-3);
}
.empty-ico {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: var(--fill);
}
.empty-ico .ico {
  width: 26px;
  height: 26px;
}
.empty h3 {
  margin: 0 0 6px;
  color: var(--ink);
  font-size: 19px;
  font-weight: 650;
  letter-spacing: -0.02em;
}
.empty p {
  margin: 0;
  font-size: 15px;
}

/* ───────── Audit ───────── */
.tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 12.5px;
  font-weight: 600;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chip {
  display: inline-flex;
  gap: 6px;
  max-width: 260px;
  padding: 3px 10px;
  border-radius: 8px;
  background: var(--fill);
  font-size: 12.5px;
}
.chip i {
  font-style: normal;
  color: var(--ink-3);
}
.chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ───────── Skeleton ───────── */
.skel {
  border-radius: 12px;
  background: linear-gradient(
    90deg,
    var(--fill) 25%,
    color-mix(in srgb, var(--fill) 40%, transparent) 37%,
    var(--fill) 63%
  );
  background-size: 400% 100%;
  animation: shimmer 1.5s ease infinite;
}
.project.is-skel {
  grid-template-columns: 1fr;
  padding: 30px 34px;
  gap: 18px;
}

/* ───────── Dialog ───────── */
dialog {
  width: min(420px, calc(100% - 32px));
  padding: 0;
  border: 0;
  border-radius: 26px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-2);
}
dialog[open] {
  animation: pop 0.35s var(--ease);
}
dialog::backdrop {
  background: rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
dialog[open]::backdrop {
  animation: fade 0.3s ease;
}
dialog form {
  padding: 30px 28px 24px;
}
dialog h3 {
  margin: 0 0 8px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.025em;
}

#projectDialog {
  width: min(680px, calc(100% - 24px));
  max-width: 680px;
}
.project-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 20px;
}
.project-grid label {
  font-size: 12px;
  color: var(--muted);
}
.project-grid .wide {
  grid-column: 1/-1;
}
.project-grid input,
.project-grid textarea {
  display: block;
  width: 100%;
  margin-top: 7px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 12px;
  background: var(--panel);
  color: var(--ink);
  font: inherit;
}
.project-grid textarea {
  resize: vertical;
  font:
    12px/1.45 ui-monospace,
    SFMono-Regular,
    Consolas,
    monospace;
}
@media (max-width: 620px) {
  .project-grid {
    grid-template-columns: 1fr;
  }
  .project-grid .wide {
    grid-column: auto;
  }
}
dialog p {
  margin: 0;
  color: var(--ink-2);
  font-size: 15.5px;
  line-height: 1.45;
}
.dialog-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 26px;
}

/* ───────── Toasts ───────── */
#toasts {
  position: fixed;
  z-index: 100;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  display: grid;
  gap: 8px;
  justify-items: center;
  pointer-events: none;
}
.toast {
  padding: 12px 20px;
  border-radius: 999px;
  background: rgba(29, 29, 31, 0.92);
  color: #fff;
  font-size: 14.5px;
  font-weight: 500;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(20px);
  animation: toastIn 0.45s var(--ease) both;
}
.toast.err {
  background: rgba(215, 0, 21, 0.94);
}
.toast.out {
  animation: toastOut 0.3s ease forwards;
}
@media (prefers-color-scheme: dark) {
  .toast {
    background: rgba(245, 245, 247, 0.94);
    color: #1d1d1f;
  }
}

/* ───────── View transitions ───────── */
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.28s;
  animation-timing-function: ease;
}

/* ───────── Keyframes ───────── */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
@keyframes fade {
  from {
    opacity: 0;
  }
}
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(36px) scale(0.96);
  }
}
@keyframes settle {
  from {
    opacity: 0;
    transform: translateY(-14px) scale(0.7) rotate(-8deg);
  }
}
@keyframes shake {
  20% {
    transform: translateX(-9px);
  }
  40% {
    transform: translateX(8px);
  }
  60% {
    transform: translateX(-5px);
  }
  80% {
    transform: translateX(3px);
  }
}
@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(22px) scale(0.985);
  }
}
@keyframes grow {
  from {
    transform: scaleX(0);
  }
}
@keyframes ping {
  0% {
    transform: scale(1);
    opacity: 0.55;
  }
  70%,
  100% {
    transform: scale(3.2);
    opacity: 0;
  }
}
@keyframes shimmer {
  to {
    background-position: -135% 0;
  }
}
@keyframes pop {
  from {
    opacity: 0;
    transform: scale(0.92) translateY(10px);
  }
}
@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.96);
  }
}
@keyframes toastOut {
  to {
    opacity: 0;
    transform: translateY(8px);
  }
}
@keyframes drift1 {
  to {
    transform: translate(14vmax, 10vmax) scale(1.12);
  }
}
@keyframes drift2 {
  to {
    transform: translate(-12vmax, 12vmax) scale(0.9);
  }
}
@keyframes drift3 {
  to {
    transform: translate(8vmax, -10vmax) scale(1.15);
  }
}

/* ───────── Polish: фильтр, поиск, строки, обратная связь ───────── */
.seg {
  position: relative;
}
.seg button {
  position: relative;
  z-index: 1;
}
.seg button:active {
  transform: scale(0.96);
}
.seg button.on {
  background: none;
  box-shadow: none;
  color: var(--ink);
}
.seg-thumb {
  position: absolute;
  z-index: 0;
  left: 0;
  top: 3px;
  height: 34px;
  width: var(--w, 0);
  transform: translateX(var(--x, 0));
  border-radius: 9px;
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}
.seg.ready .seg-thumb {
  transition:
    transform 0.4s var(--ease),
    width 0.4s var(--ease);
}

.search kbd {
  position: absolute;
  right: 10px;
  top: 9px;
  height: 22px;
  padding: 0 7px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: var(--fill);
  color: var(--ink-3);
  font:
    500 12px ui-monospace,
    Menlo,
    monospace;
  pointer-events: none;
  transition: opacity 0.2s;
}
.search:focus-within kbd,
.search input:not(:placeholder-shown) ~ kbd {
  opacity: 0;
}

.enter .t-clients tbody tr {
  animation: rowIn 0.5s var(--ease) both;
  animation-delay: calc(min(var(--i, 0), 12) * 28ms);
}
.t-clients tbody tr.flash {
  animation: flash 1.8s ease-out;
}
.stat b {
  transform-origin: left bottom;
}
.bump {
  animation: bump 0.9s var(--ease);
}
.copy:active {
  transform: scale(0.96);
}
.copy.done::after {
  content: "✓";
  margin-left: 6px;
  color: var(--green);
  font-weight: 700;
}
.live.stale {
  color: var(--amber);
}
.titles h2:focus {
  outline: 0;
}
.titles h2,
.empty h3,
.empty p,
dialog h3 {
  text-wrap: balance;
}

.field .peek {
  position: absolute;
  right: 8px;
  top: 11px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: var(--ink-3);
  transition:
    color 0.2s,
    background-color 0.2s;
}
.field .peek:hover {
  color: var(--ink);
  background: var(--fill);
}
.field .peek.on {
  color: var(--blue);
}
.field.has-peek input {
  padding-right: 52px;
}
.peek .slash {
  stroke-dasharray: 23;
  stroke-dashoffset: 23;
  transition: stroke-dashoffset 0.3s var(--ease);
}
.peek.on .slash {
  stroke-dashoffset: 0;
}

@keyframes rowIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}
@keyframes flash {
  from {
    background: var(--blue-soft);
  }
}
@keyframes bump {
  35% {
    transform: scale(1.12);
    color: var(--blue);
  }
}

@media (pointer: coarse) {
  .btn-sm {
    height: 40px;
  }
  .seg button {
    height: 38px;
  }
  .seg-thumb {
    height: 38px;
  }
  .search kbd {
    display: none;
  }
  .copy {
    padding: 8px;
    margin: -8px;
  }
}

/* ───────── Tablet / mobile ───────── */
@media (max-width: 820px) {
  .app {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: fixed;
    top: auto;
    height: auto;
    flex-direction: row;
    gap: 4px;
    padding: 6px;
    left: 12px;
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    border: 1px solid var(--line);
    border-radius: 26px;
    box-shadow: var(--shadow-2);
  }
  .brand {
    display: none;
  }
  #nav {
    flex: 2;
    flex-direction: row;
  }
  .nav {
    flex: 1;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    padding: 8px 4px;
    font-size: 11.5px;
    text-align: center;
    border-radius: 20px;
  }
  .nav-pill {
    border-radius: 20px;
  }
  .logout {
    flex: 1;
    margin-top: 0;
  }
  .workspace {
    padding: calc(28px + env(safe-area-inset-top)) 18px
      calc(120px + env(safe-area-inset-bottom));
  }
  .topbar {
    margin-bottom: 24px;
  }
  .sub {
    font-size: 15px;
  }
  #toasts {
    bottom: calc(96px + env(safe-area-inset-bottom));
  }

  .project {
    grid-template-columns: 1fr;
  }
  .project-main {
    padding: 24px 22px;
  }
  .project-actions {
    border-left: 0;
    border-top: 1px solid var(--line);
    padding: 18px 22px 22px;
  }
  .stats {
    gap: 12px;
  }
  .stat b {
    font-size: 32px;
  }
  .stat span {
    font-size: 13px;
  }

  .table-wrap {
    overflow: visible;
    background: none;
    box-shadow: none;
    border-radius: 0;
  }
  table,
  tbody,
  tr,
  td {
    display: block;
  }
  table {
    min-width: 0;
  }
  thead {
    display: none;
  }
  tbody {
    display: grid;
    gap: 12px;
  }
  tbody tr:hover {
    background: var(--surface);
  }
  tr {
    background: var(--surface);
    border-radius: 22px;
    box-shadow: var(--shadow-1);
    padding: 18px;
  }
  td {
    padding: 0 !important;
    border: 0;
    white-space: normal !important;
  }
  td .pill {
    display: inline-flex;
    margin: 0 0 0 8px;
  }
  td[data-label]:not(.who-cell):not(.act):not(.st)::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 2px;
    color: var(--ink-3);
    font-size: 12px;
  }

  .t-clients tr {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    align-items: end;
    grid-template-areas: "who who" "dev id" "time act";
  }
  .t-clients td:nth-child(1) {
    position: absolute;
    top: 20px;
    right: 18px;
  }
  .st-wrap {
    flex-direction: column-reverse;
    align-items: flex-end;
    gap: 6px;
  }
  .t-clients td.who-cell {
    padding-right: 104px;
    min-height: 38px;
  }
  .t-clients td:nth-child(2) {
    grid-area: who;
  }
  .t-clients td:nth-child(3) {
    grid-area: dev;
  }
  .t-clients td:nth-child(4) {
    grid-area: id;
  }
  .t-clients td:nth-child(5) {
    grid-area: time;
  }
  .t-clients td:nth-child(6) {
    grid-area: act;
  }
  .t-clients td.act {
    justify-self: end;
  }
  .t-clients td.act .btn {
    min-width: 0;
  }
  .t-audit tr {
    display: grid;
    gap: 10px;
  }
  .copy {
    margin: 0 -8px;
  }
  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }
  .live {
    margin-bottom: 0;
  }
  .toolbar .seg {
    width: 100%;
  }
  .toolbar .seg button {
    flex: 1;
    padding: 0 8px;
  }
  .search {
    max-width: none;
  }
  .sidebar #clock {
    display: none;
  }
}

/* ───────── Practical: сортировка, выбор, пакетные действия ───────── */
.th-sort {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 6px;
  margin: -4px -6px;
  border-radius: 8px;
  font: inherit;
  color: inherit;
  transition:
    color 0.2s,
    background-color 0.2s;
}
.th-sort:hover {
  color: var(--ink);
  background: var(--fill);
}
.th-sort.on {
  color: var(--ink);
}
.th-sort .ico {
  width: 14px;
  height: 14px;
  opacity: 0;
  transition:
    opacity 0.2s,
    transform 0.3s var(--ease);
}
.th-sort:hover .ico {
  opacity: 0.45;
}
.th-sort.on .ico {
  opacity: 1;
}
.th-sort.desc .ico {
  transform: rotate(180deg);
}
th .sel {
  margin-right: 12px;
  vertical-align: middle;
}

.sel {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  display: inline-grid;
  place-content: center;
  width: 18px;
  height: 18px;
  margin: 0;
  border-radius: 6px;
  border: 1.5px solid var(--line-strong);
  background: var(--surface);
  cursor: pointer;
  transition:
    background-color 0.2s,
    border-color 0.2s,
    transform 0.15s var(--ease);
}
.sel:active {
  transform: scale(0.88);
}
.sel::after {
  content: "";
  width: 9px;
  height: 5px;
  margin-top: -2px;
  border: solid #fff;
  border-width: 0 0 2px 2px;
  transform: rotate(-45deg) scale(0);
  transition: transform 0.22s var(--ease);
}
.sel:checked,
.sel:indeterminate {
  background: var(--blue);
  border-color: var(--blue);
}
.sel:checked::after {
  transform: rotate(-45deg) scale(1);
}
.sel:indeterminate::after {
  height: 0;
  margin: 0;
  border-width: 2px 0 0;
  transform: scale(1);
}
.t-clients tbody tr.is-sel,
.t-clients tbody tr.is-sel:hover {
  background: var(--blue-soft);
}

.toolbar .export {
  margin-left: auto;
  height: 36px;
}
.sort-sel {
  display: none;
  height: 40px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.bulk {
  position: fixed;
  z-index: 30;
  left: calc(248px + (100vw - 248px) / 2);
  bottom: 24px;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100vw - 32px);
  padding: 8px 8px 8px 20px;
  border-radius: 999px;
  background: var(--glass);
  backdrop-filter: saturate(180%) blur(28px);
  -webkit-backdrop-filter: saturate(180%) blur(28px);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-2);
  transform: translate(-50%, 160%);
  opacity: 0;
  pointer-events: none;
  transition:
    transform 0.5s var(--ease),
    opacity 0.3s;
}
.bulk.show {
  transform: translate(-50%, 0);
  opacity: 1;
  pointer-events: auto;
}
.bulk b {
  margin-right: 8px;
  font-size: 14px;
  font-weight: 650;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
@media (min-width: 821px) {
  body:has(.bulk.show) #toasts {
    bottom: 92px;
  }
}
#toasts {
  transition: bottom 0.4s var(--ease);
}
.toast {
  display: flex;
  align-items: center;
  gap: 14px;
}
.toast button {
  pointer-events: auto;
  font-weight: 650;
  color: #6cb8ff;
}
@media (prefers-color-scheme: dark) {
  .toast button {
    color: #0071e3;
  }
}

@media (max-width: 820px) {
  .bulk {
    left: 50%;
    bottom: calc(92px + env(safe-area-inset-bottom));
    flex-wrap: wrap;
    justify-content: center;
    padding: 12px;
    border-radius: 22px;
    width: calc(100vw - 24px);
  }
  .bulk b {
    flex: 1 0 100%;
    text-align: center;
    margin: 0;
  }
  .bulk-sp {
    display: none;
  }
  body:has(.bulk.show) #toasts {
    bottom: calc(200px + env(safe-area-inset-bottom));
  }
  .sort-sel {
    display: block;
    flex: 1;
  }
  .toolbar .export {
    margin-left: 0;
    flex: 1;
    height: 40px;
  }
  .who .sel {
    width: 22px;
    height: 22px;
  }
}

@media (min-width: 821px) {
  #clientTable .table-wrap {
    overflow: hidden;
  }
  .t-clients {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
  }
  .t-clients th:nth-child(1) {
    width: 14%;
  }
  .t-clients th:nth-child(2) {
    width: 15%;
  }
  .t-clients th:nth-child(3) {
    width: 10%;
  }
  .t-clients th:nth-child(4) {
    width: 18%;
  }
  .t-clients th:nth-child(5) {
    width: 9%;
  }
  .t-clients th:nth-child(6) {
    width: 34%;
  }
  .t-clients th,
  .t-clients td {
    padding-inline: 12px;
  }
  .t-clients th:first-child,
  .t-clients td:first-child {
    padding-left: 22px;
  }
  .t-clients th:last-child,
  .t-clients td:last-child {
    padding-right: 18px;
  }
  .t-clients .st-wrap {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }
  .t-clients td .pill {
    margin-top: 0;
  }
  .t-clients td.act .btn {
    min-width: 0;
    padding-inline: 12px;
    font-size: 12.5px;
  }
  .t-clients td.act .btn + .btn {
    margin-left: 8px;
  }
  .t-clients .who,
  .t-clients .who > div,
  .t-clients .copy,
  .t-clients .copy code {
    min-width: 0;
    max-width: 100%;
  }
  .t-clients .who > div,
  .t-clients .copy,
  .t-clients .copy code {
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .t-clients .copy {
    display: block;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .orbs i {
    animation: none !important;
  }
}
