/* R24 — Mishio mobile-first light design system. Presentation only. */
:root{
  --bg:#f2f4f7;--surface:#fff;--surface2:#f8fafc;--line:#e2e7ee;
  --text:#182230;--muted:#68778c;--blue:#1769e0;--blue2:#46b0f3;
  --cyan:#8ed5fb;--green:#109b6d;--amber:#e7a100;--red:#e32d24;
  --shadow:0 3px 14px rgba(26,49,78,.07);--radius:18px;
  --font:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Noto Sans",Arial,sans-serif;
}
*{box-sizing:border-box}
html{background:var(--bg);-webkit-text-size-adjust:100%}
body{margin:0;background:var(--bg);color:var(--text);font:14px/1.48 var(--font);letter-spacing:-.005em}
button,input,select,textarea{font-family:var(--font);color:var(--text)}
button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible{outline:3px solid rgba(23,105,224,.22);outline-offset:2px}

/* Authentication */
.login{background:linear-gradient(180deg,#65bef4 0,#a8ddfb 210px,var(--bg) 210px);padding:24px}
.login-card{width:min(440px,100%);padding:30px;border:1px solid rgba(255,255,255,.9);border-radius:22px;background:#fff;box-shadow:0 18px 50px rgba(33,79,117,.14)}
.login-card h1{color:var(--text);font-size:27px;letter-spacing:-.035em}
.login-card p,.auth-hint{color:var(--muted)}
.login-card label{color:#3f4d5f;font-weight:650}
.login-card input{height:48px;background:#fff;color:var(--text);border:1px solid #cfd7e2;border-radius:12px}
.brandmark{background:linear-gradient(145deg,#1680e8,#43b9f4);color:#fff;box-shadow:0 5px 14px rgba(23,105,224,.18)}

/* App shell */
.app{background:var(--bg)}
.sidebar{padding:18px 14px;border-right:1px solid var(--line);background:#fff;box-shadow:4px 0 18px rgba(37,60,91,.04)}
.brand{margin:-18px -14px 18px;padding:20px 20px 18px;background:linear-gradient(135deg,#4aaef0,#98d7fb);color:#10243a}
.brand small{color:rgba(16,36,58,.67)}
.scope-label,.nav-group{color:#7b8797;font-weight:750}
.tenant{height:46px;border:1px solid #d7dee7;border-radius:12px;background:#fff;color:var(--text);font-weight:650;padding:0 12px}
.nav-button{min-height:44px;border-radius:12px;color:#617085;font-weight:650}
.nav-button:hover{background:#f2f7fd;color:#155ab7}
.nav-button.active{background:#eaf3ff;color:#0e62d4;box-shadow:inset 3px 0 0 #1769e0}
.advanced-nav{border-top-color:var(--line)}
.advanced-nav summary{color:#778598}
.safety{border:1px solid #b9dfd2;border-radius:14px;background:#effaf6;color:#087353}
.safety span{color:#4b7468}

.topbar{height:82px;padding:0 30px;border:0;background:linear-gradient(105deg,#49aff1,#99d7fa);box-shadow:0 2px 10px rgba(35,93,137,.1)}
.topbar h1{font-size:20px;color:#10243a;letter-spacing:-.025em}
.breadcrumbs{color:rgba(16,36,58,.65);font-weight:650}
.health{padding:7px 10px;border-radius:999px;background:rgba(255,255,255,.7);color:#087353;font-weight:700}
.account{min-height:44px;border:1px solid rgba(255,255,255,.9);background:#fff;color:var(--text);box-shadow:0 3px 12px rgba(35,93,137,.12)}
.account>span:first-child{background:#1769e0;color:#fff}
.account-menu{border-color:var(--line);background:#fff;box-shadow:0 14px 34px rgba(26,49,78,.14)}
.account-menu button{background:#eef5ff;color:#155ab7;font-weight:700}
.content{padding:28px 30px 92px}

/* Typography and hierarchy */
.page-head{margin-bottom:18px;align-items:center}
.page-head h2{font-size:27px;line-height:1.2;letter-spacing:-.035em;color:var(--text)}
.page-head p{color:var(--muted);font-size:14px}
.eyebrow{color:#1769e0;font-size:10px;font-weight:850;letter-spacing:.09em}
small,.muted{color:var(--muted)}

/* Cards, metrics and lists */
.grid{gap:14px}
.card,.stat,.work-queue,.flow-banner,.auto-sync-panel{border:1px solid var(--line);border-radius:var(--radius);background:#fff;box-shadow:var(--shadow)}
.card{padding:19px}
.card h3{font-size:16px;color:var(--text);letter-spacing:-.015em}
.stat{min-height:122px;padding:17px;position:relative;overflow:hidden}
.stat:after{content:"";position:absolute;left:0;right:0;bottom:0;height:3px;background:#1769e0;opacity:.8}
.stat small{color:var(--muted);font-weight:650}
.stat b{font-size:28px;line-height:1.15;color:var(--text);letter-spacing:-.04em}
.stat span{color:var(--green);font-weight:700}
.stat span.warn{color:var(--red)}
.item,.approval-card,.product-card,.order-card{border:1px solid var(--line);background:#fff;box-shadow:none}
.item:hover,.order-card:hover{border-color:#b8d4f4;background:#fbfdff}
.meta,.evidence,.fact,.order-card-meta>span{background:#f5f7fa;color:#35455a}
.tablewrap{border:1px solid var(--line);border-radius:16px;background:#fff;box-shadow:var(--shadow)}
.table th{background:#f7f8fa;color:#66758a;font-weight:800}
.table th,.table td{border-bottom-color:#e8ecf1}
.table tr.clickable:hover{background:#f4f8fd}
.notice{border:1px solid #bcd8f7;border-left:4px solid #1769e0;border-radius:14px;background:#f2f8ff;color:#244d7d}
.notice.warning{border-color:#f0d391;border-left-color:var(--amber);background:#fff9ea;color:#74520c}
.badge{font-weight:800}
.badge.green{background:#e8f7f1;color:#087353}.badge.blue{background:#eaf3ff;color:#0e62d4}.badge.amber{background:#fff3d9;color:#945f00}.badge.red{background:#ffebed;color:#bd2333}.badge.gray{background:#edf0f4;color:#5d6b7c}

/* Controls */
.btn{min-height:42px;border:1px solid #d4dce6;border-radius:11px;background:#fff;color:#34465c;font-weight:750;box-shadow:none}
.btn:hover{border-color:#7aaae7;background:#f6faff;color:#155ab7}
.btn.primary{border-color:#1769e0;background:#1769e0;color:#fff;box-shadow:0 4px 11px rgba(23,105,224,.18)}
.btn.primary:hover{background:#0f5fcf;color:#fff}
.btn.danger{border-color:#f0b2b8;background:#fff4f4;color:#bd271f}
.btn.ghost{background:#fff}
.toolbar{padding:10px;border:1px solid var(--line);border-radius:15px;background:#fff;box-shadow:var(--shadow)}
.toolbar input,.toolbar select,.field input,.field select,.field textarea{min-height:44px;border:1px solid #cfd7e2;border-radius:11px;background:#fff;color:var(--text)}
.toolbar input::placeholder,.field input::placeholder,.field textarea::placeholder{color:#9aa5b3}
.check{background:#f6f8fb;border-color:var(--line)}
.progress,.bar{background:#e8edf3}
.progress i,.bar i{background:#1769e0}

/* Dialogs and feedback */
dialog{border:0;border-radius:22px;background:#fff;color:var(--text);box-shadow:0 24px 70px rgba(20,38,63,.22)}
dialog::backdrop{background:rgba(20,32,48,.45);backdrop-filter:blur(3px)}
dialog form>header,dialog form>footer{border-color:var(--line)}
.icon-btn{border-color:var(--line);border-radius:50%;background:#f4f6f8;color:var(--text)}
.toast{right:24px;bottom:24px;border-radius:12px;background:#16324f;color:#fff;box-shadow:0 10px 30px rgba(17,38,61,.22)}
.help-pop{background:#16324f}
.help-pop:before{background:#16324f}

/* Operational blocks */
.action-task{border-color:var(--line);border-radius:13px;background:#fff}
.action-task.red{border-left-color:var(--red)}.action-task.amber{border-left-color:var(--amber)}.action-task.green{border-left-color:var(--green)}.action-task.blue{border-left-color:var(--blue)}
.queue-chip,.scope-route,.safety-grid>div,.sync-activity>div,.auto-sync-grid>div,.flow-step,.connection-progress>div{border-color:var(--line);background:#f8fafc}
.queue-chip:hover,.order-summary button:hover,.order-summary button.active{border-color:#8eb9ee;background:#eef6ff}
.flow-step.current,.connection-progress .current{border-color:#80b1ef;background:#edf6ff}
.flow-step.current>span,.connection-progress .current span{background:#1769e0}
.auto-sync-panel{border-left:5px solid var(--green);background:#f1fbf7}
.auto-sync-panel.paused{border-left-color:var(--amber);background:#fff9ea}
.mapping-bulk{border-color:#b7d4f4;background:#eef6ff}
.connection-setup,.connection-tree,.connection-archive,.connection-progress>div{border-color:var(--line);background:#fff}

/* Mobile: familiar app layout inspired by the approved reference. */
@media(max-width:720px){
  body{font-size:15px;background:var(--bg)}
  .app{display:block;min-height:100dvh}
  .sidebar{display:none}
  .main{width:100%;padding:0}
  .topbar{position:sticky;top:0;z-index:40;height:72px;padding:14px 14px 10px;align-items:flex-end;background:linear-gradient(135deg,#48aff1,#9bd8fa);border:0}
  .topbar>div:first-child{min-width:0}
  .topbar h1{max-width:58vw;margin:3px 0 0;font-size:22px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .breadcrumbs{font-size:10px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .top-actions{gap:8px}
  .health{width:12px;height:12px;padding:0;border-radius:50%;overflow:hidden;color:var(--green);background:#fff;box-shadow:0 0 0 5px rgba(255,255,255,.9)}
  .health i{width:12px;height:12px;flex:0 0 12px}
  .account{width:46px;height:46px;padding:0;border:0;border-radius:50%;justify-content:center}
  .account>span:first-child{width:34px;height:34px}
  .account>span:last-child{display:none}
  .account-menu{top:108px;right:12px;width:min(280px,calc(100vw - 24px))}
  .content{width:100%;padding:18px 14px calc(92px + env(safe-area-inset-bottom));overflow:hidden}
  .page-head{display:block;margin-bottom:15px}
  .page-head h2{font-size:24px;margin-bottom:5px}
  .page-head p{font-size:13px;line-height:1.45}
  .page-actions{display:flex;flex-wrap:nowrap;overflow:auto;gap:8px;margin-top:13px;padding:1px 0 4px;scrollbar-width:none}
  .page-actions::-webkit-scrollbar,.toolbar::-webkit-scrollbar,.grid.stats::-webkit-scrollbar{display:none}
  .page-actions .btn{flex:0 0 auto}
  .grid.stats{display:flex;overflow:auto;gap:10px;margin-right:-14px;padding:1px 14px 7px 0;scroll-snap-type:x mandatory}
  .grid.stats .stat{flex:0 0 72vw;min-height:118px;scroll-snap-align:start}
  .grid.two,.grid.cards2{grid-template-columns:1fr}
  .card{padding:16px;border-radius:17px}
  .card h3{font-size:17px}
  .stat{border-radius:17px}
  .stat b{font-size:30px}
  .notice{margin-bottom:13px;padding:12px 13px}
  .toolbar{display:flex;flex-wrap:nowrap;overflow:auto;margin:0 0 13px;padding:8px}
  .toolbar input{min-width:220px}
  .toolbar select{min-width:140px}
  .tablewrap{border-radius:16px}
  .order-cards{gap:11px}
  .order-card{padding:15px;border-radius:16px;box-shadow:0 2px 10px rgba(26,49,78,.05)}
  .order-card-meta{grid-template-columns:1fr}
  .order-summary{margin:12px -14px 14px;padding:0 14px 5px}
  .order-summary button{min-width:132px;border-radius:14px;background:#fff}
  .action-task{grid-template-columns:42px 1fr 18px;padding:13px}
  .flow-steps{margin-right:-14px;padding-right:14px}
  .flow-step{min-width:205px;border-radius:14px;background:#fff}
  .connection-tree-head,.connection-level{padding:15px}
  dialog{width:calc(100% - 20px);max-height:88dvh;margin:auto;border-radius:22px}
  dialog form>header{padding:17px 18px}
  #dialogBody{padding:17px}
  dialog form>footer{padding:14px 17px calc(14px + env(safe-area-inset-bottom))}
  .toast{left:14px;right:14px;bottom:calc(82px + env(safe-area-inset-bottom));text-align:center}
  .mobile-nav{position:fixed;left:0;right:0;bottom:0;z-index:45;display:grid;grid-template-columns:repeat(5,1fr);height:72px;padding:6px 5px calc(6px + env(safe-area-inset-bottom));border-top:1px solid var(--line);background:rgba(255,255,255,.97);box-shadow:0 -5px 18px rgba(31,52,81,.08);backdrop-filter:blur(14px)}
  .mobile-nav a{min-width:0;min-height:54px;border-radius:12px;color:#8a96a5;font-size:10px;font-weight:750}
  .mobile-nav a svg{width:22px;height:22px}
  .mobile-nav a.active{background:transparent;color:#1769e0}
}

@media(min-width:721px) and (max-width:1100px){
  .app{grid-template-columns:220px 1fr}.sidebar{padding-left:12px;padding-right:12px}.content{padding-left:22px;padding-right:22px}.grid.stats{grid-template-columns:repeat(3,1fr)}
}

@media(prefers-reduced-motion:reduce){*{scroll-behavior:auto!important;transition:none!important;animation:none!important}}

/* R25 — simplify the mobile work surface after field review. */
@media(max-width:720px){
  .topbar{height:96px;padding:26px 14px 12px}
  .topbar h1{font-size:21px}
  .account-menu{top:90px}
  .content{padding:15px 12px calc(88px + env(safe-area-inset-bottom));overflow:hidden}
  .page-head{margin-bottom:13px}
  .page-head h2{font-size:22px}
  .page-head .page-actions{display:grid;grid-template-columns:1fr 1fr;overflow:visible;margin-top:11px;padding:0}
  .page-head .page-actions .btn{width:100%;min-width:0;padding-left:9px;padding-right:9px}
  .grid.stats.overview-stats{display:grid;grid-template-columns:1.25fr .75fr;gap:8px;margin:0;padding:0;overflow:visible}
  .grid.stats.overview-stats .stat{min-width:0;min-height:108px;padding:14px}
  .grid.stats.overview-stats .stat:nth-child(3){grid-column:1/-1;min-height:96px}
  .grid.stats.overview-stats .stat b{font-size:27px}
  .flow-steps{display:none}
  .work-queue{margin-top:0}
  .toolbar{display:grid;grid-template-columns:1fr;overflow:visible;padding:8px}
  .toolbar input,.toolbar select{width:100%;min-width:0}
  .order-cards{gap:8px}
  .order-card{padding:12px;border-radius:14px}
  .order-summary{margin:10px -12px 12px;padding-left:12px;padding-right:12px}
  .order-summary button{min-width:118px;padding:10px}
  .connection-tree-head{padding:14px 15px}
}

@media(max-width:720px){.page-head h2{display:none}.page-head p{margin-top:0}.page-head{padding-top:0}.topbar{min-height:72px}}
/* R26.2 visual-QA fixes: measured on iPhone/Android/tablet/desktop. */
.content,.main,.orders-table{min-width:0;max-width:100%}
.orders-table{width:100%}
.help-pop{left:auto;right:0;max-width:min(310px,calc(100vw - 32px))}
@media(max-width:900px){.orders-table{display:none!important}.order-cards{display:grid!important}.order-scroll-hint{display:none!important}}
@media(max-width:720px){
  .topbar{height:72px!important;min-height:72px!important;padding:12px 14px 9px!important}
  .account-menu{top:70px!important}
  .order-card{width:100%;min-width:0;max-width:100%;overflow:hidden}
  .order-card .item-head,.order-card .item-head>div,.order-card p,.order-card-meta{min-width:0;max-width:100%}
  .order-card .item-head{flex-wrap:wrap}
  .help-pop{position:fixed;left:16px;right:16px;top:auto;bottom:88px;width:auto;max-width:none}
  .btn.small,.dialog-close,dialog button{min-height:44px}
}

/* R26.2.2 visual QA touch-target hardening */
.btn,.dialog-close,dialog button,.connection-tree button,.connection-level button,.order-card button,.orders-table .btn.small{min-height:44px}
.btn{display:inline-flex;align-items:center;justify-content:center}
.dialog-close{min-width:44px;width:44px}
@media(max-width:900px){
  .order-card,.order-card *{max-width:100%}
  .order-card-meta,.page-actions,.toolbar,.order-summary,.flow-steps{overscroll-behavior-x:contain}
}
