/* ─── cambio-core shared styles. Brand colors come from client.config.json (nav.js sets them). ─── */
:root {
  --brand: #465496; --brand-d: #36427a; --brand-l: #eef0f8; --accent: #B1377F; --accent-l: #f8ecf3;
  --ink: #1b1b22; --muted: #6b6b76; --line: #e3e3ea; --bg: #f6f6f9; --white: #fff;
  --ok: #2f7d4f; --ok-l: #e6f3ec; --warn: #a86a00; --warn-l: #fff3c4; --bad: #b3261e; --bad-l: #fdecea;
}
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.45 'Segoe UI', system-ui, -apple-system, Arial, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--brand); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

/* Header (nav.js) */
.topbar { position: sticky; top: 0; z-index: 50; height: 54px; background: var(--white); border-bottom: 3px solid var(--brand); display: flex; align-items: center; gap: 18px; padding: 0 20px; }
.topbar .brandname { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 17px; color: var(--brand); text-decoration: none; white-space: nowrap; }
.topbar .brandname img { height: 30px; }
.topbar nav { display: flex; gap: 2px; overflow-x: auto; }
.topbar nav a { text-decoration: none; color: var(--muted); padding: 7px 11px; border-radius: 6px; font-weight: 500; white-space: nowrap; }
.topbar nav a.on, .topbar nav a:hover { color: var(--brand); background: var(--brand-l); }
.topbar .me { margin-left: auto; position: relative; }
.topbar .me > button { background: none; border: 1px solid var(--line); border-radius: 18px; padding: 4px 12px; color: var(--muted); font-size: 13px; }
.menu { position: absolute; right: 0; top: 38px; background: var(--white); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 28px rgba(0,0,0,.12); min-width: 190px; padding: 6px; }
.menu button, .menu a { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 8px 10px; border-radius: 6px; text-decoration: none; color: var(--ink); }
.menu button:hover, .menu a:hover { background: var(--brand-l); }
.menu .who { padding: 6px 10px 8px; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.stagingbar { background: repeating-linear-gradient(45deg, #fff3c4, #fff3c4 12px, #ffe79a 12px, #ffe79a 24px); color: #6b4d00; text-align: center; font-weight: 700; font-size: 12px; padding: 4px; letter-spacing: .5px; }
.poweredby { text-align: center; color: var(--muted); font-size: 11px; padding: 24px 0 30px; }

main { max-width: 1240px; margin: 0 auto; padding: 22px 20px 40px; }
h1 { font-size: 22px; margin: 0 0 4px; color: var(--brand-d); }
h2 { font-size: 16px; margin: 18px 0 8px; color: var(--brand-d); }
h3 { font-size: 12px; margin: 14px 0 6px; color: var(--accent); text-transform: uppercase; letter-spacing: .7px; }
.sub { color: var(--muted); font-size: 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.card { background: var(--white); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; margin-bottom: 14px; }
.btn { background: var(--brand); color: #fff; border: 0; border-radius: 7px; padding: 8px 15px; font-weight: 600; text-decoration: none; display: inline-block; }
.btn:hover { background: var(--brand-d); }
.btn.alt { background: var(--white); color: var(--brand); border: 1px solid var(--line); }
.btn.alt:hover { background: var(--brand-l); }
.btn.accent { background: var(--accent); }
.btn.danger { background: var(--bad); }
.btn.sm { padding: 5px 10px; font-size: 12px; font-weight: 500; }
.btn:disabled { opacity: .5; cursor: default; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 11px; font-weight: 600; background: var(--brand-l); color: var(--brand); white-space: nowrap; }
.pill.ok { background: var(--ok-l); color: var(--ok); } .pill.warn { background: var(--warn-l); color: var(--warn); } .pill.bad { background: var(--bad-l); color: var(--bad); } .pill.mute { background: #eee; color: var(--muted); }
.err { color: var(--bad); font-size: 13px; min-height: 18px; margin-top: 8px; }
.notice { padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; font-size: 13px; } .notice.ok { background: var(--ok-l); color: var(--ok); } .notice.warn { background: var(--warn-l); color: #6b4d00; } .notice.bad { background: var(--bad-l); color: var(--bad); }

/* Forms */
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 18px; }
.f { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.f.wide { grid-column: 1 / -1; }
.f > label { font-size: 12px; font-weight: 600; color: #3a3a46; }
.f > label .req { color: var(--accent); margin-left: 2px; }
.f .help { font-size: 11px; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=search], select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 7px; padding: 7px 10px; background: var(--white); }
textarea { min-height: 76px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-l); }
input:disabled, select:disabled, textarea:disabled { background: #f4f4f7; color: #44444f; }
.f.missing > label { color: var(--bad); }
.f.missing input, .f.missing select, .f.missing textarea { border-color: #e7a19c; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips label { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 99px; padding: 4px 10px; font-size: 13px; background: var(--white); cursor: pointer; }
.chips label.on { border-color: var(--brand); background: var(--brand-l); color: var(--brand-d); }
.chips input { margin: 0; }
.saved { font-size: 12px; color: var(--muted); } .saved.dirty { color: var(--accent); font-weight: 600; }

/* Tables */
table.list { width: 100%; border-collapse: collapse; background: var(--white); }
table.list th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); background: #fafafc; }
table.list td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.list tr.click { cursor: pointer; } table.list tr.click:hover td { background: var(--brand-l); }
table.grid { border-collapse: collapse; width: 100%; } table.grid th { font-size: 11px; color: var(--muted); text-align: left; padding: 4px; } table.grid td { padding: 2px 4px 2px 0; }

/* Modal */
.modal-bg { position: fixed; inset: 0; background: rgba(20,20,30,.38); display: flex; align-items: flex-start; justify-content: center; padding: 8vh 12px; z-index: 100; overflow-y: auto; }
.modal { background: var(--white); border-radius: 12px; padding: 20px 22px; width: 460px; max-width: 94vw; box-shadow: 0 12px 40px rgba(0,0,0,.2); }
.modal h2 { margin-top: 0; }

/* Login */
.login { max-width: 380px; margin: 9vh auto; background: var(--white); border: 1px solid var(--line); border-top: 4px solid var(--brand); border-radius: 12px; padding: 26px; }
.login .f { margin-top: 12px; }
.login .sso { width: 100%; margin-top: 16px; padding: 10px; }

/* Home cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.appcard { display: block; background: var(--white); border: 1px solid var(--line); border-radius: 12px; padding: 18px; text-decoration: none; color: var(--ink); transition: .12s; }
.appcard:hover { border-color: var(--brand); box-shadow: 0 4px 14px rgba(70,84,150,.12); transform: translateY(-1px); }
.appcard .ic { font-size: 26px; } .appcard b { display: block; margin-top: 8px; font-size: 15px; color: var(--brand-d); }
.appcard.planned { opacity: .55; pointer-events: none; border-style: dashed; }

@media (max-width: 760px) { .fields { grid-template-columns: 1fr; } .topbar { gap: 10px; padding: 0 10px; } main { padding: 14px 10px 30px; } }
