/* A7W Platform · Alpha 18 — UX audit, unified shell and Telegram autonomy */
:root{
  --a18-border:#dbe5ef;
  --a18-muted:#6f8198;
  --a18-ink:#17375f;
  --a18-surface:#ffffff;
  --a18-soft:#f5f8fc;
}

/* One global search only. Alpha 13's older search remains in source for rollback but is never rendered. */
.a13-top-search{display:none!important}
.theme-toggle{display:none!important}

/* shell rhythm */
body.a7w-ready .topbar{box-sizing:border-box}
body.a7w-ready .topbar>div:first-child{min-width:0}
body.a7w-ready .topbar .user{position:relative;justify-self:end;flex:0 0 auto;min-width:0}
body.a7w-ready .a13-global-search{min-width:0}
body.a7w-ready .a13-global-search input{font-size:12px!important;line-height:1!important}
body.a7w-ready .content{min-width:0}
body.a7w-ready .card,body.a7w-ready .fleet-panel,body.a7w-ready .a17-data-card{box-sizing:border-box}
body.a7w-ready .field{min-width:0}
body.a7w-ready .field input,body.a7w-ready .field select,body.a7w-ready .field textarea{max-width:100%;box-sizing:border-box}
body.a7w-ready .actions{display:flex;flex-wrap:wrap;align-items:center;gap:10px!important}
body.a7w-ready .form-grid,body.a7w-ready .fields,body.a7w-ready .assignment-grid,body.a7w-ready .hardware-grid{column-gap:14px!important;row-gap:14px!important}
body.a7w-ready .section-head{margin-bottom:12px}
body.a7w-ready h1,body.a7w-ready h2,body.a7w-ready h3{word-break:normal!important;overflow-wrap:break-word;hyphens:none!important}

/* Desktop sidebar collapse: a slim utility tab, not a floating black circle. */
@media(min-width:841px){
  .side-collapse-toggle{display:grid!important;position:absolute!important;right:-30px!important;top:78px!important;width:30px!important;height:42px!important;border:1px solid #d9e3ed!important;border-left:0!important;background:#fff!important;color:#31557b!important;border-radius:0 9px 9px 0!important;box-shadow:4px 5px 15px rgba(18,49,82,.07)!important;z-index:2250!important;place-items:center!important}
  .side-collapse-toggle:hover{background:#f4f8fc!important;color:#0b66e8!important;transform:none!important}
  .side-collapse-toggle span{font-size:19px!important;line-height:1!important;transform:none!important}
  body.a7w-ready .topbar{display:grid!important;grid-template-columns:minmax(190px,auto) minmax(280px,680px) auto!important;gap:18px!important;align-items:center!important}
  body.a7w-ready .a13-global-search{grid-column:2!important;width:100%!important;max-width:680px!important;margin:0 auto!important}
  body.a7w-ready .topbar .user{grid-column:3!important;grid-row:1!important;margin-left:0!important}
}

/* medium widths: keep account anchored and move search to its own row before anything overlaps */
@media(min-width:841px) and (max-width:1120px){
  body.a7w-ready .topbar{grid-template-columns:minmax(0,1fr) auto!important;grid-template-rows:auto auto!important;gap:10px 14px!important}
  body.a7w-ready .topbar>div:first-child{grid-column:1!important;grid-row:1!important}
  body.a7w-ready .topbar .user{grid-column:2!important;grid-row:1!important}
  body.a7w-ready .a13-global-search{grid-column:1/-1!important;grid-row:2!important;max-width:620px!important;width:100%!important;justify-self:center!important}
}

/* Mobile: compact neutral header, no decorative blue bar. */
@media(max-width:840px){
  html,body{max-width:100%;overflow-x:hidden}
  body.a7w-ready .side,body.a7w-ready .sidebar,body.side-collapsed .side,body.side-collapsed .sidebar{
    position:relative!important;top:auto!important;width:100%!important;height:auto!important;min-height:56px!important;
    padding:9px 12px!important;display:grid!important;grid-template-columns:minmax(0,1fr) 40px!important;align-items:center!important;
    gap:8px!important;background:#fff!important;border-right:0!important;border-bottom:1px solid #e4ebf3!important;box-shadow:none!important;
    z-index:3200!important;overflow:visible!important;box-sizing:border-box!important
  }
  html[data-theme="dark"] body.a7w-ready .side,html[data-theme="dark"] body.a7w-ready .sidebar{background:#111c27!important;border-bottom-color:#273849!important}
  body.a7w-ready .side .logo,body.a7w-ready .sidebar .logo{width:118px!important;height:32px!important;margin:0!important;padding:0!important;display:flex!important;align-items:center!important}
  body.a7w-ready .side .logo img,body.a7w-ready .sidebar .logo img{max-width:118px!important;max-height:29px!important;object-fit:contain!important;object-position:left center!important}
  .mobile-menu-toggle{display:grid!important;position:static!important;justify-self:end!important;width:38px!important;height:38px!important;border:1px solid #dce5ef!important;background:#f7f9fc!important;border-radius:10px!important;box-shadow:none!important;place-content:center!important;gap:4px!important;padding:0!important}
  .mobile-menu-toggle span{display:block!important;width:17px!important;height:2px!important;border-radius:4px!important;background:#244766!important}
  html[data-theme="dark"] .mobile-menu-toggle{background:#182634!important;border-color:#314252!important}
  html[data-theme="dark"] .mobile-menu-toggle span{background:#e6eef6!important}
  .side-collapse-toggle{display:none!important}
  .workspace,.side-foot,.side-bottom{display:none!important}
  .nav.nav-structured{top:54px!important;left:8px!important;right:8px!important;max-height:calc(100dvh - 70px)!important;border-radius:13px!important}

  body.a7w-ready .topbar{position:relative!important;top:auto!important;display:grid!important;grid-template-columns:minmax(0,1fr) auto!important;grid-template-rows:auto auto!important;gap:10px!important;min-height:0!important;padding:11px 12px!important;background:#fff!important;border-bottom:1px solid #e6edf4!important;box-shadow:none!important;z-index:110!important}
  html[data-theme="dark"] body.a7w-ready .topbar{background:#141f2a!important;border-bottom-color:#2a3948!important}
  body.a7w-ready .topbar>div:first-child{grid-column:1!important;grid-row:1!important;min-width:0!important}
  body.a7w-ready .topbar .eyebrow{font-size:8px!important;white-space:normal!important}
  body.a7w-ready .topbar h1{font-size:18px!important;line-height:1.12!important;margin:2px 0 0!important;max-width:100%!important}
  body.a7w-ready .topbar .user{grid-column:2!important;grid-row:1!important;align-self:center!important;justify-self:end!important;margin:0!important}
  body.a7w-ready .topbar .user-copy{display:none!important}
  body.a7w-ready .topbar .avatar{width:36px!important;height:36px!important}
  body.a7w-ready .a13-global-search{grid-column:1/-1!important;grid-row:2!important;width:min(100%,560px)!important;max-width:560px!important;min-width:0!important;margin:0 auto!important}
  body.a7w-ready .a13-global-search input{height:42px!important;font-size:11px!important;padding-left:40px!important;padding-right:12px!important}
  body.a7w-ready .a13-search-results{top:46px!important}

  body.a7w-ready .content{padding:12px!important;max-width:100%!important;box-sizing:border-box!important}
  body.a7w-ready .section-head,body.a7w-ready .a13-section-head{display:grid!important;grid-template-columns:1fr!important;gap:9px!important;align-items:start!important}
  body.a7w-ready .actions{width:100%;display:grid!important;grid-template-columns:1fr!important;gap:8px!important}
  body.a7w-ready .actions>.btn,body.a7w-ready .actions>button,body.a7w-ready .actions>a{width:100%!important;box-sizing:border-box!important;justify-content:center!important;white-space:normal!important}
  body.a7w-ready .form-grid,body.a7w-ready .fields,body.a7w-ready .fields.three,body.a7w-ready .assignment-grid,body.a7w-ready .hardware-grid{grid-template-columns:1fr!important;gap:11px!important}
  body.a7w-ready .field+button,body.a7w-ready .field+.btn{margin-top:4px!important}
  body.a7w-ready .status{max-width:100%;white-space:normal;line-height:1.3}
  body.a7w-ready .profile-grid{grid-template-columns:1fr!important}
  .profile-menu{right:0!important;left:auto!important;max-width:min(320px,calc(100vw - 24px))!important}
}

@media(max-width:430px){
  body.a7w-ready .topbar{padding:10px!important}
  body.a7w-ready .topbar h1{font-size:17px!important}
  body.a7w-ready .content{padding:10px!important}
  body.a7w-ready .card{padding:12px!important}
  .a17-kpi-grid,.fleet-metric-strip,.delivery-kpis{grid-template-columns:1fr!important}
}
