@import url('/fonts/fonts.css');
/* Theme taken from mgkunified.com: sky-blue accent, navy headings, magenta-orange gradient, Space Grotesk + Plus Jakarta Sans */
:root {
  --bg: #f5f9fc; --panel: #fff; --ink: #2c3f56; --heading: #0f2a4a; --muted: #5b7189; --line: #e1eaf2; --line2: #eef3f8;
  --brand: #1379c4; --brand-deep: #0b3d68; --brand-ink: #fff; --brand-soft: #e7f2fb; --sky: #85cbea; --orange: #f7941e;
  --grad: linear-gradient(120deg, #9c1fa0 0%, #e0368b 55%, #f7941e 100%);
  --ok: #15803d; --ok-bg: #dcfce7; --warn: #b45309; --warn-bg: #fef3c7; --bad: #c0392b; --bad-bg: #fde8e6; --info: #0b5fa5; --info-bg: #e2effa;
  --neutral-bg: #edf3f8; --shadow: 0 8px 20px #0e223a12; --shadow-lg: 0 30px 70px #0e223a24; --radius: 18px; --radius-sm: 12px;
  --font-body: 'Plus Jakarta Sans', 'Segoe UI', system-ui, sans-serif; --font-head: 'Space Grotesk', 'Segoe UI', system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a1626; --panel: #10223a; --ink: #d3e0ee; --heading: #f0f6fc; --muted: #8fa6bf; --line: #1f3654; --line2: #172c47;
    --brand: #4aa3e8; --brand-deep: #85cbea; --brand-soft: #12304e;
    --ok: #4ade80; --ok-bg: #12351f; --warn: #fbbf24; --warn-bg: #3a2c0b; --bad: #f87171; --bad-bg: #3b1515; --info: #7db8f0; --info-bg: #15294d; --neutral-bg: #17304d;
    --shadow: 0 8px 20px #00000055;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.5 var(--font-body); background: var(--bg); color: var(--ink); }
h1, h2, h3 { margin: 0; line-height: 1.25; font-family: var(--font-head); color: var(--heading); letter-spacing: -.01em; }
h1 { font-size: 20px; } h2 { font-size: 16px; } h3 { font-size: 14px; }
a { color: var(--brand); text-decoration: none; } a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
.muted { color: var(--muted); } .small { font-size: 12px; } .right { text-align: right; } .nowrap { white-space: nowrap; }
.mono { font-variant-numeric: tabular-nums; }
.hide { display: none !important; }

/* layout */
.app { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { background: var(--panel); border-right: 1px solid var(--line); padding: 16px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: block; padding: 4px 4px 14px; }
.brand .logo { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 8px 10px; display: block; }
.brand img { display: block; width: 100%; height: auto; }
.nav-group { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 16px 12px 4px; opacity: .8; }
.nav a { position: relative; display: flex; gap: 10px; align-items: center; padding: 8px 12px; border-radius: 12px; color: var(--muted); text-decoration: none; font-weight: 500; }
.nav a:hover { background: var(--brand-soft); color: var(--brand-deep); text-decoration: none; }
.nav a.on { background: var(--brand-soft); color: var(--brand-deep); font-weight: 700; }
.nav a.on::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 4px; border-radius: 0 4px 4px 0; background: var(--grad); }
.nav svg { width: 17px; height: 17px; flex: none; opacity: .9; }
.main { min-width: 0; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; gap: 12px; padding: 10px 24px; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.top .grow { flex: 1; }
.btn.menu-btn { display: none; }
.page { padding: 22px 24px 60px; max-width: 1280px; width: 100%; }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head .grow { flex: 1; }
.user-chip { display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 4px 8px; border-radius: 8px; }
.user-chip:hover { background: var(--neutral-bg); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--grad); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 12px; }

/* components */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--line); gap: 8px; }
.grid { display: grid; gap: 14px; } .g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi { padding: 14px 16px; } .kpi .l { color: var(--muted); font-size: 12px; } .kpi .v { font-size: 22px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; } .kpi .s { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kpi.bad .v { color: var(--bad); } .kpi.ok .v { color: var(--ok); }
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 7px 15px; cursor: pointer; font-weight: 600; text-decoration: none; color: var(--heading); white-space: nowrap; transition: box-shadow .15s, transform .15s, background .15s; }
.btn:hover { background: var(--neutral-bg); text-decoration: none; }
.btn.primary { background: var(--grad); border-color: transparent; color: #fff; box-shadow: 0 6px 16px #e0368b33; } .btn.primary:hover { filter: brightness(1.06); box-shadow: 0 8px 20px #e0368b4d; transform: translateY(-1px); }
.btn.danger { color: var(--bad); } .btn.sm { padding: 4px 9px; font-size: 12.5px; } .btn.ghost { border-color: transparent; background: transparent; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.badge { display: inline-block; padding: 1px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--neutral-bg); color: var(--muted); white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); } .badge.warn { background: var(--warn-bg); color: var(--warn); } .badge.bad { background: var(--bad-bg); color: var(--bad); } .badge.info { background: var(--info-bg); color: var(--info); }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs button { background: none; border: 0; border-bottom: 2px solid transparent; padding: 9px 14px; cursor: pointer; color: var(--muted); font-weight: 500; white-space: nowrap; }
.tabs button.on { color: var(--brand); border-bottom-color: var(--brand); }
.notice { padding: 10px 14px; border-radius: 8px; background: var(--info-bg); color: var(--info); margin-bottom: 14px; font-size: 13px; }
.notice.warn { background: var(--warn-bg); color: var(--warn); } .notice.bad { background: var(--bad-bg); color: var(--bad); } .notice.ok { background: var(--ok-bg); color: var(--ok); }
.empty { text-align: center; padding: 44px 16px; color: var(--muted); }
.empty b { display: block; color: var(--ink); margin-bottom: 4px; font-size: 15px; }

/* tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: 9px 12px; border-bottom: 1px solid var(--line); background: var(--panel); white-space: nowrap; }
td { padding: 9px 12px; border-bottom: 1px solid var(--line2); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr.click { cursor: pointer; } tbody tr.click:hover td { background: var(--brand-soft); }
th.r, td.r { text-align: right; } td.r { font-variant-numeric: tabular-nums; }
tfoot td { font-weight: 700; border-top: 2px solid var(--line); }

/* forms */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
input, select, textarea { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; width: 100%; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: -1px; border-color: transparent; }
input[type=checkbox], input[type=radio] { width: auto; }
textarea { resize: vertical; min-height: 64px; }
.toolbar input, .toolbar select { width: auto; min-width: 150px; }
.toolbar .search { min-width: 240px; }
label.f { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
label.f > span.hint { font-weight: 400; font-size: 12px; }
label.f.req > span.t::after { content: " *"; color: var(--bad); }
label.chk { display: flex; align-items: center; gap: 8px; font-weight: 500; color: var(--ink); font-size: 13.5px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.form-grid .span2 { grid-column: span 2; }
.input-row { display: flex; gap: 6px; } .input-row > :first-child { flex: 1; }
.form-err { color: var(--bad); background: var(--bad-bg); padding: 8px 12px; border-radius: 8px; margin-bottom: 10px; font-size: 13px; }

/* modal & toast */
.overlay { position: fixed; inset: 0; background: rgba(15,23,42,.55); display: grid; place-items: start center; padding: 5vh 16px; overflow-y: auto; z-index: 50; }
.modal { background: var(--panel); border-radius: 12px; width: 100%; max-width: 560px; box-shadow: 0 20px 50px rgba(0,0,0,.35); }
.modal.wide { max-width: 860px; } .modal.xl { max-width: 1040px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-body { padding: 18px; } .modal-foot { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }
.x { background: none; border: 0; font-size: 22px; line-height: 1; cursor: pointer; color: var(--muted); }
#toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: #111827; color: #fff; padding: 10px 14px; border-radius: 8px; box-shadow: 0 6px 18px rgba(0,0,0,.3); max-width: 380px; font-size: 13.5px; }
.toast.err { background: #991b1b; } .toast.ok { background: #166534; }

/* document form */
.doc-items th, .doc-items td { padding: 6px 6px; }
.doc-items input, .doc-items select, .doc-items textarea { padding: 5px 7px; }
.doc-items textarea { min-height: 34px; height: 34px; }
.doc-items .num { text-align: right; }
.totals { margin-left: auto; width: 320px; max-width: 100%; }
.totals div { display: flex; justify-content: space-between; padding: 4px 0; } .totals .big { font-size: 17px; font-weight: 700; border-top: 1px solid var(--line); margin-top: 4px; padding-top: 8px; }
.pdf-frame { width: 100%; height: 78vh; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 6px 12px; } .kv dt { color: var(--muted); } .kv dd { margin: 0; }

/* leads board */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 10px; align-items: start; }
.col { background: var(--neutral-bg); border-radius: 10px; padding: 8px; min-height: 120px; }
.col.over { outline: 2px dashed var(--brand); }
.col h3 { display: flex; justify-content: space-between; padding: 4px 6px 8px; font-size: 13px; }
.lead-card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin-bottom: 8px; cursor: grab; box-shadow: var(--shadow); }
.lead-card:hover { border-color: var(--brand); } .lead-card b { display: block; } .lead-card .row { display: flex; justify-content: space-between; gap: 6px; margin-top: 6px; font-size: 12px; color: var(--muted); }
.timeline { list-style: none; padding: 0; margin: 0; } .timeline li { padding: 8px 0 8px 14px; border-left: 2px solid var(--line); position: relative; }
.timeline li::before { content: ""; position: absolute; left: -5px; top: 14px; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); }

/* charts */
.bars { display: flex; align-items: flex-end; gap: 14px; height: 170px; padding: 8px 4px 0; }
.bar-group { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; min-width: 0; }
.bar-stack { display: flex; align-items: flex-end; gap: 3px; height: 100%; width: 100%; justify-content: center; }
.bar { width: 100%; max-width: 22px; border-radius: 4px 4px 0 0; min-height: 2px; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); } .legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; }
.hbar { display: grid; grid-template-columns: 96px 1fr 52px; gap: 8px; align-items: center; margin: 6px 0; font-size: 13px; }
.hbar .track { background: var(--neutral-bg); border-radius: 99px; height: 10px; overflow: hidden; } .hbar .fill { height: 100%; background: var(--brand); border-radius: 99px; }
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login .card { width: 100%; max-width: 380px; padding: 28px; }
.perm-table td, .perm-table th { padding: 6px 10px; } .perm-table select { width: auto; padding: 3px 6px; }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 250px; transform: translateX(-100%); transition: transform .2s; z-index: 40; }
  .side.open { transform: none; }
  .btn.menu-btn { display: inline-flex; }
  .g3, .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .page { padding: 16px 14px 60px; }
}
@media (max-width: 600px) {
  .g2, .g3, .g4, .form-grid { grid-template-columns: 1fr; } .form-grid .span2 { grid-column: auto; }
}
@media print { .side, .top, .btn, .toolbar { display: none !important; } .app { display: block; } }
.grow { flex: 1; }
.toolbar input[type=checkbox] { min-width: 0; width: auto; }
.toolbar .chk { white-space: nowrap; }
.pdf-pages { display: flex; flex-direction: column; gap: 12px; align-items: center; background: var(--neutral-bg); padding: 12px; border-radius: 8px; overflow-x: auto; }
.pdf-page { background: #fff; box-shadow: 0 1px 6px rgba(0,0,0,.25); max-width: 100%; height: auto !important; }

/* ---- brand refinements (mgkunified.com look) ---- */
input, select, textarea { border-radius: var(--radius-sm); border-color: var(--line); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: -1px; box-shadow: 0 0 0 4px #1379c426; }
.modal { border-radius: 24px; box-shadow: var(--shadow-lg); }
.modal-head { border-bottom-color: var(--line); } .modal-head h2 { font-size: 17px; }
.lead-card { border-radius: 14px; } .col { border-radius: 16px; }
.kpi .v { font-family: var(--font-head); font-size: 24px; color: var(--heading); letter-spacing: -.02em; }
.kpi.bad .v { color: var(--bad); } .kpi.ok .v { color: var(--ok); }
.kpi { position: relative; overflow: hidden; }
.kpi::after { content: ""; position: absolute; right: -24px; top: -24px; width: 70px; height: 70px; border-radius: 50%; background: var(--brand-soft); opacity: .8; }
.page-head h1 { font-size: 24px; }
th { color: var(--muted); background: color-mix(in srgb, var(--brand-soft) 45%, var(--panel)); font-weight: 700; }
tbody tr.click:hover td { background: var(--brand-soft); }
.tabs { gap: 6px; border-bottom: 0; }
.tabs button { border: 1px solid var(--line); border-radius: 999px; background: var(--panel); padding: 7px 16px; font-weight: 600; }
.tabs button.on { background: var(--brand-soft); color: var(--brand-deep); border-color: var(--brand); }
.card-head h2 { font-size: 16px; }
.badge { font-weight: 700; }
.hbar .fill { background: linear-gradient(90deg, var(--brand), var(--sky)); }
.notice { border-radius: var(--radius-sm); }
.btn.sm { padding: 3px 11px; }
.btn:hover { box-shadow: 0 4px 12px #0e223a1a; }
.btn.primary:disabled { transform: none; box-shadow: none; }
.totals .big, .kv dt { color: var(--heading); }
.perm-table th { background: transparent; }

/* login */
.login { background: radial-gradient(900px 500px at 85% -10%, #e0368b1f, transparent 60%), radial-gradient(900px 600px at -10% 110%, #1379c426, transparent 60%), var(--bg); }
.login .card { max-width: 420px; padding: 32px; border-radius: 28px; box-shadow: var(--shadow-lg); }
.login .logo { display: block; margin: 0 auto 18px; max-width: 230px; width: 100%; background: #fff; border-radius: 16px; padding: 10px 14px; border: 1px solid var(--line); }
.login h1 { font-size: 26px; }
.login .tag { height: 4px; border-radius: 4px; background: var(--grad); margin: 14px 0 18px; }

/* workspace branding without a logo: show the company name instead */
.brand-name { display: block; font-family: var(--font-head); font-weight: 700; font-size: 17px; color: var(--heading); padding: 4px 2px; line-height: 1.2; word-break: break-word; }
.login-name { font-family: var(--font-head); font-weight: 700; font-size: 24px; color: var(--heading); margin: 0 0 14px; line-height: 1.2; word-break: break-word; }
.banner { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

/* product attribution + support session bar */
.powered { display: flex; gap: 8px; align-items: center; justify-content: center; flex-wrap: wrap; font-size: 12px; color: var(--muted); padding: 14px 16px 18px; }
.powered a { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); text-decoration: none; }
.powered a:hover { color: var(--brand-deep); text-decoration: none; } .powered b { color: var(--heading); }
.powered img { border-radius: 4px; }
.page { flex: 1; }
.app-foot { border-top: 1px solid var(--line); margin-top: 8px; }
.login { display: flex !important; flex-direction: column; align-items: center; justify-content: center; gap: 14px; }
.login-foot { padding: 0; }
.support-bar { position: sticky; top: 0; z-index: 60; display: flex; gap: 12px; align-items: center; justify-content: center; flex-wrap: wrap; padding: 8px 14px; background: #7c2d12; color: #fff; font-size: 13px; }
.support-bar .btn { background: #fff; color: #7c2d12; border-color: #fff; }
.has-support-bar .side, .has-support-bar .top { top: 42px; } .has-support-bar .side { height: calc(100vh - 42px); }
