* { box-sizing: border-box; }
html, body, #app { height: 100%; margin: 0; }
body { font-family: ui-sans-serif, system-ui, sans-serif; background: #f3efe6; color: #1c1917; }
.v-b { display: grid; grid-template-columns: 232px 1fr; height: 100%; }
.side { background: #1c1917; color: #e7e5e4; padding: 24px 16px; display: flex; flex-direction: column; gap: 6px; }
.side .brand { font-family: Georgia, serif; font-size: 26px; margin-bottom: 24px; }
.side button { text-align: left; background: transparent; border: 0; color: #a8a29e; padding: 10px 12px; border-radius: 10px; cursor: pointer; }
.side button.on { background: #c2410c; color: #fff; }
.side .foot { margin-top: auto; font-size: 12px; color: #78716c; }
.main { padding: 28px 32px; overflow: auto; }
h1 { font-weight: 500; font-size: 28px; margin: 0 0 8px; }
.lede { display:none; color: #57534e; margin-bottom: 20px; }
.card { background: #fffcf7; border: 1px solid #e7e0d4; border-radius: 16px; padding: 18px; margin-bottom: 16px; }
.filters { display: grid; grid-template-columns: repeat(4, minmax(160px, 1fr)); gap: 12px; align-items: end; }
.filter-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
label.chk { display: flex; flex-direction: row; align-items: center; gap: 8px; color: #1c1917; font-size: 13px; white-space: nowrap; }
label.chk input { accent-color: #c2410c; }
label { font-size: 12px; color: #78716c; display: grid; gap: 6px; }
input, select { border: 1px solid #d6d3d1; border-radius: 10px; padding: 8px 10px; font: inherit; }
input[type="datetime-local"] { min-width: 0; width: 100%; }
.go { background: #c2410c; color: #fff; border: 0; border-radius: 999px; padding: 10px 18px; font-weight: 600; cursor: pointer; }
.ghost { background: #fff; border: 1px solid #d6d3d1; border-radius: 999px; padding: 8px 14px; cursor: pointer; }
table { width: 100%; border-collapse: collapse; }
td { padding: 10px 16px; border-bottom: 1px solid #f0ebe3; }
table.logs { 
	table-layout: auto;
	font-size: 10pt;
	word-wrap:break-word;
	border-collapse: separate;
}

th {
	text-align: left;
	font-size: 12pt;
	background-color:#808080;
	color:#FFFFFF;
	padding: 8px;
	border-bottom: 1px solid #e7e0d4;
}
table.logs th.id, table.logs td.id,
table.logs th.t, table.logs td.t,
table.logs th.lv, table.logs td.lv,
table.logs th.tag, table.logs td.tag,
table.logs th.user, table.logs td.user {
  width: 1%;
  white-space: nowrap;
  vertical-align: middle;
}
table.logs td.id {
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  color: #78716c;
}
table.logs td.t {
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
}
table.logs td.tag, table.logs td.user {
  max-width: 14em;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-link {
  appearance: none;
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  font: inherit;
  color: #9a3412;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  max-width: 14em;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-link:hover { color: #c2410c; }
.user-id-line { margin: 0 0 12px; }
.user-id-line code { font-size: 14px; }
.modal h2 { font-family: Georgia, serif; font-weight: 500; font-size: 22px; margin: 0 0 8px; }
table.kv th {
  width: 1%;
  white-space: nowrap;
  background: transparent;
  color: #78716c;
  font-weight: 500;
  font-size: 13px;
  text-align: left;
  padding: 8px 16px 8px 0;
  border-bottom: 1px solid #f0ebe3;
}
table.kv td { font-size: 14px; padding: 8px 0; }
table.logs th.prev, table.logs td.prev {
  width: 99%;
  white-space: normal;
  overflow: hidden;
}
td.prev pre {
  margin: 0px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
table.evts { table-layout: fixed; width: 100%; }
table.evts col.col-t { width: 13em; }
table.evts col.col-ev { width: 13em; }
table.evts col.col-user { width: 7em; }
table.evts col.col-props { width: auto; }
table.evts th.t, table.evts td.t,
table.evts th.ev, table.evts td.ev,
table.evts th.user, table.evts td.user {
  white-space: nowrap;
  vertical-align: middle;
  overflow: hidden;
  text-overflow: ellipsis;
}
table.evts th.props, table.evts td.props {
  min-width: 0;
  white-space: normal;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  color: #44403c;
}
input[type="date"] { min-width: 0; width: 100%; }
tr[data-eid] { cursor: pointer; }
tr{
	background-color: #fff;
}
tr.tr1 {
	background-color: #eee; 
}
td.lv * { border-radius: 999px; padding: 2px 8px; font-size: 12px; }
.lv-error, .lv-fatal { background: #fee2e2; color: #991b1b; }
.lv-warn { background: #ffedd5; color: #9a3412; }
.lv-info { background: #e0f2fe; color: #075985; }
.lv-debug, .lv-trace { background: #f5f5f4; color: #44403c; }
.ms { position: relative; }
.ms-btn { width: 100%; text-align: left; border: 1px solid #d6d3d1; border-radius: 10px; padding: 8px 10px; background: #fff; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #1c1917; }
.ms-drop { display: none; position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px); background: #fff; border: 1px solid #e7e0d4; border-radius: 12px; padding: 8px; box-shadow: 0 10px 30px rgba(28,25,23,.12); max-height: 240px; overflow: auto; }
.ms.open .ms-drop { display: grid; gap: 2px; }
.ms-opt { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; cursor: pointer; color: #1c1917; font-size: 13px; }
.ms-opt:hover { background: #faf6ef; }
.ms-opt input { accent-color: #c2410c; }
.ms-empty { margin: 0; padding: 8px; color: #78716c; }
.modal-bg { position: fixed; inset: 0; background: rgba(28,25,23,.45); display: flex; align-items: center; justify-content: center; }
.modal { background: #fff; width: min(640px, 92vw); max-height: 80vh; overflow: auto; border-radius: 18px; padding: 24px; }
.modal pre { background: #1c1917; color: #e7e5e4; padding: 14px; border-radius: 12px; white-space: pre-wrap; }
.login { grid-column: 1 / -1; display: grid; place-items: center; }
.login .card { width: 380px; }
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.warn { color: #b45309; }
.cli-url { margin-top: 10px; font-size: 12px; word-break: break-all; background: #faf6ef; border-radius: 10px; padding: 10px 12px; }
.pager { display: flex; gap: 8px; align-items: center; margin-top: 12px; flex-wrap: wrap; color: #57534e; font-size: 13px; }
.pager-hint { color: #78716c; }
.ghost:disabled { opacity: 0.4; cursor: not-allowed; }
.dash-toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.dash-toolbar .rpt-meta { margin: 0; }
.rpt-pick { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; }
.rpt-pager { display: flex; flex-wrap: wrap; gap: 6px; align-items: end; }
.rpt-pager input[type="date"] { min-width: 10.5em; }
.rpt-meta { font-size: 13px; opacity: 0.75; margin: 0 0 16px; }
.rpt-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 16px; }
.rpt-kpi { padding: 12px; border-radius: 8px; border: 1px solid rgba(127,127,127,.25); }
.rpt-kpi span { font-size: 12px; opacity: 0.7; display: block; }
.rpt-kpi b { font-size: 22px; display: block; margin: 4px 0; }
.rpt-kpi small { opacity: 0.6; }
.rpt-sec-title { font-size: 13px; margin: 8px 0; opacity: 0.8; }
.rpt-bar { display: grid; grid-template-columns: 88px 1fr 64px; gap: 8px; align-items: center; margin: 6px 0; font-size: 13px; }
.rpt-bar .track { height: 8px; background: rgba(127,127,127,.2); border-radius: 99px; overflow: hidden; }
.rpt-bar .fill { height: 100%; border-radius: 99px; background: #c2410c; }
.rpt-funnel, .funnel-mini { display: grid; gap: 8px; }
.funnel-mini .step, .rpt-funnel .step { text-align: center; padding: 10px 8px; border-radius: 6px; background: rgba(127,127,127,.12); }
.dash-grid { display: grid; gap: 16px; align-items: stretch; }
.dash-cell { min-width: 0; margin-bottom: 0; }
.dash-cell.bare { background: transparent; border: 0; padding: 0; }
.dash-chart { width: 100%; height: 280px; }
.dash-callout { border-left: 4px solid #c2410c; padding: 12px 16px; background: #fff7ed; border-radius: 0 8px 8px 0; }
.dash-callout strong { display: block; margin-bottom: 4px; }
.dash-callout p { margin: 0; color: #57534e; }
.widget-lib h2 { font-size: 16px; margin: 0; }
.settings-card h2 { font-size: 16px; margin: 0; }
.set-h { font-size: 13px; margin: 16px 0 8px; color: #57534e; font-weight: 600; }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; align-items: end; }
.settings-grid.ro input { background: #f5f5f4; color: #57534e; }
.settings-card .chk { margin-top: 8px; }
.widget-editor label { display: block; margin: 10px 0; }
.widget-editor textarea { width: 100%; min-height: 160px; font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.widget-lib .js-preview { font-family: ui-monospace, Consolas, monospace; font-size: 11px; max-width: 28em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.widget-lib td.actions { white-space: nowrap; }
.muted { color: #78716c; }
@media (max-width: 800px) {
  .dash-cell { grid-column: 1 / -1 !important; }
  .metrics { grid-template-columns: 1fr 1fr; }
}
