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

:root {
  --green: #22a832;
  --green-dark: #1b8f2b;
  --green-soft: #f1fbf5;
  --blue-dark: #1a1f36;
  --blue-pill: #1e223d;
  --blue-soft: #eef2ff;
  --bg: #f4f6f9;
  --surface: #ffffff;
  --border: #e8ecf1;
  --border-light: #f1f4f8;
  --text: #1a1f36;
  --muted: #8b92a6;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
  --radius-xl: 14px;
  --radius-lg: 12px;
  --radius-md: 10px;
  --radius-pill: 999px;
  --sidebar-w: 260px;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --warn: #d97706;
  --warn-soft: #fffbeb;
  --info: #075cff;
  --info-soft: #eff6ff;
}

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: 'Pliant', system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
  overflow-x: hidden;
  min-height: 100vh;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; }

[hidden] { display: none !important; }

/* ===================== LOGIN ===================== */
.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 12% 18%, rgba(34, 168, 50, 0.08), transparent 36%),
    radial-gradient(circle at 88% 82%, rgba(26, 31, 54, 0.04), transparent 34%),
    linear-gradient(145deg, #f8fafc 0%, #eef2f7 55%, #f4f6f9 100%);
}

.login-card {
  width: min(100%, 420px);
  padding: 36px 32px;
  border-radius: var(--radius-xl);
  background: var(--blue-dark);
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.login-logo {
  display: flex;
  justify-content: center;
  margin: 0 auto 24px;
}

.login-logo img { height: 44px; width: auto; }

.login-form {
  display: grid;
  gap: 14px;
}

.login-form label,
.form-stack label,
.form-grid label {
  display: grid;
  gap: 6px;
}

.login-form label span {
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.82);
}

.form-stack label span,
.form-grid label span {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.login-form input {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
}

.login-form input::placeholder {
  color: rgba(255, 255, 255, 0.38);
}

.login-form input:focus {
  border-color: var(--green);
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0 0 0 3px rgba(34, 168, 50, 0.18);
}

.password-field {
  position: relative;
  display: flex;
  align-items: center;
}

.password-field input {
  padding-right: 46px;
}

.password-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 8px;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.password-toggle:hover {
  background: rgba(255, 255, 255, 0.08);
}

.password-toggle img {
  width: 20px;
  height: 20px;
  object-fit: contain;
  filter: brightness(0) invert(1);
  opacity: 0.75;
}

.password-toggle:hover img {
  opacity: 1;
}

.password-field--light input {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
}

.password-field--light input:focus {
  border-color: var(--green);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(34, 168, 50, 0.12);
}

.password-field--light .password-toggle img {
  filter: none;
  opacity: 0.55;
}

.form-actions-inline {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.account-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.account-users-panel,
.account-tokens-panel {
  grid-column: 1 / -1;
}

.token-stack {
  padding-bottom: 8px;
}

.token-field {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 4px 10px 4px 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #fff;
  box-sizing: border-box;
}

.token-field:focus-within {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(34, 168, 50, 0.12);
}

.token-field input,
.form-stack .token-field input {
  flex: 1 1 0;
  width: 0 !important;
  max-width: 100%;
  min-width: 0;
  margin: 0;
  padding: 11px 12px 11px 14px !important;
  border: none !important;
  box-shadow: none !important;
  background: transparent !important;
  color: var(--muted) !important;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  -webkit-text-fill-color: var(--muted);
}

.token-field .password-toggle {
  position: static;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  transform: none;
}

.token-field .password-toggle img {
  filter: none;
  opacity: 0.55;
}

.token-field .password-toggle:hover {
  background: #f1f4f8;
}

.token-field .password-toggle:hover img {
  opacity: 1;
}

.token-icon-btn {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: none;
  border-radius: 10px;
  background: #e8ecf1;
  color: #5c6578;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}

.token-icon-btn svg {
  width: 16px;
  height: 16px;
}

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

.token-icon-btn.is-copied {
  background: #d4f0d9;
  color: #009812;
}

.token-field .token-regen {
  flex-shrink: 0;
  margin-right: 2px;
}

.users-list {
  display: grid;
  gap: 10px;
  padding: 16px 20px 20px;
}

.user-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fafbfc;
}

.user-row .user-avatar {
  width: 36px;
  height: 36px;
  font-size: 12px;
}

.user-row-meta {
  flex: 1;
  min-width: 0;
}

.user-row-meta strong {
  display: block;
  font-size: 14px;
}

.user-row-meta small {
  color: var(--muted);
  font-size: 12px;
}

.clients-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  align-items: start;
}

.categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  align-items: start;
}

.category-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
}

.category-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-light);
}

.category-card-head h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.category-card .data-table th,
.category-card .data-table td {
  padding: 10px 14px;
  white-space: normal;
}

.category-card .data-table th {
  width: 42%;
  background: #fafbfc;
}

.client-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
}

.client-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-light);
}

.client-card-head h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.client-card .data-table th,
.client-card .data-table td {
  padding: 10px 14px;
  white-space: normal;
}

.client-card .data-table th {
  width: 38%;
  background: #fafbfc;
}

.wizard-steps {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 18px;
}

.wizard-step {
  flex: 0 1 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  background: #e8ecf1;
  color: #5c6578;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.wizard-step.active {
  background: var(--green-soft);
  color: var(--green-dark);
  box-shadow: 0 0 0 1px rgba(34, 168, 50, 0.2);
}

.wizard-step.done {
  background: #d4f0d9;
  color: var(--green-dark);
}

.wizard-step-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #fff;
  font-size: 11px;
  flex-shrink: 0;
}

.wizard-step-line {
  flex: 1;
  height: 2px;
  min-width: 12px;
  margin: 0 8px;
  border-radius: 999px;
  background: #e8ecf1;
}

.wizard-step-line.filled {
  background: linear-gradient(90deg, #22a832, #009812);
}

.wizard-pane { display: none; }
.wizard-pane.active {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.wizard-pane .full { grid-column: 1 / -1; }

.photo-drop {
  display: grid;
  gap: 12px;
  justify-items: center;
  padding: 24px 20px;
  border: 1.5px dashed #cfd5dd;
  border-radius: 16px;
  background: #fafbfc;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s, box-shadow 0.2s;
}

.photo-drop:hover,
.photo-drop.is-dragover {
  border-color: var(--green);
  background: var(--green-soft);
  box-shadow: 0 0 0 3px rgba(34, 168, 50, 0.1);
}

.photo-preview-wrap {
  width: 140px;
  height: 140px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: #fff;
  border: 1px solid var(--border);
  overflow: hidden;
}

.photo-preview {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.photo-placeholder {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  color: #9aa3b5;
}

.photo-placeholder svg {
  width: 52px;
  height: 52px;
}

.photo-drop p {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  max-width: 260px;
  line-height: 1.4;
}

.photo-drop-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: 100%;
  padding: 8px 10px 8px 14px;
  border-radius: 999px;
  background: #e8ecf1;
  border: 1px solid #dde2e8;
}

.photo-drop-hint {
  font-size: 12px;
  font-weight: 500;
  color: #5c6578;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: min(240px, 52vw);
}

.photo-drop input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.photo-drop-btn {
  pointer-events: none;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid #cfd5dd;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.price-field {
  display: flex;
  align-items: center;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #fff;
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.price-field:focus-within {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(34, 168, 50, 0.12);
}

.price-prefix {
  flex-shrink: 0;
  padding: 0 0 0 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
}

.form-grid label .price-prefix,
.form-stack label .price-prefix {
  color: var(--muted);
  font-weight: 500;
}

.price-field input {
  border: none !important;
  box-shadow: none !important;
  padding-left: 8px !important;
  font-weight: 600;
  letter-spacing: 0.01em;
  background: transparent !important;
  color: var(--text);
}

.price-field input::placeholder {
  color: var(--muted);
  font-weight: 500;
}

.price-field input:focus {
  border: none !important;
  box-shadow: none !important;
}

.modal.modal--wide {
  width: min(100%, 620px);
}

.input-readonly,
.form-stack input[readonly] {
  background: #f8fafc !important;
  color: var(--muted) !important;
  cursor: default;
}

.form-stack input:not(.styled_input_bar),
.form-stack select,
.form-stack textarea,
.form-grid input:not(.styled_input_bar),
.form-grid select,
.form-grid textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #fff;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  font: inherit;
}

.form-grid select,
.form-stack select {
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%238b92a6' d='M13.069 5.157L8.384 9.768a.546.546 0 0 1-.768 0L2.93 5.158a.55.55 0 0 0-.771 0a.53.53 0 0 0 0 .759l4.684 4.61a1.65 1.65 0 0 0 2.312 0l4.684-4.61a.53.53 0 0 0 0-.76a.55.55 0 0 0-.771 0'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 14px;
}

.form-stack input:focus,
.form-stack select:focus,
.form-stack textarea:focus,
.form-grid input:focus,
.form-grid select:focus,
.form-grid textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(34, 168, 50, 0.12);
}

.form-error {
  margin: 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 13px;
  font-weight: 500;
}

/* ===================== BUTTONS ===================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  border: none;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 600;
  transition: background-color 0.2s, color 0.2s, opacity 0.2s;
}

.btn svg { width: 16px; height: 16px; }

.btn-icon {
  width: 15px;
  height: 15px;
  object-fit: contain;
}

.btn-icon--light {
  filter: brightness(0) invert(1);
}

.btn-icon-svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: currentColor;
}

.btn-primary {
  background: #009812;
  color: #fff;
}

.btn-primary:hover:not(:disabled) { background: #007f10; }

.btn-primary:disabled {
  background: #a8d4ae;
  color: rgba(255, 255, 255, 0.85);
  cursor: not-allowed;
  box-shadow: none;
}

.btn-block { width: 100%; }

.btn-ghost {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-ghost:hover { background: #f8fafc; }

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

.btn-danger:hover { background: #fee2e2; }

.icon-btn {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 0;
}

.icon-btn:hover { background: #f8fafc; }
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn img {
  width: 15px;
  height: 15px;
  object-fit: contain;
  opacity: 0.75;
}

.btn-sm {
  min-height: 32px;
  padding: 0 12px;
  font-size: 12px;
}

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

/* ===================== APP LAYOUT ===================== */
.app {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 40;
  width: var(--sidebar-w);
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--blue-dark);
  color: #fff;
  padding: 20px 0;
  transition: transform 0.25s ease;
  transform: translateX(0);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 22px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  margin-bottom: 16px;
  width: 100%;
}

.sidebar-logo img {
  height: 36px;
  width: auto;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  overflow-y: auto;
  padding: 0 14px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 14px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: rgba(255, 255, 255, 0.78);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  box-sizing: border-box;
  transition: background-color 0.2s, color 0.2s;
}

.nav-icon {
  width: 18px;
  height: 18px;
  object-fit: contain;
  flex-shrink: 0;
}

img.nav-icon {
  filter: brightness(0) invert(1);
  opacity: 0.75;
}

svg.nav-icon {
  color: rgba(255, 255, 255, 0.75);
}

.nav-item:hover img.nav-icon {
  opacity: 1;
  filter: invert(48%) sepia(79%) saturate(450%) hue-rotate(82deg) brightness(95%) contrast(90%);
}

.nav-item.active img.nav-icon {
  opacity: 1;
  filter: invert(72%) sepia(42%) saturate(520%) hue-rotate(72deg) brightness(108%) contrast(92%);
}

.nav-item:hover svg.nav-icon {
  color: #63d873;
}

.nav-item.active svg.nav-icon {
  color: #9ef0a8;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.nav-item.active {
  background: rgba(34, 168, 50, 0.18);
  color: #fff;
}

.sidebar-footer {
  display: grid;
  gap: 4px;
  margin-top: auto;
  padding: 14px 14px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  width: 100%;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 14px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
}

.sidebar-link .nav-icon {
  width: 16px;
  height: 16px;
}

.sidebar-link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.sidebar-link:hover .nav-icon {
  opacity: 1;
  filter: invert(48%) sepia(79%) saturate(450%) hue-rotate(82deg) brightness(95%) contrast(90%);
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  z-index: 35;
  background: rgba(15, 23, 42, 0.45);
}

.main-wrap {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left 0.25s ease;
}

.menu-toggle {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  padding: 0;
  flex-shrink: 0;
}

.menu-toggle:hover {
  background: #f8fafc;
  border-color: #d0d8e4;
}

.menu-toggle .nav-icon {
  width: 20px;
  height: 20px;
  color: var(--text);
  opacity: 0.85;
}

.app.sidebar-collapsed .sidebar {
  transform: translateX(-100%);
}

.app.sidebar-collapsed .main-wrap {
  margin-left: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 28px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.topbar-spacer { flex: 1; }

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: min(280px, 56vw);
  padding: 6px 12px 6px 6px;
  border-radius: 999px;
  background: #e8ecf1;
  border: 1px solid #dde2e8;
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.user-chip:hover {
  background: #dde2e8;
  border-color: #cfd5dd;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}

.user-chip .user-avatar {
  width: 32px;
  height: 32px;
  font-size: 11px;
  flex-shrink: 0;
  border-radius: 50%;
  background: #009812;
  color: #e8f8eb;
  display: grid;
  place-items: center;
}

.user-chip strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 600;
  color: #5c6578;
  line-height: 1.1;
}

.user-chip-chevron {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: #8b92a6;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--green-soft);
  color: var(--green-dark);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.02em;
}

.user-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.user-meta strong {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.1;
}

.user-meta small {
  font-size: 12px;
  color: var(--muted);
}

.content {
  padding: 24px 28px 40px;
  flex: 1;
}

.view { display: none; }
.view.active { display: block; }

/* ===================== STATS ===================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  padding: 0;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

.stat-card:hover {
  border-color: rgba(34, 168, 50, 0.35);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.06);
  transform: translateY(-1px);
}

.stat-card .stat-label {
  display: block;
  width: 100%;
  margin: 0;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  box-sizing: border-box;
}

.stat-card .stat-label-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green-dark);
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  box-sizing: border-box;
}

.stat-card .stat-label-chip .stat-icon {
  width: 16px;
  height: 16px;
  object-fit: contain;
  flex-shrink: 0;
  filter: invert(36%) sepia(86%) saturate(650%) hue-rotate(82deg) brightness(90%) contrast(95%);
}

.stat-card .stat-label-chip svg.stat-icon {
  color: var(--green-dark);
  filter: none;
}

.stat-card .stat-body {
  padding: 18px 16px 20px;
}

.stat-card .stat-value {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
  line-height: 1;
}

.charts-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.chart-panel .panel-body {
  padding: 18px 20px 22px;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-top: 14px;
}

.chart-legend-dot {
  display: none;
}

.bar-chart {
  display: grid;
  gap: 12px;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(0, auto) minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  cursor: default;
}

.bar-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 160px;
}

.bar-label > span {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  min-height: 26px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #e8ecf1;
  color: #5c6578;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-sizing: border-box;
  justify-self: start;
}

.bar-track {
  height: 10px;
  border-radius: 999px;
  background: #eef1f5;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #22a832, #009812);
  min-width: 0;
  transition: width 0.35s ease, filter 0.15s ease;
}

.bar-row strong,
.bar-row .count-chip {
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  border-radius: 999px;
  background: #e8ecf1;
  color: #5c6578;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  box-sizing: border-box;
}

.bar-row:hover .bar-fill {
  filter: brightness(1.08);
}

.bar-row:hover .bar-label > span {
  background: #dde2e8;
}

.bar-row:hover strong,
.bar-row:hover .count-chip {
  background: #dde2e8;
}

.donut-wrap {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 18px;
  align-items: center;
}

.donut-svg {
  width: 150px;
  height: 150px;
}

.donut-center-label {
  fill: var(--text);
  font-size: 18px;
  font-weight: 700;
  text-anchor: middle;
}

.donut-center-sub {
  fill: var(--muted);
  font-size: 10px;
  text-anchor: middle;
}

.donut-svg .donut-segment {
  cursor: pointer;
  transition: stroke-width 0.15s ease, opacity 0.15s ease;
}

.donut-svg .donut-segment:hover,
.donut-svg .donut-segment.is-active {
  stroke-width: 20;
  opacity: 1;
}

.donut-svg.is-dimmed .donut-segment:not(.is-active):not(:hover) {
  opacity: 0.35;
}

.chart-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text);
  font-weight: 500;
  cursor: pointer;
  padding: 6px 8px 6px 12px;
  border: 1px solid var(--border);
  background: #f8fafc;
  border-radius: 999px;
  font-family: inherit;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.chart-legend-item:hover,
.chart-legend-item.is-active {
  background: var(--green-soft);
  border-color: rgba(34, 168, 50, 0.28);
  color: var(--green-dark);
  box-shadow: 0 2px 8px rgba(0, 152, 18, 0.08);
}

.chart-legend-label {
  line-height: 1;
}

.chart-legend-count {
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

.line-chart-wrap {
  position: relative;
  width: 100%;
  overflow: visible;
}

.line-chart-svg {
  width: 100%;
  height: 180px;
  display: block;
  overflow: visible;
}

.line-point {
  cursor: pointer;
}

.chart-tooltip {
  position: absolute;
  z-index: 5;
  pointer-events: none;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--blue-dark);
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
  transform: translate(-50%, calc(-100% - 10px));
  opacity: 0;
  transition: opacity 0.12s ease;
}

.chart-tooltip.is-visible {
  opacity: 1;
}

.chart-empty {
  margin: 0;
  padding: 28px 8px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

/* ===================== PANEL / TABLE ===================== */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-light);
}

.panel-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.panel-title-chip {
  display: inline-flex;
  align-items: center;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green-dark);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
}

.panel-footer {
  display: flex;
  justify-content: flex-end;
  padding: 12px 16px 16px;
  border-top: 1px solid var(--border-light);
}

.btn-view-more {
  gap: 6px;
}

.btn-view-more svg {
  width: 14px;
  height: 14px;
  color: #009812;
}

.order-code {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: #e8ecf1;
  color: #5c6578;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.client-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 4px 12px 4px 4px;
  border-radius: 999px;
  background: #e8ecf1;
  border: 1px solid #dde2e8;
}

.client-chip-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  background: #c5cbd6;
  color: #3d4656;
  font-size: 10px;
  font-weight: 700;
}

.client-chip strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 600;
  color: #5c6578;
  line-height: 1.1;
}

.count-chip {
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: #e8ecf1;
  color: #5c6578;
  font-size: 12px;
  font-weight: 700;
  box-sizing: border-box;
}

.phone-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px 5px 8px;
  border-radius: 999px;
  background: #e8f8ef;
  border: 1px solid rgba(37, 211, 102, 0.28);
  color: #1f6b3a;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.15s, border-color 0.15s;
}

.phone-chip:hover {
  background: #d8f5e4;
  border-color: rgba(37, 211, 102, 0.45);
}

.phone-chip-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: #25d366;
}

.thumb-stack {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.thumb-stack-item {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  background: #f1f4f8;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--border);
}

.thumb-stack-item + .thumb-stack-item,
.thumb-stack-item + .thumb-stack-more {
  margin-left: -10px;
}

.thumb-stack-more {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #e8ecf1;
  color: #5c6578;
  font-size: 10px;
  font-weight: 700;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--border);
}

.thumb-stack--empty {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #eef1f5;
  border: 1px solid var(--border);
}

.bar-label .thumb-stack-item,
.bar-label .thumb-stack-more,
.bar-label .thumb-stack--empty {
  width: 26px;
  height: 26px;
}

.cell-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  background: var(--green-soft);
  color: var(--green-dark);
  font-size: 11px;
  font-weight: 700;
}

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

.search-field {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 200px;
  max-width: 360px;
  padding: 0 14px;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
}

.search-field:focus-within {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(34, 168, 50, 0.1);
}

.search-field svg {
  width: 16px;
  height: 16px;
  color: var(--green);
  flex-shrink: 0;
}

.search-icon-img {
  width: 15px;
  height: 15px;
  object-fit: contain;
  opacity: 0.55;
  flex-shrink: 0;
}

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

.search-field input::placeholder { color: var(--muted); }

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

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

.data-table th,
.data-table td {
  padding: 14px 18px;
  text-align: left;
  font-size: 13px;
  border-bottom: 1px solid var(--border-light);
  white-space: nowrap;
}

.data-table th {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: #fafbfc;
}

.data-table tbody tr:hover { background: #f8fafc; }
.data-table tbody tr:last-child td { border-bottom: none; }

.cell-main {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cell-thumb {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  object-fit: cover;
  background: #f1f4f8;
  border: 1px solid var(--border);
}

.cell-strong {
  font-weight: 700;
}

.cell-title {
  font-weight: 600;
  color: var(--text);
}

.cell-sub {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 400;
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: flex-end;
}

.empty-state {
  margin: 0;
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

/* ===================== BADGES ===================== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
}

.badge-green-soft {
  background: #e8f6eb;
  color: #5aad66;
}

.badge-green {
  background: var(--green-soft);
  color: var(--green);
}

.badge-green-strong {
  background: #d4f0d9;
  color: #009812;
}

.badge-blue { background: var(--info-soft); color: var(--info); }
.badge-amber { background: var(--warn-soft); color: var(--warn); }
.badge-red { background: var(--danger-soft); color: var(--danger); }
.badge-gray { background: #f1f4f8; color: #64748b; }

/* ===================== FORMS ===================== */
.form-stack {
  display: grid;
  gap: 16px;
  padding: 20px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding: 4px 0 0;
}

.form-grid .full,
.form-grid .input-container.full { grid-column: 1 / -1; }

.lvj-modal .input-container--light,
.modal .input-container--light,
.panel .input-container--light {
  --input-surface: #fff;
}

.panel .input-container--light.input-container--muted {
  --input-surface: #f8fafc;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 8px;
  grid-column: 1 / -1;
}

/* ===================== MODAL ===================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
}

.modal {
  width: min(100%, 560px);
  max-height: min(90vh, 720px);
  overflow: auto;
  background: #fff;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.modal::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
}

.modal-head h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.modal-body { padding: 20px; }

/* ===================== RESPONSIVE ===================== */
@media (max-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .charts-grid { grid-template-columns: 1fr; }
  .account-grid { grid-template-columns: 1fr; }
  .donut-wrap { grid-template-columns: 1fr; justify-items: center; }
}

@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .app.sidebar-collapsed .sidebar {
    transform: translateX(-100%);
  }

  .main-wrap,
  .app.sidebar-collapsed .main-wrap {
    margin-left: 0;
  }

  .user-chip strong {
    max-width: 110px;
  }

  .content { padding: 18px 16px 32px; }

  .topbar { padding: 12px 16px; }

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

@media (max-width: 560px) {
  .stats-grid { grid-template-columns: 1fr; }

  .toolbar { flex-direction: column; align-items: stretch; }

  .toolbar-actions { width: 100%; }

  .toolbar-actions .btn { flex: 1; }

  .search-field { max-width: none; }

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

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

  .login-card { padding: 28px 22px; }
}
