:root{
  --bg0:#070A12;
  --bg1:#0B1020;
  --card: rgba(255,255,255,.06);
  --border: rgba(255,255,255,.10);
  --text:#EAF0FF;
  --muted: rgba(234,240,255,.72);
  --danger:#fb7185;
  --ok:#34d399;
  --shadow: 0 12px 40px rgba(0,0,0,.45);
  --r: 18px;
  --r2: 22px;
  --max: 1100px;
  --tap: 44px;
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
  color:var(--text);
  background:
    radial-gradient(1200px 700px at 20% 0%, #1b2250 0%, transparent 55%),
    radial-gradient(900px 700px at 90% 10%, #2a1144 0%, transparent 55%),
    linear-gradient(180deg, var(--bg0), var(--bg1));
  overflow-x:hidden;
}

.bg{
  position:fixed; inset:0;
  background:
    radial-gradient(900px 500px at 50% 120%, rgba(255,255,255,.06), transparent 60%),
    radial-gradient(900px 500px at 50% -10%, rgba(255,255,255,.04), transparent 60%);
  pointer-events:none;
}

/* TOPBAR */
.topbar{
  position:sticky; top:0; z-index:20;
  backdrop-filter: blur(12px);
  background: rgba(10, 14, 28, .65);
  border-bottom:1px solid var(--border);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:12px 16px;
}

.brand{
  display:flex; align-items:center; gap:10px;
  min-width: 170px;
}
.logo{
  width:40px; height:40px;
  display:grid; place-items:center;
  border-radius:14px;
  background: rgba(255,255,255,.08);
  border:1px solid var(--border);
  box-shadow: var(--shadow);
}
.brand .title{ font-weight:800; letter-spacing:.2px; }
.brand .brandtext{ display:flex; flex-direction:column; line-height:1.05; }

.nav{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  flex-wrap:wrap;
  gap:10px;
}

.navlink{
  color:var(--muted);
  text-decoration:none;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid transparent;
  white-space:nowrap;
}
.navlink:hover{
  color:var(--text);
  border-color: rgba(255,255,255,.10);
  background: rgba(255,255,255,.05);
}
.navlink.active{
  color:var(--text);
  background: rgba(255,255,255,.07);
  border-color: rgba(255,255,255,.12);
}

/* LAYOUT */
.container{
  max-width: var(--max);
  margin: 0 auto;
  padding: 18px 16px 92px;
}
.view{ min-height: 60vh; }

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

.card{
  background: var(--card);
  border:1px solid var(--border);
  border-radius: var(--r2);
  padding: 18px;
  box-shadow: var(--shadow);
}

/* TYPO */
h2{ font-size: 26px; }
h3{ font-size: 18px; }
.muted{ color: var(--muted); }
.badge{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:8px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,.07);
  border:1px solid var(--border);
  color: var(--text);
  white-space:nowrap;
}

/* BUTTONS */
.btn{
  min-height: var(--tap);
  padding: 10px 14px;
  border-radius: 14px;
  border:1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
  color: var(--text);
  cursor:pointer;
  box-shadow: 0 8px 26px rgba(0,0,0,.25);
  transition: transform .08s ease, background .15s ease, border-color .15s ease;
  white-space:nowrap;
}
.btn:hover{ background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.16); }
.btn:active{ transform: translateY(1px); }
.btn[disabled]{ opacity:.55; cursor:not-allowed; }

.btn.primary{
  background: rgba(59,130,246,.30);
  border-color: rgba(59,130,246,.45);
}
.btn.primary:hover{
  background: rgba(59,130,246,.36);
  border-color: rgba(59,130,246,.60);
}
.btn.danger{
  background: rgba(251,113,133,.20);
  border-color: rgba(251,113,133,.45);
}
.btn.danger:hover{
  background: rgba(251,113,133,.28);
  border-color: rgba(251,113,133,.60);
}
.btn.ghost{
  background: transparent;
  box-shadow:none;
  border-color: rgba(255,255,255,.10);
}
.btn.full{ width:100%; }

/* FORMS */
.field{
  display:flex;
  flex-direction:column;
  gap:8px;
  margin: 10px 0;
}
.field > span{
  color: var(--muted);
  font-size: 13px;
}
.field.inlinecheck{
  flex-direction:row;
  align-items:center;
  justify-content:flex-start;
  gap:10px;
  margin: 6px 0;
}
.field.inlinecheck input[type="checkbox"]{
  width:18px;
  height:18px;
  margin:0;
  flex: 0 0 auto;
}
.field.inlinecheck span{
  color: var(--text);
  font-size: 14px;
}

input, textarea{
  width:100%;
  color: var(--text);
  background: rgba(0,0,0,.22);
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 14px;
  padding: 12px 12px;
  outline: none;
}
input:focus, textarea:focus{
  border-color: rgba(99,102,241,.55);
  box-shadow: 0 0 0 3px rgba(99,102,241,.18);
}
textarea{ resize: vertical; min-height: 90px; }

/* PILL / TILE */
.pill{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding: 12px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
  color: var(--text);
}
.tile{
  grid-column: span 6;
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  padding: 14px 14px;
  border-radius: var(--r2);
  border:1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.05);
  cursor:pointer;
  transition: transform .10s ease, background .15s ease, border-color .15s ease;
}
.tile:hover{
  transform: translateY(-1px);
  background: rgba(255,255,255,.07);
  border-color: rgba(255,255,255,.16);
}
.tile .name{ font-weight: 800; }
.tile .sub{ color: var(--muted); font-size: 13px; }
.tile .icon{ font-size: 22px; opacity:.95; }

/* TABLES */
.table-wrap{
  width:100%;
  overflow:auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--r2);
  border:1px solid rgba(255,255,255,.10);
}
.table{
  width:100%;
  border-collapse: collapse;
  min-width: 720px;
}
.table th, .table td{
  text-align:left;
  padding: 12px 10px;
  border-bottom: 1px solid rgba(255,255,255,.10);
  vertical-align: top;
}
.table th{
  color: var(--muted);
  font-weight: 700;
  font-size: 13px;
}
.table td{ color: var(--text); }

/* ROW / STACK */
.row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
}
.stack-sm{ display:flex; gap:10px; flex-wrap:wrap; align-items:center; }
.stack-sm.end{ justify-content:flex-end; }

/* MODALS */
.modal::backdrop{
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(3px);
}
.modal{ border:none; padding:0; background: transparent; }
.modal-card{
  width: min(760px, calc(100vw - 24px));
  margin: 12px auto;
  background: rgba(10, 14, 28, .96);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 22px;
  padding: 16px;
  box-shadow: var(--shadow);
  max-height: calc(100vh - 24px);
  overflow: auto;
}
.modal-top{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  position: sticky;
  top: 0;
  background: rgba(10, 14, 28, .96);
  padding-bottom: 10px;
  z-index: 2;
}
.modal-title{ font-weight:900; font-size: 18px; }
.modal-subtitle{ color: var(--muted); font-size: 13px; margin-top: 3px; }
.modal-actions{
  display:flex;
  justify-content:flex-end;
  gap:10px;
  flex-wrap:wrap;
  margin-top: 10px;
}

/* LOGIN */
.login-card{
  width: min(420px, calc(100vw - 24px));
  margin: 12px auto;
  background: rgba(10, 14, 28, .96);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 22px;
  padding: 18px;
  box-shadow: var(--shadow);
  max-height: calc(100vh - 24px);
  overflow: auto;
}
.login-head{ display:flex; gap:12px; align-items:center; margin-bottom: 10px; }
.login-icon{
  width:44px; height:44px;
  border-radius: 16px;
  display:grid; place-items:center;
  background: rgba(255,255,255,.08);
  border:1px solid rgba(255,255,255,.12);
}
.login-title{ font-weight: 900; font-size: 18px; }
.login-subtitle{ color: var(--muted); font-size: 13px; margin-top: 3px; }
.login-error{
  color: var(--danger);
  font-weight: 700;
  min-height: 18px;
  margin-top: 10px;
}

/* STATUS + TOAST */
.statusbar{
  position:fixed;
  left:0; right:0; bottom:0;
  padding: 10px 12px;
  z-index: 30;
  pointer-events:none;
}
.statuspill{
  width: fit-content;
  pointer-events:auto;
  margin: 0 auto;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(0,0,0,.35);
  border:1px solid rgba(255,255,255,.12);
  backdrop-filter: blur(10px);
  color: var(--text);
  box-shadow: var(--shadow);
}
.toast{
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 70px;
  padding: 12px 14px;
  border-radius: 999px;
  background: rgba(0,0,0,.55);
  border:1px solid rgba(255,255,255,.12);
  color: var(--text);
  box-shadow: var(--shadow);
  opacity:0;
  pointer-events:none;
  transition: opacity .20s ease, transform .20s ease;
  z-index: 40;
}
.toast.show{
  opacity:1;
  transform: translateX(-50%) translateY(-2px);
}

.score{ font-weight:900; }
.score.pos{ color: var(--ok); }
.score.neg{ color: var(--danger); }
.score.zero{ color: var(--text); opacity:.85; }

.tagrow{ margin-top:6px; display:flex; gap:8px; flex-wrap:wrap; }
.tag{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
  color: var(--text);
  font-size: 12px;
}
.tag b{ font-weight:900; }
.tag-give{ border-color: rgba(59,130,246,.45); background: rgba(59,130,246,.16); }
.tag-recv{ border-color: rgba(34,197,94,.35); background: rgba(34,197,94,.12); }

.formgrid{ grid-template-columns: repeat(12, 1fr); align-items: start; }
.col6{ grid-column: span 6; }
.col7{ grid-column: span 7; }
.col3{ grid-column: span 3; }
.col2{ grid-column: span 2; }

/* RESPONSIVE */
@media (max-width: 900px){
  .container{ padding-left: 14px; padding-right: 14px; }
  .tile{ grid-column: span 12; }
  h2{ font-size: 24px; }
  .brand{ min-width: 150px; }
  .grid > .card{ grid-column: span 12 !important; }
}
@media (max-width: 720px){
  .col7, .col6, .col3, .col2{ grid-column: span 12; }
  .table{ min-width: 680px; }
}
@media (max-width: 560px){
  .topbar{
    padding: 10px 12px;
    gap:10px;
    flex-direction: column;
    align-items: stretch;
  }
  .brand{ min-width: unset; }
  .nav{
    width:100%;
    overflow-x:auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
    gap:8px;
    justify-content:flex-start;
  }
  .navlink{ flex: 0 0 auto; padding: 9px 10px; border-radius: 999px; }
  .modal-card, .login-card{
    width: calc(100vw - 16px);
    margin: 8px auto;
    border-radius: 18px;
    padding: 14px;
    max-height: calc(100vh - 16px);
  }
  .card{ padding: 16px; border-radius: 18px; }
  .modal-actions{
    flex-direction: column-reverse;
    align-items: stretch;
  }
  .modal-actions .btn{ width:100%; }
  .table{ min-width: 640px; }
}
@media (max-width: 380px){
  .logo{ width:38px; height:38px; border-radius: 14px; }
  .login-title{ font-size: 17px; }
  .modal-title{ font-size: 17px; }
}

/* === FORCE WHITE TEXT (Safari/Chrome fix) === */
body, .card, .modal-card, .login-card,
.table, .table td, .table th,
.pill, .badge, .navlink, .btn,
label, .field, .field > span, .muted, h1,h2,h3,h4,h5,h6,p,div,span{
  color: var(--text);
}
input, textarea, select{
  color: var(--text) !important;
  caret-color: var(--text);
}
input::placeholder, textarea::placeholder{
  color: rgba(234,240,255,.55) !important;
}
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
select:-webkit-autofill{
  -webkit-text-fill-color: var(--text) !important;
  transition: background-color 99999s ease-out 0s;
  box-shadow: 0 0 0px 1000px rgba(0,0,0,.22) inset !important;
  caret-color: var(--text) !important;
}
option{
  color: #111;
  background: #fff;
}