:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --text: #0f172a;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --line: #e2e8f0;
  --primary: #1d4ed8;
  --primary-2: #2563eb;
  --primary-dark: #173ea5;
  --success: #059669;
  --warning: #d97706;
  --danger: #dc2626;
  --info: #0284c7;
  --shadow: 0 20px 45px rgba(15, 23, 42, .10);
  --shadow-soft: 0 10px 30px rgba(15, 23, 42, .07);
  --radius: 22px;
  --sidebar: 290px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, sans-serif;
  background: var(--bg);
  color: var(--text);
}
button, input, select { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  background:
    radial-gradient(circle at 8% 5%, rgba(37,99,235,.22), transparent 28%),
    radial-gradient(circle at 100% 0%, rgba(14,165,233,.18), transparent 32%),
    linear-gradient(135deg, #071327 0%, #0f2342 48%, #102f69 100%);
}
.login-hero {
  position: relative;
  padding: 58px 70px;
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
}
.login-hero:after {
  content: "";
  position: absolute;
  width: 520px;
  height: 520px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 44px;
  transform: rotate(18deg);
  right: -180px;
  bottom: -160px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
  z-index: 1;
}
.logo-mark {
  width: 46px;
  height: 46px;
  border-radius: 16px;
  background: linear-gradient(135deg, #60a5fa, #1d4ed8 55%, #0f172a);
  display: grid;
  place-items: center;
  font-weight: 800;
  color: #fff;
  box-shadow: 0 18px 35px rgba(37,99,235,.36);
}
.brand strong { font-size: 19px; display: block; }
.brand span { color: rgba(255,255,255,.66); font-size: 13px; }
.hero-content { max-width: 640px; position: relative; z-index: 1; }
.hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  background: rgba(255,255,255,.10);
  border: 1px solid rgba(255,255,255,.14);
  color: rgba(255,255,255,.86);
  padding: 9px 14px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 13px;
  backdrop-filter: blur(12px);
}
.hero-content h1 {
  font-size: clamp(40px, 5vw, 68px);
  line-height: .98;
  margin: 28px 0 20px;
  letter-spacing: -2.4px;
}
.hero-content p {
  font-size: 18px;
  line-height: 1.7;
  color: rgba(255,255,255,.76);
  max-width: 560px;
}
.hero-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 42px;
}
.hero-mini-card {
  padding: 18px;
  border-radius: 20px;
  background: rgba(255,255,255,.11);
  border: 1px solid rgba(255,255,255,.13);
  backdrop-filter: blur(16px);
}
.hero-mini-card b { display: block; font-size: 21px; margin-bottom: 8px; }
.hero-mini-card span { color: rgba(255,255,255,.67); font-size: 12px; line-height: 1.4; }
.login-footer { color: rgba(255,255,255,.48); font-size: 13px; position: relative; z-index: 1; }

.login-panel {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 34px;
  background: #f8fafc;
}
.login-card {
  width: min(470px, 100%);
  background: var(--surface);
  border: 1px solid rgba(226,232,240,.9);
  border-radius: 30px;
  box-shadow: var(--shadow);
  padding: 34px;
}
.mobile-brand { display: none; margin-bottom: 28px; }
.login-card h2 { margin: 0 0 8px; font-size: 28px; letter-spacing: -.8px; }
.login-card .subtitle { color: var(--muted); margin: 0 0 28px; line-height: 1.6; }
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-weight: 700; font-size: 13px; margin-bottom: 8px; color: #334155; }
.input-wrap {
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 16px;
  padding: 0 14px;
  transition: .2s;
}
.input-wrap:focus-within { border-color: rgba(37,99,235,.55); box-shadow: 0 0 0 4px rgba(37,99,235,.10); }
.input-wrap input {
  width: 100%;
  border: 0;
  outline: 0;
  padding: 15px 4px;
  background: transparent;
  color: var(--text);
}
.input-icon { color: var(--muted-2); margin-right: 7px; }
.form-row { display: flex; justify-content: space-between; align-items: center; gap: 15px; margin: 12px 0 24px; }
.check { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
a { color: var(--primary); text-decoration: none; font-weight: 700; }
a:hover { text-decoration: underline; }
.btn {
  border: 0;
  border-radius: 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 13px 17px;
  font-weight: 800;
  transition: .18s ease;
  white-space: nowrap;
}
.btn-primary { background: linear-gradient(135deg, var(--primary-2), var(--primary-dark)); color: #fff; box-shadow: 0 18px 24px rgba(37,99,235,.20); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 22px 28px rgba(37,99,235,.26); }
.btn-secondary { background: #eef2ff; color: #1d4ed8; }
.btn-secondary:hover { background: #e0e7ff; }
.btn-light { background: #fff; color: #334155; border: 1px solid var(--line); }
.btn-light:hover { background: #f8fafc; }
.btn-ghost { background: transparent; color: #475569; }
.btn-full { width: 100%; }
.demo-access {
  margin-top: 22px;
  padding: 14px;
  border: 1px dashed #cbd5e1;
  border-radius: 17px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  background: #f8fafc;
}
.demo-access b { color: var(--text); }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar) 1fr; }
.sidebar {
  min-height: 100vh;
  background: #081225;
  color: #fff;
  padding: 26px 20px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar .brand { margin-bottom: 34px; }
.sidebar .brand span { font-size: 12px; }
.client-card {
  background: linear-gradient(145deg, rgba(255,255,255,.12), rgba(255,255,255,.05));
  border: 1px solid rgba(255,255,255,.11);
  padding: 18px;
  border-radius: 22px;
  margin-bottom: 24px;
}
.avatar {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-weight: 800;
  background: linear-gradient(135deg,#93c5fd,#2563eb);
  margin-bottom: 13px;
}
.client-card strong { display: block; margin-bottom: 5px; }
.client-card span { color: rgba(255,255,255,.58); font-size: 12px; }
.nav { display: flex; flex-direction: column; gap: 7px; }
.nav button {
  width: 100%;
  border: 0;
  background: transparent;
  color: rgba(255,255,255,.66);
  padding: 13px 14px;
  border-radius: 15px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  text-align: left;
}
.nav button:hover, .nav button.active { background: rgba(255,255,255,.10); color: #fff; }
.sidebar-footer {
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: 22px;
  color: rgba(255,255,255,.46);
  font-size: 12px;
  line-height: 1.5;
}
.main { padding: 28px 34px 50px; min-width: 0; }
.topbar { display: flex; justify-content: space-between; gap: 20px; align-items: center; margin-bottom: 28px; }
.topbar h1 { margin: 0 0 6px; letter-spacing: -.9px; font-size: 30px; }
.topbar p { margin: 0; color: var(--muted); }
.top-actions { display: flex; align-items: center; gap: 12px; }
.mobile-menu { display: none; }
.status-dot { width: 10px; height: 10px; border-radius: 999px; background: var(--success); display: inline-block; box-shadow: 0 0 0 5px rgba(5,150,105,.12); }
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: 1.15fr .85fr; }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card {
  background: var(--surface);
  border: 1px solid rgba(226,232,240,.8);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  padding: 22px;
}
.card-header { display: flex; align-items: start; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.card-header h2 { margin: 0; font-size: 18px; letter-spacing: -.35px; }
.card-header p { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-radius: 999px;
  padding: 7px 10px;
  font-weight: 800;
  font-size: 12px;
}
.badge-success { background: #dcfce7; color: #047857; }
.badge-warning { background: #fef3c7; color: #b45309; }
.badge-danger { background: #fee2e2; color: #b91c1c; }
.badge-info { background: #e0f2fe; color: #0369a1; }
.kpi { display: flex; flex-direction: column; gap: 8px; }
.kpi .label { color: var(--muted); font-size: 13px; font-weight: 700; }
.kpi .value { font-size: 27px; font-weight: 800; letter-spacing: -.9px; }
.kpi .hint { color: var(--muted); font-size: 13px; }
.featured-bill {
  background:
    radial-gradient(circle at 100% 0%, rgba(37,99,235,.16), transparent 28%),
    linear-gradient(135deg, #ffffff, #f8fbff);
  border: 1px solid #dbeafe;
}
.amount { font-size: clamp(34px, 4vw, 52px); font-weight: 800; letter-spacing: -1.8px; margin: 8px 0 6px; }
.money-details { display: flex; flex-wrap: wrap; gap: 12px; margin: 22px 0; }
.detail-chip { background: #f1f5f9; border: 1px solid var(--line); padding: 11px 13px; border-radius: 14px; }
.detail-chip small { display: block; color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; margin-bottom: 4px; }
.detail-chip b { font-size: 14px; }
.action-row { display: flex; flex-wrap: wrap; gap: 11px; }
.copy-box {
  margin-top: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 12px;
}
.copy-box code { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #334155; }
.invoice-preview {
  border-radius: 20px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg,#fff,#f8fafc);
  padding: 18px;
}
.invoice-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 18px; }
.invoice-number { font-weight: 800; font-size: 24px; letter-spacing: -.7px; }
.invoice-lines { display: grid; gap: 10px; margin: 18px 0; }
.invoice-line { height: 9px; border-radius: 999px; background: #e2e8f0; }
.invoice-line:nth-child(2) { width: 78%; }
.invoice-line:nth-child(3) { width: 55%; }
.table-card { padding: 0; overflow: hidden; }
.table-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 15px; padding: 20px 22px; border-bottom: 1px solid var(--line); }
.search-filter { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.search-input, .select-input {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 13px;
  padding: 11px 13px;
  outline: 0;
  min-width: 210px;
}
table { width: 100%; border-collapse: collapse; }
th { text-align: left; color: #64748b; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; background: #f8fafc; padding: 14px 22px; }
td { padding: 16px 22px; border-top: 1px solid #eef2f7; vertical-align: middle; }
td strong { display: block; margin-bottom: 4px; }
td small { color: var(--muted); }
.table-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.icon-btn {
  border: 1px solid var(--line);
  background: #fff;
  color: #334155;
  min-width: 38px;
  height: 38px;
  border-radius: 12px;
  display: inline-grid;
  place-items: center;
  font-weight: 800;
}
.icon-btn:hover { background: #f8fafc; }
.timeline { display: grid; gap: 15px; }
.timeline-item { display: grid; grid-template-columns: 34px 1fr; gap: 12px; }
.timeline-dot { width: 34px; height: 34px; border-radius: 12px; display: grid; place-items: center; background: #eff6ff; color: var(--primary); }
.timeline-item strong { display: block; margin-bottom: 4px; }
.timeline-item span { color: var(--muted); font-size: 13px; line-height: 1.5; }
.profile-box { display: grid; grid-template-columns: 72px 1fr; gap: 18px; align-items: center; }
.profile-avatar { width: 72px; height: 72px; border-radius: 24px; background: linear-gradient(135deg,#bfdbfe,#2563eb); display: grid; place-items: center; color:#fff; font-weight: 800; font-size: 24px; }
.profile-meta h2 { margin: 0 0 6px; }
.profile-meta p { margin: 0; color: var(--muted); line-height: 1.6; }
.info-list { display: grid; gap: 12px; margin-top: 20px; }
.info-item { display: flex; justify-content: space-between; gap: 20px; padding: 14px; border: 1px solid var(--line); border-radius: 15px; background: #f8fafc; }
.info-item span { color: var(--muted); }
.info-item b { text-align: right; }
.empty-state { padding: 56px 20px; text-align: center; color: var(--muted); }
.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  background: #0f172a;
  color: #fff;
  padding: 14px 17px;
  border-radius: 15px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(15px);
  pointer-events: none;
  transition: .2s;
  z-index: 50;
  font-weight: 700;
}
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 1040px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-hero { display: none; }
  .mobile-brand { display: flex; color: var(--text); }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 30; transform: translateX(-105%); transition: .22s; width: var(--sidebar); }
  .sidebar.open { transform: translateX(0); }
  .mobile-menu { display: inline-flex; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .main { padding: 18px 16px 36px; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .top-actions { width: 100%; justify-content: space-between; }
  .login-card { padding: 24px; border-radius: 24px; }
  .table-toolbar { align-items: stretch; flex-direction: column; }
  .search-input, .select-input { min-width: 0; width: 100%; }
  table, thead, tbody, tr, th, td { display: block; }
  thead { display: none; }
  tr { border-top: 1px solid var(--line); padding: 12px 0; }
  td { border: 0; padding: 9px 18px; }
  td:before { content: attr(data-label); display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; font-weight: 800; margin-bottom: 5px; }
}
