:root {
  --orange: #FF5100;
  --dark: #1a1a1a;
  --gray: #666;
  --light: #e9e9e9;
  --bg: #f7f6f4;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: 'Inter', -apple-system, 'Helvetica Neue', Arial, sans-serif; background: var(--bg); color: var(--dark); font-size: 14px; }
a { color: var(--orange); text-decoration: none; }
a:hover { text-decoration: underline; }

.sidebar { position: fixed; inset: 0 auto 0 0; width: 210px; background: var(--dark); color: #fff; padding: 20px 0; display: flex; flex-direction: column; overflow-y: auto; }
.sidebar a.nav-link { color: #c9c9c9; padding: 10px 18px; display: flex; align-items: center; gap: 11px; font-size: 13.5px; border-left: 3px solid transparent; transition: background 0.1s, color 0.1s; }
.sidebar a.nav-link svg.icon { flex-shrink: 0; opacity: 0.75; }
.sidebar a.nav-link:hover { background: #2b2b2b; color: #fff; text-decoration: none; }
.sidebar a.nav-link:hover svg.icon { opacity: 1; }
.sidebar a.nav-link.active { background: #292929; color: #fff; border-left-color: var(--orange); }
.sidebar a.nav-link.active svg.icon { opacity: 1; color: var(--orange); }
.brand { font-weight: 800; letter-spacing: 1px; color: var(--orange); padding: 0 20px 14px; font-size: 17px; }
.brand span { color: #fff; font-weight: 300; }
.brand.big { font-size: 26px; padding: 0 0 18px; }
.brand-logo { display: block; width: 150px; height: auto; }
.brand-sub { display: block; color: #999; font-weight: 300; font-size: 11px; letter-spacing: 3px; text-transform: uppercase; margin-top: 4px; padding-left: 2px; }
.mode-badge { margin: 0 20px 14px; text-align: center; font-size: 10px; font-weight: 700; letter-spacing: 1.5px; padding: 4px; border-radius: 3px; }
.mode-badge.sandbox { background: #2f4b2f; color: #9fdb9f; }
.mode-badge.production { background: #5a1c00; color: #ffb38a; }
.sidebar-footer { margin-top: auto; padding: 14px 20px 0; border-top: 1px solid #333; }
.whoami { font-size: 12px; color: #aaa; margin-bottom: 8px; }

main.with-sidebar { margin-left: 210px; padding: 28px 36px 60px; max-width: 1250px; }

tr.has-history { cursor: pointer; }
tr.has-history:hover td { background: #fdf8f5; }
tr.has-history .chevron { display: inline-block; color: var(--gray); transition: transform 0.15s; }
tr.has-history.open .chevron { transform: rotate(90deg); }
tr.activity-history td { background: #fafaf9; font-size: 13px; }
.history-indent { padding-left: 20px; border-left: 3px solid #e8ded7; }

.approved-panel { background: #fff; border: 2px solid var(--orange); border-radius: 10px; padding: 16px 18px; margin: 26px 0 6px; }
.approved-panel-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.approved-panel table { border: none; }

.card.mtd-total { border-color: var(--orange); background: #fff8f4; }
.card.mtd-total .num { color: var(--orange); }
main.centered { display: flex; align-items: center; justify-content: center; min-height: 100vh; }

h1 { font-size: 22px; margin: 0 0 18px; }
h1 small { font-weight: 400; font-size: 14px; }
h2 { font-size: 15px; margin: 30px 0 10px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--gray); }
.page-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; gap: 12px; flex-wrap: wrap; }
.page-head h1 { margin: 0; }

table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--light); border-radius: 6px; overflow: hidden; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--light); vertical-align: middle; }
th { background: #faf5f2; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--gray); }
tr:last-child td { border-bottom: none; }
td.actions { white-space: nowrap; }
td.actions form { display: inline; }
.inactive-row { opacity: 0.55; }
tr.section-header-row td { background: #f3f1ef; border-top: 2px solid #ccc; font-size: 13px; }
.alloc-breakdown { margin-top: 3px; color: var(--gray); line-height: 1.5; }
.mono { font-family: ui-monospace, Menlo, monospace; font-size: 11px; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; background: #eee; color: #444; }
.badge.ok { background: #e2f3e2; color: #226622; }
.badge.bad { background: #fde3db; color: #9c2500; }
.badge.off { background: #eee; color: #888; }
.badge.accent { background: #ffe3d6; color: #b23800; }
.badge.good { background: #d9f2d9; color: #1d7a1d; font-weight: 600; }
.muted { color: var(--gray); }
.pre { white-space: pre-wrap; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-bottom: 10px; }
.card { background: #fff; border: 1px solid var(--light); border-radius: 8px; padding: 14px 16px; color: var(--dark); font-size: 12px; }
.card:hover { border-color: var(--orange); text-decoration: none; }
.card .num { display: block; font-size: 26px; font-weight: 700; margin-bottom: 2px; }
.card.warn .num { color: #b57700; }
.card.bad .num { color: var(--orange); }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 18px; background: #fff; border: 1px solid var(--light); border-radius: 8px; padding: 20px; max-width: 760px; }
.form-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--gray); }
.form-grid .span2 { grid-column: span 2; }
.form-grid label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--dark); }
input, select, textarea { padding: 8px 10px; border: 1px solid #ccc; border-radius: 5px; font: inherit; background: #fff; }
input:focus, select:focus, textarea:focus { outline: 2px solid #ffcdb5; border-color: var(--orange); }
.form-inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 8px 0; }

.btn { display: inline-block; padding: 8px 14px; border-radius: 5px; border: 1px solid #ccc; background: #fff; color: var(--dark); font: inherit; cursor: pointer; }
.btn:hover { border-color: var(--orange); text-decoration: none; }
.btn.primary { background: var(--orange); border-color: var(--orange); color: #fff; font-weight: 600; }
.btn.primary:hover { background: #e64900; }
.btn.danger { color: #9c2500; }
.btn-link { background: none; border: none; color: var(--orange); cursor: pointer; padding: 0; font: inherit; }
.btn-link:hover { text-decoration: underline; }
.btn-link.danger { color: #9c2500; }

.alert { padding: 10px 14px; border-radius: 6px; margin-bottom: 14px; }
.alert.error { background: #fde3db; color: #9c2500; }
.alert.ok { background: #e2f3e2; color: #226622; }
.alert.warn { background: #fff3d6; color: #7a5b00; }

.login-card { background: #fff; border: 1px solid var(--light); border-radius: 10px; padding: 36px; width: 340px; }
.login-card .brand { color: var(--orange); text-align: center; }
.login-card .brand span { color: var(--dark); }
.login-card .brand-logo { width: 220px; margin: 0 auto; }
.login-card .brand-sub { color: #8a8a8a; }
.login-card form { display: flex; flex-direction: column; gap: 12px; }
.test-creds { margin-top: 16px; padding: 10px 12px; background: #fff3d6; border: 1px dashed #d8b45a; border-radius: 6px; font-size: 12px; color: #7a5b00; }
.login-card label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--gray); }

.meta-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px 20px; background: #fff; border: 1px solid var(--light); border-radius: 8px; padding: 16px 20px; margin-bottom: 8px; }
.meta-grid .lbl { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--gray); margin-bottom: 2px; }

.panel { background: #fff; border: 1px solid var(--light); border-radius: 8px; padding: 14px 16px; margin-bottom: 14px; }
.panel-head { margin-bottom: 10px; }
.panel table { border: none; }

.thumb { width: 32px; height: 32px; border-radius: 4px; object-fit: cover; display: block; }
.thumb.lg { width: 96px; height: 96px; }
.thumb.placeholder { background: repeating-linear-gradient(45deg, #eee, #eee 4px, #f7f7f7 4px, #f7f7f7 8px); border: 1px solid var(--light); }

.totals-box { max-width: 320px; margin: 14px 0 0 auto; background: #fff; border: 1px solid var(--light); border-radius: 8px; padding: 14px 18px; }
.totals-box div { display: flex; justify-content: space-between; padding: 4px 0; }
.totals-box .big { font-weight: 700; font-size: 15px; border-top: 1px solid var(--light); margin-top: 4px; padding-top: 8px; }

.note { background: #fff; border: 1px solid var(--light); border-left: 3px solid #ccc; border-radius: 6px; padding: 12px 16px; margin-bottom: 10px; }
.note.legacy { border-left-color: var(--orange); background: #fffaf7; }
.note-head { display: flex; gap: 10px; align-items: center; margin-bottom: 6px; flex-wrap: wrap; }
.note p { margin: 0; }

svg.icon { vertical-align: -2px; }
.btn svg.icon { margin-right: 4px; vertical-align: -2px; }
.icon-btn { background: none; border: 1px solid transparent; border-radius: 4px; cursor: pointer; color: #555; padding: 3px 5px 1px; line-height: 1; vertical-align: middle; }
.icon-btn:hover { color: var(--orange); }
.icon-btn:hover { border-color: var(--orange); background: #fff4ee; }
.icon-btn.danger:hover { border-color: #9c2500; background: #fde3db; }

tr.pm-default td { background: #f4fbf4; }
tr.pm-default td:first-child { border-left: 4px solid #2e9e2e; }

.hw-flags { display: flex; gap: 28px; flex-wrap: wrap; align-items: center; }

.email-preview { max-width: 720px; padding: 0; overflow: hidden; }
.email-headers { background: #faf5f2; padding: 14px 18px; border-bottom: 1px solid var(--light); display: flex; flex-direction: column; gap: 5px; font-size: 13px; }
.email-headers .lbl { display: inline-block; width: 90px; font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--gray); }
.email-body { padding: 20px 22px; font-size: 14px; line-height: 1.55; }

.setup-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.setup-grid .panel { margin-bottom: 0; }
.setup-table td { padding: 5px 8px; border-bottom: 1px solid #f2f2f2; font-size: 13px; }
.setup-table .setup-val { text-align: right; }

.add-block { margin: 10px 0 20px; }
.add-block summary { cursor: pointer; color: var(--orange); font-weight: 600; margin-bottom: 10px; }
.searchbar { display: flex; gap: 8px; margin-bottom: 14px; }
.searchbar input { width: 320px; }

/* Filter bar: one clean grid row (search + filters + columns button), with
   the result count on its own full-width second row. */
.filter-bar { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr auto; gap: 8px; align-items: center; margin-bottom: 14px; }
.filter-bar > input, .filter-bar > select { width: 100%; min-width: 0; }
.filter-bar #filter-count { grid-column: 1 / -1; font-size: 12px; }
@media (max-width: 1100px) {
  .filter-bar { grid-template-columns: 1fr 1fr; }
  .filter-bar > input { grid-column: 1 / -1; }
}

.col-picker { position: relative; justify-self: end; }
.col-picker summary { list-style: none; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; white-space: nowrap; }
.col-picker summary::-webkit-details-marker { display: none; }
.col-picker-menu { position: absolute; right: 0; top: calc(100% + 4px); z-index: 40; background: #fff; border: 1px solid #ccc; border-radius: 8px; box-shadow: 0 6px 18px rgba(0,0,0,0.12); padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; width: 200px; font-size: 13px; }
.col-picker-menu label { display: flex; align-items: center; justify-content: flex-start; gap: 9px; cursor: pointer; white-space: nowrap; padding: 4px 2px; border-radius: 5px; }
.col-picker-menu label:hover { background: #faf5f2; }
.col-picker-menu input[type=checkbox] { appearance: auto; -webkit-appearance: auto; width: 15px; height: 15px; padding: 0; margin: 0; flex: 0 0 auto; accent-color: var(--orange); }
.col-picker-menu .btn-link { margin-top: 6px; text-align: left; font-size: 12px; padding: 2px; }
a.icon-btn { display: inline-block; color: #555; }
a.icon-btn:hover { text-decoration: none; }

/* Payroll pricing row: caption-over-input columns, bottom-aligned */
.payroll-pricing-grid { display: grid; grid-template-columns: 1fr 1fr 1fr 3fr auto auto; gap: 12px; align-items: end; width: 100%; }
.payroll-pricing-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--gray); min-width: 0; }
.payroll-pricing-grid label.check { flex-direction: row; align-items: center; gap: 6px; color: var(--dark); padding-bottom: 10px; white-space: nowrap; }
.payroll-pricing-grid input { width: 100%; min-width: 0; }
.payroll-pricing-grid label.check input { width: auto; }
.payroll-pricing-grid .btn { white-space: nowrap; }
@media (max-width: 1000px) { .payroll-pricing-grid { grid-template-columns: 1fr 1fr 1fr; } }

.addon-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.addon-chip { display: inline-flex; align-items: center; gap: 5px; background: #fff4ee; border: 1px solid #f4c9b2; color: #b23800; border-radius: 12px; padding: 2px 8px; font-size: 12px; }
.chip-x { background: none; border: none; cursor: pointer; color: #b23800; font-size: 14px; line-height: 1; padding: 0; }

.discount-group { display: flex; gap: 6px; }
.discount-group input { flex: 1; min-width: 0; }
.discount-group select { width: 62px; flex: 0 0 auto; }

.combo { position: relative; }
.combo input { width: 100%; }
.combo-list { position: absolute; z-index: 30; left: 0; right: 0; top: 100%; margin: 2px 0 0; padding: 0; list-style: none; background: #fff; border: 1px solid #ccc; border-radius: 6px; box-shadow: 0 6px 18px rgba(0,0,0,0.12); max-height: 300px; overflow-y: auto; display: none; }
.combo-list li { padding: 8px 12px; cursor: pointer; display: flex; justify-content: space-between; gap: 10px; }
.combo-list li:hover { background: #fff4ee; }
.combo-list li small { color: var(--gray); }
.combo-invalid { border-color: #9c2500 !important; outline: 2px solid #fde3db; }
.revealed { background: #fff3d6; padding: 2px 6px; border-radius: 4px; font-family: ui-monospace, Menlo, monospace; }
