:root {
  --bg-main: #0a0a0a; --bg-card: #141414; --bg-field: #070707;
  --border: #2a2a2a; --border-strong: #3a3a3a;
  --text-main: #e0e0e0; --text-muted: #8f8f8f; --text-soft: #b8b8b8;
  --accent: #d4af37; --accent-hover: #b5952f;
  --shadow: rgba(0, 0, 0, 0.32);
}

* { box-sizing: border-box; }
body { margin: 0; font-family: "Segoe UI", system-ui, Arial, sans-serif; background: var(--bg-main); color: var(--text-main); overflow-x: hidden; }
header { height: 54px; padding: 0 24px; background: var(--bg-card); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
header h1 { margin: 0; color: #fff; font-size: 22px; font-weight: 650; letter-spacing: 0; }
header h1 span { color: var(--accent); }
.header-logos { display: flex; gap: 16px; align-items: center; }
.header-logos img { max-height: 32px; object-fit: contain; }

.layout { display: grid; grid-template-columns: 350px minmax(0, 1fr); gap: 24px; max-width: 1700px; margin: 0 auto; padding: 24px; min-height: calc(100vh - 54px); }
.sidebar { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.content { display: flex; flex-direction: column; gap: 18px; min-width: 0; }

.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 18px 46px var(--shadow); }
.card-inner { padding: 20px; }
.card h2 { margin: 0 0 16px; color: #fff; font-size: 16px; font-weight: 650; letter-spacing: 0.6px; text-transform: uppercase; }

.field-group { margin-top: 14px; }
label { display: block; margin: 0 0 7px; color: var(--text-muted); font-size: 13px; }
input, select { width: 100%; min-height: 38px; padding: 9px 10px; border: 1px solid var(--border-strong); border-radius: 6px; background: var(--bg-field); color: var(--text-main); font-size: 14px; outline: none; transition: border-color 0.2s; }
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.13); }

.flex-row { display: flex; gap: 10px; }
.flex-row .field-group { flex: 1; margin-top: 0; }
.period-toggle { margin-bottom: 12px; }
.period-toggle-label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.period-toggle-label span { font-weight: 500; }
.period-range { display: none; margin-bottom: 14px; }
.route-limits { margin-top: 14px; }

.checklist-container { display: flex; flex-direction: column; gap: 8px; max-height: 140px; overflow-y: auto; padding: 10px; background: var(--bg-field); border: 1px solid var(--border-strong); border-radius: 6px; }
.check-item { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-main); }
.check-item input[type="checkbox"] { width: 16px; height: 16px; min-height: auto; accent-color: var(--accent); cursor: pointer; margin: 0; }

button { width: 100%; min-height: 40px; margin-top: 16px; padding: 11px 14px; border: 0; border-radius: 6px; background: var(--accent); color: #080808; font-weight: 700; cursor: pointer; transition: 0.16s ease; }
button:hover { background: var(--accent-hover); }
button.outline { background: transparent; border: 1px solid var(--accent); color: var(--accent); }
button.outline:hover { background: rgba(212, 175, 55, 0.09); }
button.export { max-width: 320px; margin-top: 0; }
button.secondary { background: #333; color: #fff; margin-top: 0; max-width: 200px; font-weight: 500;}
button.secondary:hover { background: #444; }
.btn-muted-outline { border-color: #666; color: #999; }

.status-log { min-height: 36px; margin-top: 12px; color: var(--text-muted); font-size: 13px; line-height: 1.45; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat-box { min-height: 74px; padding: 12px 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg-main); text-align: center; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.stat-box strong { display: block; color: var(--accent); font-size: 19px; line-height: 1.1; }
.stat-box span { margin-top: 8px; color: var(--text-muted); font-size: 10px; text-transform: uppercase; }

.view-toolbar { display: flex; align-items: center; gap: 16px; padding: 12px 20px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; }
.view-toolbar .field-group { margin: 0; display: flex; align-items: center; gap: 10px; flex: 1; }
.view-toolbar label { margin: 0; white-space: nowrap; font-weight: 600; color: #fff; }
.view-toolbar select { max-width: 350px; background: #1e1e1e; border-color: var(--border-strong); }

.map-card { position: relative; padding: 0; overflow: hidden; min-width: 0; min-height: 400px; height: 50vh; transition: all 0.3s ease; }
.map-card.fullscreen { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; z-index: 9999; border-radius: 0; }
#map { width: 100%; height: 100%; background: #1e1e1e; }

.btn-fullscreen { position: absolute; top: 12px; right: 12px; z-index: 10; width: auto; margin: 0; padding: 8px 16px; background: rgba(0,0,0,0.8); color: var(--accent); border: 1px solid var(--accent); backdrop-filter: blur(4px); box-shadow: 0 4px 12px rgba(0,0,0,0.5); }
.btn-fullscreen:hover { background: var(--accent); color: #000; }

.map-hud { position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px); z-index: 10; background: rgba(15, 15, 15, 0.95); border: 1px solid var(--accent); padding: 12px 20px; border-radius: 8px; display: flex; gap: 16px; align-items: center; box-shadow: 0 10px 40px rgba(0,0,0,0.8); backdrop-filter: blur(8px); opacity: 0; pointer-events: none; transition: all 0.3s ease; }
.map-hud.active { opacity: 1; pointer-events: auto; transform: translateX(-50%) translateY(0); }
.map-hud .stats-text { color: #fff; font-size: 15px; font-weight: 600; white-space: nowrap; border-right: 1px solid #333; padding-right: 16px;}
.map-hud .stats-text span { color: var(--accent); }
.map-hud select { width: 220px; margin: 0; min-height: 36px; background: #000; }
.map-hud button { width: auto; margin: 0; min-height: 36px; padding: 0 20px; }

.table-card { min-width: 0; overflow: hidden; display: flex; flex-direction: column; flex: 1;}
.table-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.table-head h2 { margin: 0; font-size: 15px; }

.table-wrap { width: 100%; max-height: 400px; overflow-y: auto; overflow-x: auto; background: var(--bg-card); }
table { width: 100%; border-collapse: collapse; min-width: 1400px; }

thead th { position: sticky; top: 0; z-index: 2; background: #101010; color: #fff; font-size: 12px; text-align: left; text-transform: uppercase; padding: 12px 14px; border-bottom: 1px solid var(--border-strong); white-space: nowrap; }

thead th.col-fixed, tbody td.col-fixed { position: sticky; left: 0; z-index: 3; background: #141414; border-right: 1px solid var(--border-strong); }
thead th.col-fixed { background: #101010; z-index: 4; }
tbody tr:nth-child(odd) td.col-fixed { background: #111111; }
tbody tr:nth-child(even) td.col-fixed { background: #161616; }
tbody tr:hover td.col-fixed { background: #202020; }
tbody tr.selecionado td.col-fixed { background: #231f13; }

tbody td { padding: 12px 14px; border-bottom: 1px solid rgba(255, 255, 255, 0.045); color: var(--text-soft); font-size: 13px; vertical-align: middle; }
tbody tr:nth-child(odd) { background: #111111; }
tbody tr:nth-child(even) { background: #161616; }
tbody tr:hover { background: #202020; }
tbody tr.selecionado { background: rgba(212, 175, 55, 0.12); }

.inline-select { width: 180px; min-height: 30px; padding: 4px 8px; font-size: 12px; border-color: var(--border); background: #000; color: #e0e0e0;}
.obs-cell { max-width: 250px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.check-cell { width: 60px; text-align: center; }
.pedido-check { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }

.table-actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 20px 20px; border-top: 1px solid var(--border); }
.selection-summary { flex: 1; text-align: center; }
.empty-state { padding: 26px 20px; color: var(--text-muted); text-align: center; font-size: 14px; }
