:root {
  --bg: #121316;
  --bg-sidebar: #0e0f11;
  --surface: #181a1f;
  --surface-2: #1e2128;
  --border: #2a2d35;
  --border-light: #353942;

  --text: #e4e4e7;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;

  --accent: #a89060;
  --accent-hover: #bfa070;
  --accent-muted: rgba(168, 144, 96, 0.12);

  --ok: #4ade80;
  --warn: #f87171;
  --info: #60a5fa;

  --font: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: ui-monospace, 'Cascadia Code', 'Segoe UI Mono', monospace;

  --sidebar-w: 220px;
  --topbar-h: 48px;
  --radius: 4px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-font-smoothing: antialiased; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.5;
}

.hidden { display: none !important; }
.muted { color: var(--text-muted); }

* {
  scrollbar-width: thin;
  scrollbar-color: #3f3f46 var(--bg-sidebar);
}

*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: var(--bg-sidebar); }
*::-webkit-scrollbar-thumb { background: #3f3f46; border-radius: 4px; }

h1, h2, h3 {
  margin: 0;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

h1 { font-size: 1.25rem; }
h2 { font-size: 0.9375rem; }
h3 { font-size: 0.8125rem; font-weight: 600; color: var(--text-secondary); }

p { margin: 0; color: var(--text-secondary); font-size: 0.8125rem; }

.nav-label {
  display: block;
  padding: 0 10px;
  margin-bottom: 4px;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

/* buttons & inputs */

button, input, select, textarea {
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
}

button { cursor: pointer; border: none; background: none; padding: 0; }

.btn-primary,
.btn-secondary,
.btn-ghost,
.nav-item,
.log-type-btn,
.hub-link,
#filters button,
.config-toolbar button,
.view-footer button,
.price-edit button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: var(--radius);
  font-weight: 500;
}

.btn-primary,
#filters button[type="submit"],
.config-toolbar button[type="submit"],
#devlog-analyze {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #111;
}

.btn-primary:hover,
#filters button[type="submit"]:hover,
.config-toolbar button[type="submit"]:hover,
#devlog-analyze:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-secondary,
#refresh, #refresh-stats, #refresh-system, #refresh-config, #refresh-devlog {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}

.btn-secondary:hover,
#refresh:hover, #refresh-stats:hover, #refresh-system:hover,
#refresh-config:hover, #refresh-devlog:hover {
  background: var(--surface-2);
  border-color: var(--border-light);
}

.btn-ghost,
#clear, #prev, #next {
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover,
#clear:hover, #prev:hover, #next:hover {
  background: var(--surface);
  color: var(--text);
}

input, select, textarea {
  width: 100%;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-sidebar);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
}

textarea {
  min-height: 52px;
  padding: 8px 10px;
  resize: vertical;
}

select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath d='M2 3.5L5 6.5L8 3.5' stroke='%2371717a' stroke-width='1.2' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 28px;
}

/* welcome */

.welcome-view {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: var(--bg-sidebar);
}

.welcome-panel {
  width: min(320px, 90vw);
  padding: 32px 28px;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.welcome-panel .brand-mark {
  margin: 0 auto 16px;
}

.welcome-panel h1 {
  font-size: 1.375rem;
  margin-bottom: 4px;
}

.welcome-sub {
  margin-bottom: 20px;
  color: var(--text-muted);
  font-size: 0.8125rem;
}

.welcome-panel .btn-primary {
  width: 100%;
}

.login-form {
  display: grid;
  gap: 12px;
  text-align: left;
}

.login-form label {
  display: grid;
  gap: 4px;
  font-size: 12px;
  color: var(--text-muted);
}

.login-form input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
}

.login-error {
  margin: 0;
  font-size: 12px;
  color: var(--danger, #f87171);
}

.sidebar-foot {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: grid;
  gap: 8px;
}

.sidebar-user {
  display: grid;
  gap: 2px;
  padding: 0 8px;
}

.sidebar-user-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

.sidebar-user-role {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sidebar-logout {
  width: 100%;
  justify-content: center;
  font-size: 12px;
}

.users-layout {
  height: calc(100% - 64px);
  min-height: 320px;
}

.users-table td:last-child {
  width: 220px;
  text-align: right;
}

.users-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.users-flash {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 30;
  max-width: 420px;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(10, 12, 16, 0.95);
  color: var(--text);
  font-size: 13px;
  white-space: pre-wrap;
}

.panel-dialog {
  width: min(560px, calc(100vw - 24px));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0;
  background: var(--surface);
  color: var(--text);
}

.panel-dialog::backdrop {
  background: rgba(0, 0, 0, 0.55);
}

.panel-dialog-body {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.panel-dialog-head,
.panel-dialog-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.panel-dialog-head h3 {
  margin: 0;
  font-size: 15px;
}

.panel-dialog-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.panel-dialog-grid label {
  display: grid;
  gap: 4px;
  font-size: 12px;
  color: var(--text-muted);
}

.panel-dialog-grid input,
.panel-dialog-grid select {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
}

.users-active-label {
  display: flex !important;
  align-items: center;
  gap: 8px;
  padding-top: 22px;
}

.users-permissions-field {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
}

.users-permissions-field legend {
  padding: 0 4px;
  font-size: 12px;
  color: var(--text-muted);
}

.users-permissions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 6px 10px;
  margin-top: 8px;
}

.users-permissions-grid label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-secondary);
}

@media (max-width: 640px) {
  .panel-dialog-grid { grid-template-columns: 1fr; }
  .users-active-label { padding-top: 0; }
}

/* layout */

body.panel-open {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 16px 10px;
  border-right: 1px solid var(--border);
  background: var(--bg-sidebar);
  overflow: hidden;
}

.app-shell {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
  background: var(--bg);
}

.topbar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--topbar-h);
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-sidebar);
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
}

.breadcrumb-home {
  padding: 0;
  min-height: auto;
  color: var(--text-secondary);
  font-weight: 500;
}

.breadcrumb-home:hover { color: var(--text); }

.breadcrumb-sep { opacity: 0.4; }

#breadcrumb-current { color: var(--text); font-weight: 500; }

#panel-clock {
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: var(--text-muted);
}

/* brand & nav */

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 16px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
}

.brand-text strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
}

.brand-text small {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
}

.nav-main {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.nav-item {
  justify-content: flex-start;
  width: 100%;
  min-height: 34px;
  padding: 0 10px;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-secondary);
  font-weight: 500;
  text-align: left;
}

.nav-item:hover {
  background: var(--surface);
  color: var(--text);
}

.nav-item.active {
  background: var(--accent-muted);
  color: var(--text);
  box-shadow: inset 2px 0 0 var(--accent);
}

.log-types {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  overflow-y: auto;
}

.log-type-btn {
  justify-content: flex-start;
  width: 100%;
  min-height: 30px;
  padding: 0 10px;
  border: none;
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 12px;
  text-align: left;
}

.log-type-btn:hover { background: var(--surface); color: var(--text-secondary); }

.log-type-btn.active {
  background: var(--surface);
  color: var(--text);
}

/* main sections */

main {
  flex: 1;
  min-height: 0;
  padding: 16px 20px 24px;
  overflow: hidden;
}

main > section {
  height: calc(100vh - var(--topbar-h) - 40px);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.view-header {
  flex-shrink: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}

.view-header p { margin-top: 4px; }

.view-header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex-shrink: 0;
  align-items: center;
}

.view-footer {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-sidebar);
}

.page-label {
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* hub */

#hub-view { overflow-y: auto; }

.hub-live {
  display: grid;
  grid-template-columns: 240px 1fr 1fr;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}

.hub-live-online,
.hub-live-panel {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-sidebar);
  min-height: 220px;
  display: flex;
  flex-direction: column;
}

.hub-live-online-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.hub-live-badge {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.hub-live-badge.is-live { color: var(--ok); }
.hub-live-badge.is-off { color: var(--warn); }

.hub-live-count-row {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.hub-live-count-row strong {
  font-size: 2rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.hub-online-cap {
  font-size: 14px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.hub-online-list-wrap {
  flex: 1;
  min-height: 0;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  overflow: hidden;
}

.hub-player-list,
.hub-session-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  flex: 1;
}

.hub-player-list li,
.hub-session-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}

.hub-player-list li:last-child,
.hub-session-list li:last-child { border-bottom: 0; }

.hub-session-list .name-block { min-width: 0; flex: 1; }

.hub-player-list .name,
.hub-session-list .name {
  display: block;
  color: var(--text);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hub-session-list .meta {
  flex-shrink: 0;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.hub-session-list .sub {
  display: block;
  margin-top: 1px;
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hub-session-list .sub.reason { color: var(--warn); }

.hub-sync-label {
  margin: 4px 0 0;
  font-size: 11px;
  color: var(--text-muted);
}

.hub-player-list .name-block {
  min-width: 0;
  flex: 1;
}

.hub-player-list .sub {
  display: block;
  margin-top: 2px;
  font-size: 10px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.hub-list-empty {
  padding: 12px 0;
  color: var(--text-muted);
  font-size: 12px;
  list-style: none;
}

.hub-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 16px 18px;
}

.hub-link {
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-sidebar);
  color: var(--text-secondary);
  font-weight: 500;
}

.hub-link:hover {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border-light);
}

/* ai / filters */

.ai-box {
  flex-shrink: 0;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-sidebar);
}

.ai-box-intro strong {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
}

.ai-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-top: 10px;
}

.ai-answer {
  margin-top: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  color: var(--text-secondary);
}

.filters-bar {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
}

.filters-bar--compact {
  padding: 8px 14px;
  gap: 0;
}

.filters-row { display: grid; gap: 8px; }

.filters-row--primary {
  grid-template-columns: 1fr auto auto;
}

.filters-row--secondary {
  grid-template-columns: repeat(5, 1fr) repeat(2, minmax(140px, 1fr)) 80px;
}

/* tables */

.table-wrap {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.data-table {
  width: 100%;
  min-width: 1200px;
  border-collapse: collapse;
  font-size: 12px;
}

.data-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 8px 10px;
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-align: left;
}

.data-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  color: var(--text-secondary);
}

.data-table tbody tr:hover td { background: rgba(255, 255, 255, 0.02); }

.data-table td strong { color: var(--text); font-weight: 500; }

.data-table .message {
  max-width: 480px;
  line-height: 1.4;
}

.data-table .message strong { display: block; margin-bottom: 2px; }

.empty-row td {
  padding: 32px !important;
  text-align: center;
  color: var(--text-muted) !important;
}

/* pills */

.pill {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 3px;
  border: 1px solid var(--border);
  background: var(--bg-sidebar);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-secondary);
}

.pill-death { border-color: #7f1d1d; color: #fca5a5; background: rgba(127, 29, 29, 0.2); }
.pill-admin { border-color: #713f12; color: #fcd34d; background: rgba(113, 63, 18, 0.2); }
.pill-economy, .pill-banking { border-color: #14532d; color: #86efac; background: rgba(20, 83, 45, 0.2); }
.pill-inventory, .pill-storage { border-color: #1e3a5f; color: #93c5fd; background: rgba(30, 58, 95, 0.2); }
.pill-shop, .pill-craft { border-color: #44403c; color: #d6d3d1; background: rgba(68, 64, 60, 0.3); }
.pill-job { border-color: #365314; color: #bef264; background: rgba(54, 83, 20, 0.2); }
.pill-medical { border-color: #134e4a; color: #5eead4; background: rgba(19, 78, 74, 0.2); }
.pill-housing { border-color: #44403c; color: #d6d3d1; background: rgba(68, 64, 60, 0.2); }
.pill-success { border-color: #14532d; color: #86efac; background: rgba(20, 83, 45, 0.2); }

.pill-action-add { border-color: #14532d; color: #86efac; background: rgba(20, 83, 45, 0.18); }
.pill-action-remove { border-color: #7f1d1d; color: #fca5a5; background: rgba(127, 29, 29, 0.18); }
.pill-action-danger { border-color: #991b1b; color: #fecaca; background: rgba(153, 27, 27, 0.22); }
.pill-action-warn { border-color: #854d0e; color: #fde68a; background: rgba(133, 77, 14, 0.18); }
.pill-action-neutral { border-color: #334155; color: #cbd5e1; background: rgba(51, 65, 85, 0.25); }

/* logs — feed em cartões (leitura rápida) */

.logs-feed-wrap {
  background: rgba(0, 0, 0, 0.12);
}

.logs-feed-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}

.logs-feed-thead th {
  padding: 8px 14px;
  font-size: 11px;
}

.log-feed-row td {
  padding: 0;
  border: none;
  vertical-align: top;
}

.log-feed-cell {
  padding: 0 8px 6px !important;
}

.log-feed-row:first-child .log-feed-cell {
  padding-top: 8px !important;
}

.log-feed-row .empty-row td {
  padding: 24px 14px !important;
  color: var(--text-muted);
  text-align: center;
}

.log-card {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.log-card-inner {
  padding: 8px 10px 8px 14px;
}

.log-card-accent {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--border);
}

.log-card-accent--add { background: #22c55e; }
.log-card-accent--remove { background: #ef4444; }
.log-card-accent--join { background: #22c55e; }
.log-card-accent--leave { background: #f97316; }
.log-card-accent--death,
.log-card-accent--danger { background: #dc2626; }
.log-card-accent--shop { background: #eab308; }
.log-card-accent--money { background: #4ade80; }
.log-card-accent--storage { background: #60a5fa; }
.log-card-accent--admin,
.log-card-accent--warn { background: #fbbf24; }
.log-card-accent--job { background: #a3e635; }
.log-card-accent--craft { background: #a8a29e; }
.log-card-accent--neutral { background: #64748b; }

.log-card-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin-bottom: 5px;
}

.log-card-type {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.log-card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  flex-shrink: 0;
}

.log-card--join .log-card-icon { color: #86efac; border-color: rgba(34, 197, 94, 0.35); }
.log-card--leave .log-card-icon { color: #fdba74; border-color: rgba(249, 115, 22, 0.35); }
.log-card--shop .log-card-icon { color: #fde047; border-color: rgba(234, 179, 8, 0.35); }
.log-card--death .log-card-icon { color: #fca5a5; border-color: rgba(220, 38, 38, 0.35); }
.log-card--add .log-card-icon { color: #86efac; border-color: rgba(34, 197, 94, 0.35); }
.log-card--remove .log-card-icon { color: #fca5a5; border-color: rgba(239, 68, 68, 0.35); }
.log-card--money .log-card-icon { color: #86efac; border-color: rgba(74, 222, 128, 0.35); }
.log-card--storage .log-card-icon { color: #93c5fd; border-color: rgba(96, 165, 250, 0.35); }

.log-card-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text);
  text-transform: uppercase;
}

.log-card-meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-left: auto;
  font-size: 10px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.log-card-meta time {
  font-size: inherit;
  color: inherit;
}

.log-card-ref {
  font-size: inherit;
  color: inherit;
  opacity: 0.85;
}

.log-card-body {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  line-height: 1.35;
}

.log-card-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.log-card-body .log-chip {
  padding: 1px 7px;
  font-size: 10px;
}

.log-card-sep {
  color: var(--text-muted);
  opacity: 0.45;
  font-size: 11px;
  user-select: none;
}

.log-card-what {
  flex: 1 1 160px;
  min-width: 0;
  font-size: 13px;
  line-height: 1.35;
  color: var(--text-secondary);
  font-weight: 500;
}

.log-card-highlight {
  color: var(--text);
  font-weight: 700;
}

.log-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.log-card-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  font-size: 10px;
  color: var(--text-secondary);
}

.log-card-tag-icon {
  opacity: 0.75;
  font-size: 10px;
}

.log-card .log-details {
  margin-top: 6px;
}

/* logs — layout administrativo (legado) */

.logs-table-wrap {
  background: var(--bg);
}

.data-table.logs-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}

.logs-table col.col-log-time { width: 9%; }
.logs-table col.col-log-event { width: 12%; }
.logs-table col.col-log-identity { width: 21%; }
.logs-table col.col-log-summary { width: 58%; }

.logs-table .log-row td {
  padding: 12px 14px;
}

.log-cell--time {
  width: 9%;
  white-space: nowrap;
}

.log-cell--event {
  width: 12%;
}

.log-cell--identity {
  width: 21%;
  min-width: 0;
}

.log-cell--summary {
  width: 58%;
  min-width: 0;
}

.log-cell--summary .log-summary {
  width: 100%;
  max-width: none;
}

.log-time {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.log-time-value {
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.log-time-date,
.log-time-weekday {
  font-size: 11px;
  color: var(--text-muted);
}

.log-ref {
  margin-top: 4px;
  font-size: 10px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.log-badges {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 6px;
}

.log-identity {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.log-character {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.25;
}

.log-id-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.log-chip {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

button.log-chip {
  cursor: pointer;
  font: inherit;
}

button.log-chip:hover {
  border-color: var(--accent);
  color: var(--text);
}

.log-chip--primary {
  border-color: rgba(59, 130, 246, 0.45);
  color: #93c5fd;
  background: rgba(30, 58, 95, 0.25);
  font-family: var(--font-mono);
}

.log-chip--job {
  border-color: rgba(132, 204, 22, 0.35);
  color: #bef264;
  background: rgba(54, 83, 20, 0.18);
}

.log-chip--resource {
  border-color: rgba(100, 116, 139, 0.45);
  color: #cbd5e1;
}

.log-chip--muted {
  color: var(--text-muted);
}

.log-chip.is-copied {
  border-color: var(--ok);
  color: var(--ok);
}

.log-summary {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.log-headline {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text);
  font-weight: 500;
}

.log-detail-line {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-muted);
  word-break: break-word;
}

.log-summary--ranch .log-facts {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (min-width: 1280px) {
  .log-summary--ranch .log-facts {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.log-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
  width: 100%;
}

.log-fact {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.02);
}

.log-fact em {
  font-style: normal;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.log-fact strong {
  font-size: 12px;
  color: var(--text);
  font-weight: 600;
  word-break: break-word;
}

.log-fact small,
.log-item-code {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 500;
}

.log-tech-code {
  font-size: 10px;
  color: var(--text-muted);
  font-family: var(--font-mono, monospace);
}

.log-fact--money strong {
  color: #86efac;
}

.log-details {
  margin-top: 2px;
  font-size: 11px;
  color: var(--text-muted);
}

.log-details summary {
  cursor: pointer;
  user-select: none;
  color: var(--text-secondary);
}

.log-details summary:hover {
  color: var(--text);
}

.log-details-body {
  margin-top: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.15);
  line-height: 1.45;
  word-break: break-word;
}

.log-details-body strong {
  color: var(--text-secondary);
  font-weight: 600;
}

.log-row:hover td {
  background: rgba(255, 255, 255, 0.025);
}

.badge-count {
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 3px;
  font-size: 11px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* metrics & charts */

.stats-grid,
.system-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 16px 18px;
  flex-shrink: 0;
}

#stats-view {
  overflow-y: auto;
}

.stats-layout {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 12px;
  padding: 16px 18px 24px;
}

.stats-total-card {
  grid-column: 1;
  grid-row: 1;
}

.stats-chart-card:first-of-type {
  grid-column: 2;
  grid-row: 1;
}

.stats-chart-card:last-of-type {
  grid-column: 3;
  grid-row: 1;
}

.stats-inventory-card {
  grid-column: 1 / -1;
}

.stats-inventory-card h2 {
  margin: 4px 0 0;
  font-size: 1.15rem;
  font-weight: 600;
}

.stats-distribution {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  margin-top: 10px;
}

.stats-donut {
  position: relative;
  width: 132px;
  height: 132px;
  border-radius: 50%;
  display: grid;
  place-items: center;
}

.stats-donut-hole {
  width: 78px;
  height: 78px;
  border-radius: 50%;
  background: var(--bg-sidebar);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 8px;
}

.stats-donut-hole strong {
  font-size: 1rem;
  line-height: 1.1;
}

.stats-donut-hole span {
  margin-top: 4px;
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1.2;
}

.stats-donut-empty {
  font-size: 1.25rem;
  color: var(--text-muted);
}

.stats-bar-list {
  min-width: 0;
}

.stats-sparkline-wrap {
  margin-top: 12px;
  min-height: 120px;
}

.stats-sparkline {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(18px, 1fr);
  align-items: end;
  gap: 6px;
  height: 120px;
  padding-top: 8px;
}

.stats-sparkline-bar {
  position: relative;
  min-height: 6px;
  border-radius: 4px 4px 2px 2px;
  background: linear-gradient(180deg, rgba(59, 130, 246, 0.95), rgba(59, 130, 246, 0.35));
  align-self: end;
}

.stats-sparkline-bar span {
  position: absolute;
  left: 50%;
  bottom: -18px;
  transform: translateX(-50%);
  font-size: 9px;
  color: var(--text-muted);
  white-space: nowrap;
}

.stats-sparkline-legend {
  margin-top: 24px;
  font-size: 12px;
}

.stats-inventory-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 12px;
}

.stats-inventory-panel h3 {
  margin: 0 0 8px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.stats-inventory-panel--wide {
  grid-column: 1 / -1;
}

.stats-daily-chart {
  min-height: 140px;
}

.stats-daily-bars {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  align-items: end;
  gap: 10px;
  height: 140px;
  padding-top: 8px;
}

.stats-daily-bar {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
  min-height: 8px;
  border-radius: 6px 6px 2px 2px;
  background: linear-gradient(180deg, rgba(34, 197, 94, 0.95), rgba(34, 197, 94, 0.28));
  padding: 8px 4px 6px;
}

.stats-daily-bar strong {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.stats-daily-bar span {
  font-size: 10px;
  color: var(--text-muted);
}

.stats-compact-bars .bar-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-card,
.chart-card,
.panel-block {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-sidebar);
}

.metric-card strong,
.chart-card-head strong {
  display: block;
  margin-top: 6px;
  font-size: 1.5rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.metric-card--wide { grid-column: span 2; }
.stats-grid .metric-card--wide { grid-column: span 2; }

.metric-label,
.stat-extra-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.metric-detail {
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

.metric-detail--sub {
  margin-top: 4px;
  font-size: 11px;
  opacity: 0.9;
}

.metric-card--detail strong {
  color: var(--accent);
}

.metric-link {
  all: unset;
  display: inline-block;
  margin-top: 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.metric-link:hover {
  color: var(--text);
}

.metric-link.hidden {
  display: none;
}

.chart-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.chart-card-head strong { margin-top: 0; font-size: 1.125rem; }

.chart-wrap {
  height: 96px;
  margin: 10px 0 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #0a0b0d;
  overflow: hidden;
}

.metric-chart {
  display: block;
  width: 100%;
  height: 100%;
}

.chart-grid-line { stroke: rgba(255, 255, 255, 0.05); stroke-width: 1; }

.chart-legend {
  display: flex;
  gap: 12px;
  font-size: 11px;
  color: var(--text-muted);
}

.chart-legend-item::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 2px;
  margin-right: 4px;
  vertical-align: middle;
}

.chart-legend-rx::before { background: var(--ok); }
.chart-legend-tx::before { background: var(--accent); }

.stat-extra {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: grid;
  gap: 8px;
}

.stat-extra > div {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
}

.stat-extra-value {
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  color: var(--text);
}

.system-charts-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 16px 18px 0;
  flex-shrink: 0;
}

#system-view { overflow-y: auto; }
#system-view > .view-header { flex-shrink: 0; }
#system-view .panel-block { margin: 12px 18px 18px; flex-shrink: 0; }

.bar-list .bar,
.bar {
  display: grid;
  grid-template-columns: minmax(88px, 120px) minmax(0, 1fr) minmax(56px, max-content) minmax(42px, max-content);
  align-items: center;
  gap: 8px 10px;
  margin-top: 8px;
  font-size: 12px;
}

.bar--share {
  grid-template-columns: minmax(88px, 130px) minmax(0, 1fr) minmax(64px, max-content) minmax(44px, max-content);
}

.bar-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-value {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.bar-pct {
  text-align: right;
  font-style: normal;
  font-size: 11px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.track, .bar .track {
  height: 6px;
  border-radius: 2px;
  background: var(--border);
  overflow: hidden;
}

.fill, .bar .fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
}

.bar strong {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

@media (max-width: 1200px) {
  .stats-layout {
    grid-template-columns: 1fr 1fr;
  }

  .stats-total-card,
  .stats-chart-card:first-of-type,
  .stats-chart-card:last-of-type {
    grid-column: auto;
    grid-row: auto;
  }

  .stats-inventory-card {
    grid-column: 1 / -1;
  }
}

@media (max-width: 820px) {
  .stats-layout,
  .stats-inventory-grid,
  .stats-distribution {
    grid-template-columns: 1fr;
  }

  .stats-donut {
    margin: 0 auto;
  }
}

/* config */

.config-layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 220px 1fr;
  overflow: hidden;
}

.config-menu {
  padding: 12px;
  border-right: 1px solid var(--border);
  overflow-y: auto;
}

.config-menu button {
  width: 100%;
  justify-content: flex-start;
  min-height: 32px;
  margin-bottom: 2px;
  padding: 0 10px;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-secondary);
  text-align: left;
}

.config-menu button:hover { background: var(--surface-2); }
.config-menu button.active { background: var(--accent-muted); color: var(--text); }

.config-menu-group {
  margin-bottom: 12px;
}

.config-menu-group-label {
  display: block;
  margin: 0 0 4px;
  padding: 0 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.config-active-heading {
  padding: 12px 14px 0;
}

.config-active-heading h2 {
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 700;
}

.config-active-heading p {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
}

.config-resource-id {
  margin-top: 6px !important;
  font-size: 11px;
  font-family: ui-monospace, monospace;
  opacity: 0.75;
}

.config-category-hint {
  margin: 0;
  padding: 0 14px 8px;
  font-size: 12px;
  line-height: 1.4;
}

.config-section-row td {
  background: var(--surface-2);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding-top: 10px;
  padding-bottom: 10px;
}

.config-section-desc {
  margin-top: 4px;
  font-size: 12px;
}

.config-content {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.config-toolbar {
  display: grid;
  grid-template-columns: 180px minmax(160px, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}

.toolbar-hint { font-size: 12px; }

.config-table { min-width: 960px; }

.price-edit {
  display: grid;
  grid-template-columns: 1fr 64px;
  gap: 4px;
}

.price-edit button { font-size: 11px; padding: 0 6px; }

/* devlog */

#devlog-view {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#devlog-view > .view-header,
#devlog-view > .devlog-live-panel,
#devlog-view > .system-grid {
  flex-shrink: 0;
}

.devlog-live-toggle.is-active {
  border-color: color-mix(in srgb, var(--accent) 70%, var(--border));
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
}

.devlog-live-panel {
  margin: 0 18px 10px;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--border));
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.devlog-live-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--accent) 5%, var(--surface));
}

.devlog-live-status-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.devlog-live-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}

.devlog-live-panel:not(.hidden) .devlog-live-dot {
  background: #3ddc84;
  box-shadow: 0 0 8px color-mix(in srgb, #3ddc84 60%, transparent);
  animation: devlog-live-pulse 1.5s ease-in-out infinite;
}

@keyframes devlog-live-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.92); }
}

.devlog-live-head-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.devlog-live-feed {
  list-style: none;
  margin: 0;
  padding: 8px;
  max-height: min(280px, 35vh);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.devlog-live-empty {
  padding: 16px 12px;
  text-align: center;
  font-size: 12px;
  line-height: 1.45;
}

.devlog-live-item {
  display: grid;
  grid-template-columns: 4.75rem minmax(0, 1fr) auto auto;
  gap: 6px 10px;
  align-items: center;
  padding: 8px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.devlog-live-item:hover {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
}

.devlog-live-item.devlog-hitch-ms--critical { border-left: 3px solid #e74c3c; }
.devlog-live-item.devlog-hitch-ms--high { border-left: 3px solid #e67e22; }
.devlog-live-item.devlog-hitch-ms--warn { border-left: 3px solid #d4a017; }

.devlog-live-item--new {
  animation: devlog-live-flash 1.2s ease;
  border-color: color-mix(in srgb, var(--accent) 50%, var(--border));
}

@keyframes devlog-live-flash {
  0% { background: color-mix(in srgb, var(--accent) 24%, var(--bg)); }
  100% { background: var(--bg); }
}

.devlog-live-ms {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.devlog-live-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.devlog-live-loc {
  font-size: 13px;
  font-family: ui-monospace, monospace;
  word-break: break-all;
}

.devlog-live-script {
  font-size: 11px;
}

.devlog-live-meta {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

.devlog-metrics {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.devlog-metrics--extended {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  row-gap: 10px;
}

.devlog-metrics--extended .metric-card--detail .metric-detail {
  font-size: 11px;
}

.btn-ghost--tiny {
  font-size: 11px;
  padding: 3px 8px;
  min-height: 0;
}

.btn-secondary--small {
  font-size: 11px;
  padding: 4px 10px;
}

.devlog-filter-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

.devlog-hitches-table .devlog-col-when { width: 11rem; }
.devlog-hitches-table .devlog-col-ms { width: 5.5rem; }
.devlog-hitches-table .devlog-col-players { width: 3rem; text-align: center; }
.devlog-hitches-table .devlog-col-loc { min-width: 280px; }
.devlog-hitches-table .devlog-col-act { width: 5.5rem; }

.devlog-hitch-row {
  cursor: pointer;
}

.devlog-hitch-row:hover td {
  background: color-mix(in srgb, var(--accent) 6%, transparent);
}

.devlog-hitch-row.is-selected td {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
}

.devlog-hitch-row--unknown .devlog-col-loc {
  opacity: 0.92;
}

.devlog-hitch-ms {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.devlog-hitch-unit {
  font-size: 0.72em;
  font-weight: 500;
  opacity: 0.75;
}

.devlog-hitch-ms--warn { color: #d4a017; }
.devlog-hitch-ms--high { color: #e67e22; }
.devlog-hitch-ms--critical { color: #e74c3c; }

.devlog-loc {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 0;
}

.devlog-loc--missing,
.devlog-loc--pending {
  align-items: center;
}

.devlog-loc--pending {
  border-left: 3px solid color-mix(in srgb, var(--accent) 55%, transparent);
  padding-left: 6px;
}

.devlog-loc-badge--spin {
  animation: devlog-live-pulse 1s ease-in-out infinite;
  background: color-mix(in srgb, var(--accent) 22%, transparent);
}

.devlog-live-item.devlog-loc-pending {
  border-left: 3px solid color-mix(in srgb, var(--accent) 50%, var(--border));
}

.devlog-loc-badge {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  background: color-mix(in srgb, var(--warn, #d4a017) 25%, transparent);
  color: var(--text);
}

.devlog-loc-body {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 3px;
}

.devlog-loc-script {
  font-size: 14px;
  line-height: 1.2;
  color: var(--text);
}

.devlog-loc-tech {
  font-size: 11px;
  font-family: ui-monospace, monospace;
  color: var(--text-muted);
}

.devlog-loc-path {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
}

.devlog-loc-file {
  font-size: 12px;
  word-break: break-all;
}

.devlog-loc-lines {
  font-size: 12px;
}

.devlog-loc-line-num {
  font-size: 15px;
  color: var(--accent);
}

.devlog-loc-pointer {
  font-family: ui-monospace, monospace;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.02em;
}

.devlog-loc-fn-ms {
  font-size: 11px;
  color: var(--text-muted);
}

.devlog-loc-hint,
.devlog-loc-missing-file {
  font-size: 11px;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.35;
}

.devlog-loc-title {
  font-size: 12px;
}

.devlog-loc-actions {
  flex-shrink: 0;
  padding-top: 2px;
}

.devlog-hitches-dialog {
  width: min(1440px, calc(100vw - 16px));
  max-width: none;
  height: min(94vh, 960px);
  max-height: calc(100vh - 20px);
  margin: auto;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}

.devlog-hitches-dialog::backdrop {
  background: rgba(0, 0, 0, 0.72);
}

.devlog-hitches-dialog-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: 100%;
  min-height: 0;
  padding: 14px 16px 16px;
  box-sizing: border-box;
}

.devlog-hitches-dialog-head h3 {
  margin: 0 0 4px;
  font-size: 16px;
}

.devlog-hitches-dialog-sub {
  margin: 0;
  font-size: 12px;
  line-height: 1.35;
}

.devlog-hitches-dialog-table {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}

.devlog-hitches-dialog-split {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
  gap: 12px;
  overflow: hidden;
}

.devlog-hitches-dialog-table {
  min-height: 0;
}

.devlog-hitches-dialog-table .process-table {
  min-width: 640px;
}

.devlog-hitch-detail-banner {
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border));
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
  font-size: 13px;
}

.devlog-hitch-detail-banner code {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
}

.devlog-hitch-detail {
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.devlog-hitch-detail-empty {
  margin: auto 0;
  text-align: center;
  line-height: 1.45;
}

.devlog-detail-head {
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
}

.devlog-detail-ms {
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
}

.devlog-detail-label {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.devlog-detail-script {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.devlog-detail-tech {
  margin: 4px 0 0;
  font-size: 12px;
}

.devlog-detail-file code,
.devlog-detail-pointer code {
  font-size: 13px;
  word-break: break-all;
}

.devlog-detail-line {
  margin: 0;
  font-size: 22px;
}

.devlog-detail-line strong {
  color: var(--accent);
}

.devlog-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.devlog-detail-steps {
  margin: 6px 0 0;
  padding-left: 18px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-secondary);
}

.devlog-detail-steps code {
  font-size: 11px;
}

.devlog-detail-alert {
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px dashed var(--border);
  background: var(--surface-2);
  font-size: 12px;
}

.devlog-detail-alert p {
  margin: 6px 0 0;
  color: var(--text-muted);
}

@media (max-width: 1100px) {
  .devlog-hitches-dialog-split {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(200px, 1fr) auto;
  }

  .devlog-hitch-detail {
    max-height: 240px;
  }
}

.devlog-last-entry {
  font-size: 0.95rem;
  line-height: 1.25;
  font-weight: 600;
}

.devlog-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(260px, 1fr) minmax(240px, 1.15fr);
  overflow: hidden;
  padding: 0 18px 18px;
  gap: 12px;
}

.devlog-scroll {
  grid-row: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 12px;
  overflow: hidden;
  padding-top: 14px;
}

.devlog-scroll .panel-block,
.devlog-body > .panel-block {
  margin: 0;
  min-width: 0;
}

.panel-block {
  margin: 0 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  min-width: 0;
}

.panel-block-head h2 { margin-bottom: 2px; }

.panel-block-head--split {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: nowrap;
}

.panel-block-head-text {
  flex: 1;
  min-width: 0;
}

.panel-block-head-text p {
  margin: 4px 0 0;
  line-height: 1.4;
}

.panel-block-head--split .badge-count {
  flex-shrink: 0;
  white-space: nowrap;
}

.panel-block .config-toolbar {
  padding: 0;
  border-bottom: none;
  background: transparent;
}

.devlog-panel-hitches {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.devlog-panel-hitches .panel-block-head,
.devlog-panel-hitches .devlog-filters {
  flex-shrink: 0;
}

.devlog-panel-hitches .table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}

.devlog-panel-hitches .process-table {
  min-width: 680px;
}

.devlog-filters {
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
}

.devlog-panel-profile {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.devlog-panel-profile .panel-block-head,
.devlog-panel-profile .devlog-profile-toolbar {
  flex-shrink: 0;
}

.devlog-resources-block {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.devlog-resources-block h3 {
  margin: 0 0 8px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.devlog-resources-wrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}

.devlog-compact-table { min-width: 520px; }

.devlog-panel-functions {
  grid-row: 2;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.devlog-panel-functions .panel-block-head,
.devlog-panel-functions .config-toolbar {
  flex-shrink: 0;
}

.devlog-functions-toolbar {
  flex-shrink: 0;
  grid-template-columns: minmax(0, 1fr) minmax(140px, 200px);
}

.devlog-functions-wrap {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}

.devlog-functions-table {
  min-width: 760px;
  width: 100%;
}

.devlog-functions-table td:nth-child(2),
.devlog-functions-table .devlog-file {
  font-family: var(--font-mono);
  font-size: 11px;
  word-break: break-all;
}

.devlog-sort {
  all: unset;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: inherit;
  white-space: nowrap;
}

.devlog-sort:hover { color: var(--text); }
.devlog-sort.active { color: var(--accent); }
.devlog-sort.active::after { content: ' ↑'; font-size: 9px; }
.devlog-sort.active.desc::after { content: ' ↓'; }

.devlog-profile-toolbar {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.devlog-profile-toolbar .toolbar-hint {
  grid-column: 1 / -1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (min-width: 900px) {
  .devlog-profile-toolbar {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1.2fr);
  }

  .devlog-profile-toolbar .toolbar-hint {
    grid-column: auto;
  }
}

.devlog-open-profile {
  min-height: 28px;
  padding: 0 10px;
  font-size: 11px;
  white-space: nowrap;
}

.process-table { min-width: 900px; }

#devlog-filters input,
#devlog-filters select {
  max-width: none;
  min-width: 0;
}

/* responsive */

@media (max-width: 1200px) {
  .filters-row--secondary { grid-template-columns: repeat(3, 1fr); }
  .stats-grid, .system-grid, .system-charts-grid { grid-template-columns: repeat(2, 1fr); }
  .hub-live { grid-template-columns: 1fr 1fr; }
  .hub-live-online { grid-column: span 2; }
}

@media (max-width: 900px) {
  body.panel-open { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    z-index: 50;
    width: var(--sidebar-w);
    transform: translateX(-100%);
  }
  .hub-live, .system-charts-grid { grid-template-columns: 1fr; }
  .hub-live-online { grid-column: span 1; }
  .filters-row--primary,
  .filters-row--secondary,
  .ai-form,
  .config-toolbar,
  .devlog-profile-toolbar,
  .devlog-functions-toolbar { grid-template-columns: 1fr; }
  .config-layout { grid-template-columns: 1fr; }
  .config-menu { max-height: 140px; border-right: 0; border-bottom: 1px solid var(--border); }
  .devlog-body { grid-template-rows: auto auto; overflow-y: auto; }
  .devlog-scroll {
    grid-template-columns: 1fr;
    overflow: visible;
  }
  .devlog-panel-hitches,
  .devlog-panel-profile {
    height: auto;
    min-height: 280px;
  }
  .devlog-panel-hitches .table-wrap {
    max-height: min(360px, 50vh);
  }
  .devlog-resources-wrap {
    max-height: min(220px, 30vh);
  }
}

@media (max-width: 640px) {
  main { padding: 10px; }
  main > section { height: calc(100vh - var(--topbar-h) - 20px); }
}

.map-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.map-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 14px;
  height: calc(100% - 64px);
  min-height: 420px;
}

.map-stage-wrap {
  min-height: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #0b0d11;
  overflow: hidden;
}

.map-stage {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 420px;
  background: #1a1410;
  overflow: hidden;
  touch-action: none;
  cursor: grab;
}

.map-stage.is-panning {
  cursor: grabbing;
}

.map-viewport {
  position: absolute;
  will-change: left, top, width, height;
}

.map-image {
  display: block;
  width: 100%;
  height: 100%;
  user-select: none;
  pointer-events: none;
  background: #1a1410;
  transition: filter 0.35s ease, opacity 0.35s ease;
}

.map-image.is-preview {
  filter: blur(0.35px) saturate(0.96);
}

.map-image.is-hd {
  filter: none;
  image-rendering: auto;
}

.map-quality-badge {
  padding: 0 6px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-right: 1px solid var(--border);
  margin-right: 2px;
}

.map-quality-badge.is-hd {
  color: #86efac;
}

.map-markers {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.map-zoom-controls {
  position: absolute;
  right: 12px;
  bottom: 36px;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(10, 12, 16, 0.88);
  backdrop-filter: blur(6px);
}

.map-zoom-btn {
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  border: 1px solid var(--border-light);
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.map-zoom-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.map-zoom-btn--wide {
  min-width: auto;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.map-zoom-level {
  min-width: 42px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

.map-zoom-hint {
  position: absolute;
  left: 12px;
  bottom: 10px;
  z-index: 5;
  margin: 0;
  font-size: 10px;
  color: var(--text-muted);
  pointer-events: none;
  opacity: 0.85;
}

.map-marker {
  position: absolute;
  transform: translate(-50%, -50%);
  z-index: 2;
  cursor: pointer;
  pointer-events: auto;
  border: none;
  padding: 0;
  background: transparent;
  line-height: 0;
}

.map-marker-dot {
  display: block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.92);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
  background: var(--accent);
}

.map-marker.is-selected .map-marker-dot {
  width: 8px;
  height: 8px;
  border-width: 1.5px;
  box-shadow: 0 0 0 2px rgba(168, 144, 96, 0.5), 0 1px 3px rgba(0, 0, 0, 0.45);
}

.map-marker-label {
  position: absolute;
  left: 50%;
  top: -4px;
  transform: translate(-50%, -100%);
  white-space: nowrap;
  font-size: 9px;
  line-height: 1.3;
  padding: 1px 5px;
  border-radius: 2px;
  background: rgba(10, 12, 16, 0.9);
  border: 1px solid var(--border-light);
  color: var(--text);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s ease;
}

.map-marker:hover .map-marker-label {
  opacity: 1;
}

.map-marker.job-law .map-marker-dot { background: #60a5fa; }
.map-marker.job-medic .map-marker-dot { background: #4ade80; }
.map-marker.job-outlaw .map-marker-dot { background: #f87171; }

.map-sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.map-sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

.map-sidebar-head h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
}

.map-player-list {
  list-style: none;
  margin: 0;
  padding: 8px;
  overflow: auto;
  flex: 1;
}

.map-player-list li {
  display: grid;
  gap: 2px;
  padding: 8px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  border: 1px solid transparent;
}

.map-player-list li:hover {
  background: var(--surface-2);
}

.map-player-list li.is-selected {
  border-color: var(--accent);
  background: var(--accent-muted);
}

.map-player-list .name {
  font-weight: 600;
  color: var(--text);
}

.map-player-list .meta {
  font-size: 11px;
  color: var(--text-muted);
}

.map-player-list .coords {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-secondary);
}

@media (max-width: 900px) {
  .map-layout { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  .map-sidebar { max-height: 220px; }
}

/* Empresas (WLjobs) */

.companies-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  margin-bottom: 10px;
}

.companies-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.companies-search {
  flex: 1 1 200px;
  min-width: 180px;
  max-width: 360px;
}

.companies-sort-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.companies-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.companies-stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg-sidebar);
  font-size: 11px;
  color: var(--text-secondary);
}

.companies-stat-pill strong {
  color: var(--text);
  font-weight: 600;
}

.companies-table-wrap {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-panel);
}

.companies-table {
  min-width: 1280px;
  font-size: 11px;
}

.companies-table .companies-head-group th {
  top: 0;
  padding: 6px 10px;
  font-size: 10px;
  letter-spacing: 0.06em;
  text-align: center;
  background: var(--bg-elevated, var(--bg-sidebar));
  border-bottom: 1px solid var(--border);
}

.companies-table thead tr:nth-child(2) th {
  top: 28px;
}

.companies-table th.num,
.companies-table td.num {
  text-align: right;
  width: 52px;
}

.companies-table .col-job {
  min-width: 120px;
  max-width: 160px;
}

.companies-table .col-name {
  min-width: 140px;
  max-width: 220px;
}

.companies-table .col-type {
  min-width: 88px;
  white-space: nowrap;
}

.companies-table .col-coords {
  min-width: 118px;
  max-width: 140px;
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.35;
}

.companies-table .col-coords.is-missing {
  color: var(--text-muted);
  opacity: 0.75;
}

.companies-table .col-coords.is-missing .coord-btn {
  border-style: dashed;
}

.companies-table .col-crafts {
  min-width: 100px;
  max-width: 180px;
  font-size: 10px;
  word-break: break-word;
}

.companies-table .col-setjob {
  min-width: 140px;
  white-space: nowrap;
}

.companies-table .coord-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 3px 6px;
  border-radius: 3px;
  border: 1px solid var(--border);
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
}

.companies-table .coord-btn:hover {
  border-color: var(--accent, #c9a227);
  color: var(--text);
}

.companies-table tbody tr.is-disabled td {
  opacity: 0.72;
}

.companies-table tbody tr.has-staff td.num {
  color: #86efac;
  font-weight: 600;
}

.companies-table tbody tr.is-missing-coords {
  box-shadow: inset 3px 0 0 #ca8a04;
}
