/* Layout dos painéis inspirado nos protótipos de Downloads/Frotas.
   Os dados e as ações continuam vindo do app.js e da API existente. */

#shell {
  --ink: #0b111b;
  --muted: #5b6b82;
  --line: #e3e8ef;
  --canvas: #f4f6fa;
  --white: #fff;
  --green: #16509b;
  --green-dark: #0f3d78;
  --green-pale: #e6eefb;
  --amber: #a56810;
  --amber-pale: #fff3e0;
  --red: #c93a3a;
  --red-pale: #fdecec;
  --shadow: none;
  background: var(--canvas);
  color: var(--ink);
  font: 13px/1.45 'IBM Plex Sans', system-ui, sans-serif;
}

body:has(#shell:not(.hidden)) { background: #f4f6fa; }
#shell [hidden] { display: none !important; }
.auth-shell .auth-form-wrap h2 { color: #fff; }

#shell .sidebar {
  width: 232px;
  min-width: 232px;
  background: #0b111b;
  color: #c9d3e3;
  border: 0;
}
#shell .sidebar-top { padding: 18px 12px 8px; }
#shell .brand {
  align-items: center;
  gap: 9px;
  padding: 0 8px 13px;
  color: #fff;
  font: 800 19px/1.05 Archivo, sans-serif;
  letter-spacing: -.03em;
}
#shell .brand b { color: #f2a33e; font-weight: 800; }
#shell .brand small {
  color: #8595ad;
  font: 500 10px/1.4 'IBM Plex Sans', sans-serif;
  letter-spacing: .04em;
  margin-top: 5px;
}
#shell .brand-mark {
  width: 36px;
  height: 36px;
  flex: none;
  padding: 0;
  background: #f2a33e;
  color: #0b111b;
  box-shadow: none;
  border-radius: 8px;
  font: 800 21px Archivo, sans-serif;
}
#shell .workspace-label, #shell .nav-separator { display: none; }
#shell #nav { display: grid; gap: 2px; }
#shell .nav-group {
  padding: 16px 10px 4px;
  color: #788ba8;
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
}
#shell .nav-button {
  min-height: 31px;
  padding: 6px 10px;
  gap: 9px;
  border-radius: 7px;
  color: #c9d3e3;
  font-size: 12px;
  font-weight: 500;
}
#shell .nav-button:hover, #shell .nav-button.active {
  background: #1d2c45;
  color: #fff;
  box-shadow: none;
}
#shell .nav-icon, #shell .nav-button.active .nav-icon {
  width: 16px;
  color: #9fb4d3;
  font: 16px/1 Arial, sans-serif;
}
#shell .sidebar-bottom { padding: 10px 12px 16px; }
#shell .help-card {
  margin: 0;
  padding: 10px;
  background: transparent;
  border: 0;
  border-top: 1px solid #263246;
  border-radius: 0;
}
#shell .help-card .help-icon, #shell .help-card p { display: none; }
#shell .help-card strong { display: block; color: #a7b8d0; font-size: 11px; }
#shell .help-card button { margin-top: 5px; color: #a9c9fb; font-size: 11px; }
#shell .profile { border-color: #263246; padding: 12px 7px 0; }
#shell .profile strong { color: #edf3fc; }
#shell .profile small { color: #91a4be; }
#shell .profile button { color: #9ab0ca; }
#shell .avatar, #shell .topbar-avatar {
  background: #16509b;
  color: #fff;
  font: 700 11px Archivo, sans-serif;
}

#shell .main-area { min-width: 0; background: #f4f6fa; }
#shell .topbar {
  height: 56px;
  padding: 0 24px;
  gap: 12px;
  background: #fff;
  border-color: #e3e8ef;
  position: sticky;
  top: 0;
  z-index: 10;
}
#shell .topbar-left { flex: 1; min-width: 0; display: flex; align-items: center; }
#shell .topbar-search {
  height: 36px;
  width: min(440px, 100%);
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 12px;
  border: 1px solid #e3e8ef;
  border-radius: 8px;
  background: #f4f6fa;
  color: #677992;
}
#shell .topbar-search span { font-size: 20px; line-height: 1; }
#shell .topbar-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: #26324a;
  font: 12px 'IBM Plex Sans', sans-serif;
}
#shell .topbar-search input::placeholder { color: #718198; }
#shell .breadcrumb, #shell .today { display: none; }
#shell .topbar-brand { display: none; }
#shell .topbar-right { position: relative; gap: 9px; }
#shell .topbar-action { padding: 8px 11px; font-size: 11px; }
#shell .tenant-pill {
  max-width: 145px;
  background: #e6eefb;
  color: #16509b;
  border-radius: 16px;
}
#shell .icon-button {
  width: 31px;
  height: 31px;
  background: transparent;
  border: 0;
  color: #5b6b82;
}
#shell .topbar-avatar {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 0;
  padding: 0;
  flex: none;
}
#shell .account-menu {
  position: absolute;
  top: 42px;
  right: 0;
  z-index: 30;
  min-width: 175px;
  padding: 6px;
  background: #fff;
  border: 1px solid #e3e8ef;
  border-radius: 10px;
  box-shadow: 0 16px 38px #0b111b24;
}
#shell .account-menu button {
  display: block;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: #26324a;
  text-align: left;
  font: 500 12px 'IBM Plex Sans', sans-serif;
}
#shell .account-menu button:hover { background: #f4f6fa; }
#shell #content { max-width: none; padding: 20px 24px 38px; }
#shell .page-intro,
#shell #content.dashboard-view > .page-intro,
#shell #content.portal-view > .page-intro {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 16px;
  padding: 0;
  background: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
#shell .page-intro .eyebrow { display: none; }
#shell .page-intro h1,
#shell #content.dashboard-view > .page-intro h1,
#shell #content.portal-view > .page-intro h1 {
  max-width: none;
  margin: 0 0 3px;
  color: #0b111b;
  font: 800 22px/1.2 Archivo, sans-serif;
  letter-spacing: -.01em;
}
#shell .page-intro p,
#shell #content.dashboard-view > .page-intro p,
#shell #content.portal-view > .page-intro p,
#shell .panel-head p { color: #5b6b82; font-size: 12px; }
#shell .page-actions { gap: 8px; }
#shell .button {
  border-radius: 8px;
  padding: 8px 12px;
  font: 600 12px 'IBM Plex Sans', sans-serif;
  box-shadow: none;
}
#shell .button-primary { background: #16509b; color: #fff; }
#shell .button-primary:hover { background: #0f3d78; }
#shell .button-secondary { background: #fff; border-color: #e3e8ef; color: #26324a; }
#shell .button-secondary:hover { background: #f2f6fc; }
#shell .button-danger { background: #fff; border-color: #f2d5d5; color: #c93a3a; }

#shell .dashboard-alert {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 64px;
  margin-bottom: 16px;
  padding: 12px 18px;
  border-radius: 12px;
  background: #c93a3a;
  color: #fff;
}
#shell .dashboard-alert > strong { font: 800 30px Archivo, sans-serif; }
#shell .dashboard-alert span { display: grid; gap: 2px; min-width: 0; }
#shell .dashboard-alert b { font-size: 12px; }
#shell .dashboard-alert small { font-size: 11px; opacity: .9; }
#shell .dashboard-alert .button { margin-left: auto; flex: none; border: 0; }
#shell .stats-grid {
  grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
  gap: 16px;
}
#shell .portal-cases-panel { margin-top: 16px; }
#shell .stat-card, #shell .panel, #shell .info-card {
  min-width: 0;
  background: #fff;
  border: 1px solid #e3e8ef;
  border-radius: 12px;
  box-shadow: none;
}
#shell .stat-card { padding: 14px 16px; }
#shell .stat-label, #shell .stat-top, #shell .detail-stat span { color: #5b6b82; font-size: 12px; font-weight: 400; }
#shell .stat-icon { display: none; }
#shell .stat-value {
  margin-top: 4px;
  color: #0b111b;
  font: 700 24px/1.15 Archivo, sans-serif;
  letter-spacing: -.02em;
}
#shell .stat-bottom { margin-top: 4px; color: #5b6b82; font-size: 11px; }
#shell .stat-bottom strong { color: #16509b; }
#shell .dashboard-layout {
  grid-template-columns: minmax(0, 2fr) minmax(290px, 1fr);
  gap: 16px;
  margin-top: 16px;
}
#shell .panel-head { padding: 16px 16px 10px; border-color: #e3e8ef; }
#shell .panel-head h2, #shell .info-card h3, #shell .empty h3, #shell .detail-section h3 {
  color: #0b111b;
  font: 700 15px Archivo, sans-serif;
  letter-spacing: -.01em;
}
#shell .panel-head p { margin-top: 3px; }
#shell .link-button, #shell .row-button, #shell .info-card button { color: #16509b; }
#shell .table-wrap { max-width: 100%; overflow-x: auto; }
#shell table { font-size: 12px; }
#shell th {
  padding: 9px 11px;
  background: #fff;
  border-bottom: 1px solid #e3e8ef;
  color: #5b6b82;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .04em;
}
#shell td { padding: 10px 11px; border-color: #eef1f5; color: #26324a; }
#shell td strong, #shell .info-card .card-meta strong { color: #0b111b; }
#shell tbody tr:hover { background: #f7f9fd; }
#shell .plate {
  background: transparent;
  border: 0;
  padding: 0;
  color: #0b111b;
  font: 700 12px 'IBM Plex Mono', Consolas, monospace;
}
#shell .badge { padding: 3px 8px; background: #eef1f5; color: #5b6b82; font-size: 10px; }
#shell .badge::before { display: none; }
#shell .badge.green { background: #e6f5ee; color: #1f8a5b; }
#shell .badge.amber { background: #fff3e0; color: #a56810; }
#shell .badge.red { background: #fdecec; color: #c93a3a; }
#shell .mini-summary { color: #26324a; }
#shell .summary-line span, #shell .info-card p, #shell .info-card .card-meta { color: #5b6b82; }
#shell .progress-track { background: #eef1f5; }
#shell .progress-fill { background: #16509b; }
#shell .progress-fill.blue { background: #16509b; }
#shell .progress-fill.amber { background: #f2a33e; }
#shell .quick-links { border-color: #e3e8ef; }
#shell .quick-links button { background: #f4f6fa; color: #26324a; border-radius: 8px; }
#shell .quick-links button span { color: #16509b; }
#shell .section-grid { gap: 16px; }
#shell .info-card { padding: 16px; }
#shell .info-card .card-meta { border-color: #e3e8ef; }
#shell .toolbar { flex-wrap: wrap; }
#shell .search input, #shell .toolbar select {
  background: #fff;
  border-color: #e3e8ef;
  color: #26324a;
  border-radius: 8px;
  font-size: 12px;
}
#shell .search input::placeholder { color: #718198; }
#shell .search::before { color: #718198; }
#shell .empty { color: #5b6b82; }
#shell .empty-icon { background: #e6eefb; color: #16509b; }
#shell .guide { color: #5b6b82; }
#shell .guide strong { color: #0b111b; }
#shell .portal-bottom-nav { display: none; }
@media (min-width: 1101px) {
  #shell #content.dashboard-view > .page-intro .page-actions { display: none; }
}

/* O portal do condutor mantém o formato compacto do desenho de referência. */
#shell.role-driver {
  max-width: 560px;
  min-height: 100vh;
  margin: 0 auto;
  box-shadow: 0 16px 50px #0b111b16;
}
#shell.role-driver .sidebar { display: none; }
#shell.role-driver .main-area { width: 100%; }
#shell.role-driver .topbar { height: 62px; padding: 0 16px; background: #0b111b; border: 0; }
#shell.role-driver .topbar-left { flex: 1; }
#shell.role-driver .topbar-brand { display: inline; color: #fff; font: 800 18px Archivo, sans-serif; }
#shell.role-driver .topbar-brand b { color: #f2a33e; }
#shell.role-driver .topbar-search,
#shell.role-driver .topbar-action,
#shell.role-driver .tenant-pill,
#shell.role-driver #alerts-button,
#shell.role-driver #refresh-button,
#shell.role-driver #mobile-menu { display: none !important; }
#shell.role-driver .topbar-avatar { background: #f2a33e; color: #0b111b; }
#shell.role-driver #content { padding: 16px 16px 90px; }
#shell.role-driver .page-intro { margin-bottom: 14px; }
#shell.role-driver .page-intro h1,
#shell.role-driver #content.portal-view > .page-intro h1 { font-size: 22px; }
#shell.role-driver .stats-grid { grid-template-columns: 1fr; gap: 12px; }
#shell.role-driver .stat-card { padding: 16px; }
#shell.role-driver .portal-priority {
  display: grid;
  gap: 4px;
  margin-bottom: 14px;
  padding: 16px;
  border: 1px solid #e3e8ef;
  border-left: 5px solid #c93a3a;
  border-radius: 12px;
  background: #fff;
}
#shell.role-driver .portal-priority small { color: #5b6b82; font-size: 10px; letter-spacing: .08em; }
#shell.role-driver .portal-priority strong { color: #0b111b; font: 700 16px Archivo, sans-serif; }
#shell.role-driver .portal-priority span { color: #5b6b82; font-size: 12px; }
#shell.role-driver .portal-priority .button { justify-self: start; margin-top: 8px; }
#shell.role-driver .portal-case-list { display: grid; gap: 10px; padding: 0 16px 16px; }
#shell.role-driver .portal-case-card {
  display: grid;
  gap: 6px;
  width: 100%;
  padding: 13px 14px;
  border: 1px solid #e3e8ef;
  border-left: 4px solid #f2a33e;
  border-radius: 10px;
  background: #fff;
  color: #0b111b;
  text-align: left;
}
#shell.role-driver .portal-case-card:hover { background: #f7f9fd; }
#shell.role-driver .portal-case-card strong { font: 700 13px Archivo, sans-serif; }
#shell.role-driver .portal-case-card > span { color: #5b6b82; font-size: 11px; }
#shell.role-driver .portal-case-card > div { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
#shell.role-driver .portal-case-card b { font-size: 11px; }
#shell.role-driver .portal-case-card small { margin-left: auto; color: #a56810; font-size: 11px; }
#shell.role-driver .portal-bottom-nav {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 25;
  width: min(560px, 100%);
  padding: 7px 0 calc(9px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  background: #fff;
  border-top: 1px solid #e3e8ef;
}
#shell.role-driver .portal-bottom-nav button {
  display: grid;
  justify-items: center;
  gap: 2px;
  border: 0;
  background: none;
  color: #5b6b82;
  font: 500 11px 'IBM Plex Sans', sans-serif;
}
#shell.role-driver .portal-bottom-nav button span { font-size: 19px; line-height: 1; }
#shell.role-driver .portal-bottom-nav button.active { color: #16509b; font-weight: 700; }

/* Modais e detalhes ficam fora de #shell no DOM. */
.modal, .drawer { background: #fff; color: #0b111b; border: 1px solid #e3e8ef; border-radius: 14px; }
.modal-header, .drawer-hero, .detail-section { border-color: #e3e8ef; }
.modal-header h2, .drawer-hero h2, .detail-section h3 { color: #0b111b; }
.drawer-hero { background: #f4f6fa; }
.drawer-hero p, .timeline-item p, .timeline-item span, .doc-item small { color: #5b6b82; }
.close-button { background: #eef1f5; color: #5b6b82; }
.modal .field label, .drawer .field label { color: #26324a; }
.modal .field small, .drawer .field small { color: #5b6b82; }
.modal .field input, .modal .field select, .modal .field textarea,
.drawer .field input, .drawer .field select, .drawer .field textarea {
  background: #fff;
  border-color: #e3e8ef;
  color: #0b111b;
  border-radius: 8px;
}
.modal .field input:focus, .modal .field select:focus, .modal .field textarea:focus,
.drawer .field input:focus, .drawer .field select:focus, .drawer .field textarea:focus { border-color: #16509b; box-shadow: 0 0 0 3px #e6eefb; }
.modal .form-note, .drawer .form-note { background: #e6eefb; border-color: #16509b; color: #263e67; }
/* Texto de orientacao dentro do aviso do modal: o tema escuro de style.css o deixava claro demais. */
.modal .form-note .guide, .drawer .form-note .guide { color: #263e67; font-size: 13px; line-height: 1.6; margin: 0; padding-left: 20px; }
.modal .form-note .guide li, .drawer .form-note .guide li { margin: 0 0 8px; }
.modal .form-note .guide li:last-child, .drawer .form-note .guide li:last-child { margin-bottom: 0; }
.modal .form-note .guide strong, .drawer .form-note .guide strong { color: #0b111b; }
.modal .button-primary, .drawer .button-primary { background: #16509b; color: #fff; }
.modal .button-secondary, .drawer .button-secondary { background: #fff; border-color: #e3e8ef; color: #26324a; }
.detail-stat, .draft-preview { background: #f4f6fa; border-color: #e3e8ef; color: #26324a; }
.detail-stat strong, .guide strong { color: #0b111b; }
.timeline { border-color: #c7d8f3; }
.timeline-item::before { background: #16509b; box-shadow: 0 0 0 2px #c7d8f3; }
.doc-item { border-color: #e3e8ef; }
.doc-item a { color: #16509b; }
.alert-strip { background: #fff3e0; border-color: #f6d49c; color: #6b4300; }

@media (max-width: 1100px) {
  #shell .dashboard-layout { grid-template-columns: 1fr; }
  #shell .topbar-action { display: none; }
}
@media (max-width: 780px) {
  #shell .sidebar { left: -232px; }
  #shell .sidebar.open { left: 0; }
  #shell .mobile-menu { color: #26324a; }
  #shell .topbar { padding: 0 16px; }
  #shell .topbar-search { width: 100%; }
  #shell .topbar-right .tenant-pill { display: none; }
  #shell #content { padding: 16px; }
  #shell .dashboard-alert { flex-wrap: wrap; }
  #shell .dashboard-alert .button { margin-left: 0; }
}
@media (max-width: 500px) {
  #shell .topbar { gap: 5px; }
  #shell .topbar-right { gap: 3px; }
  #shell #refresh-button { display: none; }
  #shell .page-intro,
  #shell #content.dashboard-view > .page-intro,
  #shell #content.portal-view > .page-intro { display: block; }
  #shell .page-actions { margin-top: 12px; }
  #shell .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  #shell .stat-card { padding: 13px; }
  #shell .stat-label { line-height: 1.3; }
  #shell .stat-value { font-size: 22px; overflow-wrap: anywhere; }
  #shell .panel-head { flex-wrap: wrap; }
  #shell .dashboard-layout { gap: 12px; }
  #shell.role-driver .stats-grid { grid-template-columns: 1fr; }
  #shell.role-driver #content { padding: 16px 16px 90px; }
}
