/* KPB Portal */
/* Palette, type and logo match the Kentucky Paper Box website (kybox.com / c9swag.com, "Skin R"). */
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400 600; font-display: swap; src: url(fonts/inter-latin.woff2) format('woff2'); }
@font-face { font-family: 'Bricolage Grotesque'; font-style: normal; font-weight: 500 800; font-stretch: 100%; font-display: swap; src: url(fonts/bricolage-grotesque-latin.woff2) format('woff2'); }
:root {
  --blue: #0033A0; --blue-ink: #0a1630; --blue-soft: #eef3ff; --sky: #a9c0ff; --night: #0a1630;
  --grey-50: #f7f8fa; --grey-100: #eef0f3; --grey-300: #e2e5ea; --grey-500: #5b6275; --grey-800: #1f2533;
  --bg: var(--grey-50); --panel: #fff; --ink: var(--blue-ink); --muted: var(--grey-500); --line: var(--grey-300);
  --brand: var(--blue); --brand-2: #00226b; --accent: var(--blue);
  --ok: #2f9e44; --warn: #f08c00; --err: #c92a2a; --radius: 16px; --side: 228px; --top: 60px;
  --shadow: 0 1px 2px rgba(10,22,48,.05), 0 2px 8px rgba(10,22,48,.06);
  --display: "Bricolage Grotesque", system-ui, sans-serif;
  --nightglow: radial-gradient(60% 120% at 85% 0%, rgba(59,110,245,.55), transparent 60%), #0a1630;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}
h1, h2, h3, .page-title, .tile-n, .login-brand { font-family: var(--display); letter-spacing: -.01em; }
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-size: 14px; }
a { color: var(--accent); text-decoration: none; } a:hover { text-decoration: underline; }
code { background: var(--blue-soft); padding: 1px 5px; border-radius: 4px; }
h2 { font-size: 16px; margin: 0 0 .7rem; } h3 { font-size: 14px; margin: 1rem 0 .5rem; }
.muted { color: var(--muted); } .small { font-size: 12px; } .center { text-align: center; } .num { text-align: right; } .neg { color: var(--err); font-weight: 600; }

/* Top bar */
.topbar { position: fixed; inset: 0 0 auto 0; height: var(--top); background: var(--panel); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 14px; padding: 0 14px; z-index: 30; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--grey-500); white-space: nowrap; font-size: 13px; } .brand:hover { text-decoration: none; }
.brand img { height: 34px; width: auto; display: block; }
.logo-img { height: 64px; width: auto; display: block; margin: 0 auto 6px; }
.page-title { font-size: 18px; font-weight: 700; margin: 0 0 0 calc(var(--side) - 170px); flex: 0 1 auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-btn { display: none; background: none; border: 0; font-size: 22px; cursor: pointer; padding: 6px; }
.presence { display: flex; gap: 4px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; color: #fff; font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); cursor: default; }
.avatar.editing { animation: pulse 1.4s infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 1px var(--line); } 50% { box-shadow: 0 0 0 4px rgba(28,126,214,.25); } }
.me { display: flex; align-items: center; gap: 10px; white-space: nowrap; } .me form { margin: 0; }
button.link { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 0; font: inherit; } button.link:hover { color: var(--ink); text-decoration: underline; }

/* Sidebar */
.sidebar { position: fixed; top: var(--top); bottom: 0; left: 0; width: var(--side); background: var(--nightglow); background-attachment: fixed; color: #cfd8ef; overflow-y: auto; padding: 10px 0 30px; z-index: 25; }
.nav-group { font-size: 11px; text-transform: uppercase; letter-spacing: .8px; color: var(--sky); opacity: .8; padding: 14px 18px 6px; }
.nav-item { display: flex; align-items: center; justify-content: space-between; color: #e4e9f7; padding: 8px 14px; margin: 1px 10px; border-radius: 10px; }
.nav-item:hover { background: rgba(255,255,255,.07); text-decoration: none; }
.nav-item.active { background: rgba(169,192,255,.18); color: #fff; font-weight: 600; box-shadow: inset 3px 0 0 var(--sky); }
.nav-dots { display: flex; gap: 3px; } .nav-dots i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.nav-foot { color: #8f9bbd; font-size: 11px; padding: 20px 18px 0; }

.main { margin: var(--top) 0 0 var(--side); padding: 16px 18px 40px; min-height: calc(100vh - var(--top)); }

/* Cards, tiles, flash */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; box-shadow: var(--shadow); }
.table-card { overflow-x: auto; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-bottom: 14px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; color: var(--ink); box-shadow: var(--shadow); }
.tile:hover { text-decoration: none; border-color: #c9d0dc; } .tile.warn { border-left: 4px solid var(--warn); }
.tile-n { color: var(--blue); }
.tile-n { font-size: 26px; font-weight: 700; } .tile-n.small { font-size: 18px; } .tile-l { font-weight: 600; } .tile-s { color: var(--muted); font-size: 12px; margin-top: 2px; }
.flash { padding: 10px 12px; border-radius: 8px; margin-bottom: 12px; border: 1px solid; }
.flash.ok { background: #ebfbee; border-color: #b2f2bb; } .flash.err { background: #fff5f5; border-color: #ffc9c9; color: #8a1c1c; }
.flash.info { background: var(--blue-soft); border-color: var(--sky); } .flash.warn { background: #fff9db; border-color: #ffe066; }
.activity { list-style: none; padding: 0; margin: 0; } .activity li { padding: 6px 0; border-bottom: 1px solid var(--line); } .activity .when { color: var(--muted); font-size: 12px; margin-right: 6px; }
.act { font-size: 11px; padding: 1px 6px; border-radius: 10px; background: #eef1f6; } .act-create { background: #d3f9d8; } .act-delete { background: #ffe3e3; } .act-update { background: #e7f5ff; } .act-import { background: #fff3bf; } .act-login_failed { background: #ffe3e3; }
.badge { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 10px; background: #eef1f6; } .badge.red { background: #ffe3e3; color: #8a1c1c; }

/* Forms & buttons */
.btn { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--grey-300); background: #fff; color: var(--ink); padding: 7px 14px; border-radius: 999px; cursor: pointer; font: inherit; font-weight: 500; white-space: nowrap; }
.btn:hover { background: var(--blue-soft); border-color: var(--sky); text-decoration: none; } .btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; } .btn.primary:hover { background: var(--brand-2); border-color: var(--brand-2); }
.btn.danger { background: #fff; border-color: var(--err); color: var(--err); } .btn.danger:hover { background: #fff5f5; }
.btn.small { padding: 4px 9px; font-size: 12px; } .btn.wide { width: 100%; justify-content: center; padding: 10px; }
.icon-btn { border: 0; background: none; cursor: pointer; font-size: 14px; opacity: .55; } .icon-btn:hover { opacity: 1; }
.form label, .inline-form label { display: flex; flex-direction: column; gap: 4px; font-weight: 500; margin-bottom: 10px; }
.form label.chk, label.chk { flex-direction: row; align-items: center; gap: 6px; font-weight: 400; }
input, select, textarea { font: inherit; padding: 8px 10px; border: 1px solid var(--grey-300); border-radius: 10px; background: #fff; color: var(--ink); min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(0,51,160,.15); border-color: var(--blue); }
input[type=checkbox] { width: 18px; height: 18px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 0 14px; }
.narrow { max-width: 520px; }
.inline-form { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; } .inline-form label { margin: 0; } .inline-form input { width: 110px; }
.steps li { margin-bottom: 6px; }
.temp { font-size: 16px; padding: 3px 8px; }
table.plain { width: 100%; border-collapse: collapse; } table.plain th, table.plain td { padding: 7px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
table.plain th { font-size: 12px; color: var(--muted); font-weight: 600; } table.plain tr.dim td { opacity: .55; } table.plain input, table.plain select { padding: 5px 7px; } table.plain.compact td { padding: 5px 8px; }
.actions { white-space: nowrap; }

/* Toolbar & grids */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; } .toolbar .spacer { flex: 1; }
.toolbar .search { width: 220px; } .count { font-size: 12px; }
.tabulator { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; font-size: 13px; box-shadow: var(--shadow); }
.tabulator .tabulator-header { background: var(--blue-soft); border-bottom: 1px solid var(--line); }
.tabulator .tabulator-header .tabulator-col { background: var(--blue-soft); border-right: 1px solid #dfe6fa; color: var(--blue-ink); }
.tabulator .tabulator-header .tabulator-col .tabulator-col-content { padding: 7px 8px; }
.tabulator .tabulator-header .tabulator-col input, .tabulator .tabulator-header .tabulator-col select { padding: 3px 6px; font-size: 12px; border-radius: 5px; }
.tabulator-row { border-bottom: 1px solid #f0f2f6; } .tabulator-row.tabulator-row-even { background: #fcfcfe; }
.tabulator-row .tabulator-cell { padding: 6px 8px; border-right: 1px solid #f3f4f7; }
.tabulator-row .tabulator-cell.computed { background: #f8f9fc; color: #3b4356; }
.tabulator-row .tabulator-cell.editable { background: #fffdf2; }
.tabulator-row .tabulator-cell.strong { font-weight: 700; }
.tabulator-row.row-flag .tabulator-cell:not(.who-col) { background: #fff5f5; }
.tabulator-row.row-red .tabulator-cell { background: #ffe3e3 !important; } .tabulator-row.row-yellow .tabulator-cell { background: #fff3bf !important; }
.tabulator-row.row-ship .tabulator-cell { background: #ebfbee; } .tabulator-row.follow-on .tabulator-cell:nth-child(2) { padding-left: 20px; color: var(--muted); }
.tabulator-row.saving { opacity: .6; } .tabulator-row.flash-good .tabulator-cell { background: #d3f9d8 !important; transition: background .3s; } .tabulator-row.flash-bad .tabulator-cell { background: #ffc9c9 !important; }
.tabulator .tabulator-row .tabulator-cell.who-col { padding: 0; overflow: visible; position: relative; }
.who-tag { position: absolute; left: 2px; top: 50%; transform: translateY(-50%); color: #fff; font-size: 10px; font-weight: 700; padding: 1px 5px; border-radius: 6px; z-index: 5; white-space: nowrap; pointer-events: none; }
.rcard .who-tag { position: static; transform: none; }
.tabulator .tabulator-group { background: #e3eafc; color: var(--blue-ink); border-bottom: 1px solid var(--line); padding: 6px 10px; font-weight: 600; }
.tabulator .tabulator-row.tabulator-group span { color: var(--muted); }
.group-sums { color: var(--muted); font-weight: 400; font-size: 12px; margin-left: 10px; }
.tabulator .tabulator-footer { background: #f7f8fb; }
.tabulator-calcs-holder .tabulator-row { background: #f1f3f8 !important; font-weight: 600; }

/* Split layout for board orders */
.split-bottom { margin-top: 10px; } .detail-head { padding: 8px 2px; }
.detail-grids { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* Tabs */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 10px; border-bottom: 1px solid var(--line); }
.tab { border: 0; background: none; padding: 8px 14px; cursor: pointer; font: inherit; color: var(--muted); border-bottom: 2px solid transparent; }
.tab.active { color: var(--blue); border-bottom-color: var(--blue); font-weight: 600; }

/* Modal */
.modal-wrap { position: fixed; inset: 0; background: rgba(20,24,33,.45); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 12px; z-index: 100; overflow-y: auto; }
.modal { background: #fff; border-radius: 12px; width: 100%; max-width: 760px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); } .modal-head h2 { margin: 0; }
.modal-x { border: 0; background: none; font-size: 26px; cursor: pointer; line-height: 1; color: var(--muted); }
.modal-body { padding: 16px; } .modal-body pre { background: #f6f7fa; padding: 10px; border-radius: 8px; overflow-x: auto; font-size: 12px; }
.form-actions { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.computed-list { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; background: #f8f9fc; padding: 10px 12px; border-radius: 8px; margin: 6px 0 10px; } .computed-list dt { color: var(--muted); } .computed-list dd { margin: 0; font-weight: 600; }
.pnote { display: inline-flex; align-items: center; gap: 6px; border: 1px solid; border-radius: 14px; padding: 3px 10px; margin: 0 6px 8px 0; font-size: 12px; } .pnote i { width: 9px; height: 9px; border-radius: 50%; }

/* Toasts */
#toasts { position: fixed; right: 14px; bottom: 14px; display: flex; flex-direction: column; gap: 8px; z-index: 200; max-width: min(420px, calc(100vw - 28px)); }
.toast { background: var(--blue-ink); color: #fff; padding: 10px 14px; border-radius: 8px; box-shadow: 0 6px 18px rgba(0,0,0,.2); transition: opacity .4s, transform .4s; }
.toast.err { background: #a61e1e; } .toast.warn { background: #b35c00; } .toast.info { background: var(--blue); } .toast.out { opacity: 0; transform: translateY(8px); }

/* Charts */
.chart-wrap { position: relative; height: 380px; } .chart-wrap.short { height: 260px; }

/* Login */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 16px; background: var(--nightglow); }
.login-card { background: #fff; padding: 32px 28px; border-radius: 28px; text-align: left; width: 100%; max-width: 380px; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.login-card.wide-card { max-width: 720px; }
.login-card label { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; font-weight: 500; }
.login-brand { font-size: 22px; font-weight: 700; margin-bottom: 4px; text-align: center; color: var(--blue-ink); }
.login-card > .muted:first-of-type { text-align: center; }

/* Phone */
.cards { display: flex; flex-direction: column; gap: 8px; }
.rcard { text-align: left; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px; font: inherit; color: var(--ink); cursor: pointer; box-shadow: var(--shadow); width: 100%; }
.rcard.flagged { border-left: 4px solid var(--err); }
.rcard-head { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; font-size: 15px; } .rcard-who { margin-left: auto; }
.rcard-body { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; } .rcard-body em { color: var(--muted); font-style: normal; font-size: 12px; margin-right: 3px; }
@media (max-width: 1000px) { .detail-grids { grid-template-columns: 1fr; } }
@media (max-width: 760px) {
  :root { --side: 0px; }
  .menu-btn { display: block; } .page-title { margin: 0; font-size: 15px; } .brand { display: none; } .me-name { display: none; }
  .sidebar { width: 260px; transform: translateX(-100%); transition: transform .2s; box-shadow: 4px 0 20px rgba(0,0,0,.3); }
  body.nav-open .sidebar { transform: none; }
  .main { padding: 12px 10px 80px; }
  .toolbar .search { flex: 1 1 100%; width: auto; } .toolbar .btn { padding: 9px 12px; }
  .btn.primary.add-btn { position: fixed; right: 16px; bottom: 16px; z-index: 40; border-radius: 28px; padding: 14px 20px; box-shadow: 0 6px 18px rgba(0,0,0,.25); font-size: 15px; }
  .modal-wrap { padding: 0; align-items: stretch; } .modal { border-radius: 0; min-height: 100vh; }
  input, select, textarea { font-size: 16px; padding: 10px 12px; }  /* stops iOS zoom */
  .grid-2 { grid-template-columns: 1fr; }
  .inline-form input { width: 100%; } .inline-form label { flex: 1 1 45%; }
  .avatar { width: 26px; height: 26px; font-size: 11px; }
  #toasts { left: 10px; right: 10px; bottom: 80px; }
  .tiles { grid-template-columns: 1fr 1fr; } .tile-n { font-size: 20px; }
}
@media print { .topbar, .sidebar, .toolbar, #toasts { display: none !important; } .main { margin: 0; padding: 0; } }

/* Admin center */
.grid-3 { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0 14px; }
.radio-row { display: flex; flex-wrap: wrap; gap: 6px 22px; margin: 4px 0 14px; } .radio-row label { margin: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; } .card-head h2 { margin: 0; }
.copy-row { display: flex; gap: 8px; align-items: center; margin-top: 8px; flex-wrap: wrap; } .copy-input { flex: 1; min-width: 240px; font-size: 12px; }
form.inline { display: inline; margin: 0; }
.user-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; } .two-col > .card { margin-bottom: 14px; }
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0 0 12px; } dl.kv dt { color: var(--muted); } dl.kv dd { margin: 0; }
.admin-links { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; margin-bottom: 14px; }
.admin-link { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; color: var(--ink); display: flex; flex-direction: column; gap: 4px; box-shadow: var(--shadow); }
.admin-link:hover { border-color: var(--sky); background: var(--blue-soft); text-decoration: none; } .admin-link b { color: var(--blue); font-family: var(--display); font-size: 15px; } .admin-link span { color: var(--muted); font-size: 13px; }
.badge.st-green { background: #d3f9d8; color: #1b5e20; } .badge.st-yellow { background: #fff3bf; color: #7a5b00; } .badge.st-blue { background: var(--blue-soft); color: var(--blue); } .badge.st-grey { background: var(--grey-100); color: var(--muted); }
.badge.role-admin { background: var(--blue); color: #fff; } .badge.role-editor { background: var(--blue-soft); color: var(--blue); } .badge.role-viewer { background: var(--grey-100); color: var(--grey-800); }
.avatar.sm { width: 22px; height: 22px; font-size: 10px; border-width: 1px; vertical-align: middle; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 4px; } .dot.ok { background: var(--ok); } .dot.bad { background: var(--err); }
pre.errlog { background: #f6f7fa; padding: 8px; border-radius: 8px; overflow-x: auto; white-space: pre-wrap; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }
@media (max-width: 760px) {
  .user-table thead { display: none; } .user-table, .user-table tbody, .user-table tr, .user-table td { display: block; width: 100%; }
  .user-table tr { border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; margin-bottom: 8px; } .user-table td { border: 0; padding: 3px 0; }
  .user-table td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); font-size: 12px; }
  .user-actions .btn { padding: 9px 12px; }
}
table.plain td.small { white-space: nowrap; }

/* Top action bar */
.top-actions { display: flex; gap: 6px; align-items: center; flex: 1; padding-left: 8px; }
.dropdown { position: relative; }
.dropdown-menu { display: none; position: absolute; top: calc(100% + 6px); left: 0; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 30px rgba(10,22,48,.15); width: min(460px, 90vw); max-height: 60vh; overflow-y: auto; z-index: 60; padding: 6px; }
.dropdown.open .dropdown-menu { display: block; }
.dropdown-menu .hist-item { display: flex; gap: 8px; align-items: flex-start; padding: 8px; border-radius: 8px; }
.dropdown-menu .hist-item:hover { background: var(--blue-soft); }
.dropdown-menu .hist-item .when { color: var(--muted); font-size: 11px; white-space: nowrap; min-width: 70px; }
.dropdown-menu .hist-item .what { flex: 1; font-size: 13px; }
.dropdown-menu .empty { padding: 10px; color: var(--muted); }
@media (max-width: 760px) { .top-actions { padding-left: 0; } .top-actions .btn { padding: 6px 8px; font-size: 12px; } #historyBtn { display: none; } .page-title { display: none; } }
.dg-title { font-size: 13px; color: var(--muted); margin: 6px 0 6px; font-weight: 600; }
