/* ========= Pay2Easy Admin – Global Styles ========= */
:root{
  --sidebar-w: 260px;
  --bg: #f6f8fb;
  --card: #ffffff;
  --line: #e5e7eb;
  --text: #2b2f36;
  --brand: #3a78c0;
  --container: 1200px;
  --content-pad: 24px;
}

*{ box-sizing: border-box; }
body{
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 system-ui, Segoe UI, Roboto, Arial, sans-serif;
}
a{ color: var(--brand); text-decoration: none; }
a.small{ font-size: 12px; }

.btn{
  background: var(--brand);
  color: #fff;
  border: 0;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
}
.btn.small{ padding: 6px 10px; font-size: 12.5px; }
.btn.ghost{ background: #f3f4f6; color: #111827; border: 1px solid var(--line); }
.btn:disabled{ opacity:.6; cursor:not-allowed; }

/* ========= Topbar ========= */
.topbar{
  height: 56px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; position: sticky; top: 0; z-index: 20;
}
.topbar .brand{ display: flex; align-items: center; gap: 8px; font-weight: 700; color: #394b59; }
.topbar .user{ display: flex; align-items: center; gap: 10px; }

/* ========= Layout ========= */
.sidebar{
  width: var(--sidebar-w); background: #fff; border-right: 1px solid var(--line);
  position: sticky; top: 56px; height: calc(100vh - 56px); overflow: auto;
}
.sidebar nav{ display: flex; flex-direction: column; padding: 8px 0; }
.sidebar a{
  padding: 10px 16px; color: #334155; display: flex; gap: 10px; align-items: center;
  border-left: 3px solid transparent;
}
.sidebar a:hover{ background: #eef2ff; }
.sidebar a.active{ background: #eef2ff; border-left-color: var(--brand); }

.content{ flex: 1; padding: 20px var(--content-pad); }
.content > *{ max-width: none; margin: 0; width: 100%; }
.container{ max-width: var(--container); margin: 0 auto; width: 100%; }

/* ========= Page elements ========= */
.page-title{ color: var(--brand); margin: 10px 0 16px; }

/* ========= Cards / Grid ========= */
.cards-grid{ display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: stretch; }
.card{
  background: var(--card); border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
  height: 100%; display: flex; flex-direction: column;
}
.card-head{
  padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 18px; font-weight: 600;
  display: flex; justify-content: space-between; align-items: center; background: #f8fafc; color: #1f2937; flex: 0 0 auto;
}
.card-head .head-actions{ display:flex; gap:8px; flex-wrap: wrap; }
.subhead{ padding: 12px 14px 6px; font-weight: 600; color: #374151; flex: 0 0 auto; }
.card > table.kv{ flex: 1 1 auto; width: 100%; }
.card--fit{ height: auto; display: block; }
.cards-grid .card--fit{ align-self: start; }
.card--fit > table.kv{ flex: initial !important; }
.card--blue .card-head{ background: linear-gradient(180deg, #6aa5f9, #4e86e5); color: #fff; border-bottom-color:#4e86e5; }
.card--green .card-head{ background: linear-gradient(180deg, #52c99c, #35b586); color:#fff; }
.card--purple .card-head{ background: linear-gradient(180deg, #9c7cf3, #7a61da); color:#fff; }

/* ========= KV Tables ========= */
table.kv{ width: 100%; border-collapse: collapse; font-size: 14px; }
table.kv th, table.kv td{ padding: 9px 12px; border-top: 1px solid #eceff3; vertical-align: middle; }
table.kv th{ text-align: left; color: #1f2937; font-weight: 500; }
table.kv td:nth-child(2){ text-align: right; }

/* ========= Data table ========= */
.table-container{ overflow: auto; border-top: 1px solid var(--line); }
.table{ width: 100%; border-collapse: collapse; font-size: 14px; table-layout: auto; }
.table th, .table td{
  padding: 10px 12px; border-top: 1px solid #eceff3; vertical-align: middle; text-align: left; white-space: nowrap;
}
.table thead th{ position: sticky; top: 0; background: #f8fafc; z-index: 1; }
.table--compact th, .table--compact td{ padding: 8px 10px; }
.table--striped tbody tr:nth-child(even) td{ background: #f7f8fa; }
.table .w-220{ min-width: 200px; } .table .w-160{ min-width: 100px; } .table .w-120{ min-width: 75px; } .table .w-100{ min-width: 75px; }

/* ========= Filters ========= */
.filter-card .card-head{ background:#f3f6fb; }

/* Single-line on desktop */
.filter-row{
  display: flex; gap: 8px; padding: 12px 14px; align-items: flex-end; flex-wrap: nowrap;
}
.filter-row .fg{ min-width: 175px; flex: 0 0 175px; }        /* uniform widths */
.filter-row .fg label{ display:block; margin:3px 0 5px; color:#374151; font-weight:600; font-size:12px; }
.filter-row .fg input, .filter-row .fg select{
  width:100%; height:34px; padding:6px 9px; border:1px solid #e5e7eb; border-radius:8px; font:inherit; background:#fff;
}

/* === Buttons right after last field (reduced gap) === */
.filter-row .filter-actions{
  margin-left: 8px;            /* << was 'auto' — removed big empty space */
  flex: 0 0 auto;
  display: inline-flex;
  gap: 8px;
  align-items: flex-end;
}
.filter-row .btn, .filter-row .btn.small{
  font-size: 12.5px; padding: 6px 10px; min-height: 34px; line-height: 1.2; border-radius: 8px;
}

/* ========= Login, Modal, etc. (unchanged essentials) ========= */
body.login{ display:grid; place-items:center; height:100vh; background:var(--bg); }
.login-card{ width:340px; background:#fff; border:1px solid var(--line); border-radius:12px; padding:22px 20px; }
.login-card h2{ margin:0 0 12px; }
.login-card input{ width:100%; padding:10px; border:1px solid var(--line); border-radius:8px; }
.login-card .btn{ width:100%; margin-top:14px; }
.error{ color:#b00020; margin:8px 0 0; }
.muted{ color:#7a8a9a; font-size:12px; margin-top:10px; }

.modal{ position:fixed; inset:0; display:none; z-index:2000; }
.modal.is-open{ display:block; }
.modal__backdrop{ position:absolute; inset:0; background:rgba(17,24,39,.45); z-index:0; }
.modal__dialog{
  position:relative; max-width:860px; margin:6vh auto; background:#fff;
  border:1px solid var(--line); border-radius:12px; overflow:hidden;
  box-shadow:0 20px 50px rgba(0,0,0,.25); z-index:1;
}
.modal__head{ display:flex; justify-content:space-between; align-items:center; padding:1px 16px; border-bottom:1px solid var(--line); font-weight:600; background:#dce9ff; color:#0f172a; }
.modal__body{ padding:16px; max-height:65vh; overflow:auto }
.modal__foot{ padding:12px 16px; border-top:1px solid var(--line); display:flex; justify-content:flex-end }
.modal__close{ background:transparent; border:0; font-size:18px; cursor:pointer; color:#0f172a }

.grid-2{ display:grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap:12px }
.f label{ display:block; margin:6px 0 6px; color:#374151; font-weight:500 }
.f input, .f select, .f textarea{ width:100%; padding:10px; border:1px solid #e5e7eb; border-radius:8px; font:inherit; }
textarea{ min-height:50px; resize:vertical }

body.modal-open .table thead th{ position: static !important; z-index:auto !important; }
body.modal-open{ overflow: hidden; }

/* ========= Responsive ========= */
@media (max-width: 1200px){ .filter-row .fg{ flex-basis: 110px; min-width: 110px; } }
@media (max-width: 980px){
  .filter-row{ flex-wrap: wrap; }
  .filter-row .filter-actions{ width:100%; justify-content:flex-end; margin-left:0; }
  .grid-2{ grid-template-columns: 1fr; }
}
@media (max-width: 900px){ .cards-grid{ grid-template-columns: 1fr; } }
@media (max-width: 640px){
  .sidebar{ position: fixed; left: -270px; transition: transform .2s ease; transform: translateX(0); }
  body.nav-open .sidebar{ left: 0; transform: translateX(270px); }
}

/* Table icon buttons */
.iconbtn{ display:inline-flex; align-items:center; justify-content:center; gap:6px; padding:6px 10px; background:#fff; border:1px solid var(--line); border-radius:8px; cursor:pointer; }
.iconbtn:hover{ background:#f3f6fb; }
.iconbtn svg{ width:16px; height:16px; display:block; }

/* DTH / status helpers (unchanged) */
.cell-icons{ display:flex; align-items:center; gap:10px; }
.icon-round{ width:28px; height:28px; border-radius:999px; display:inline-flex; align-items:center; justify-content:center; border:2px solid currentColor; background:#fff; cursor:pointer; position:relative; transition:background .15s ease, transform .1s ease; }
.icon-round:active{ transform: scale(.97); }
.icon-dth{ color:#7c3aed; }
.icon-dth:hover{ background:#f6f0ff; }
.icon-round .small-plus{ position:absolute; right:-3px; bottom:-3px; width:14px; height:14px; border-radius:50%; background:#7c3aed; color:#fff; font-weight:700; font-size:10px; display:grid; place-items:center; line-height:1; border:2px solid #fff; }
.status-badge{ font-weight:700; padding:4px 10px; border-radius:999px; font-size:13px; display:inline-block; border:1px solid transparent; }
.status--active{ background:#ecfdf5; color:#065f46; border-color:#a7f3d0; }
.status--suspend{ background:#fff7ed; color:#9a3412; border-color:#fed7aa; }

/* Topnav dark (unchanged essentials) */
.topnav-dark{ background:#0b1f3a; color:#fff; border-bottom:1px solid rgba(255,255,255,0.12); }
.topnav-dark.topbar{ height:56px; display:flex; align-items:center; gap:14px; padding:0 16px; position:sticky; top:0; z-index:60; }
.topnav-dark .brand{ display:flex; align-items:center; gap:10px; font-weight:800; color:#fff }
#menuToggle{ display:none; border:0; background:rgba(255,255,255,0.08); color:#fff; border-radius:8px; padding:8px 10px; cursor:pointer; }
.topnav{ flex:1; }
.topnav ul{ list-style:none; margin:0; padding:0; display:flex; gap:4px; align-items:center; }
.topnav li{ position:relative; }
.topnav a{ color:#fff; display:inline-flex; align-items:center; gap:8px; padding:10px 14px; border-radius:8px; text-decoration:none; }
.topnav a:hover, .topnav a:focus{ background:rgba(255,255,255,0.10); outline:none; }
.topnav a.active, .topnav li.parent-active > a{ background:rgba(255,255,255,0.18); }
.topnav li.has-sub:hover>.submenu{ display:block; }
.topnav .submenu{ display:none; position:absolute; top:100%; left:0; min-width:220px; padding:8px; background:#0f2a52; border:1px solid rgba(255,255,255,0.15); border-radius:10px; box-shadow:0 10px 24px rgba(0,0,0,.25); }
.topnav .submenu a{ width:100%; padding:8px 10px; border-radius:8px; color:#fff; }
.topnav .submenu a:hover{ background:rgba(255,255,255,0.10); }

@media (max-width: 980px){
  #menuToggle{ display:inline-block; }
  .topnav{ position:absolute; left:0; right:0; top:56px; display:none; }
  .topnav.open{ display:block; }
  .topnav ul{ flex-direction:column; align-items:stretch; gap:6px; padding:12px; background:#0b1f3a; border-bottom:1px solid rgba(255,255,255,0.12); }
  .topnav a{ padding:12px 14px; border-radius:10px; }
  .topnav .submenu{ position:static; display:none; background:#0f2a52; border-radius:10px; border:1px solid rgba(255,255,255,0.15); padding:6px; box-shadow:none; margin:4px 0 0; }
  .topnav li.open>.submenu{ display:block; }
}

/* Privacy helpers */
.table--mask-col1 tbody td:nth-child(1), .table--mask-col1 tbody td:nth-child(1) *{ color: transparent !important; }
.table--mask-col1.show-names tbody td:nth-child(1), .table--mask-col1.show-names tbody td:nth-child(1) *{ color: inherit !important; }
.table--mask-col2 tbody td:nth-child(2), .table--mask-col2 tbody td:nth-child(2) *{ color: transparent !important; }
.table--mask-col3 tbody td:nth-child(3), .table--mask-col3 tbody td:nth-child(3) *{ color: transparent !important; }
.table--mask-col4 tbody td:nth-child(4), .table--mask-col4 tbody td:nth-child(4) *{ color: transparent !important; }
