/* TenPlus CRM, new look. Loaded after styles.css and active only while <html> has the class "ui2" (see theme_v2.js).
   It re-points the old colour variables and restyles the shared pieces (menu, cards, tables, buttons, forms) so every page follows.
   It also drops the heavy fixed-background and blur effects, which made scrolling and redrawing slow. */
html.ui2 {
  --v2-bg: #f2f5f9;
  --v2-surface: #ffffff;
  --v2-ink: #0f1b2d;
  --v2-muted: #64748b;
  --v2-line: #e4e9f1;
  --v2-line-strong: #d3dae6;
  --v2-accent: #0f9d7a;
  --v2-accent-dark: #0a7c60;
  --v2-accent-soft: #e5f6f0;
  --v2-shadow: 0 1px 2px rgba(15, 27, 45, 0.05), 0 12px 28px -14px rgba(15, 27, 45, 0.14);
  --v2-shadow-lg: 0 20px 50px -16px rgba(15, 27, 45, 0.28);

  /* the old variables, re-pointed */
  --ink: var(--v2-ink);
  --muted: var(--v2-muted);
  --line: var(--v2-line);
  --panel: #ffffff;
  --canvas: var(--v2-bg);
  --soft: #eef6f3;
  --teal: var(--v2-accent);
  --teal-dark: var(--v2-accent-dark);
  --shadow: var(--v2-shadow-lg);
  --field-bg: #ffffff;
  --chat-wallpaper: #f1f4f8;
  --chat-wallpaper-size: auto;
  --status-row-active: #ffffff;
  --status-row-expiring: #ffffff;
  --status-row-expired: #ffffff;
  --status-row-hardware: #ffffff;
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ---- canvas: one flat colour (no fixed gradient, nothing to repaint while scrolling) ---- */
html.ui2 body,
html.ui2 .workspace,
html.ui2 .app-shell {
  background: var(--v2-bg);
  background-attachment: scroll;
  color: var(--v2-ink);
}
html.ui2 * {
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}

/* ---- menu ---- */
html.ui2 .sidebar {
  background: linear-gradient(180deg, #0a1d1a 0%, #0b2a24 100%);
  border-right: 0;
  box-shadow: none;
  padding: 22px 14px 18px;
}
html.ui2 .side-top { margin-bottom: 22px; padding: 0 6px; }
html.ui2 .side-top .brand-logo { width: 42px; height: 42px; flex-basis: 42px; border: 0; border-radius: 12px; background: #fff; padding: 4px; }
html.ui2 .side-title strong { font-size: 15px; font-weight: 700; letter-spacing: -0.01em; color: #fff; }
html.ui2 .side-title span { color: rgba(255, 255, 255, 0.55); font-size: 12px; }
html.ui2 .nav-list { gap: 3px; }
html.ui2 .nav-button {
  min-height: 40px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  padding: 9px 12px;
  font-size: 14px;
  font-weight: 600;
  transition: background 0.15s, color 0.15s;
}
html.ui2 .nav-button .icon { opacity: 0.8; }
html.ui2 .nav-button:hover { border: 0; background: rgba(255, 255, 255, 0.07); color: #fff; }
html.ui2 .nav-button.active {
  border: 0;
  background: linear-gradient(90deg, rgba(52, 211, 153, 0.26), rgba(52, 211, 153, 0.07));
  color: #fff;
  box-shadow: inset 3px 0 0 #34d399;
}
html.ui2 .nav-button.active .icon { opacity: 1; color: #6ee7b7; }
html.ui2 .nav-badge { border: 0; background: #ef4444; }
html.ui2 .crm-order-link {
  margin-top: 10px;
  border: 0;
  background: linear-gradient(135deg, #10b88f, #0a8f6f);
  color: #fff;
  justify-content: center;
}
html.ui2 .crm-order-link:hover { background: linear-gradient(135deg, #14c79c, #0c9b79); }
html.ui2 .side-footer { border-top: 1px solid rgba(255, 255, 255, 0.1); margin-top: 24px; padding-top: 16px; gap: 8px; }
html.ui2 .side-footer .btn {
  min-height: 38px;
  border: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.07);
  color: rgba(255, 255, 255, 0.85);
  box-shadow: none;
  font-weight: 600;
}
html.ui2 .side-footer .btn:hover { background: rgba(255, 255, 255, 0.14); color: #fff; transform: none; }
html.ui2 .ui-switch {
  border: 0;
  background: none;
  color: rgba(255, 255, 255, 0.45);
  font-size: 12px;
  text-align: left;
  padding: 4px 2px;
  text-decoration: underline;
  text-underline-offset: 3px;
}
html.ui2 .ui-switch:hover { color: rgba(255, 255, 255, 0.8); }
.ui-switch { cursor: pointer; }

/* ---- page ---- */
html.ui2 .content { padding: 26px 32px 40px; }
html.ui2 .topbar { margin-bottom: 22px; align-items: center; }
html.ui2 .topbar h1 { color: var(--v2-ink); font-size: 26px; font-weight: 700; letter-spacing: -0.02em; text-shadow: none; margin: 0 0 4px; }
html.ui2 .topbar p { color: var(--v2-muted); font-size: 14px; }

/* ---- number cards ---- */
html.ui2 .metrics-grid { gap: 14px; margin-bottom: 22px; }
html.ui2 .metric-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--v2-line);
  border-radius: 16px;
  background: var(--v2-surface);
  box-shadow: var(--v2-shadow);
  color: var(--v2-ink);
  padding: 16px 18px 14px 20px;
  text-align: left;
  transition: transform 0.15s, box-shadow 0.15s;
}
html.ui2 .metric-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--v2-accent); }
html.ui2 .metrics-grid > .metric-card:nth-child(2)::before { background: #22c55e; }
html.ui2 .metrics-grid > .metric-card:nth-child(3)::before { background: #f59e0b; }
html.ui2 .metrics-grid > .metric-card:nth-child(4)::before { background: #ef4444; }
html.ui2 .metrics-grid > .metric-card:nth-child(5)::before { background: #3b82f6; }
html.ui2 .metrics-grid > .metric-card:nth-child(6)::before { background: #8b5cf6; }
html.ui2 .metric-button:hover { transform: translateY(-2px); box-shadow: var(--v2-shadow-lg); }
html.ui2 .metric-card span { color: var(--v2-muted); font-size: 11.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
html.ui2 .metric-card strong { color: var(--v2-ink); font-size: 30px; font-weight: 700; letter-spacing: -0.03em; }
html.ui2 .metric-card small { color: var(--v2-muted); font-size: 12.5px; }
html.ui2 .metric-card.revenue-card { background: linear-gradient(160deg, #ffffff, #f3f0ff); }

/* ---- cards / panels ---- */
html.ui2 .panel {
  border: 1px solid var(--v2-line);
  border-radius: 16px;
  background: var(--v2-surface);
  box-shadow: var(--v2-shadow);
  overflow: hidden;
}
html.ui2 .panel-header { border-bottom: 1px solid var(--v2-line); background: #fff; padding: 16px 20px; }
html.ui2 .panel-header h2 { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; color: var(--v2-ink); }
html.ui2 .panel-body { padding: 18px 20px; }
html.ui2 .dashboard-grid { gap: 16px; }
html.ui2 .mini-item { border: 1px solid var(--v2-line); border-radius: 12px; background: #fff; transition: border-color 0.15s, box-shadow 0.15s; }
html.ui2 .mini-item:hover { border-color: #b9e3d6; box-shadow: 0 4px 14px -6px rgba(15, 157, 122, 0.3); }
html.ui2 .empty-state { border: 1px dashed var(--v2-line-strong); border-radius: 12px; background: #fafbfd; }

/* ---- tables ---- */
html.ui2 .table-wrap { border: 1px solid var(--v2-line); border-radius: 12px; background: #fff; }
html.ui2 table { border-collapse: separate; border-spacing: 0; }
html.ui2 th {
  position: sticky;
  top: 0;
  z-index: 1;
  border-bottom: 1px solid var(--v2-line);
  background: #f7f9fc;
  color: var(--v2-muted);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 11px 12px;
}
html.ui2 td { border-bottom: 1px solid #eef1f6; padding: 12px; font-size: 13.5px; vertical-align: middle; }
html.ui2 tbody tr { background: #fff; transition: background 0.12s; }
html.ui2 tbody tr:hover { background: #f5faf8; }
html.ui2 tbody tr:last-child td { border-bottom: 0; }
html.ui2 tr.customer-row-active td:first-child { box-shadow: inset 3px 0 0 #22c55e; }
html.ui2 tr.customer-row-expiring td:first-child { box-shadow: inset 3px 0 0 #f59e0b; }
html.ui2 tr.customer-row-expired td:first-child { box-shadow: inset 3px 0 0 #ef4444; }
html.ui2 tr.customer-row-hardware td:first-child { box-shadow: inset 3px 0 0 #94a3b8; }
html.ui2 .row-actions { flex-wrap: nowrap; gap: 6px; }
html.ui2 .customer-id { border: 0; border-radius: 8px; background: var(--v2-accent-soft); color: var(--v2-accent-dark); }

/* ---- chips ---- */
html.ui2 .status-chip,
html.ui2 .payment-chip { min-height: 24px; border-radius: 999px; padding: 3px 10px; font-size: 11px; font-weight: 700; letter-spacing: 0.03em; }

/* ---- buttons ---- */
html.ui2 .btn {
  min-height: 38px;
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 13.5px;
  font-weight: 600;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
html.ui2 .btn:hover { transform: none; }
html.ui2 .btn-secondary { border: 1px solid var(--v2-line-strong); background: #fff; color: var(--v2-ink); box-shadow: 0 1px 1px rgba(15, 27, 45, 0.04); }
html.ui2 .btn-secondary:hover { background: #f6f8fb; border-color: #c2cbd9; }
html.ui2 .btn-primary { border: 1px solid #0a7c60; background: linear-gradient(180deg, #14b08a, #0d8e6e); color: #fff; box-shadow: 0 1px 2px rgba(10, 124, 96, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.2); }
html.ui2 .btn-primary:hover { background: linear-gradient(180deg, #17bf96, #0f9c79); }
html.ui2 .row-actions .btn,
html.ui2 .row-actions button,
html.ui2 .row-actions a { border-radius: 9px; }

/* ---- forms ---- */
html.ui2 input,
html.ui2 select,
html.ui2 textarea { border-radius: 10px; }
html.ui2 .search-input,
html.ui2 input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]),
html.ui2 select,
html.ui2 textarea {
  border: 1px solid var(--v2-line-strong);
  background-color: #fff;
  color: var(--v2-ink);
  transition: border-color 0.15s, box-shadow 0.15s;
}
html.ui2 .search-input:focus,
html.ui2 input:focus,
html.ui2 select:focus,
html.ui2 textarea:focus { outline: none; border-color: var(--v2-accent); box-shadow: 0 0 0 3px rgba(15, 157, 122, 0.18); }
html.ui2 .toolbar { gap: 10px; }

/* ---- pop-up windows ---- */
html.ui2 .modal-backdrop { background: rgba(10, 22, 38, 0.52); }
html.ui2 .modal { border: 0; border-radius: 18px; box-shadow: var(--v2-shadow-lg); }
html.ui2 .modal-header { border-bottom: 1px solid var(--v2-line); }
html.ui2 .modal-footer { border-top: 1px solid var(--v2-line); }

/* ---- small things ---- */
html.ui2 ::-webkit-scrollbar { width: 10px; height: 10px; }
html.ui2 ::-webkit-scrollbar-thumb { background: #cbd3df; border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
html.ui2 ::-webkit-scrollbar-thumb:hover { background: #aab4c4; background-clip: padding-box; border: 2px solid transparent; }
html.ui2 .content > * { animation: ui2-in 0.18s ease-out; }
@keyframes ui2-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { html.ui2 .content > * { animation: none; } }
html.ui2 .metric-card .metric-corner { position: static; display: block; margin-top: 6px; color: #7c3aed; font-weight: 700; }
html.ui2 .list-more { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 14px 0 4px; color: var(--v2-muted); font-size: 13px; }

/* ---- sign-in page ---- */
html.ui2 .login-layout {
  background:
    radial-gradient(900px 520px at 85% 0%, rgba(52, 211, 153, 0.2), transparent 62%),
    radial-gradient(760px 520px at 0% 100%, rgba(16, 185, 129, 0.18), transparent 60%),
    linear-gradient(160deg, #07151a 0%, #0a2722 58%, #0a1d1a 100%);
  color: #fff;
}
html.ui2 .login-copy h1 { color: #fff; font-size: clamp(32px, 4.2vw, 54px); font-weight: 700; letter-spacing: -0.03em; line-height: 1.08; text-shadow: none; }
html.ui2 .login-copy p { color: rgba(255, 255, 255, 0.72); font-size: 16px; line-height: 1.55; text-shadow: none; }
html.ui2 .login-copy .brand-lockup > span { color: #fff; font-weight: 700; letter-spacing: -0.01em; }
html.ui2 .login-order-tab { border: 1px solid rgba(255, 255, 255, 0.28); border-radius: 999px; background: rgba(255, 255, 255, 0.08); color: #fff; font-weight: 600; }
html.ui2 .login-order-tab:hover { background: rgba(255, 255, 255, 0.16); }
html.ui2 .login-card { border: 0; border-radius: 20px; background: #fff; box-shadow: 0 34px 80px -24px rgba(0, 0, 0, 0.6); padding: 30px; }
html.ui2 .login-card h2 { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
html.ui2 .login-card .btn-primary { min-height: 44px; font-size: 15px; }
html.ui2 .login-card,
html.ui2 .login-card h2,
html.ui2 .login-card label { color: var(--v2-ink); }
html.ui2 .login-card p,
html.ui2 .login-card .subtle { color: var(--v2-muted); }

@media (max-width: 900px) {
  html.ui2 .content { padding: 18px 16px 32px; }
  html.ui2 .topbar { flex-direction: column; align-items: flex-start; }
  html.ui2 .topbar h1 { font-size: 22px; }
  html.ui2 .metric-card strong { font-size: 26px; }
}
