@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;700;800&family=Syne:wght@700;800&display=swap');

:root{
  --bg-1:#ffffff;
  --bg-2:#f6f8ff;
  --panel:#ffffff;
  --panel-2:#f8faff;
  --panel-3:#eef2ff;

  --border:#e5e7eb;
  --border-2:rgba(79,70,229,.18);

  --text:#0f172a;
  --muted:#64748b;

  --primary:#2563eb;
  --primary-2:#4f46e5;
  --violet:#6d28d9;
  --blue:#2563eb;
  --blue-soft:#60a5fa;

  --green:#16a34a;
  --red:#dc2626;
  --yellow:#d97706;

  --shadow:0 10px 30px rgba(15,23,42,.08);
  --shadow-soft:0 6px 18px rgba(15,23,42,.06);
}

*{
  box-sizing:border-box;
  -webkit-tap-highlight-color:transparent;
}

html,body{
  margin:0;
  padding:0;
  min-height:100%;
}

body{
  font-family:'DM Sans',sans-serif;
  line-height:1.5;
  color:var(--text);
  background:
    linear-gradient(rgba(79,70,229,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(79,70,229,.035) 1px, transparent 1px),
    linear-gradient(180deg, var(--bg-1), var(--bg-2));
  background-size:26px 26px,26px 26px,auto;
}

a{
  color:inherit;
  text-decoration:none;
}

.container{
  width:100%;
  max-width:460px;
  margin:0 auto;
  padding:16px 14px 28px;
}

.card{
  background:linear-gradient(180deg, var(--panel), var(--panel-2));
  border:1px solid var(--border);
  border-radius:22px;
  padding:18px;
  margin-bottom:16px;
  box-shadow:var(--shadow);
  position:relative;
  overflow:hidden;
}

.card::before{
  content:"";
  position:absolute;
  inset:0;
  border-radius:22px;
  padding:1px;
  background:linear-gradient(135deg, rgba(37,99,235,.06), rgba(79,70,229,.10), rgba(255,255,255,.2));
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite:xor;
  mask-composite:exclude;
  pointer-events:none;
}

h1,h2,h3,h4,h5,h6{
  margin:0 0 10px;
  font-weight:800;
  letter-spacing:-0.03em;
  line-height:1.1;
  color:var(--text);
}

h1{
  font-family:'Syne',sans-serif;
  font-size:28px;
}

h2{
  font-family:'Syne',sans-serif;
  font-size:22px;
}

h3{
  font-size:18px;
}

p{
  margin:0 0 10px;
}

.muted{
  color:var(--muted);
  font-size:14px;
}

/* top section */
.top-card{
  padding:0;
  background:transparent;
  border:none;
  box-shadow:none;
  margin-bottom:14px;
}

.top-card::before{
  display:none;
}

.topbar{
  background:linear-gradient(180deg, #ffffff, #f8faff);
  border:1px solid #e5e7eb;
  border-radius:24px;
  padding:16px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  box-shadow:var(--shadow);
  position:relative;
  overflow:hidden;
}

.topbar-brand-only{
  flex-direction:column;
  align-items:stretch;
  gap:14px;
}

.brand-banner{
  width:100%;
  border-radius:20px;
  overflow:hidden;
  background:linear-gradient(135deg, #ffffff, #f8faff);
  border:1px solid #e5e7eb;
  box-shadow:var(--shadow-soft);
}

.brand-banner-img{
  display:block;
  width:100%;
  height:auto;
  aspect-ratio:4 / 1;
  object-fit:contain;
  background:#ffffff;
}

.brand-banner-fallback{
  min-height:92px;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  background:linear-gradient(135deg, #2563eb, #4f46e5 60%, #ffffff);
  color:#fff;
  text-align:center;
  padding:16px;
}

.brand-fallback-title{
  font-family:'Syne',sans-serif;
  font-size:22px;
  font-weight:800;
  letter-spacing:-0.02em;
}

.brand-fallback-sub{
  margin-top:6px;
  font-size:13px;
  color:rgba(255,255,255,.9);
}

.balance-panel{
  width:100%;
  border-radius:18px;
  padding:14px 16px;
  background:linear-gradient(135deg, rgba(37,99,235,.08), rgba(79,70,229,.10), #ffffff);
  border:1px solid rgba(79,70,229,.14);
  box-shadow:var(--shadow-soft);
  text-align:left;
}

.balance-panel-label{
  font-size:12px;
  color:#475569;
  margin-bottom:8px;
  font-weight:700;
}

.balance-panel-amount{
  font-family:'Syne',sans-serif;
  font-size:24px;
  font-weight:800;
  line-height:1;
  color:#111827;
  letter-spacing:-0.03em;
}

.page-back-wrap{
  margin-bottom:14px;
}

.page-back-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:46px;
  padding:0 16px;
  border-radius:14px;
  background:linear-gradient(180deg, #ffffff, #f8faff);
  border:1px solid rgba(79,70,229,.16);
  color:#1e293b;
  font-size:14px;
  font-weight:800;
  box-shadow:var(--shadow-soft);
  transition:transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}

.page-back-btn:active{
  transform:scale(.985);
}

.page-back-btn:hover{
  border-color:rgba(79,70,229,.28);
}

/* compatibility old classes */
.brand-wrap{
  display:flex;
  align-items:center;
  gap:14px;
  min-width:0;
  flex:1;
}

.profile-box{
  width:60px;
  height:60px;
  border-radius:18px;
  flex-shrink:0;
  display:flex;
  align-items:center;
  justify-content:center;
  overflow:hidden;
  background:#ffffff;
  border:1px solid #e5e7eb;
  box-shadow:var(--shadow-soft);
}

.avatar,
.logo{
  width:60px;
  height:60px;
  border-radius:18px;
  flex-shrink:0;
}

.avatar{
  object-fit:cover;
  border:1px solid #e5e7eb;
  background:#ffffff;
  display:block;
}

.logo{
  display:flex;
  align-items:center;
  justify-content:center;
  background:linear-gradient(135deg, #2563eb, #4f46e5 60%, #ffffff);
  color:#fff;
  font-family:'Syne',sans-serif;
  font-weight:800;
  font-size:20px;
  letter-spacing:.03em;
  box-shadow:var(--shadow-soft);
}

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

.site-title{
  font-family:'Syne',sans-serif;
  font-size:19px;
  font-weight:800;
  letter-spacing:-0.02em;
  line-height:1.08;
  color:#111827;
}

.site-sub{
  margin-top:6px;
  font-size:13px;
  color:var(--muted);
}

.site-uid{
  margin-top:6px;
  font-size:12px;
  color:#64748b;
  word-break:break-word;
}

.user-meta{
  min-width:124px;
  text-align:right;
  font-size:13px;
  color:var(--muted);
}

.balance-label{
  font-size:12px;
  color:#64748b;
}

.bal{
  margin-top:8px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:44px;
  padding:10px 14px;
  border-radius:999px;
  background:linear-gradient(135deg, rgba(37,99,235,.08), rgba(79,70,229,.10), #ffffff);
  border:1px solid rgba(79,70,229,.14);
  color:#111827;
  font-size:16px;
  font-weight:800;
  box-shadow:var(--shadow-soft);
}

/* nav */
.menu-grid{
  display:grid;
  grid-template-columns:repeat(2,1fr);
  gap:12px;
  margin-bottom:16px;
}

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

.menu-grid-3{
  grid-template-columns:repeat(3,1fr);
}

.menu-grid a,
.btn,
.btn-submit{
  appearance:none;
  border:none;
  outline:none;
  cursor:pointer;
  display:flex;
  align-items:center;
  justify-content:center;
  min-height:56px;
  width:100%;
  border-radius:16px;
  background:linear-gradient(180deg, #ffffff, #f8faff);
  border:1px solid #e5e7eb;
  color:#111827;
  font-size:15px;
  font-weight:800;
  letter-spacing:-0.01em;
  transition:transform .16s ease, border-color .16s ease, box-shadow .16s ease, background .16s ease;
  box-shadow:var(--shadow-soft);
}

.menu-grid a:active,
.btn:active,
.btn-submit:active{
  transform:scale(.985);
}

.menu-grid a:hover,
.btn:hover,
.btn-submit:hover{
  border-color:rgba(79,70,229,.24);
}

.btn-submit{
  background:linear-gradient(90deg, #2563eb, #4f46e5);
  color:#fff;
  font-weight:800;
  margin-top:12px;
}

/* content cards */
.table-list{
  display:flex;
  flex-direction:column;
  gap:12px;
}

.order-box{
  background:linear-gradient(180deg, #ffffff, #fbfcff);
  border:1px solid #e5e7eb;
  border-radius:20px;
  padding:16px;
  box-shadow:var(--shadow-soft);
  position:relative;
  overflow:hidden;
  transition:transform .18s ease, border-color .18s ease;
}

.order-box:hover{
  transform:translateY(-2px);
  border-color:rgba(79,70,229,.18);
}

.order-box::after{
  display:none;
}

/* forms */
label{
  display:block;
  font-size:14px;
  font-weight:700;
  color:#1e293b;
  margin-bottom:8px;
}

input,
select,
textarea{
  width:100%;
  background:#ffffff;
  color:#111827;
  border:1px solid #dbe2ea;
  border-radius:16px;
  min-height:52px;
  padding:14px 16px;
  font-size:15px;
  outline:none;
  margin-bottom:12px;
  transition:border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

textarea{
  min-height:120px;
  resize:vertical;
  padding-top:14px;
}

input::placeholder,
textarea::placeholder{
  color:#94a3b8;
}

input:focus,
select:focus,
textarea:focus{
  border-color:rgba(79,70,229,.45);
  box-shadow:0 0 0 3px rgba(79,70,229,.08);
}

/* alerts */
.alert{
  border-radius:16px;
  padding:14px 16px;
  margin-bottom:14px;
  font-size:14px;
  font-weight:700;
  border:1px solid transparent;
}

.alert.error,
.alert-error,
.error{
  background:#fef2f2;
  border-color:#fecaca;
  color:#b91c1c;
}

.alert.success,
.alert-success,
.success{
  background:#f0fdf4;
  border-color:#bbf7d0;
  color:#15803d;
}

pre.debug{
  margin:0;
  white-space:pre-wrap;
  word-break:break-word;
  font-size:12px;
  color:#334155;
  background:#f8fafc;
  border:1px solid #e5e7eb;
  border-radius:16px;
  padding:14px;
}

.invalid-box{
  max-width:420px;
  margin:40px auto;
  padding:18px;
}

details{
  border-radius:16px;
  overflow:hidden;
}

summary{
  cursor:pointer;
  font-weight:700;
  color:#1e293b;
  outline:none;
}

code{
  font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;
  background:#f8fafc;
  border:1px solid #e5e7eb;
  border-radius:10px;
  padding:2px 8px;
  color:#334155;
  font-size:13px;
}

.stats-grid{
  display:grid;
  grid-template-columns:1fr;
  gap:12px;
}

.stat-card{
  background:linear-gradient(180deg, #ffffff, #fbfcff);
  border:1px solid #e5e7eb;
  border-radius:20px;
  padding:16px;
}

.stat-label{
  font-size:13px;
  color:var(--muted);
}

.stat-value{
  margin-top:8px;
  font-size:22px;
  font-weight:800;
  letter-spacing:-0.03em;
  color:#111827;
}

.section-title{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-bottom:14px;
}

hr{
  border:none;
  border-top:1px solid #e5e7eb;
  margin:16px 0;
}

@media (min-width:768px){
  .container{
    max-width:980px;
    padding:28px 20px 40px;
  }

  .menu-grid{
    grid-template-columns:repeat(4,1fr);
  }

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

  .menu-grid-3{
    grid-template-columns:repeat(3,1fr);
  }

  .stats-grid{
    grid-template-columns:repeat(3,1fr);
  }

  .table-list.grid-2{
    display:grid;
    grid-template-columns:repeat(2,1fr);
    gap:14px;
  }

  .table-list.grid-3{
    display:grid;
    grid-template-columns:repeat(3,1fr);
    gap:14px;
  }
}