/* BDKM Admin - on-brand, independent of the public-site classes. */
:root {
  --primary: #1E293B;
  --primary-light: #334155;
  --accent: #D97706;
  --accent-light: #F59E0B;
  --bg: #F1F5F9;
  --card: #FFFFFF;
  --text: #0F172A;
  --text-secondary: #475569;
  --text-muted: #94A3B8;
  --border: #E2E8F0;
  --green-bg: #D1FAE5;
  --green: #059669;
  --font: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --radius: 10px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.6; }

/* --- Top nav --- */
.admin-nav { background: var(--primary); color: #fff; }
.admin-nav-inner {
  max-width: 1080px; margin: 0 auto; padding: 0 1.5rem;
  display: flex; align-items: center; justify-content: space-between; height: 56px;
}
.admin-brand { color: #fff; text-decoration: none; font-weight: 800; font-size: 1.1rem; }
.admin-brand span { color: var(--accent-light); }
.admin-nav nav { display: flex; gap: 1.25rem; }
.admin-nav nav a {
  color: rgba(255,255,255,0.8); text-decoration: none; font-size: 0.9rem; font-weight: 600;
}
.admin-nav nav a:hover, .admin-nav nav a.active { color: #fff; }

/* --- Main --- */
.admin-main { max-width: 1080px; margin: 0 auto; padding: 2rem 1.5rem 4rem; }
.admin-main.wide { max-width: 1500px; }
.admin-main h1 { font-size: 1.6rem; font-weight: 800; margin-bottom: 1.25rem; }
.admin-main h2 { font-size: 1.15rem; font-weight: 700; margin: 1.5rem 0 0.75rem; }

/* --- Cards / stats --- */
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.5rem; margin-bottom: 1.5rem;
}
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; }
.stat .num { font-size: 1.8rem; font-weight: 800; color: var(--primary); }
.stat .lbl { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); font-weight: 700; }

/* --- Tables --- */
table.data { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
table.data th { background: #F8FAFC; text-align: left; padding: 0.7rem 0.9rem; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }
table.data td { padding: 0.7rem 0.9rem; border-top: 1px solid var(--border); font-size: 0.92rem; }
table.data tr:hover td { background: #FAFCFF; }
.num { text-align: right; }

/* --- Status pills --- */
.pill { display: inline-block; padding: 2px 10px; border-radius: 100px; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.pill.draft { background: var(--bg); color: var(--text-muted); }
.pill.sent  { background: #DBEAFE; color: #2563EB; }
.pill.paid  { background: var(--green-bg); color: var(--green); }
.pill.void  { background: #FEE2E2; color: #DC2626; }

/* --- Buttons --- */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 0.6rem 1.1rem; border-radius: 8px; border: none; font-family: var(--font); font-weight: 600; font-size: 0.9rem; cursor: pointer; text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-light); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-light); }
.btn-light { background: var(--card); color: var(--text); border: 1px solid var(--border); }
.btn-light:hover { border-color: var(--accent); color: var(--accent); }
.btn-row { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; margin-bottom: 1.25rem; }
.btn-row .spacer { flex: 1; }

/* Inline link-styled button (sits among the "&middot;" action links in tables) */
.linkbtn { background: none; border: none; padding: 0; margin: 0; font: inherit; color: var(--accent); cursor: pointer; }
.linkbtn:hover { text-decoration: underline; }
.linkbtn.danger { color: #DC2626; }

/* --- Forms --- */
.field { margin-bottom: 1rem; }
.field label { display: block; font-weight: 600; font-size: 0.85rem; margin-bottom: 0.35rem; }
.field input, .field select, .field textarea {
  width: 100%; padding: 0.6rem 0.75rem; border: 1px solid var(--border); border-radius: 8px;
  font-family: var(--font); font-size: 0.92rem; background: var(--card); color: var(--text);
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px #FFFBEB; }
.field textarea { min-height: 90px; resize: vertical; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

.items-table { width: 100%; border-collapse: collapse; margin-bottom: 0.75rem; }
.items-table th { text-align: left; font-size: 0.78rem; text-transform: uppercase; color: var(--text-muted); padding: 0.4rem 0.5rem; }
.items-table td { padding: 0.3rem 0.5rem; }
.items-table input, .items-table textarea { width: 100%; padding: 0.5rem 0.6rem; border: 1px solid var(--border); border-radius: 6px; font-family: var(--font); font-size: 0.9rem; box-sizing: border-box; }
.items-table textarea { resize: vertical; overflow: hidden; min-height: 38px; line-height: 1.35; }
.items-table .row-del { background: none; border: none; color: #DC2626; cursor: pointer; font-size: 1.1rem; }

/* --- Manage-columns panel (dynamic tracker columns) --- */
.colpanel-wrap { border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); padding: 0.9rem 1.1rem; margin-bottom: 1.25rem; }
.colpanel-wrap > summary { cursor: pointer; font-weight: 700; }
.colpanel-list { display: flex; flex-direction: column; gap: 0.4rem; margin: 0.5rem 0; }
.colrow { display: flex; align-items: center; gap: 0.5rem; padding: 0.35rem 0.5rem; border: 1px solid var(--border); border-radius: 6px; background: #F8FAFC; }
.colrow .colmove { white-space: nowrap; }
.colrow .collabel { flex: 1; min-width: 120px; padding: 0.35rem 0.5rem; border: 1px solid var(--border); border-radius: 6px; font-family: var(--font); font-size: 0.9rem; }
.colrow .coltype { min-width: 90px; color: var(--text-muted); }
.colrow select.coltype { padding: 0.3rem; border: 1px solid var(--border); border-radius: 6px; font-family: var(--font); color: var(--text); }
.colpanel-add { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.6rem; }
.colpanel-add input, .colpanel-add select { padding: 0.4rem 0.5rem; border: 1px solid var(--border); border-radius: 6px; font-family: var(--font); font-size: 0.9rem; }
.colpanel-list .linkbtn[disabled] { color: var(--text-muted); cursor: default; text-decoration: none; }

.notice { padding: 0.8rem 1rem; border-radius: 8px; margin-bottom: 1rem; font-size: 0.9rem; }
.notice.error { background: #FEE2E2; color: #B91C1C; }
.notice.info  { background: #DBEAFE; color: #1D4ED8; }
.muted { color: var(--text-muted); }

/* --- Login --- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem; }
.login-card { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 2rem; width: 100%; max-width: 360px; }
.login-card h1 { font-size: 1.3rem; font-weight: 800; margin-bottom: 0.25rem; }
.login-card .sub { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 1.25rem; }

/* --- Invoice preview frame --- */
.invoice-frame { width: 100%; height: 1000px; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; }

@media (max-width: 640px) {
  .field-row { grid-template-columns: 1fr; }
  .admin-nav nav { gap: 0.8rem; }
}
