/* =============================================================
   ZUNNO · Glassmorphism / Neumorphism UI
   ============================================================= */

:root {
  color-scheme: dark;

  --font-sans: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --sidebar-w: 286px;
  --topbar-h: 68px;
  --mobile-nav-h: 68px;

  --r-xs: 10px;
  --r-sm: 14px;
  --r-md: 18px;
  --r-lg: 22px;
  --r-xl: 28px;
  --r-full: 999px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  --bg: #070912;
  --bg-image:
    radial-gradient(circle at 10% 10%, rgba(139, 92, 246, 0.22), transparent 28%),
    radial-gradient(circle at 90% 8%, rgba(34, 211, 238, 0.16), transparent 24%),
    radial-gradient(circle at 82% 82%, rgba(244, 114, 182, 0.13), transparent 26%),
    radial-gradient(circle at 16% 88%, rgba(52, 211, 153, 0.10), transparent 24%);

  --text: #eef2ff;
  --text-2: #a3adc2;
  --text-3: #6b7590;

  --glass: rgba(17, 22, 38, 0.46);
  --glass-soft: rgba(255, 255, 255, 0.045);
  --glass-strong: rgba(9, 12, 22, 0.78);
  --glass-border: rgba(255, 255, 255, 0.10);
  --glass-border-strong: rgba(255, 255, 255, 0.16);
  --glass-highlight: rgba(255, 255, 255, 0.08);

  --input-bg: rgba(8, 11, 20, 0.52);
  --input-border: rgba(255, 255, 255, 0.10);

  --item-bg: rgba(255, 255, 255, 0.035);
  --item-hover: rgba(255, 255, 255, 0.06);

  --segment-bg: rgba(4, 6, 12, 0.55);
  --progress-track: rgba(255, 255, 255, 0.07);

  --skeleton-base: rgba(255, 255, 255, 0.05);
  --skeleton-highlight: rgba(255, 255, 255, 0.10);

  --overlay: rgba(3, 5, 12, 0.62);

  --shadow-dark: rgba(0, 0, 0, 0.55);
  --shadow-light: rgba(255, 255, 255, 0.055);
  --shadow-soft: 0 24px 70px rgba(0, 0, 0, 0.38);

  --shadow-neu-out:
    10px 10px 24px var(--shadow-dark),
    -10px -10px 24px var(--shadow-light);

  --shadow-neu-in:
    inset 5px 5px 12px var(--shadow-dark),
    inset -5px -5px 12px var(--shadow-light);

  --primary: #8b5cf6;
  --primary-rgb: 139, 92, 246;
  --primary-hi: #a78bfa;

  --accent: #22d3ee;
  --accent-rgb: 34, 211, 238;

  --success: #34d399;
  --success-rgb: 52, 211, 153;

  --warning: #fbbf24;
  --warning-rgb: 251, 191, 36;

  --danger: #fb7185;
  --danger-rgb: 251, 113, 133;

  --info: #60a5fa;
  --info-rgb: 96, 165, 250;

  --focus-ring:
    0 0 0 3px rgba(var(--primary-rgb), 0.22),
    0 0 26px rgba(var(--primary-rgb), 0.16);

  --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23a3adc2' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}

[data-theme="light"] {
  color-scheme: light;

  --bg: #eef2f8;
  --bg-image:
    radial-gradient(circle at 10% 10%, rgba(124, 58, 237, 0.12), transparent 28%),
    radial-gradient(circle at 90% 8%, rgba(8, 145, 178, 0.10), transparent 24%),
    radial-gradient(circle at 82% 82%, rgba(219, 39, 119, 0.08), transparent 26%),
    radial-gradient(circle at 16% 88%, rgba(5, 150, 105, 0.08), transparent 24%);

  --text: #0f172a;
  --text-2: #475569;
  --text-3: #64748b;

  --glass: rgba(255, 255, 255, 0.58);
  --glass-soft: rgba(15, 23, 42, 0.04);
  --glass-strong: rgba(255, 255, 255, 0.82);
  --glass-border: rgba(15, 23, 42, 0.08);
  --glass-border-strong: rgba(15, 23, 42, 0.13);
  --glass-highlight: rgba(255, 255, 255, 0.9);

  --input-bg: rgba(255, 255, 255, 0.62);
  --input-border: rgba(15, 23, 42, 0.10);

  --item-bg: rgba(255, 255, 255, 0.48);
  --item-hover: rgba(255, 255, 255, 0.72);

  --segment-bg: rgba(15, 23, 42, 0.05);
  --progress-track: rgba(15, 23, 42, 0.08);

  --skeleton-base: rgba(15, 23, 42, 0.06);
  --skeleton-highlight: rgba(255, 255, 255, 0.8);

  --overlay: rgba(15, 23, 42, 0.28);

  --shadow-dark: rgba(148, 163, 184, 0.45);
  --shadow-light: rgba(255, 255, 255, 0.95);
  --shadow-soft: 0 18px 50px rgba(15, 23, 42, 0.10);

  --primary: #7c3aed;
  --primary-rgb: 124, 58, 237;
  --primary-hi: #6d28d9;

  --accent: #0891b2;
  --accent-rgb: 8, 145, 178;

  --success: #059669;
  --success-rgb: 5, 150, 105;

  --warning: #d97706;
  --warning-rgb: 217, 119, 6;

  --danger: #e11d48;
  --danger-rgb: 225, 29, 72;

  --info: #2563eb;
  --info-rgb: 37, 99, 235;

  --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg-image), var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

button {
  border: none;
  background: none;
  cursor: pointer;
}

input,
select,
textarea {
  outline: none;
}

a {
  color: var(--primary-hi);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

::selection {
  background: rgba(var(--primary-rgb), 0.28);
}

.hidden {
  display: none !important;
}

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* ===== Scrollbar ===== */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(var(--primary-rgb), 0.24) transparent;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(var(--primary-rgb), 0.22);
  border-radius: var(--r-full);
  border: 2px solid transparent;
  background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(var(--primary-rgb), 0.38);
  background-clip: content-box;
}

/* ===== Focus ===== */
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* ===== Glass primitives ===== */
.glass,
.glass-strong,
.card,
.modal,
.sheet,
.cmdk-panel,
.toast {
  backdrop-filter: blur(22px) saturate(150%);
  -webkit-backdrop-filter: blur(22px) saturate(150%);
}

.glass {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  box-shadow:
    var(--shadow-soft),
    inset 0 1px 0 var(--glass-highlight);
}

.glass-strong {
  background: var(--glass-strong);
  border: 1px solid var(--glass-border);
  box-shadow:
    var(--shadow-soft),
    inset 0 1px 0 var(--glass-highlight);
}

@supports not (backdrop-filter: blur(1px)) {
  .glass,
  .glass-strong,
  .card,
  .modal,
  .sheet,
  .cmdk-panel,
  .toast {
    background: var(--glass-strong);
  }
}

/* ===== Preloader ===== */
.preloader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--bg);
  transition: opacity 0.28s var(--ease);
}

.preloader.hide {
  opacity: 0;
  pointer-events: none;
}

.preloader-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  box-shadow: 0 0 18px rgba(var(--primary-rgb), 0.35);
  animation: bounce 1.2s infinite var(--ease);
}

.preloader-dot:nth-child(2) {
  animation-delay: 0.14s;
}

.preloader-dot:nth-child(3) {
  animation-delay: 0.28s;
}

@keyframes bounce {
  0%, 80%, 100% {
    transform: scale(0.62);
    opacity: 0.45;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* ===== Toasts ===== */
.toasts {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(380px, calc(100vw - 24px));
  pointer-events: none;
}

.toast {
  position: relative;
  overflow: hidden;
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px 12px 16px;
  border-radius: var(--r-md);
  color: var(--text);
  font-size: 13.5px;
  animation: toastIn 0.24s var(--ease-spring);
}

.toast.hide {
  animation: toastOut 0.22s var(--ease) forwards;
}

.toast::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--info);
}

.toast-success::before {
  background: var(--success);
  box-shadow: 0 0 20px rgba(var(--success-rgb), 0.35);
}

.toast-error::before {
  background: var(--danger);
  box-shadow: 0 0 20px rgba(var(--danger-rgb), 0.35);
}

.toast-warning::before {
  background: var(--warning);
  box-shadow: 0 0 20px rgba(var(--warning-rgb), 0.35);
}

.toast-info::before {
  background: var(--info);
  box-shadow: 0 0 20px rgba(var(--info-rgb), 0.35);
}

.toast-ico {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  border-radius: 8px;
  font-weight: 700;
  background: var(--glass-soft);
  border: 1px solid var(--glass-border);
}

.toast-success .toast-ico {
  color: var(--success);
}

.toast-error .toast-ico {
  color: var(--danger);
}

.toast-warning .toast-ico {
  color: var(--warning);
}

.toast-info .toast-ico {
  color: var(--info);
}

.toast-msg {
  min-width: 0;
  flex: 1;
  overflow-wrap: anywhere;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(24px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes toastOut {
  to {
    opacity: 0;
    transform: translateX(24px) scale(0.98);
  }
}

@media (max-width: 520px) {
  .toasts {
    top: 12px;
    left: 12px;
    right: 12px;
    width: auto;
  }
}

/* ===== Auth ===== */
.screen-auth {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 24px;
  overflow-y: auto;
  background: var(--bg-image), var(--bg);
}

.auth-shell {
  position: relative;
  width: 100%;
  max-width: 440px;
  animation: fadeUp 0.42s var(--ease);
}

.auth-theme-btn {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 2;
}

.auth-brand {
  text-align: center;
  margin-bottom: 28px;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 62px;
  height: 62px;
  margin-bottom: 16px;
  border-radius: 22px;
  font-weight: 800;
  font-size: 28px;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  box-shadow:
    0 18px 48px rgba(var(--primary-rgb), 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.brand-mark.sm {
  width: 36px;
  height: 36px;
  margin: 0;
  border-radius: 13px;
  font-size: 17px;
  box-shadow:
    0 10px 24px rgba(var(--primary-rgb), 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.auth-title {
  margin: 0 0 6px;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.auth-subtitle {
  margin: 0;
  color: var(--text-2);
}

.auth-panel {
  padding: 24px;
  border-radius: var(--r-xl);
}

.segmented {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 5px;
  margin-bottom: 20px;
  border-radius: 16px;
  background: var(--segment-bg);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-neu-in);
}

.segmented-btn {
  position: relative;
  z-index: 2;
  padding: 9px 0;
  border-radius: 12px;
  color: var(--text-3);
  font-size: 13.5px;
  font-weight: 600;
  transition: color 0.2s var(--ease);
}

.segmented-btn.is-active {
  color: var(--text);
}

.segmented-thumb {
  position: absolute;
  z-index: 1;
  top: 5px;
  left: 5px;
  width: calc(50% - 5px);
  height: calc(100% - 10px);
  border-radius: 12px;
  background:
    linear-gradient(
      135deg,
      rgba(var(--primary-rgb), 0.24),
      rgba(var(--accent-rgb), 0.16)
    );
  border: 1px solid var(--glass-border-strong);
  box-shadow: var(--shadow-neu-out);
  transition: transform 0.28s var(--ease-spring);
}

.segmented-thumb.right {
  transform: translateX(100%);
}

/* ===== App layout ===== */
.screen-app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  height: 100vh;
  height: 100dvh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 18px 14px;
  border-right: 1px solid var(--glass-border);
  overflow: hidden;
}

.sidebar-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px 16px;
  border-bottom: 1px solid var(--glass-border);
  margin-bottom: 14px;
  flex-shrink: 0;
}

.sidebar-brand-text {
  min-width: 0;
}

.brand-title {
  font-size: 16px;
  font-weight: 750;
  letter-spacing: -0.01em;
}

.brand-sub {
  font-size: 11.5px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-nav {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 2px;
}

.nav-section-label {
  padding: 10px 10px 6px;
  font-size: 10.5px;
  font-weight: 750;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  margin-bottom: 3px;
  border-radius: 14px;
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 600;
  text-align: left;
  transition:
    transform 0.18s var(--ease),
    background 0.18s var(--ease),
    color 0.18s var(--ease);
}

.nav-item:hover {
  color: var(--text);
  background: var(--item-hover);
  transform: translateX(2px);
}

.nav-item.is-active {
  color: var(--text);
  background:
    linear-gradient(
      90deg,
      rgba(var(--primary-rgb), 0.18),
      rgba(var(--accent-rgb), 0.06)
    );
  box-shadow: inset 0 1px 0 var(--glass-highlight);
}

.nav-item.is-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: var(--r-full);
  background: linear-gradient(180deg, var(--primary), var(--accent));
  box-shadow: 0 0 18px rgba(var(--primary-rgb), 0.35);
}

.nav-icon {
  width: 20px;
  text-align: center;
  font-size: 15px;
  opacity: 0.9;
}

.sidebar-group-block {
  flex-shrink: 0;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--glass-border);
}

.sidebar-label {
  padding: 0 10px 8px;
  font-size: 10.5px;
  font-weight: 750;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.sidebar-group-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-height: 210px;
  overflow-y: auto;
  margin-bottom: 10px;
  padding-right: 2px;
}

.sidebar-group-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border-radius: 12px;
  color: var(--text-2);
  font-size: 13px;
  text-align: left;
  transition:
    background 0.16s var(--ease),
    color 0.16s var(--ease),
    transform 0.16s var(--ease);
}

.sidebar-group-item:hover {
  background: var(--item-hover);
  color: var(--text);
  transform: translateX(2px);
}

.sidebar-group-item.is-active {
  background: var(--item-bg);
  color: var(--text);
  font-weight: 650;
  border: 1px solid var(--glass-border);
}

.sidebar-group-item .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--text-3);
}

.sidebar-group-item.is-active .dot {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  box-shadow: 0 0 14px rgba(var(--primary-rgb), 0.45);
}

.sidebar-group-item-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-group-actions {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.sidebar-user {
  flex-shrink: 0;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--glass-border);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px;
  border-radius: 14px;
  text-align: left;
  transition: background 0.16s var(--ease);
}

.user-chip:hover {
  background: var(--item-hover);
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 750;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  box-shadow:
    0 10px 24px rgba(var(--primary-rgb), 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.user-chip-info {
  min-width: 0;
  flex: 1;
}

.user-chip-name {
  font-size: 13px;
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-chip-phone {
  font-size: 11.5px;
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.topbar {
  height: var(--topbar-h);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 22px;
  border-bottom: 1px solid var(--glass-border);
}

.topbar-group-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 8px 12px;
  border-radius: 16px;
  text-align: left;
  transition: background 0.16s var(--ease);
}

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

.group-avatar {
  width: 34px;
  height: 34px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  box-shadow:
    0 10px 24px rgba(var(--primary-rgb), 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.topbar-group-info {
  min-width: 0;
}

.topbar-group-name {
  display: block;
  font-size: 14.5px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-group-meta {
  display: block;
  margin-top: 1px;
  font-size: 11.5px;
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.caret {
  color: var(--text-3);
  font-size: 10px;
}

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

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: var(--text-2);
  background: var(--item-bg);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-neu-out);
  transition:
    transform 0.16s var(--ease),
    color 0.16s var(--ease),
    border-color 0.16s var(--ease),
    background 0.16s var(--ease);
}

.icon-btn:hover {
  color: var(--text);
  background: var(--item-hover);
  border-color: var(--glass-border-strong);
  transform: translateY(-1px);
}

.icon-btn:active {
  transform: translateY(0);
  box-shadow: var(--shadow-neu-in);
}

.icon-btn.sm {
  width: 32px;
  height: 32px;
  border-radius: 11px;
  font-size: 13px;
}

.avatar-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  box-shadow:
    0 12px 28px rgba(var(--primary-rgb), 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transition: transform 0.16s var(--ease);
}

.avatar-btn:hover {
  transform: scale(1.05);
}

.view {
  flex: 1;
  min-height: 0;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px;
  overflow-y: auto;
}

.mobile-nav {
  display: none;
}

/* ===== Cards / sections ===== */
.card {
  position: relative;
  padding: 20px;
  border-radius: var(--r-lg);
  background: var(--glass);
  border: 1px solid var(--glass-border);
  box-shadow:
    var(--shadow-soft),
    inset 0 1px 0 var(--glass-highlight);
  animation: fadeUp 0.32s var(--ease) both;
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.card-subtitle {
  margin-top: 3px;
  font-size: 12.5px;
  color: var(--text-3);
}

.card.is-done .card-title {
  text-decoration: line-through;
  opacity: 0.62;
}

.section {
  margin-top: 20px;
}

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

.section-title {
  font-size: 16px;
  font-weight: 750;
}

.section-desc {
  margin-top: 2px;
  font-size: 12.5px;
  color: var(--text-3);
}

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

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
}

.stat-card,
.stat {
  position: relative;
  overflow: hidden;
  padding: 18px;
  border-radius: var(--r-lg);
  background: var(--glass);
  border: 1px solid var(--glass-border);
  box-shadow:
    var(--shadow-soft),
    inset 0 1px 0 var(--glass-highlight);
  transition:
    transform 0.2s var(--ease),
    border-color 0.2s var(--ease),
    box-shadow 0.2s var(--ease);
  animation: fadeUp 0.32s var(--ease) both;
}

.stat-card::before,
.stat::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--accent), var(--success));
  opacity: 0.75;
}

.stat-card:hover,
.stat:hover {
  transform: translateY(-3px);
  border-color: var(--glass-border-strong);
}

.stat-label {
  margin-bottom: 7px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.stat-value {
  font-size: 23px;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.stat-value.primary {
  color: var(--primary-hi);
}

.stat-value.success {
  color: var(--success);
}

.stat-value.warning {
  color: var(--warning);
}

.stat-value.danger {
  color: var(--danger);
}

/* ===== Lists / items ===== */
.list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  background: var(--item-bg);
  border: 1px solid transparent;
  transition:
    transform 0.16s var(--ease),
    background 0.16s var(--ease),
    border-color 0.16s var(--ease);
  animation: fadeUp 0.26s var(--ease) both;
}

.item:hover {
  background: var(--item-hover);
  border-color: var(--glass-border);
  transform: translateY(-1px);
}

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

.item-title {
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-sub {
  margin-top: 2px;
  font-size: 12px;
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item.is-done {
  opacity: 0.62;
}

.item.is-done .item-title {
  text-decoration: line-through;
}

.item-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.avatar-sm {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 750;
  color: #fff;
  box-shadow:
    0 10px 24px rgba(0, 0, 0, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

/* ===== Checkbox ===== */
.check {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  border-radius: 8px;
  border: 1.5px solid var(--glass-border-strong);
  background: var(--input-bg);
  box-shadow: var(--shadow-neu-in);
  display: grid;
  place-items: center;
  transition:
    transform 0.16s var(--ease-spring),
    background 0.16s var(--ease),
    border-color 0.16s var(--ease),
    box-shadow 0.16s var(--ease);
}

.check::after {
  content: "";
  width: 10px;
  height: 5px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg) scale(0) translate(-1px, -1px);
  transition: transform 0.16s var(--ease-spring);
}

.check:hover {
  border-color: var(--primary);
}

.check.on {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-color: transparent;
  box-shadow: 0 0 20px rgba(var(--primary-rgb), 0.32);
}

.check.on::after {
  transform: rotate(-45deg) scale(1) translate(-1px, -1px);
}

/* ===== Tags ===== */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border-radius: var(--r-full);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  border: 1px solid transparent;
}

.tag-primary {
  color: var(--primary-hi);
  background: rgba(var(--primary-rgb), 0.13);
  border-color: rgba(var(--primary-rgb), 0.22);
}

.tag-success {
  color: var(--success);
  background: rgba(var(--success-rgb), 0.13);
  border-color: rgba(var(--success-rgb), 0.22);
}

.tag-warning {
  color: var(--warning);
  background: rgba(var(--warning-rgb), 0.13);
  border-color: rgba(var(--warning-rgb), 0.22);
}

.tag-danger {
  color: var(--danger);
  background: rgba(var(--danger-rgb), 0.13);
  border-color: rgba(var(--danger-rgb), 0.22);
}

.tag-mute {
  color: var(--text-2);
  background: var(--glass-soft);
  border-color: var(--glass-border);
}

/* ===== Progress ===== */
.progress {
  height: 8px;
  border-radius: var(--r-full);
  background: var(--progress-track);
  box-shadow: var(--shadow-neu-in);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  box-shadow: 0 0 18px rgba(var(--primary-rgb), 0.28);
  transition: width 0.65s var(--ease);
}

.progress-fill.danger {
  background: linear-gradient(90deg, var(--danger), #fb923c);
  box-shadow: 0 0 18px rgba(var(--danger-rgb), 0.28);
}

.progress-fill.success {
  background: linear-gradient(90deg, var(--success), var(--accent));
  box-shadow: 0 0 18px rgba(var(--success-rgb), 0.28);
}

/* ===== Empty state ===== */
.empty {
  padding: 46px 22px;
  text-align: center;
  color: var(--text-3);
}

.empty-ico {
  width: 66px;
  height: 66px;
  margin: 0 auto 12px;
  display: grid;
  place-items: center;
  border-radius: 24px;
  font-size: 30px;
  color: var(--text-2);
  background: var(--item-bg);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-neu-out);
}

.empty-title {
  margin-bottom: 4px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-2);
}

.empty-text {
  font-size: 12.5px;
  overflow-wrap: anywhere;
}

.empty-actions {
  margin-top: 16px;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}

/* ===== Forms ===== */
.form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field-label {
  font-size: 12.5px;
  font-weight: 650;
  color: var(--text-2);
}

.field-hint {
  font-size: 11.5px;
  color: var(--text-3);
}

.field input,
.field select,
.field textarea,
.copy-input {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--r-sm);
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  color: var(--text);
  box-shadow: var(--shadow-neu-in);
  transition:
    border-color 0.16s var(--ease),
    box-shadow 0.16s var(--ease),
    background 0.16s var(--ease);
}

.field input::placeholder,
.field textarea::placeholder {
  color: var(--text-3);
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.copy-input:focus {
  border-color: rgba(var(--primary-rgb), 0.55);
  box-shadow:
    var(--focus-ring),
    var(--shadow-neu-in);
}

.field input.error,
.field select.error,
.field textarea.error {
  border-color: rgba(var(--danger-rgb), 0.65);
  box-shadow: 0 0 0 3px rgba(var(--danger-rgb), 0.12);
}

.field textarea {
  min-height: 94px;
  resize: vertical;
}

.field select {
  appearance: none;
  padding-right: 40px;
  background-image: var(--select-arrow);
  background-repeat: no-repeat;
  background-position: right 13px center;
  cursor: pointer;
}

select option {
  background: var(--glass-strong);
  color: var(--text);
}

.copy-input {
  font-family: var(--font-mono);
  font-size: 12px;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 14px;
  border: 1px solid transparent;
  font-size: 13.5px;
  font-weight: 700;
  white-space: nowrap;
  user-select: none;
  transition:
    transform 0.16s var(--ease),
    box-shadow 0.16s var(--ease),
    background 0.16s var(--ease),
    border-color 0.16s var(--ease),
    color 0.16s var(--ease);
  box-shadow: var(--shadow-neu-out);
}

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

.btn:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: var(--shadow-neu-in);
}

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

.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-color: rgba(255, 255, 255, 0.14);
  box-shadow:
    0 14px 34px rgba(var(--primary-rgb), 0.26),
    var(--shadow-neu-out);
}

.btn-primary:hover:not(:disabled) {
  box-shadow:
    0 18px 42px rgba(var(--primary-rgb), 0.34),
    var(--shadow-neu-out);
}

.btn-ghost {
  color: var(--text-2);
  background: var(--item-bg);
  border-color: var(--glass-border);
}

.btn-ghost:hover:not(:disabled) {
  color: var(--text);
  background: var(--item-hover);
  border-color: var(--glass-border-strong);
}

.btn-danger {
  color: var(--danger);
  background: rgba(var(--danger-rgb), 0.13);
  border-color: rgba(var(--danger-rgb), 0.24);
}

.btn-danger:hover:not(:disabled) {
  background: rgba(var(--danger-rgb), 0.2);
}

.btn-sm {
  padding: 8px 12px;
  font-size: 12.5px;
  border-radius: 12px;
}

.btn-lg {
  padding: 14px 20px;
  font-size: 14.5px;
}

.btn-block {
  width: 100%;
}

/* ===== Modal ===== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--overlay);
  backdrop-filter: blur(12px) saturate(130%);
  -webkit-backdrop-filter: blur(12px) saturate(130%);
  animation: fadeIn 0.18s var(--ease);
}

.modal {
  width: min(460px, 100%);
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  padding: 22px;
  border-radius: var(--r-xl);
  background: var(--glass-strong);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-soft);
  animation: modalIn 0.22s var(--ease-spring);
}

.modal-title {
  margin-bottom: 16px;
  font-size: 17px;
  font-weight: 750;
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}

/* ===== Sheet ===== */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 8500;
  display: flex;
  align-items: flex-end;
  background: var(--overlay);
  backdrop-filter: blur(10px) saturate(130%);
  -webkit-backdrop-filter: blur(10px) saturate(130%);
  animation: fadeIn 0.18s var(--ease);
}

.sheet {
  width: 100%;
  max-height: 86vh;
  overflow-y: auto;
  padding: 20px;
  padding-bottom: calc(20px + env(safe-area-inset-bottom));
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  background: var(--glass-strong);
  border-top: 1px solid var(--glass-border-strong);
  box-shadow: var(--shadow-soft);
  animation: sheetUp 0.26s var(--ease);
}

.sheet-handle {
  width: 42px;
  height: 4px;
  margin: 0 auto 16px;
  border-radius: var(--r-full);
  background: var(--glass-border-strong);
}

.sheet-title {
  margin-bottom: 14px;
  text-align: center;
  font-size: 16px;
  font-weight: 750;
}

.sheet-actions {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.sheet-action {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 13px 14px;
  border-radius: 16px;
  background: var(--item-bg);
  border: 1px solid var(--glass-border);
  font-size: 14px;
  text-align: left;
  transition:
    background 0.16s var(--ease),
    transform 0.16s var(--ease),
    border-color 0.16s var(--ease);
}

.sheet-action:hover {
  background: var(--item-hover);
  border-color: var(--glass-border-strong);
  transform: translateY(-1px);
}

.sheet-action-icon {
  width: 22px;
  text-align: center;
  color: var(--text-3);
}

/* ===== Command palette ===== */
.cmdk {
  position: fixed;
  inset: 0;
  z-index: 9500;
  display: grid;
  place-items: start center;
  padding: 12vh 16px 16px;
  background: var(--overlay);
  backdrop-filter: blur(14px) saturate(135%);
  -webkit-backdrop-filter: blur(14px) saturate(135%);
  animation: fadeIn 0.16s var(--ease);
}

.cmdk-panel {
  width: min(640px, 100%);
  border-radius: var(--r-xl);
  overflow: hidden;
  background: var(--glass-strong);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-soft);
  animation: modalIn 0.2s var(--ease-spring);
}

.cmdk-search {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--glass-border);
}

.cmdk-icon {
  color: var(--text-3);
  font-size: 18px;
}

.cmdk-search input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  font-size: 15px;
}

.cmdk-search input::placeholder {
  color: var(--text-3);
}

kbd {
  padding: 2px 7px;
  border-radius: 8px;
  background: var(--item-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-3);
  font-family: var(--font-mono);
  font-size: 11px;
}

.cmdk-list {
  max-height: min(50vh, 420px);
  overflow-y: auto;
  padding: 8px;
}

.cmdk-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 14px;
  color: var(--text);
  text-align: left;
  transition: background 0.14s var(--ease);
}

.cmdk-item:hover,
.cmdk-item.is-selected {
  background: var(--item-hover);
}

.cmdk-item-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: var(--item-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-2);
  flex-shrink: 0;
}

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

.cmdk-item-title {
  display: block;
  font-size: 14px;
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cmdk-item-hint {
  display: block;
  margin-top: 1px;
  font-size: 11.5px;
  color: var(--text-3);
}

.cmdk-empty {
  padding: 22px;
  text-align: center;
  color: var(--text-3);
}

/* ===== Skeleton ===== */
.skeleton {
  border-radius: 14px;
  background: linear-gradient(
    90deg,
    var(--skeleton-base) 25%,
    var(--skeleton-highlight) 50%,
    var(--skeleton-base) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}

.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.skeleton-stat {
  height: 94px;
  border-radius: var(--r-lg);
}

.skeleton-card {
  height: 168px;
  border-radius: var(--r-lg);
  margin-bottom: 14px;
}

.skeleton-line {
  height: 14px;
  margin-bottom: 10px;
}

@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

/* ===== Utilities ===== */
.row {
  display: flex;
  align-items: center;
  gap: 8px;
}

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

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

.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }

.text-2 { color: var(--text-2); }
.text-3 { color: var(--text-3); }
.text-sm { font-size: 12.5px; }
.text-xs { font-size: 11.5px; }

.amount-negative {
  color: var(--danger);
  font-weight: 700;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes sheetUp {
  from { transform: translateY(100%); }
  to { transform: none; }
}

/* ===== Responsive ===== */
@media (min-width: 720px) {
  .sheet-backdrop {
    align-items: center;
    justify-content: center;
    padding: 24px;
  }

  .sheet {
    width: min(440px, 100%);
    border-radius: var(--r-xl);
    border: 1px solid var(--glass-border);
    padding-bottom: 20px;
    animation: modalIn 0.22s var(--ease-spring);
  }
}

@media (max-width: 1024px) {
  .screen-app {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto;
  }

  .sidebar {
    display: none;
  }

  .main {
    grid-row: 1;
  }

  .topbar {
    height: 60px;
    padding: 0 14px;
  }

  .topbar-group-meta {
    display: none;
  }

  .view {
    padding: 16px;
    padding-bottom: calc(var(--mobile-nav-h) + 16px + env(safe-area-inset-bottom));
  }

  .mobile-nav {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100;
    height: var(--mobile-nav-h);
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--glass-strong);
    border-top: 1px solid var(--glass-border);
    backdrop-filter: blur(22px) saturate(150%);
    -webkit-backdrop-filter: blur(22px) saturate(150%);
  }

  .mobile-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: var(--text-3);
    padding: 6px 4px;
    transition: color 0.16s var(--ease);
  }

  .mobile-nav-item.is-active {
    color: var(--primary-hi);
  }

  .mobile-nav-icon {
    font-size: 18px;
  }

  .mobile-nav-label {
    font-size: 10.5px;
    font-weight: 650;
  }

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

  .stat-value {
    font-size: 19px;
  }

  .stat-card,
  .stat {
    padding: 14px;
  }
}

@media (max-width: 520px) {
  .auth-shell {
    max-width: 100%;
  }

  .auth-title {
    font-size: 26px;
  }

  .auth-panel {
    padding: 20px 16px;
  }

  .card {
    padding: 16px;
    border-radius: var(--r-md);
  }

  .card-head {
    margin-bottom: 12px;
  }

  .section-title {
    font-size: 15px;
  }

  .view {
    padding: 12px;
    padding-bottom: calc(var(--mobile-nav-h) + 12px + env(safe-area-inset-bottom));
  }

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

  .modal-backdrop {
    align-items: flex-end;
    padding: 0;
  }

  .modal {
    width: 100%;
    max-width: none;
    max-height: 90vh;
    border-radius: var(--r-xl) var(--r-xl) 0 0;
    padding-bottom: calc(22px + env(safe-area-inset-bottom));
    animation: sheetUp 0.25s var(--ease);
  }

  .field input,
  .field select,
  .field textarea {
    font-size: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
