/* Royal Duck CRM: admin console styles (dashboard, tables, kanban, dialogs). */
.ico { display: inline-grid; place-items: center; width: 18px; margin-right: 8px; font-size: 14px; }
.ico svg { fill: currentColor; }
.nav-item { display: flex; align-items: center; cursor: default; }
.app:not(.locked) .nav-item { cursor: pointer; color: #4b5563; }
.app:not(.locked) .nav-item:hover { background: #e2e6ec; }
.app:not(.locked) .nav-item.active { background: #dbe3f0; color: var(--accent-2); }
button.logo { border: 0; cursor: pointer; }
.user { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 13px; }
.user .avatar { width: 30px; height: 30px; background: #dbe3f0; color: var(--accent-2); }
.user .avatar svg { fill: currentColor; }
.search { margin-left: auto; }
.user ~ .avatar { display: none; }
.content { padding: 22px 24px 70px; min-width: 0; }
.content h1 { font-size: 22px; margin-bottom: 4px; }
.sub { color: var(--muted); margin-bottom: 14px; }
.note { font-size: 12px; color: var(--muted); margin-top: 6px; }
.sm { padding: 7px 12px; font-size: 12.5px; width: auto; display: inline-block; }
.primary.sm, .secondary.sm { display: inline-block; width: auto; }
.secondary.sm.is-off { opacity: .55; }
.as-btn { text-decoration: none; margin-top: 8px; }

.fundbar { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 13px; color: var(--muted); padding: 8px 0 10px; }
.fundbar b { color: var(--ink); }
.fundbar i { font-style: normal; font-size: 11px; }
.mk-ticker { overflow: hidden; white-space: nowrap; border: 1px solid var(--line); background: #fff; border-radius: 6px; margin-bottom: 12px; }
.mk-track { display: inline-block; padding: 7px 0; padding-left: 100%; animation: mk 40s linear infinite; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: #4b5563; }
@keyframes mk { to { transform: translateX(-100%); } }
.alert { padding: 10px 14px; border-radius: 6px; margin: 0 0 12px; font-weight: 700; letter-spacing: .06em; }
.alert.danger { background: #fdecea; color: var(--danger); border: 1px solid #f3b9b4; }

.kpis7 { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.kpi b .sm, .kpi b.sm { font-size: 13px; font-weight: 600; }
.kpi em { display: block; font-style: normal; font-size: 11px; color: var(--muted); }
.kpi button { margin-top: 6px; }

.dash-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.col-main, .col-side { display: grid; gap: 14px; min-width: 0; }
.box h3 { display: flex; align-items: center; gap: 8px; }
.chart-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin-bottom: 10px; }
.chart-head h3 { margin: 0; }
.seg { display: inline-flex; border: 1px solid #c3cad4; border-radius: 6px; overflow: hidden; }
.seg button { background: #fff; border: 0; padding: 6px 12px; font-size: 12.5px; border-right: 1px solid #c3cad4; }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--accent); color: #fff; }
.info { width: 20px; height: 20px; border-radius: 50%; border: 1px solid #9aa4b2; background: #fff; color: #4b5563; font-size: 12px; font-style: italic; line-height: 1; }
.pop { background: #f9fafb; border: 1px solid var(--line); border-radius: 6px; padding: 10px 14px; margin-bottom: 10px; font-size: 12.5px; }
.pop ul { margin: 6px 0 0 18px; }
.chart-wrap { position: relative; border: 1px solid var(--line); border-radius: 6px; background: #fbfcfd; overflow: hidden; }
#chart { display: block; width: 100%; height: 220px; }
#chart .grid line { stroke: #e5e8ed; stroke-width: 1; }
#chart .ln { fill: none; stroke-width: 2; vector-effect: non-scaling-stroke; }
#chart .idx { stroke: var(--accent); }
#chart .vol { stroke: #d08a1c; stroke-width: 1.5; stroke-dasharray: 4 3; }
.off { position: absolute; left: 10px; top: 8px; background: #fdecea; color: var(--danger); font-weight: 700; font-size: 12px; padding: 3px 8px; border-radius: 4px; }
.infl { position: absolute; right: 10px; top: 8px; background: #fff7e0; color: #8a6100; font-weight: 600; font-size: 12px; padding: 3px 8px; border-radius: 4px; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 8px; font-size: 12px; color: var(--muted); }
.lg::before { content: ""; display: inline-block; width: 14px; height: 3px; margin-right: 6px; vertical-align: middle; background: var(--accent); }
.lg.vol::before { background: #d08a1c; }
.foot-note { font-size: 11px; color: #8a919d; margin-top: 4px; }
.cond { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.cond label, .box label { display: block; font-size: 12.5px; color: var(--muted); margin: 6px 0; }
.cond label b, .box label b { color: var(--ink); }
input[type=range] { width: 100%; accent-color: var(--accent); }
.row-btns { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.actions .secondary.sm { width: 100%; }
.audit { margin-top: 12px; }
.p-bar { height: 6px; background: #dde1e7; border-radius: 3px; overflow: hidden; }
.p-bar i { display: block; height: 100%; width: 0; background: var(--accent); }
.feed { list-style: none; max-height: 330px; overflow: auto; font-size: 13px; }
.feed li { display: grid; grid-template-columns: 64px 1fr; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.feed time { color: #8a919d; font-variant-numeric: tabular-nums; font-size: 12px; }
.feed li.you span { color: var(--accent-2); font-weight: 500; }
.feed li.alert span { color: var(--danger); font-weight: 700; background: none; border: 0; padding: 0; margin: 0; letter-spacing: 0; }
.feed li.alert { background: none; border: 0; padding: 7px 0; margin: 0; border-bottom: 1px solid var(--line); }

/* tables */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; background: #fff; margin-bottom: 14px; }
.box .tbl-wrap { border: 0; margin: 0; }
.grid-tbl { min-width: 560px; }
.grid-tbl th { cursor: default; white-space: nowrap; }
#lt th[data-k] { cursor: pointer; }
#lt th.sorted::after { content: " " attr(data-dir); font-size: 10px; }
.grid-tbl tbody tr[data-id] { cursor: pointer; }
.grid-tbl tbody tr[data-id]:hover { background: #f6f8fb; }
.tag { font-size: 11px; color: var(--muted); font-style: italic; }
.src { font-size: 11px; color: #8a919d; }
.st { display: inline-block; padding: 2px 8px; border-radius: 999px; background: #e8ecf2; font-size: 12px; }
.s-settled { background: #e1f3ea; color: #1f6b4a; } .s-pending { background: #fff3d6; color: #8a6100; }
.s-eaten { background: #fdecea; color: var(--danger); } .s-unaccounted { background: #ece7f7; color: #5a3f9b; } .s-locked { background: #fdecea; color: var(--danger); }
.acts { white-space: nowrap; }
.acts .sm { padding: 5px 9px; font-size: 12px; margin-right: 4px; }
tr.eaten { animation: eaten .7s ease-in forwards; }
@keyframes eaten { 0% { opacity: 1; transform: none; } 60% { opacity: .5; clip-path: polygon(0 0, 100% 0, 92% 100%, 0 100%); } 100% { opacity: 0; transform: translateX(40px) scale(.96); } }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; font-size: 13px; margin-top: 8px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }
#lead-detail { margin-top: 14px; }

/* kanban */
.kanban { display: grid; grid-template-columns: repeat(5, minmax(210px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 10px; }
.kcol { background: #eceef1; border: 1px solid var(--line); border-radius: 8px; padding: 10px; min-height: 260px; }
.kcol.over { outline: 2px dashed var(--accent); }
.kh { display: flex; justify-content: space-between; font-size: 12.5px; margin-bottom: 10px; color: #4b5563; }
.kcard { display: grid; grid-template-columns: 22px 1fr; gap: 6px 4px; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 9px 10px; margin-bottom: 8px; font-size: 13px; }
.kcard .kt b { display: block; } .kcard .kt i { font-style: normal; color: var(--muted); font-size: 12px; }
.kcard .link-btn { grid-column: 2; justify-self: start; }
.drag { cursor: grab; color: #9aa4b2; touch-action: none; user-select: none; text-align: center; padding: 6px 0; }
.kcard.dragging { opacity: .35; }
.kcard.ghost { position: fixed; z-index: 90; pointer-events: none; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.link-btn { background: none; border: 0; color: var(--accent); text-decoration: underline; font-size: 12px; padding: 2px 0; }

/* cards, docs, settings */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; margin: 14px 0; }
.pcard { display: grid; grid-template-columns: 48px 1fr; gap: 12px; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 14px; }
.av { width: 44px; height: 44px; border-radius: 50%; background: #dbe3f0; color: var(--accent-2); display: grid; place-items: center; font-weight: 700; }
.pcard span { display: block; color: var(--muted); font-size: 12.5px; }
.pcard em { display: block; font-style: normal; font-size: 11.5px; color: var(--accent-2); margin: 2px 0 6px; }
.pcard p { font-size: 12.5px; margin-bottom: 8px; }
.plain { list-style: none; display: grid; gap: 8px; font-size: 13.5px; }
.plain i { color: var(--muted); font-style: normal; }
.doc-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 14px; margin-top: 12px; align-items: start; }
.doclist { list-style: none; }
.doclist li { display: grid; grid-template-columns: 70px 1fr auto; gap: 8px; align-items: center; padding: 10px 8px; border-bottom: 1px solid var(--line); cursor: pointer; font-size: 13px; }
.doclist li:hover, .doclist li.on { background: #f1f4f9; }
.doclist li.locked span { color: var(--muted); }
#dd h3 { margin-bottom: 6px; } #dd p { margin: 8px 0; }
.letter-v p { line-height: 1.8; }
.redact { background: #1b1f27; color: transparent; border-radius: 2px; user-select: none; }
.letter-v mark { background: #fff3d6; padding: 0 2px; }

/* dialogs, goose, honk */
.dlg-ov { position: fixed; inset: 0; z-index: 70; background: rgba(31,41,55,.45); display: grid; place-items: center; padding: 16px; }
.dlg { width: min(440px, 100%); background: #fff; border-radius: 12px; padding: 20px 22px; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.dlg h3 { margin-bottom: 8px; font-size: 18px; }
.dlg-text { margin: 8px 0 12px; }
.dlg-pct { margin-top: 6px; font-size: 12px; color: var(--muted); text-align: right; }
.dlg-btns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.tr-list { display: grid; gap: 6px; }
.tr { display: flex !important; gap: 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; color: var(--ink) !important; margin: 0 !important; }
.goose-fly { position: fixed; z-index: 85; left: 0; bottom: 18%; pointer-events: none; animation: gfly 2.4s ease-in-out forwards; }
@keyframes gfly { from { transform: translateX(-160px); } to { transform: translateX(calc(100vw + 40px)); } }
.flock { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.flock span { position: absolute; left: -40px; top: calc(40% + var(--r)); animation: flk 4s linear forwards; animation-delay: var(--d); fill: #6b7280; }
.flock svg { fill: #6b7280; }
@keyframes flk { to { transform: translateX(calc(100vw + 60px)); } }
.app.honking { animation: honk .4s ease-in-out 5; }
@keyframes honk { 0%, 100% { transform: translate(0,0); } 25% { transform: translate(-2px,1px); } 75% { transform: translate(2px,-1px); } }

.withdraw { position: fixed; right: 12px; bottom: 44px; z-index: 41; background: none; border: 0; color: #8a919d; font-size: 11px; text-decoration: underline; }
.crm-foot a { margin-left: auto; }

/* mobile: sidebar becomes a bottom navigation, wide things scroll */
@media (max-width: 800px) {
  .sidebar { position: fixed; left: 0; right: 0; bottom: var(--foot-h, 34px); z-index: 39; flex-direction: row; overflow-x: auto; border-right: 0; border-top: 1px solid var(--line); padding: 6px; gap: 4px; }
  .nav-item { flex: none; padding: 8px 10px; font-size: 12.5px; white-space: nowrap; }
  .ico { margin-right: 4px; }
  .app { padding-bottom: calc(var(--foot-h, 34px) + 64px); }
  .content { padding: 14px 12px 20px; }
  .user .who { display: none; }
  .dash-grid, .doc-grid, .cond { grid-template-columns: 1fr; }
  .withdraw { bottom: calc(var(--foot-h, 34px) + 62px); }
  #toasts { bottom: calc(var(--foot-h, 34px) + 70px); }
  .kanban { grid-template-columns: repeat(5, 230px); }
  .crm-foot a { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .mk-track { animation: none; padding-left: 12px; }
  .goose-fly, .flock, .app.honking, tr.eaten { animation: none; }
  .app { transition: none; }
}

/* KPI value + unit stay on one line */
.kpi b > span { display: inline; font-size: inherit; color: inherit; }
