:root {
  --ink: #101828;
  --muted: #667085;
  --line: #e6eaf0;
  --paper: #ffffff;
  --canvas: #f4f7fb;
  --navy: #101828;
  --blue: #32a8f4;
  --violet: #7357ff;
  --green: #18a874;
  --amber: #f4aa24;
  --red: #dc4c64;
  --radius: 18px;
  --shadow: 0 16px 45px rgba(16, 24, 40, .08);
}
* { box-sizing: border-box; }
html { min-height: 100%; }
body {
  margin: 0; min-height: 100vh; color: var(--ink); background: var(--canvas);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
button { cursor: pointer; }
.auth-shell {
  min-height: 100vh; display: grid; grid-template-columns: 1.08fr .92fr;
  background: radial-gradient(circle at 20% 10%, rgba(50,168,244,.2), transparent 31%),
              linear-gradient(140deg, #0c1528 0 50%, #f7f9fc 50%);
}
.auth-brand { color: #fff; padding: 8vw; display: flex; flex-direction: column; justify-content: center; }
.auth-mark { width: 330px; max-width: 100%; margin-bottom: 55px; border-radius: 16px; }
.auth-brand h1 { font-size: clamp(38px, 5vw, 68px); line-height: 1.02; max-width: 650px; margin: 0 0 24px; letter-spacing: -.045em; }
.auth-brand p { color: #b9c8df; font-size: 18px; line-height: 1.65; max-width: 580px; }
.auth-card-wrap { display: grid; place-items: center; padding: 34px; }
.auth-card { width: min(440px, 100%); padding: 42px; background: rgba(255,255,255,.94); border: 1px solid rgba(255,255,255,.8); border-radius: 28px; box-shadow: 0 30px 90px rgba(16,24,40,.18); }
.auth-card h2 { font-size: 30px; margin: 0 0 9px; letter-spacing: -.03em; }
.auth-card > p { color: var(--muted); margin: 0 0 30px; }
.field { display: grid; gap: 8px; margin: 0 0 18px; }
.field label { font-size: 13px; font-weight: 750; color: #344054; }
.field input, .field select {
  width: 100%; border: 1px solid #d5dae2; border-radius: 12px; padding: 13px 14px;
  outline: 0; background: #fff; transition: .2s;
}
.field input:focus, .field select:focus { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(50,168,244,.12); }
.btn {
  display: inline-flex; justify-content: center; align-items: center; gap: 8px; border: 0;
  border-radius: 12px; padding: 12px 17px; font-weight: 750; color: #fff;
  background: linear-gradient(135deg, var(--blue), var(--violet)); box-shadow: 0 8px 20px rgba(82,105,244,.22);
}
.btn:hover { transform: translateY(-1px); }
.btn.secondary { color: var(--ink); background: #fff; box-shadow: none; border: 1px solid var(--line); }
.btn.danger { background: var(--red); box-shadow: none; }
.btn.block { width: 100%; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 255px minmax(0,1fr); }
.sidebar { background: var(--navy); color: #d7deeb; padding: 24px 18px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; }
.sidebar .logo { padding: 7px 10px 32px; }
.sidebar .logo img { width: 205px; border-radius: 12px; display: block; }
.nav { display: grid; gap: 7px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 11px; color: #aebbd0; font-weight: 650; }
.nav a:hover, .nav a.active { background: rgba(255,255,255,.09); color: #fff; }
.nav .ico { width: 24px; text-align: center; }
.sidebar-user { margin-top: auto; padding: 15px; border-top: 1px solid rgba(255,255,255,.1); }
.sidebar-user strong, .sidebar-user small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user small { color: #8998b1; margin-top: 3px; }
.main { min-width: 0; padding: 32px clamp(22px, 4vw, 55px) 60px; }
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 28px; }
.topbar h1 { margin: 0 0 7px; font-size: clamp(27px, 3vw, 38px); letter-spacing: -.035em; }
.topbar p { margin: 0; color: var(--muted); }
.mobile-menu { display: none; }
.grid-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px,1fr)); gap: 16px; margin-bottom: 24px; }
.stat, .card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.stat { padding: 21px; position: relative; overflow: hidden; }
.stat:before { content: ""; position: absolute; width: 90px; height: 90px; border-radius: 50%; top: -45px; right: -30px; background: rgba(50,168,244,.1); }
.stat .label { color: var(--muted); font-size: 13px; font-weight: 700; }
.stat .value { display: block; font-size: 28px; font-weight: 850; margin: 8px 0 4px; letter-spacing: -.035em; }
.stat .hint { color: var(--muted); font-size: 12px; }
.card { padding: 24px; margin-bottom: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.card h2 { margin: 0; font-size: 19px; letter-spacing: -.02em; }
.table-wrap { overflow-x: auto; margin: 0 -8px; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { text-align: left; padding: 14px 12px; border-bottom: 1px solid #eef1f5; vertical-align: middle; }
th { color: var(--muted); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; }
td { font-size: 14px; }
tbody tr:last-child td { border-bottom: 0; }
.customer strong, .customer small { display: block; }
.customer small { color: var(--muted); margin-top: 3px; }
.badge { display: inline-flex; align-items: center; border-radius: 99px; padding: 5px 9px; font-size: 11px; font-weight: 800; }
.badge.paid, .badge.active { color: #087451; background: #e5f8f0; }
.badge.pending { color: #9a6510; background: #fff4dc; }
.badge.refunded, .badge.inactive, .badge.failed { color: #a83246; background: #fdebef; }
.filters, .form-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; align-items: end; }
.form-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
.form-grid .wide { grid-column: 1 / -1; }
.filters .field, .form-grid .field { margin: 0; }
.inline-form { display: flex; align-items: center; gap: 7px; }
.compact-input { width: 92px; border: 1px solid #d5dae2; border-radius: 10px; padding: 10px; }
.filter-actions { display: flex; align-items: center; gap: 9px; }
.live-dot { width: 8px; height: 8px; display: inline-block; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 5px rgba(24,168,116,.12); margin-right: 8px; }
.money-eur { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; }
.callout { padding: 18px; border-radius: 15px; background: linear-gradient(135deg, rgba(50,168,244,.09), rgba(115,87,255,.08)); border: 1px solid rgba(82,105,244,.16); }
.invoice-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.alert { border-radius: 12px; padding: 13px 15px; margin-bottom: 18px; font-size: 14px; }
.alert.error { background: #fdecef; color: #9f2339; border: 1px solid #facbd3; }
.alert.success { background: #e8f8f2; color: #087451; border: 1px solid #c6efdf; }
.split { display: grid; grid-template-columns: 1.1fr .9fr; gap: 20px; }
.link-box { display: flex; gap: 10px; padding: 10px; background: #f4f7fb; border: 1px solid var(--line); border-radius: 13px; }
.link-box input { min-width: 0; flex: 1; border: 0; background: transparent; padding: 3px 6px; outline: 0; color: #475467; }
.empty { color: var(--muted); text-align: center; padding: 38px 16px; }
.pagination { display: flex; justify-content: flex-end; gap: 6px; margin-top: 18px; }
.pagination a { padding: 8px 11px; border-radius: 9px; border: 1px solid var(--line); background: #fff; }
.pagination a.current { color: #fff; background: var(--navy); }
.miniapp {
  min-height: 100vh; max-width: 580px; margin: auto; padding: max(26px, env(safe-area-inset-top)) 20px max(30px, env(safe-area-inset-bottom));
  background: var(--tg-theme-bg-color, #f4f7fb);
}
.mini-logo { width: 220px; margin-bottom: 34px; }
.pay-hero { padding: 26px; color: #fff; border-radius: 25px; background: linear-gradient(145deg, #111b30, #1d2d50); box-shadow: 0 20px 45px rgba(16,24,40,.22); position: relative; overflow: hidden; }
.pay-hero:after { content: "★"; position: absolute; right: -10px; top: -35px; font-size: 155px; color: rgba(255,255,255,.06); transform: rotate(12deg); }
.pay-hero .merchant { color: #9cb3d3; font-size: 13px; font-weight: 750; }
.pay-hero h1 { font-size: 27px; margin: 10px 0 24px; letter-spacing: -.03em; }
.pay-amount { font-size: 45px; font-weight: 900; letter-spacing: -.045em; }
.pay-card { background: var(--tg-theme-secondary-bg-color, #fff); border-radius: 20px; padding: 22px; margin-top: 18px; border: 1px solid var(--line); }
.amount-presets { display: grid; grid-template-columns: repeat(3,1fr); gap: 9px; margin: 12px 0 18px; }
.amount-presets button { padding: 11px 5px; border-radius: 11px; border: 1px solid var(--line); background: #fff; font-weight: 800; }
.amount-presets button.selected { border-color: var(--blue); color: #1679b7; background: #eaf7ff; }
.pay-status { min-height: 22px; color: var(--muted); font-size: 13px; margin-top: 14px; text-align: center; }
.fineprint { color: var(--muted); font-size: 12px; line-height: 1.55; margin-top: 18px; }
@media (max-width: 1050px) {
  .grid-stats { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .filters { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .split { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .auth-shell { display: block; background: var(--canvas); }
  .auth-brand { display: none; }
  .auth-card-wrap { min-height: 100vh; padding: 20px; }
  .auth-card { padding: 30px 24px; }
  .app-shell { display: block; }
  .sidebar { position: fixed; z-index: 20; width: 255px; transform: translateX(-102%); transition: .25s; }
  body.nav-open .sidebar { transform: translateX(0); }
  .main { padding: 22px 18px 45px; }
  .mobile-menu { display: inline-flex; }
  .grid-stats { grid-template-columns: 1fr 1fr; }
  .topbar { align-items: center; }
  .filters, .form-grid { grid-template-columns: 1fr; }
  .form-grid .wide { grid-column: auto; }
}
@media (max-width: 460px) {
  .grid-stats { grid-template-columns: 1fr; }
  .card { padding: 18px; }
}
