:root{
    --bg: #0b0f14;
    --panel: #101824;
    --panel2:#0f1621;
    --text:#e6edf3;
    --muted:#9fb0c0;
    --border:#233043;
    --border2:#1b2636;
    --accent:#4cc9f0;
    --pillbg:#0b1220;
    --good:#22c55e;
    --warn:#f59e0b;
}
* { box-sizing: border-box; }

body{
    margin: 18px;
    font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
    background: radial-gradient(1200px 700px at 20% 0%, rgba(76,201,240,0.08), transparent 60%),
                radial-gradient(900px 600px at 80% 20%, rgba(34,197,94,0.06), transparent 55%),
                var(--bg);
    color: var(--text);
}

h2{ margin: 0 0 14px 0; font-size: 20px; letter-spacing: 0.2px; }
h3{ margin: 0; font-size: 15px; color: var(--text); }

a{
    color: var(--accent);
    text-decoration: none;
}
a:hover{
    text-decoration: underline;
}

.muted{ color: var(--muted); font-size: 12px; }
.row { display: flex; gap: 16px; flex-wrap: wrap; }

.card{
    border: 1px solid var(--border);
    background: linear-gradient(180deg, rgba(16,24,36,0.95), rgba(15,22,33,0.92));
    border-radius: 14px;
    padding: 14px;
    flex: 1;
    min-width: 340px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.35);
}

.section-head{
    display:flex;
    align-items:flex-start;
    justify-content:space-between;
    gap:14px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

input, select{
    padding: 8px 10px;
    border: 1px solid var(--border2);
    background: rgba(8,12,18,0.6);
    color: var(--text);
    border-radius: 10px;
    outline: none;
}
input::placeholder{ color: rgba(159,176,192,0.65); }

button{
    padding: 8px 12px;
    border: 1px solid var(--border);
    background: linear-gradient(180deg, rgba(76,201,240,0.14), rgba(76,201,240,0.08));
    color: var(--text);
    border-radius: 10px;
    cursor: pointer;
}
button:hover{ border-color: rgba(76,201,240,0.45); }
button:active{ transform: translateY(1px); }
button:disabled{
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
}

table{
    width:100%;
    border-collapse: collapse;
    margin-top: 10px;
}
th, td{
    border-bottom: 1px solid rgba(35,48,67,0.7);
    text-align: left;
    padding: 8px;
    font-size: 12.5px;
    vertical-align: top;
}
th{
    color: rgba(230,237,243,0.9);
    font-weight: 600;
    background: rgba(10,16,24,0.35);
    position: sticky;
    top: 0;
    backdrop-filter: blur(6px);
}
tr:hover td{ background: rgba(76,201,240,0.04); }

.pill{
    display:inline-block;
    padding: 2px 10px;
    border: 1px solid rgba(76,201,240,0.25);
    background: rgba(11,18,32,0.55);
    border-radius: 999px;
    font-size: 12px;
    color: rgba(230,237,243,0.92);
}

.mono{
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 12px;
    color: rgba(230,237,243,0.9);
}

.toolbar{
    display:flex;
    gap:10px;
    align-items:center;
    flex-wrap:wrap;
    margin-top: 6px;
}

.topbar{
    display:flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.topbar-actions{
    display:flex;
    align-items:center;
    gap:10px;
    flex-wrap: wrap;
}

.navlink{
    padding: 7px 12px;
    border: 1px solid rgba(35,48,67,0.85);
    border-radius: 999px;
    background: rgba(16,24,36,0.6);
    color: var(--text);
    font-size: 12px;
}
.navlink:hover{
    text-decoration: none;
    border-color: rgba(76,201,240,0.45);
}

.brand{
    display:flex;
    align-items:center;
    gap:10px;
}
.dot{
    width: 10px; height: 10px; border-radius: 50%;
    background: var(--good);
    box-shadow: 0 0 0 6px rgba(34,197,94,0.10);
}
.badge{
    padding: 2px 10px;
    border: 1px solid rgba(35,48,67,0.85);
    border-radius: 999px;
    background: rgba(16,24,36,0.6);
    font-size: 12px;
    color: var(--muted);
}

#assets table { display: block; max-height: 520px; overflow: auto; border-radius: 12px; }
#products table, #twins table { display: block; max-height: 420px; overflow: auto; border-radius: 12px; }

.clickrow { cursor: pointer; }
.clickrow:hover td { background: rgba(76,201,240,0.06); }

.pager{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  flex-wrap: wrap;
  margin: 8px 0 10px 0;
  padding: 8px 10px;
  border: 1px solid rgba(35,48,67,0.75);
  background: rgba(8,12,18,0.28);
  border-radius: 12px;
}

.pager-controls{
  display:flex;
  align-items:center;
  gap:10px;
}

.pager-page{
  padding: 0 4px;
}

.stats-grid{
  display:grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.stat-card{
  border: 1px solid rgba(35,48,67,0.8);
  background: rgba(8,12,18,0.35);
  border-radius: 14px;
  padding: 14px;
}

.stat-label{
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
}

.stat-value{
  font-size: 18px;
  font-weight: 700;
  line-height: 1.15;
}

.subgrid{
  display:grid;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.links-row{
  display:flex;
  gap:10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.link-chip{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding: 8px 12px;
  border: 1px solid rgba(35,48,67,0.85);
  border-radius: 999px;
  background: rgba(16,24,36,0.6);
  color: var(--text);
  font-size: 12px;
}

.status-ok{
  color: var(--good);
}
.status-warn{
  color: var(--warn);
}

.drawer-backdrop{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms ease;
  z-index: 998;
}
.drawer-backdrop.show{
  opacity: 1;
  pointer-events: auto;
}

.drawer{
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: min(46vw, 760px);
  min-width: 420px;
  max-width: 92vw;
  background: linear-gradient(180deg, rgba(16,24,36,0.98), rgba(12,18,28,0.96));
  border-left: 1px solid rgba(35,48,67,0.9);
  box-shadow: -18px 0 45px rgba(0,0,0,0.55);
  transform: translateX(104%);
  transition: transform 160ms ease;
  z-index: 999;
  display: flex;
  flex-direction: column;
}
.drawer.open{
  transform: translateX(0%);
}

.drawer-header{
  padding: 14px 14px 10px 14px;
  border-bottom: 1px solid rgba(35,48,67,0.85);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.drawer-title{
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.2px;
}
.drawer-sub{
  margin-top: 6px;
  color: rgba(159,176,192,0.9);
  font-size: 12px;
}

.drawer-actions{
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-ghost{
  padding: 7px 10px;
  border: 1px solid rgba(35,48,67,0.85);
  background: rgba(8,12,18,0.45);
  color: rgba(230,237,243,0.92);
  border-radius: 10px;
  cursor: pointer;
}
.btn-ghost:hover{ border-color: rgba(76,201,240,0.45); }

.btn-close{
  padding: 7px 10px;
  border: 1px solid rgba(35,48,67,0.85);
  background: rgba(8,12,18,0.45);
  color: rgba(230,237,243,0.92);
  border-radius: 10px;
  cursor: pointer;
}
.btn-close:hover{ border-color: rgba(245,158,11,0.55); }

.drawer-body{
  padding: 12px 14px 14px 14px;
  overflow: auto;
  flex: 1;
}

.drawer-meta{
  padding: 10px 10px;
  border: 1px solid rgba(35,48,67,0.75);
  background: rgba(8,12,18,0.35);
  border-radius: 12px;
  margin-bottom: 10px;
}

.drawer-pre{
  margin: 0;
  white-space: pre;
  overflow: auto;
  padding: 12px;
  border: 1px solid rgba(35,48,67,0.75);
  background: rgba(8,12,18,0.35);
  border-radius: 12px;
  line-height: 1.35;
  font-size: 12px;
}

@media (max-width: 900px){
  .drawer{
    width: 100vw;
    min-width: 0;
    border-left: none;
  }

  .subgrid{
    grid-template-columns: 1fr;
  }
}

.navlink-active{
    border-color: rgba(76,201,240,0.55);
    background: linear-gradient(180deg, rgba(76,201,240,0.18), rgba(76,201,240,0.10));
    box-shadow: 0 0 0 1px rgba(76,201,240,0.10) inset;
}

.headline-strip{
  display:grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-top: 12px;
  margin-bottom: 14px;
}

.headline-chip{
  border: 1px solid rgba(35,48,67,0.8);
  background: linear-gradient(180deg, rgba(10,16,24,0.48), rgba(8,12,18,0.34));
  border-radius: 14px;
  padding: 12px 14px;
  min-height: 76px;
  display:flex;
  flex-direction:column;
  justify-content:center;
}

.headline-label{
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}

.headline-value{
  font-size: 18px;
  font-weight: 700;
  line-height: 1.12;
  word-break: break-word;
}

.stats-page .subgrid{
  grid-template-columns: 1fr;
  gap: 18px;
}

@media (min-width: 1500px){
  .stats-page .subgrid{
    grid-template-columns: 1fr 1fr;
  }
}

.data-table{
  width: 100%;
  min-width: 900px; /* forces scroll instead of collapse */
  table-layout: auto;
}

.data-table th,
.data-table td{
  white-space: nowrap;
}

.table-wrap{
  overflow-x: auto;
  overflow-y: hidden;
  border: 1px solid rgba(35,48,67,0.72);
  border-radius: 12px;
  margin-top: 10px;
}

.data-table{
  width:100%;
  table-layout: fixed;
}

.data-table th,
.data-table td{
  overflow: hidden;
  text-overflow: ellipsis;
}

.data-table td.num,
.data-table th.num{
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.data-table td.mono,
.data-table th.mono{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.table-wrap{
  overflow:auto;
  border: 1px solid rgba(35,48,67,0.72);
  border-radius: 12px;
  margin-top: 10px;
}

.table-wrap table{
  margin-top: 0;
  min-width: 980px;
}

.topbar-actions .navlink,
.topbar-actions .badge{
  height: 34px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
}

.badge{
    white-space: nowrap;
}

.badge{
    white-space: nowrap;
}

#parcels table { display: block; max-height: 520px; overflow: auto; border-radius: 12px; }