:root{
  --border: rgba(255,255,255,.12);
  --danger: rgba(255,90,90,.95);
  --ok: rgba(120,255,180,.95);
}
.wrap{max-width:1180px;margin:0 auto;padding:24px}
.top{display:flex;gap:16px;align-items:flex-start;justify-content:space-between;margin-bottom:14px}
.top h1{margin:0;font-size:22px}
.topActions{display:flex;gap:10px;align-items:center}
.card{background:var(--card);border:1px solid var(--border);border-radius:var(--radius);box-shadow:var(--shadow);padding:16px;margin:14px 0}
.cardHead{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:10px}
.cardHead h2{margin:0;font-size:18px}
.grid2{display:grid;grid-template-columns:1fr;gap:14px}
@media (min-width: 980px){.grid2{grid-template-columns:1fr 1fr}}
.btn{
  display:inline-flex;align-items:center;justify-content:center;
  padding:10px 12px;border-radius:14px;
  border:1px solid var(--border);
  background:rgba(255,255,255,.06);color:var(--text);
  text-decoration:none;cursor:pointer;user-select:none;
}
.btn:hover{background:rgba(255,255,255,.09)}
.btn.primary{background:rgba(122,160,255,.20);border-color:rgba(122,160,255,.55)}
.btn.danger{background:rgba(255,90,90,.12);border-color:rgba(255,90,90,.40)}
.btn.small{padding:7px 10px;border-radius:12px;font-size:12px}
.muted{color:var(--muted)}
.small{font-size:12px}
.mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace}
.form{border-top:1px solid var(--border);padding-top:12px;margin-top:12px}
.form.hidden{display:none}
.row{display:flex;flex-wrap:wrap;gap:12px;margin-bottom:10px}
label{display:flex;flex-direction:column;gap:6px;flex:1;min-width:210px}
input,select,textarea{
  padding:10px 12px;border-radius:14px;border:1px solid var(--border);
  background:rgba(0,0,0,.25);color:var(--text);outline:none;
}
textarea{resize:vertical}
.check{flex-direction:row;align-items:center;gap:10px;min-width:auto}
.check input{width:18px;height:18px;margin:0}
.tableWrap{overflow:auto;border-radius:14px;border:1px solid var(--border)}
.table{width:100%;border-collapse:collapse;min-width:640px}
.table th,.table td{padding:10px 12px;border-bottom:1px solid rgba(255,255,255,.08);text-align:left;vertical-align:top}
.table th{font-size:12px;color:var(--muted);font-weight:600}
.table tr:last-child td{border-bottom:none}
.actionsRow{display:flex;gap:10px;flex-wrap:wrap}
.filters{display:flex;gap:10px;align-items:center;flex-wrap:wrap;margin:10px 0}
.filters input{flex:1;min-width:220px}
.badge{display:inline-flex;align-items:center;gap:8px}
.swatch{width:12px;height:12px;border-radius:4px;border:1px solid rgba(255,255,255,.25);display:inline-block}
/* Layout fixes: keep two-column panels same height and make lists scroll inside panels */
html, body{
  height: 100%;
  margin: 0;
}

body{
  min-height: 100vh;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.wrap{
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* The grid area should take the remaining height */
.grid2{
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* In desktop mode, make the grid row fill available height and stretch both cards */
@media (min-width: 980px){
  .grid2{
    grid-template-columns: 1fr 1fr;
    grid-auto-rows: 1fr;
    align-items: stretch;
  }
  .grid2 > .card{
    height: 100%;
  }
}

/* Make cards behave like panels with internal scrolling regions */
.card{
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* Remove outer margins for cards inside the grid so heights match cleanly */
.grid2 > .card{
  margin: 0;
}

/* Header areas should not shrink */
.cardHead, .top{
  flex: 0 0 auto;
}

/* Anything that should scroll is usually inside tableWrap */
.tableWrap{
  flex: 1;
  min-height: 0;
  overflow: auto;
}

/* If a card has no tableWrap, allow its direct children to scroll if needed */
.card > .row,
.card > .filters{
  flex: 0 0 auto;
}
/* Mobile: allow normal page scrolling and natural card heights */
@media (max-width: 979px){
  body{
    overflow: auto;
    height: auto;
  }
  .grid2{
    flex: 0 0 auto;
    overflow: visible;
  }
  .grid2 > .card{
    height: auto;
    margin: 14px 0;
  }
}
