:root{
  --bg:#f7f9fc; --card:#ffffff; --muted:#617585; --text:#0f1620; --brand:#2563eb; --border:#e4e7ec; --row:#fafbfc;
}
*{box-sizing:border-box}
body{font:14px/1.5 system-ui,-apple-system,"Segoe UI",Roboto,Ubuntu,Arial,sans-serif;margin:0;background:var(--bg);color:var(--text)}
.wrap{max-width: 1800px !important;margin:8px auto;padding:0 16px}
.header{display:flex;align-items:center;justify-content:space-between;margin-bottom:2px}
h1,h2,h3{margin:0 0 8px}
.card{background:var(--card);border:1px solid var(--border);border-radius:12px;box-shadow:0 8px 22px rgba(13,38,76,.07);padding:14px;margin-bottom:12px}
.pills a{display:inline-flex;align-items:center;margin:6px 6px 0 0;text-decoration:none}
.pills a span{padding:8px 12px;border:1px solid var(--border);border-radius:999px;background:#fff;color:#0f1620}
.pills a span.active{background:#e9f0ff;border-color:#2563eb}
.btn{display:inline-flex;align-items:center;gap:8px;padding:9px 12px;border-radius:10px;border:1px solid var(--border);background:#fff;color:#0f1620;text-decoration:none;cursor:pointer}
.btn.primary{background:linear-gradient(180deg,#3b82f6,#2563eb);border-color:#2563eb;color:#fff}
.grid3{display:grid;grid-template-columns:1fr 2fr 1fr;gap:12px}
.listwrap{border:1px solid var(--border);border-radius:10px;overflow:auto;max-height:520px}
table{width:100%;border-collapse:collapse}
th,td{padding:6px 10px;border-bottom:1px solid var(--border)}
th{font-size:12px;text-transform:uppercase;letter-spacing:.08em;background:#fafbfc;color:#5b6b7c;position:sticky;top:0}
tr:hover{background:#f6faff}
tr.selected{background:#e6f0ff}
tr.linked{background:#fff4d6}
.controls{display:flex;gap:8px;flex-wrap:wrap;align-items:center;margin:8px 0}
input[type=text]{padding:8px 10px;border:1px solid var(--border);border-radius:10px}
.small{font-size:12px;color:#5b6b7c}
.flex{display:flex;gap:8px;flex-wrap:wrap;align-items:center}
.split-13-23{display:grid;grid-template-columns:1fr 2fr;gap:10px}
.full{grid-column:1/-1}
hr{border:none;border-top:1px solid var(--border);margin:10px 0}

.listwrap.mid{max-height:none;height:auto;min-height:500px;overflow:visible}

#midTable th:last-child,
#midTable td:last-child { white-space: nowrap; width: 240px !important; }
#midTable td:last-child form { display: inline-block; margin-right: 6px; }
#midTable td:last-child .btn { display: inline-flex; align-items: center; }
.reorder { display: inline-flex; gap: 6px; white-space: nowrap; }

/* tight header gap override */
.header{margin-bottom:2px !important}
.wrap{margin:8px auto !important}


/* === Unified form controls === */
.input,
input[type=text],
input[type=number],
select,
textarea{
  padding:8px 10px;
  border:1px solid var(--border);
  border-radius:10px;
  background:#fff;
  color:var(--text);
  font:inherit;
}

.input{ width:100%; }

/* Remove number spinners for consistent look */
input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number]{ -moz-appearance: textfield; }

/* ---- shared button styles moved from pages ---- */
.btn.icon{ padding:6px 10px; min-width:0; border-radius:8px; }
.btn.success{ background:#ecfdf5; border:1px solid #bbf7d0; color:#065f46; }
.btn.success:hover{ background:#bbf7d0; }
.btn.danger{ background:#fee2e2; border:1px solid #fecaca; color:#b91c1c; }
.btn.danger:hover{ background:#fecaca; }
.badge{ background:#eef2ff; color:#3730a3; padding:2px 6px; border-radius:6px; font-size:12px; }
