/*
 * ERC Finance ERP+ — application styles.
 * Ported from the approved v2 prototype (burgundy & gold from the ERC logo).
 * Plain CSS: no build step is needed on the server.
 */
:root {
  --ink: #2b2022;
  --muted: #75686a;
  --line: #eadfd8;
  --paper: #ffffff;
  --canvas: #faf6f0;
  --forest: #62062f;
  --forest-2: #851342;
  --mint: #f8e8ca;
  --lime: #d99a3e;
  --amber: #e9b75c;
  --red: #c64245;
  --blue: #4f6a9e;
  --head: #faf5f0;
  --shadow: 0 12px 30px rgba(98, 6, 47, .08);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.login-shell { min-height: 100vh; padding: 30px; display: grid; place-items: center; background: radial-gradient(circle at 18% 15%, rgba(217,154,62,.23), transparent 28%), linear-gradient(145deg,#3d0822,#76103e 58%,#9a5d28); }
.login-card { width: min(920px,100%); display: grid; grid-template-columns: minmax(280px,.86fr) minmax(340px,1.14fr); border-radius: 24px; overflow: hidden; background: #fff; box-shadow: 0 30px 90px rgba(35,4,20,.34); }
.login-story { padding: 42px; color: #fff; background: linear-gradient(160deg,rgba(78,4,35,.97),rgba(111,14,57,.92)); display: flex; flex-direction: column; justify-content: space-between; }
.login-logo { width: 96px; height: 96px; border-radius: 50%; background: #fff; overflow: hidden; border: 3px solid rgba(255,255,255,.7); box-shadow: 0 12px 25px rgba(0,0,0,.18); }
.login-logo img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.1); }
.login-story h1 { margin: 28px 0 10px; font-size: 34px; line-height: 1.02; letter-spacing: -.04em; }
.login-story p { color: #ecd6df; line-height: 1.65; font-size: 14px; }
.login-motto { margin-top: 35px; color: #edbd70; font-size: 11px; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }
.login-form-wrap { padding: 42px; }
.login-form-wrap h2 { margin: 0; font-size: 25px; }
.login-form-wrap > p { margin: 7px 0 24px; color: var(--muted); font-size: 13px; }
.login-form { display: grid; gap: 14px; }
.login-form .btn { margin-top: 4px; padding: 12px 15px; }
.login-error { min-height: 18px; margin: 0; color: #b2383b; font-size: 12px; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
.app { min-height: 100vh; display: grid; grid-template-columns: 270px 1fr; }
.sidebar {
  position: sticky; top: 0; height: 100vh; padding: 24px 16px;
  background: linear-gradient(168deg, #671039 0%, #3d0822 100%); color: #fff; display: flex; flex-direction: column; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 24px; }
.mark { width: 58px; height: 58px; flex: 0 0 58px; border-radius: 50%; overflow: hidden; background: #fff; border: 2px solid rgba(255,255,255,.72); box-shadow: 0 8px 20px rgba(0,0,0,.16); }
.mark img { width: 100%; height: 100%; display: block; object-fit: cover; transform: scale(1.12); }
.brand strong { display: block; font-size: 15px; }
.brand span { color: #e6c5d3; font-size: 12px; }
.nav-label { margin: 14px 10px 8px; color: #d9aa73; font-size: 10px; font-weight: 850; letter-spacing: .13em; text-transform: uppercase; }
.nav { display: grid; gap: 4px; }
.nav button, .nav a { text-decoration: none; border: 0; border-radius: 10px; padding: 8px 12px; color: #f1dfe6; background: transparent; display: flex; align-items: center; gap: 10px; text-align: left; transition: background .15s; }
.nav button > span:first-child, .nav a > span:first-child { width: 18px; text-align: center; opacity: .9; }
.nav button:hover, .nav button.active, .nav a:hover, .nav a.active { background: rgba(255,255,255,.11); color: #fff; }
.nav button.active, .nav a.active { box-shadow: inset 3px 0 var(--lime); }
.nav .badge { margin-left: auto; min-width: 24px; padding: 2px 7px; border-radius: 99px; background: var(--amber); color: #45330b; font-size: 11px; font-weight: 800; text-align: center; }
.nav .badge.zero { display: none; }
.sidebar-foot { margin-top: auto; padding: 16px 10px 2px; border-top: 1px solid rgba(255,255,255,.12); color: #e6c5d3; font-size: 12px; line-height: 1.5; }
.sidebar-foot strong { color: #fff; }

main { min-width: 0; }
.topbar { min-height: 76px; padding: 18px 28px; background: rgba(255,255,255,.92); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 16px; position: sticky; top: 0; z-index: 10; backdrop-filter: blur(12px); }
.search { flex: 1; max-width: 520px; position: relative; }
.search input { width: 100%; border: 1px solid var(--line); background: #fcf9f6; border-radius: 12px; padding: 11px 14px 11px 38px; outline: none; }
.search input:focus { border-color: var(--forest-2); box-shadow: 0 0 0 3px rgba(133,19,66,.12); }
.search::before { content: "⌕"; position: absolute; left: 14px; top: 8px; color: var(--muted); font-size: 22px; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.period { color: var(--muted); font-size: 13px; border: 1px solid var(--line); padding: 9px 12px; border-radius: 10px; background: #fff; white-space: nowrap; }
.bell { position: relative; display: inline-grid; place-items: center; text-decoration: none; width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--forest); font-size: 17px; }
.bell:hover { border-color: var(--lime); }
.bell b { position: absolute; top: -7px; right: -7px; min-width: 19px; height: 19px; padding: 0 5px; display: grid; place-items: center; border-radius: 99px; background: var(--red); color: #fff; font-size: 10px; }
.avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--mint); color: var(--forest); font-weight: 800; }
.top-user { display: flex; align-items: center; gap: 9px; }
.top-user strong, .top-user span { display: block; }
.top-user strong { font-size: 12px; }
.top-user span { color: var(--muted); font-size: 10px; }
.signout { border: 0; background: transparent; color: var(--forest-2); font-size: 11px; font-weight: 800; }
.mobile-menu { display: none; border: 0; background: transparent; font-size: 24px; }

.page { padding: 28px; max-width: 1500px; margin: 0 auto; }
.view { display: none; }
.view.active { display: block; animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.heading { display: flex; justify-content: space-between; gap: 18px; align-items: flex-start; margin-bottom: 24px; }
h1 { margin: 0; font-size: clamp(25px, 3vw, 36px); letter-spacing: -.04em; }
.heading p { margin: 7px 0 0; color: var(--muted); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.btn { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; background: #fff; color: var(--ink); font-weight: 750; transition: transform .12s, box-shadow .12s; white-space: nowrap; }
.btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 7px 18px rgba(98,6,47,.09); }
.btn.primary { background: var(--forest); border-color: var(--forest); color: #fff; }
.btn.soft { background: var(--mint); color: var(--forest); border-color: #efd9b0; }
.btn.danger { color: #a4342f; background: #fff7f6; border-color: #f2d2cf; }
.btn.good { color: #176a51; background: #e9f6f0; border-color: #c9e8da; }
.btn.sm { padding: 6px 10px; font-size: 12px; border-radius: 8px; }
.demo-strip { margin: -8px 0 22px; border: 1px dashed #d5a536; background: #fff7dc; color: #725716; border-radius: 10px; padding: 9px 12px; font-size: 12px; }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 16px; margin-bottom: 18px; }
.kpis.five { grid-template-columns: repeat(5, minmax(0,1fr)); }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); }
.kpi { padding: 18px; position: relative; overflow: hidden; }
.kpi::after { content: ""; position: absolute; width: 90px; height: 90px; border-radius: 50%; right: -35px; top: -35px; background: var(--tone, var(--mint)); opacity: .7; }
.kpi-label { position: relative; z-index: 1; color: var(--muted); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.kpi-value { margin: 10px 0 6px; font-size: clamp(21px, 2vw, 29px); font-weight: 850; letter-spacing: -.04em; white-space: nowrap; }
.kpi-note { font-size: 12px; color: var(--muted); }
.kpi-note.good { color: #1b765d; }
.kpi-note.warn { color: #9b6510; }
.kpi-note.bad { color: #ae3a33; }

.grid-2 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); gap: 18px; margin-bottom: 18px; }
.grid-even { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 18px; margin-bottom: 18px; }
.panel-head { padding: 18px 20px 14px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.panel-head h2 { margin: 0; font-size: 17px; }
.panel-head p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
table.compact { min-width: 520px; }
table.compact th, table.compact td { padding-left: 11px; padding-right: 11px; }
th { padding: 11px 16px; text-align: left; background: var(--head); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
th.r, td.r { text-align: right; }
td { padding: 13px 16px; border-bottom: 1px solid #f2ebe5; font-size: 13px; vertical-align: middle; }
tbody tr { transition: background .12s; }
tbody tr:hover { background: #fdf9f5; }
tfoot td { font-weight: 850; background: #fdf9f5; border-top: 2px solid var(--line); }
tr.clickable { cursor: pointer; }
tr.unseen td { background: #fffaf0; }
.code { color: var(--forest-2); font-weight: 850; font-size: 12px; white-space: nowrap; }
td.remarks { min-width: 230px; max-width: 320px; font-size: 12px; line-height: 1.45; }
td.namecol { min-width: 170px; }
td.wrap-sm { min-width: 130px; }
.row-actions.nowrap { flex-wrap: nowrap; align-items: center; }
.stack { display: grid; gap: 18px; align-content: start; }
.grid-2 > *, .grid-even > *, .stack > * { min-width: 0; }
.sub { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.money { white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 700; }
.neg { color: #b03d3d !important; }
.pos { color: #1b765d; }
.warn-text { color: #9b6510; }
.progress { width: 120px; height: 7px; border-radius: 99px; background: #efe5dc; overflow: hidden; margin-bottom: 5px; }
.progress i { display: block; height: 100%; background: var(--forest-2); border-radius: inherit; }
.progress.wide { width: 100%; }
.progress i.warn { background: var(--lime); }
.progress i.bad { background: var(--red); }
.status { display: inline-flex; align-items: center; gap: 6px; padding: 5px 8px; border-radius: 99px; background: #f3eee9; color: #6b5d58; font-size: 11px; font-weight: 800; white-space: nowrap; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status.approved { color: #197259; background: #e5f5ef; }
.status.pending { color: #9a6510; background: #fff4d4; }
.status.posted { color: #315da7; background: #eaf0ff; }
.status.overdue { color: #b53f38; background: #fff0ee; }
.status.muted { color: #7b6f6b; background: #f3eee9; }
.edited-tag { display: inline-block; margin-left: 6px; padding: 1px 7px; border: 0; border-radius: 99px; background: #fff1cc; color: #8a5a0c; font-size: 10px; font-weight: 800; }
.lock { color: var(--muted); font-size: 12px; white-space: nowrap; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.pill { display: inline-block; padding: 4px 9px; border-radius: 99px; background: var(--mint); color: var(--forest); font-size: 11px; font-weight: 850; white-space: nowrap; }

.alerts { padding: 4px 18px 16px; display: grid; gap: 10px; }
.alert { position: relative; padding: 13px 13px 13px 13px; border: 1px solid var(--line); border-radius: 12px; display: grid; grid-template-columns: 34px 1fr; gap: 10px; background: #fff; }
.alert .icon { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: #fff4d4; color: #8a5a0c; font-weight: 850; }
.alert.high { border-color: #f2d2cf; }
.alert.high .icon { background: #fde8e7; color: #a73637; }
.alert.info .icon { background: #eef1fb; color: #3f5f9a; }
.alert strong { display: block; font-size: 13px; padding-right: 22px; line-height: 1.35; }
.alert .alert-project { color: var(--forest-2); }
.alert p { margin: 4px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.alert-foot { display: flex; align-items: center; gap: 12px; margin-top: 8px; flex-wrap: wrap; }
.alert-type { color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.link-btn { border: 0; background: none; padding: 0; color: var(--forest-2); font-weight: 800; font-size: 12px; }
.link-btn:hover { text-decoration: underline; }
.mute { position: absolute; top: 9px; right: 9px; width: 24px; height: 24px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); font-size: 15px; line-height: 1; }
.mute:hover { background: #f5ece6; color: var(--ink); }
.alerts-foot { padding: 0 18px 16px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }

.toolbar { padding: 14px 16px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.toolbar input, .toolbar select { border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px; background: #fff; }
.toolbar input { flex: 1; min-width: 180px; }
.toolbar .count { margin-left: auto; color: var(--muted); font-size: 12px; }
.section-card { margin-bottom: 18px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; padding: 20px; }
dialog.wide .form-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 750; }
label.full, .form-grid > .full { grid-column: 1 / -1; }
label .req { color: var(--red); font-style: normal; }
input, select { min-width: 0; }
label input, label select, label textarea { width: 100%; border: 1px solid var(--line); border-radius: 9px; padding: 10px 11px; background: #fff; color: var(--ink); }
label textarea { resize: vertical; }
label input[readonly] { background: #faf6f2; color: var(--muted); }
label input:focus, label select:focus, label textarea:focus { outline: none; border-color: var(--forest-2); box-shadow: 0 0 0 3px rgba(133,19,66,.1); }
label.check-row { display: flex; align-items: center; gap: 9px; color: var(--ink); font-weight: 650; }
label.check-row input { width: 18px; height: 18px; accent-color: var(--forest-2); }
.help { color: var(--muted); font-size: 11px; font-weight: 500; line-height: 1.45; }
.form-error { min-height: 0; margin: 0 22px; color: #b2383b; font-size: 12px; font-weight: 700; }
.form-error:not(:empty) { padding: 10px 12px; margin-bottom: 4px; border: 1px solid #f2d2cf; border-radius: 9px; background: #fff7f6; }
.mapping { padding: 0 20px 20px; }
.mapping-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px; }
.map-item { padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #fdfaf7; }
.map-item b { display: block; font-size: 12px; }
.map-item span { color: var(--muted); font-size: 11px; }
.drop { margin: 0 20px 20px; padding: 28px; text-align: center; border: 2px dashed #e1c9b4; border-radius: 14px; background: #fdfaf6; }
.drop strong { display: block; }
.drop p { color: var(--muted); font-size: 12px; }
.report-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; }
.report { padding: 18px; display: flex; flex-direction: column; }
.report .report-icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 11px; background: var(--mint); color: var(--forest); font-size: 20px; }
.report h3 { margin: 14px 0 6px; font-size: 15px; }
.report p { min-height: 38px; margin: 0 0 14px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.report .stats { display: flex; gap: 14px; margin: 0 0 14px; flex-wrap: wrap; }
.report .stats div { font-size: 11px; color: var(--muted); }
.report .stats b { display: block; color: var(--ink); font-size: 17px; letter-spacing: -.02em; }
.report .btn { margin-top: auto; align-self: flex-start; }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); }
.brand-rule { width: 48px; height: 4px; border-radius: 99px; background: linear-gradient(90deg, var(--forest-2), var(--lime)); margin: 12px 0 0; }
.executive-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 16px; margin-bottom: 18px; }
.insight { padding: 19px; }
.insight-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.insight h3 { margin: 0; font-size: 14px; }
.insight .big { margin: 12px 0 3px; font-size: 27px; font-weight: 850; letter-spacing: -.04em; }
.insight p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.delta { padding: 4px 7px; border-radius: 99px; color: #176a51; background: #e4f4ed; font-size: 11px; font-weight: 800; white-space: nowrap; }
.delta.warn { color: #925f0e; background: #fff1cc; }
.delta.bad { color: #a73637; background: #fde8e7; }
.spark { height: 76px; display: flex; align-items: end; gap: 7px; padding-top: 12px; }
.spark i { flex: 1; min-height: 8px; border-radius: 5px 5px 2px 2px; background: linear-gradient(#d99a3e,#8b1747); opacity: .92; }
.metric-list { padding: 0 20px 18px; display: grid; gap: 4px; }
.metric-row { display: grid; grid-template-columns: 1fr auto; gap: 14px; padding: 11px 0; border-bottom: 1px solid #f0e8e2; font-size: 13px; }
.metric-row:last-child { border-bottom: 0; }
.metric-row span { color: var(--muted); }
.metric-row b { font-variant-numeric: tabular-nums; }
.health { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 850; }
.health::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.health.green { color: #1a7259; }
.health.amber { color: #a16811; }
.health.red { color: #b03d3d; }
.workplan { display: grid; gap: 10px; padding: 0 20px 20px; }
.work-item { border: 1px solid var(--line); border-radius: 12px; padding: 13px; display: grid; grid-template-columns: minmax(180px,1fr) 130px 95px 90px; align-items: center; gap: 12px; }
.work-item strong { font-size: 13px; }
.owner { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; }
.owner i { width: 25px; height: 25px; display: grid; place-items: center; border-radius: 50%; background: var(--mint); color: var(--forest); font-style: normal; font-weight: 850; }
.mini-progress { height: 7px; background: #eee5df; border-radius: 99px; overflow: hidden; }
.mini-progress i { display: block; height: 100%; background: linear-gradient(90deg,var(--forest-2),var(--lime)); }
.score { min-width: 38px; padding: 5px 7px; border-radius: 8px; display: inline-block; text-align: center; font-weight: 850; font-size: 12px; }
.score.high { color: #a52f34; background: #fee8e6; }
.score.medium { color: #92600e; background: #fff2d2; }
.score.low { color: #19674f; background: #e4f3ed; }
.close-list { padding: 0 20px 18px; display: grid; gap: 9px; }
.close-task { display: grid; grid-template-columns: 26px 1fr auto; gap: 10px; align-items: center; padding: 11px 0; border-bottom: 1px solid #f0e8e2; }
.check { width: 23px; height: 23px; border-radius: 7px; display: grid; place-items: center; color: #fff; background: #24735d; font-size: 12px; }
.check.open { color: var(--forest); background: #f5dfb5; }
.close-task b { display: block; font-size: 13px; }
.close-task small { color: var(--muted); }
.filter-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.filter-row select { border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px; background: #fff; }
.quick-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 14px; margin-bottom: 18px; }
.quick-action { padding: 18px; text-align: left; border: 1px solid var(--line); border-radius: 14px; background: #fff; color: var(--ink); box-shadow: var(--shadow); transition: .15s; }
.quick-action:hover { border-color: var(--lime); transform: translateY(-2px); }
.quick-action i { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; background: var(--mint); color: var(--forest); font-style: normal; font-size: 18px; }
.quick-action strong { display: block; margin-top: 12px; font-size: 13px; }
.quick-action span { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; line-height: 1.4; }
.quick-card { display: flex; gap: 12px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.quick-card > span { width: 36px; height: 36px; flex: 0 0 36px; display: grid; place-items: center; border-radius: 10px; background: var(--mint); color: var(--forest); }
.quick-card b { display: block; font-size: 13px; }
.quick-card small { color: var(--muted); font-size: 11px; }
.workflow-strip { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 0; padding: 18px; }
.workflow-step { position: relative; text-align: center; padding: 8px; color: var(--muted); font-size: 11px; }
.workflow-step:not(:last-child)::after { content: ""; position: absolute; top: 20px; left: 62%; width: 76%; height: 2px; background: #eadbd3; }
.workflow-step b { position: relative; z-index: 1; width: 28px; height: 28px; margin: 0 auto 7px; display: grid; place-items: center; border-radius: 50%; background: var(--mint); color: var(--forest); }
.workflow-step.active b { color: #fff; background: var(--forest-2); }
.permission-note { padding: 12px 15px; border: 1px solid #efd7aa; background: #fff8e8; border-radius: 11px; color: #775718; font-size: 12px; line-height: 1.5; }
.info-note { padding: 12px 15px; border: 1px solid #dfe6f5; background: #f5f8ff; border-radius: 11px; color: #3d5585; font-size: 12px; line-height: 1.5; }

.tabs { display: flex; gap: 4px; padding: 10px 16px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tabs button { border: 0; border-bottom: 3px solid transparent; background: none; padding: 10px 12px; color: var(--muted); font-weight: 800; font-size: 13px; }
.tabs button:hover { color: var(--forest); }
.tabs button.active { color: var(--forest); border-color: var(--lime); }
.tabs button em { font-style: normal; margin-left: 5px; padding: 1px 7px; border-radius: 99px; background: var(--mint); font-size: 10px; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.switch { position: relative; display: inline-block; width: 38px; height: 22px; flex: 0 0 38px; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: #e2d6cd; border-radius: 99px; transition: .2s; cursor: pointer; }
.switch span::before { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--forest-2); }
.switch input:checked + span::before { transform: translateX(16px); }
.switch input:disabled + span { opacity: .5; cursor: not-allowed; }
.chip { border: 1px solid var(--line); border-radius: 99px; padding: 4px 9px; font-size: 11px; font-weight: 800; background: #fff; color: var(--muted); }
.chip.on { background: var(--mint); color: var(--forest); border-color: #efd9b0; }
.settings-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; padding: 18px 20px; }

.cal-list { padding: 0 18px 16px; display: grid; gap: 8px; }
.cal-item { display: grid; grid-template-columns: 54px 1fr auto; gap: 12px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: 12px; }
.cal-date { text-align: center; border-radius: 10px; background: var(--mint); color: var(--forest); padding: 6px 0; line-height: 1.1; }
.cal-date b { display: block; font-size: 18px; }
.cal-date small { font-size: 10px; font-weight: 800; text-transform: uppercase; }
.cal-item strong { font-size: 13px; display: block; }

.filters-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; padding: 18px 20px; }
.report-doc { padding: 4px 0 8px; }
.report-title { padding: 20px 20px 4px; display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.report-title h2 { margin: 0; font-size: 20px; letter-spacing: -.02em; }
.report-title p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.report-title img { width: 54px; height: 54px; border-radius: 50%; }
.report-section { margin: 18px 0 0; }
.report-section h3 { margin: 0; padding: 0 20px 10px; font-size: 14px; }
.bar-cell { min-width: 120px; }

dialog { width: min(720px, calc(100% - 28px)); border: 0; border-radius: 18px; padding: 0; box-shadow: 0 30px 90px rgba(35,4,20,.3); }
dialog.wide { width: min(1080px, calc(100% - 28px)); }
dialog.narrow { width: min(480px, calc(100% - 28px)); }
dialog::backdrop { background: rgba(40, 8, 24, .5); backdrop-filter: blur(4px); }
dialog[open] { animation: pop .18s ease; }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.99); } to { opacity: 1; transform: none; } }
.modal-head { padding: 20px 22px; border-bottom: 1px solid var(--line); display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.modal-head h2 { margin: 0; font-size: 20px; }
.modal-head p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.modal-body { max-height: calc(100vh - 210px); overflow: auto; }
.close { flex: 0 0 32px; border: 0; background: #f5ece6; width: 32px; height: 32px; border-radius: 50%; }
.modal-actions { padding: 16px 22px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.modal-text { padding: 20px 22px; font-size: 14px; line-height: 1.55; }
.detail-kpis { display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); gap: 10px; padding: 18px 22px 6px; }
.mini-kpi { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: #fdfaf7; }
.mini-kpi span { display: block; color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.mini-kpi b { display: block; margin-top: 6px; font-size: 17px; letter-spacing: -.02em; }
.mini-kpi .sub { text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--muted); font-size: 11px; margin-top: 3px; }
.detail-meta { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 10px; padding: 8px 22px 4px; font-size: 12px; }
.detail-meta div { color: var(--muted); }
.detail-meta b { display: block; color: var(--ink); font-size: 13px; margin-top: 3px; }
.detail-section { padding: 16px 0 4px; }
.detail-section > .panel-head { padding: 0 22px 10px; }
.remarks-box { margin: 6px 22px 0; padding: 12px 14px; border-radius: 10px; background: #fdfaf7; border: 1px solid var(--line); font-size: 13px; line-height: 1.5; white-space: pre-wrap; }
.toast { position: fixed; right: 24px; bottom: 24px; max-width: 420px; background: var(--ink); color: #fff; padding: 13px 16px; border-radius: 11px; box-shadow: var(--shadow); transform: translateY(90px); opacity: 0; transition: .25s; z-index: 100; font-size: 13px; line-height: 1.45; pointer-events: none; }
.toast.show { transform: translateY(0); opacity: 1; }
.toast.bad { background: #8c2a2d; }
.more-row { padding: 14px; text-align: center; }

@media (max-width: 1360px) {
  #dashboard.grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 1300px) {
  .kpis.five { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .filters-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
}
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .kpis.five { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .grid-2, .grid-even { grid-template-columns: 1fr; }
  .report-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .executive-grid { grid-template-columns: 1fr 1fr; }
  .quick-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .detail-kpis { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .settings-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  dialog.wide .form-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 760px) {
  .app { display: block; }
  .sidebar { position: fixed; z-index: 30; width: 250px; transform: translateX(-105%); transition: .2s; }
  .sidebar.open { transform: translateX(0); box-shadow: 20px 0 60px rgba(0,0,0,.3); }
  .mobile-menu { display: block; }
  .topbar { padding: 14px 16px; }
  .period { display: none; }
  .page { padding: 20px 14px; }
  .heading { display: block; }
  .actions { justify-content: flex-start; margin-top: 14px; }
  .kpis, .kpis.five { grid-template-columns: 1fr; }
  .form-grid, dialog.wide .form-grid, .mapping-grid, .report-grid, .executive-grid, .settings-grid, .filters-grid { grid-template-columns: 1fr; }
  .detail-kpis, .detail-meta { grid-template-columns: 1fr 1fr; }
  .work-item { grid-template-columns: 1fr; }
  .login-shell { padding: 12px; }
  .login-card { grid-template-columns: 1fr; }
  .login-story { padding: 26px; }
  .login-story h1 { font-size: 27px; }
  .login-form-wrap { padding: 26px; }
  .quick-grid { grid-template-columns: 1fr; }
  .workflow-strip { grid-template-columns: 1fr; }
  .workflow-step { text-align: left; display: flex; align-items: center; gap: 10px; }
  .workflow-step b { margin: 0; }
  .workflow-step::after { display: none; }
  .top-user > div:not(.avatar), .signout { display: none; }
}
@media print {
  body { background: #fff; }
  .sidebar, .topbar, .no-print, .toast, .demo-strip { display: none !important; }
  .app { display: block; }
  .page { padding: 0; max-width: none; }
  .card { box-shadow: none; border: 0; }
  table { min-width: 0; }
  th, td { padding: 6px 8px; font-size: 10px; }
  .report-section { break-inside: avoid; }
}

/* ---------- Additions for the Laravel application ---------- */
a { color: var(--forest-2); }
a.btn { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
.inline-form { display: inline; margin: 0; }
.flash { margin: 0 0 18px; padding: 12px 15px; border-radius: 11px; font-size: 13px; line-height: 1.5; border: 1px solid #c9e8da; background: #eef8f3; color: #176a51; }
.flash.error { border-color: #f2d2cf; background: #fff7f6; color: #a4342f; }
.flash ul { margin: 6px 0 0; padding-left: 18px; }
.field-error { color: #b2383b; font-size: 11px; font-weight: 700; }
label.has-error input, label.has-error select { border-color: #e3a5a1; }
.secret-box { margin: 0 0 18px; padding: 16px; border: 2px dashed var(--lime); border-radius: 12px; background: #fff8ec; }
.secret-box code { display: inline-block; margin: 6px 0; padding: 8px 12px; border-radius: 8px; background: #fff; border: 1px solid var(--line); font-size: 20px; letter-spacing: .08em; font-weight: 800; color: var(--forest); user-select: all; }
.pager { padding: 14px 16px; display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; color: var(--muted); font-size: 12px; border-top: 1px solid var(--line); }
.pager nav { display: flex; gap: 6px; }
.pager a, .pager span.disabled { padding: 7px 11px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); text-decoration: none; font-weight: 700; }
.pager span.disabled { opacity: .45; }
.roadmap { padding: 0 20px 18px; display: grid; gap: 8px; }
.roadmap-item { display: grid; grid-template-columns: 34px 1fr auto; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; }
.roadmap-item b.num { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: var(--mint); color: var(--forest); }
.roadmap-item.done b.num { background: var(--forest-2); color: #fff; }
.roadmap-item strong { display: block; font-size: 13px; }
.signout-form button { border: 0; background: transparent; color: var(--forest-2); font-size: 11px; font-weight: 800; cursor: pointer; }
.login-card .login-form-wrap .status { margin: 0 0 14px; }
.check-row input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--forest-2); }
.password-hints { margin: 0; padding-left: 18px; color: var(--muted); font-size: 12px; line-height: 1.7; }
details.raw { margin-top: 6px; }
details.raw summary { cursor: pointer; color: var(--forest-2); font-size: 11px; font-weight: 800; }
details.raw pre { white-space: pre-wrap; font-size: 11px; background: #fdfaf7; border: 1px solid var(--line); border-radius: 8px; padding: 8px; margin: 6px 0 0; }
.error-page { min-height: 100vh; display: grid; place-items: center; padding: 30px; text-align: center; }
.error-page .card { padding: 36px; max-width: 480px; }
.error-page h1 { font-size: 48px; color: var(--forest); }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid .span-2 { grid-column: span 2; }
@media (max-width: 900px) { .form-grid.three { grid-template-columns: 1fr 1fr; } }
@media (max-width: 760px) { .form-grid.three { grid-template-columns: 1fr; } .form-grid .span-2 { grid-column: auto; } }
.report-form { display: flex; gap: 6px; align-items: center; margin-top: 6px; flex-wrap: wrap; }
.report-form input[type=date] { border: 1px solid var(--line); border-radius: 8px; padding: 5px 7px; font-size: 12px; }
.money-input { text-align: right; font-variant-numeric: tabular-nums; }

/* Module 5 — dashboard & alerts */
.tabs a { border-bottom: 3px solid transparent; padding: 10px 12px; color: var(--muted); font-weight: 800; font-size: 13px; text-decoration: none; }
.tabs a:hover { color: var(--forest); }
.tabs a.active { color: var(--forest); border-color: var(--lime); }
.tabs a em { font-style: normal; margin-left: 5px; padding: 1px 7px; border-radius: 99px; background: var(--mint); font-size: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
label.chip { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }
label.chip input { width: auto; margin: 0; accent-color: var(--forest-2); }
.rule-card { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: #fff; }
.rule-card b { display: block; font-size: 18px; margin-top: 4px; }
.mail-preview { white-space: pre-wrap; font: 13px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: #fbf8f5; border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; margin: 0 20px 20px; overflow-x: auto; }
@media (max-width: 900px) { .settings-grid { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 560px) { .settings-grid { grid-template-columns: 1fr; } }
td.namecol a { color: inherit; text-decoration: none; }
td.namecol a:hover { color: var(--forest-2); text-decoration: underline; }
table.position td.namecol { min-width: 140px; }
table.position th, table.position td { padding-left: 9px; padding-right: 9px; }
table.position .sub { white-space: nowrap; }
table.years th, table.years td { padding-left: 8px; padding-right: 8px; font-size: 12px; }

/* Module 7 — staff portal */
.workflow-strip { display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); gap: 8px; padding: 14px 16px; }
.workflow-step { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; color: var(--muted); font-size: 12px; font-weight: 750; background: #fff; }
.workflow-step b { width: 24px; height: 24px; flex: 0 0 24px; display: grid; place-items: center; border-radius: 50%; background: #f3eee9; font-size: 11px; }
.workflow-step.active { color: var(--forest); border-color: #efd9b0; background: #fffaf0; }
.workflow-step.active b { background: var(--forest-2); color: #fff; }
a.quick-action { text-decoration: none; display: block; }
.decision-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.decision-row input[type=text] { border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; font-size: 12px; min-width: 150px; }
.detail-list { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; padding: 18px 20px; }
.detail-list div { font-size: 12px; color: var(--muted); }
.detail-list b { display: block; color: var(--ink); font-size: 14px; margin-top: 3px; font-weight: 750; }
@media (max-width: 900px) { .workflow-strip { grid-template-columns: repeat(2, minmax(0,1fr)); } .detail-list { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 560px) { .workflow-strip, .detail-list { grid-template-columns: 1fr; } }

/* Dashboard charts and greeting (same ERC colours) */
.eyebrow { margin: 0 0 4px; color: var(--forest-2); font-size: 13px; font-weight: 750; }
.budget-bars { padding: 0 20px 18px; display: grid; gap: 16px; }
.budget-bar { display: grid; gap: 6px; }
.budget-bar-head { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.budget-bar-head a { color: var(--ink); text-decoration: none; }
.budget-bar-head a:hover { color: var(--forest-2); text-decoration: underline; }
.budget-bar-head span { color: var(--muted); white-space: nowrap; }
.stackbar { display: flex; height: 12px; border-radius: 99px; overflow: hidden; background: #f3e9e1; }
.stackbar i { display: block; height: 100%; }
.stackbar i.spent, .legend i.spent, .column i.spent { background: var(--forest-2); }
.stackbar i.cash, .legend i.cash, .column i.cash { background: var(--lime); }
.legend { display: flex; flex-wrap: wrap; gap: 16px; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; background: #f3e9e1; display: inline-block; }
.column-chart { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 12px; align-items: end; padding: 10px 20px 14px; min-height: 230px; }
.column-group { display: grid; gap: 8px; justify-items: center; }
.columns { display: flex; align-items: flex-end; gap: 6px; height: 196px; border-bottom: 1px solid var(--line); padding: 0 4px; }
.column { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; }
.column span { font-size: 10px; font-weight: 750; color: var(--muted); white-space: nowrap; }
.column i { display: block; width: 28px; min-height: 2px; border-radius: 7px 7px 0 0; transition: height .4s ease; }
.column-group b { font-size: 11px; color: var(--forest); }

/* Global search */
.top-search { flex: 1 1 260px; max-width: 420px; display: flex; align-items: center; gap: 8px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--muted); }
.top-search:focus-within { border-color: var(--forest-2); box-shadow: 0 0 0 3px rgba(133,19,66,.1); }
.top-search input { flex: 1; min-width: 0; border: 0; outline: none; padding: 10px 0; background: transparent; font-size: 13px; color: var(--ink); }
.search-results { display: grid; gap: 18px; }
.search-list { display: grid; padding: 0 12px 12px; }
.search-list a { display: grid; gap: 2px; padding: 10px 10px; border-radius: 10px; color: var(--ink); text-decoration: none; }
.search-list a:hover, .search-list a:focus { background: var(--head); }
.search-list a b { font-size: 14px; }
.search-list a span { font-size: 12px; color: var(--muted); }

/* Monthly spending chart (project page) */
.month-chart { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 8px; align-items: end; padding: 6px 20px 18px; }
.month { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 5px; height: 190px; }
.month span { font-size: 10px; font-weight: 750; color: var(--muted); white-space: nowrap; }
.month i { display: block; width: 100%; max-width: 34px; min-height: 2px; border-radius: 7px 7px 0 0; background: var(--forest-2); transition: height .4s ease; }
.month b { font-size: 11px; color: var(--muted); font-weight: 700; }
@media (max-width: 560px) { .month span { display: none; } .month-chart { gap: 4px; padding-inline: 10px; } }

/* Closable messages and saving state */
.flash { position: relative; padding-right: 44px; }
.flash-close { position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; border: 0; border-radius: 50%; background: transparent; color: inherit; font-size: 18px; line-height: 1; cursor: pointer; opacity: .7; }
.flash-close:hover { opacity: 1; background: rgba(0,0,0,.06); }
button[disabled] { cursor: progress; opacity: .75; }
@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; padding: 12px 16px; gap: 10px; }
  .top-search { order: 3; flex: 1 1 100%; max-width: none; }
  .top-actions { gap: 8px; min-width: 0; }
  .top-actions .period, .top-user > div:not(.avatar) { display: none; }
}

/* Administration — roles & rights */
.rights-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; padding: 4px 20px 20px; }
.rights-group { margin: 0; padding: 12px 14px 10px; border: 1px solid var(--line); border-radius: 12px; background: #fff; min-width: 0; }
.rights-group legend { padding: 0 6px; font-size: 13px; font-weight: 800; color: var(--forest); }
.rights-tools { display: flex; gap: 12px; margin: 0 0 6px; }
label.right-row { align-items: flex-start; padding: 5px 0; font-size: 13px; font-weight: 500; line-height: 1.4; }
label.right-row input { width: 16px; height: 16px; flex: 0 0 16px; margin-top: 2px; accent-color: var(--forest-2); }
.right-mark { margin-left: 6px; padding: 1px 7px; border-radius: 99px; background: var(--head); color: var(--muted); font-size: 10px; font-style: normal; font-weight: 750; white-space: nowrap; }
table.rights-matrix th.c, table.rights-matrix td.c { text-align: center; }
table.rights-matrix tr.group-row td { background: var(--head); color: var(--forest); font-weight: 800; font-size: 12px; }
table.rights-matrix .tick { color: #197259; font-weight: 800; }
table.rights-matrix .no-tick { color: #cdbfb8; }
