/* OVRON responsive preview V2
   Desktop >= 1180px is intentionally untouched.
   Tablet: 768-1179px.
   Phone landscape: <=950px wide, <=600px high, landscape.
   Phone portrait: <=767px, portrait.
*/

#ovron-responsive-nav{display:none}

/* ---------- TABLET ---------- */
@media (min-width:768px) and (max-width:1179px){
  html,body{min-width:0!important;width:100%!important;overflow-x:hidden!important}
  body{font-size:14px!important}
  .app{grid-template-columns:82px minmax(0,1fr)!important;min-height:100vh!important}
  .sidebar{width:82px!important;padding:18px 10px!important;overflow:hidden!important}
  .brand{height:50px!important;padding:0 4px 14px!important;justify-content:center!important}
  .brand img{width:54px!important;max-width:54px!important;height:auto!important}
  .nav{gap:8px!important;padding-top:16px!important}
  .nav button{width:56px!important;min-height:48px!important;margin:0 auto!important;padding:0!important;justify-content:center!important;gap:0!important;border-radius:12px!important}
  .nav button span{display:none!important}
  .nav-icon{width:21px!important;height:21px!important}
  .sidebar-foot{display:none!important}
  .main{grid-column:2!important;min-width:0!important;width:auto!important}
  .topbar{height:68px!important;padding:0 22px!important;gap:12px!important}
  .search{width:auto!important;min-width:0!important;flex:1 1 auto!important;height:42px!important}
  .top-actions{gap:8px!important;flex:0 0 auto!important}
  .account,.account-trigger{min-width:46px!important;width:46px!important;height:44px!important;padding:3px!important;justify-content:center!important}
  .account-copy,.account-trigger .account-copy,.chev,.account-trigger>svg{display:none!important}
  .avatar{width:38px!important;height:38px!important}
  .content{width:100%!important;max-width:none!important;padding:28px 24px 48px!important}
  .page-head,.purchase-heading{gap:18px!important;margin-bottom:20px!important}
  .page-head h1,.purchase-heading h1,h1{font-size:32px!important;line-height:1.1!important}
  .primary{min-height:46px!important}

  /* Home */
  .period{flex-wrap:wrap!important;align-items:flex-end!important}
  .period-copy{min-width:0!important;flex:1 1 100%!important;margin-right:0!important}
  .date-range{flex:1 1 auto!important;min-width:0!important}
  .metrics{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  .dashboard{grid-template-columns:1fr!important}
  .status-grid{grid-template-columns:repeat(3,minmax(0,1fr))!important}

  /* Purchases */
  .registry-tools{grid-template-columns:1fr!important;gap:18px!important;padding:18px!important}
  .personalization{padding-top:0!important}
  .filters{grid-template-columns:repeat(3,minmax(0,1fr))!important}
  .table{min-width:1160px!important}
  .batch-layout{grid-template-columns:220px minmax(0,1fr)!important}
  .batch-list{padding:8px!important}
  .batch-item{grid-template-columns:38px minmax(0,1fr) 28px!important;padding:10px!important}
  .processings-head{align-items:flex-start!important;flex-direction:column!important}
  .filter-tabs{width:100%!important;justify-content:flex-start!important}
  .jobs-row{min-width:720px!important}

  /* Purchase detail */
  .overview-grid,.work-comment-grid,.audit-grid{grid-template-columns:1fr!important}
  .facts{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  .date-grid{grid-template-columns:repeat(3,minmax(0,1fr))!important}
  .work-grid,.processing-body{grid-template-columns:repeat(2,minmax(0,1fr))!important}

  /* Analytics */
  .analytics-grid{grid-template-columns:1fr!important}
}

/* ---------- PHONE COMMON ---------- */
@media (max-width:767px), (max-width:950px) and (max-height:600px) and (orientation:landscape){
  html,body{min-width:0!important;width:100%!important;overflow-x:hidden!important}
  body{min-height:100vh!important;padding-bottom:calc(66px + env(safe-area-inset-bottom,0px))!important;font-size:14px!important}
  .app{display:block!important;min-height:100vh!important;width:100%!important}
  .sidebar{display:none!important}
  .main{display:block!important;width:100%!important;min-width:0!important}
  .topbar{height:58px!important;padding:0 12px!important;gap:8px!important;position:sticky!important;top:0!important;z-index:40!important}
  .search{width:auto!important;min-width:0!important;flex:1 1 auto!important;height:40px!important;padding:0 11px!important;border-radius:10px!important}
  .search input{min-width:0!important;font-size:13px!important;text-overflow:ellipsis!important}
  .top-actions{margin-left:0!important;gap:6px!important;flex:0 0 auto!important}
  .notify,.icon-btn{width:40px!important;height:40px!important;border-radius:10px!important}
  .account,.account-trigger{min-width:40px!important;width:40px!important;height:40px!important;padding:2px!important;justify-content:center!important;border:0!important;background:transparent!important}
  .account-copy,.account-trigger .account-copy,.chev,.account-trigger>svg{display:none!important}
  .avatar{width:36px!important;height:36px!important}
  .content{width:100%!important;max-width:none!important;padding:20px 14px 28px!important}
  .eyebrow{font-size:11px!important}
  .page-head,.purchase-heading{margin-bottom:18px!important}
  .page-head h1,.purchase-heading h1,h1{font-size:27px!important;line-height:1.12!important;letter-spacing:-.025em!important}
  .page-head p,.purchase-heading p{font-size:14px!important;line-height:1.5!important}
  .primary,.button-secondary,.btn{min-height:44px!important}
  .panel,.registry,.supplier-empty,.card,.state-card,.metric,.history{border-radius:13px!important}
  .tabs{overflow-x:auto!important;white-space:nowrap!important;scrollbar-width:none!important;padding:10px 12px!important}
  .tabs::-webkit-scrollbar{display:none!important}
  .table-wrap,.jobs{overflow-x:auto!important;-webkit-overflow-scrolling:touch!important}

  #ovron-responsive-nav{
    position:fixed!important;left:10px!important;right:10px!important;bottom:calc(8px + env(safe-area-inset-bottom,0px))!important;
    z-index:100!important;height:56px!important;padding:5px!important;display:grid!important;grid-template-columns:repeat(4,1fr)!important;
    gap:3px!important;border:1px solid rgba(207,216,221,.95)!important;border-radius:16px!important;
    background:rgba(255,255,255,.96)!important;backdrop-filter:blur(16px)!important;
    box-shadow:0 8px 28px rgba(15,23,27,.16)!important
  }
  #ovron-responsive-nav a{
    min-width:0!important;display:flex!important;flex-direction:column!important;align-items:center!important;justify-content:center!important;
    gap:2px!important;border-radius:11px!important;color:#65737b!important;text-decoration:none!important;font-size:10px!important;font-weight:500!important;line-height:1!important
  }
  #ovron-responsive-nav a svg{width:19px!important;height:19px!important}
  #ovron-responsive-nav a.active{background:#e8f9fe!important;color:#087a96!important}

  /* Home */
  .period{margin-bottom:12px!important;padding:14px!important;gap:10px!important}
  .period-copy{min-width:0!important;margin-right:0!important}
  .date-range{min-width:0!important}
  .date-range-trigger{min-width:0!important}
  .metrics{gap:10px!important;margin-bottom:12px!important}
  .metric{min-height:104px!important;padding:14px!important}
  .metric strong{font-size:27px!important}
  .dashboard,.analytics-grid,.overview-grid,.work-comment-grid,.audit-grid{grid-template-columns:1fr!important;gap:12px!important}
  .stack{gap:12px!important}
  .card-head,.panel header,.section-head{padding-left:14px!important;padding-right:14px!important}
  .status-grid{gap:10px!important}
  .activity-row{padding-left:14px!important;padding-right:14px!important}

  /* Purchases */
  .bulkbar{margin:12px 12px 0!important;padding:10px 12px!important;gap:10px!important;flex-wrap:wrap!important;align-items:center!important}
  .bulkbar .selected{margin-left:auto!important}
  .registry-tools{grid-template-columns:1fr!important;gap:16px!important;padding:16px 12px!important}
  .personalization{padding-top:0!important}
  .personal-top{gap:10px!important;align-items:flex-start!important}
  .views{grid-template-columns:1fr!important}
  .view-actions{gap:8px!important}
  .filters{grid-template-columns:1fr 1fr!important;gap:10px!important}
  .date-to{grid-column:auto!important}
  .pagination{padding:12px!important;flex-wrap:wrap!important}
  .batch-layout{grid-template-columns:1fr!important;min-height:0!important}
  .batch-list{display:flex!important;gap:8px!important;overflow-x:auto!important;border-right:0!important;border-bottom:1px solid #d9e2e6!important;padding:10px!important;scrollbar-width:none!important}
  .batch-list::-webkit-scrollbar{display:none!important}
  .batch-item{min-width:245px!important;margin:0!important;grid-template-columns:38px minmax(0,1fr) 28px!important}
  .processings-head{min-height:0!important;padding:14px!important;align-items:flex-start!important;flex-direction:column!important}
  .selected-batch h2{font-size:19px!important}
  .filter-tabs{width:100%!important;justify-content:flex-start!important;overflow-x:auto!important;flex-wrap:nowrap!important;scrollbar-width:none!important}
  .filter-tabs::-webkit-scrollbar{display:none!important}
  .filter-tab{flex:0 0 auto!important}

  /* Purchase detail */
  .purchase-heading{display:block!important}
  .back-btn{margin-bottom:12px!important}
  .lifecycle{align-items:flex-start!important;flex-direction:column!important;gap:12px!important}
  .lifecycle .actions{width:100%!important;display:flex!important;gap:8px!important;flex-wrap:wrap!important}
  .lifecycle .actions .btn{flex:1 1 170px!important;justify-content:center!important}
  .facts{grid-template-columns:1fr!important;padding:4px 14px 10px!important}
  .date-grid{padding:12px 14px 14px!important;gap:8px!important}
  .work-grid,.processing-body{grid-template-columns:1fr!important;gap:10px!important}
  .processing-body,.document-groups{padding-left:14px!important;padding-right:14px!important}
  .comment-form{grid-template-columns:1fr!important}
  .comment-form .btn{width:100%!important;justify-content:center!important}
  .version-tabs{overflow-x:auto!important;white-space:nowrap!important;scrollbar-width:none!important}
  .version-tabs::-webkit-scrollbar{display:none!important}

  /* Suppliers */
  .supplier-empty{min-height:0!important;padding:30px 16px!important}
  .empty-state{width:100%!important}
  .empty-state h3{font-size:21px!important}
  .empty-state p{font-size:15px!important}
}

/* ---------- PHONE PORTRAIT ---------- */
@media (max-width:767px) and (orientation:portrait){
  .topbar{padding:0 10px!important}
  .search input::placeholder{font-size:0!important}
  .search input::placeholder{color:transparent!important}
  .content{padding:18px 12px 26px!important}
  .page-head{display:block!important}
  .page-head .primary{width:100%!important;justify-content:center!important;margin-top:14px!important}
  .page-head h1,.purchase-heading h1,h1{font-size:26px!important}

  .period{display:grid!important;grid-template-columns:1fr!important;align-items:stretch!important}
  .date-range,.date-range-trigger{width:100%!important}
  .metrics{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  .status-grid{grid-template-columns:1fr!important}

  /* Registry table becomes readable cards instead of a squeezed desktop table. */
  .table-wrap{overflow:visible!important}
  .table{display:block!important;width:100%!important;min-width:0!important;border-collapse:separate!important}
  .table thead{display:none!important}
  .table tbody{display:grid!important;gap:10px!important;padding:10px!important;background:#f6f9fa!important}
  .table tbody tr{position:relative!important;display:block!important;padding:12px 12px 10px!important;border:1px solid #d8e1e4!important;border-radius:12px!important;background:#fff!important}
  .table tbody tr:hover td{background:transparent!important}
  .table td{display:grid!important;grid-template-columns:104px minmax(0,1fr)!important;gap:8px!important;width:100%!important;padding:5px 0!important;border:0!important;font-size:13px!important;text-align:left!important;vertical-align:top!important}
  .table td::before{color:#78858c!important;font-size:10px!important;font-weight:600!important;letter-spacing:.045em!important;text-transform:uppercase!important}
  .table td:nth-child(1){display:block!important;position:absolute!important;right:12px!important;top:12px!important;width:auto!important;padding:0!important}
  .table td:nth-child(1)::before{display:none!important}
  .table td:nth-child(2){padding-right:30px!important}
  .table td:nth-child(2)::before{content:"Номер / ID"}
  .table td:nth-child(3)::before{content:"Наименование"}
  .table td:nth-child(4)::before{content:"Заказчик"}
  .table td:nth-child(5)::before{content:"Источник"}
  .table td:nth-child(6)::before{content:"Состояние"}
  .table td:nth-child(7)::before{content:"Рабочий статус"}
  .table td:nth-child(8)::before{content:"Ответственный"}
  .table td:nth-child(9){display:none!important}
  .identifier{max-width:none!important;overflow-wrap:anywhere!important}

  .jobs{overflow:visible!important}
  .jobs-head{display:none!important}
  .jobs-row.jobs-data{display:grid!important;grid-template-columns:1fr!important;min-width:0!important;gap:9px!important;padding:14px!important;align-items:start!important}
  .jobs-row.jobs-data>span{min-width:0!important}
  .job-title-copy strong,.job-title-copy small{white-space:normal!important;overflow:visible!important;text-overflow:clip!important}
  .row-more{display:none!important}

  .date-grid{grid-template-columns:1fr!important}
  .work-grid,.processing-body{grid-template-columns:1fr!important}
  .document-item{align-items:flex-start!important}

  .analytics-grid{grid-template-columns:1fr!important}
}

/* ---------- PHONE LANDSCAPE ---------- */
@media (max-width:950px) and (max-height:600px) and (orientation:landscape){
  body{padding-bottom:calc(60px + env(safe-area-inset-bottom,0px))!important}
  .topbar{height:54px!important;padding:0 12px!important}
  .content{padding:14px 16px 20px!important}
  .page-head,.purchase-heading{margin-bottom:14px!important}
  .page-head{display:flex!important;align-items:flex-end!important;justify-content:space-between!important;gap:16px!important}
  .page-head h1,.purchase-heading h1,h1{font-size:25px!important}
  .page-head .primary{width:auto!important;margin-top:0!important;flex:0 0 auto!important}
  #ovron-responsive-nav{height:52px!important;bottom:calc(5px + env(safe-area-inset-bottom,0px))!important}
  #ovron-responsive-nav a{flex-direction:row!important;gap:5px!important;font-size:10px!important}
  #ovron-responsive-nav a svg{width:17px!important;height:17px!important}

  .period{display:flex!important;flex-wrap:nowrap!important;padding:10px 12px!important;min-height:60px!important}
  .period-copy{min-width:180px!important;flex:0 1 auto!important;margin-right:auto!important}
  .metrics{grid-template-columns:repeat(4,minmax(0,1fr))!important;gap:8px!important}
  .metric{min-height:90px!important;padding:11px 12px!important}
  .metric strong{font-size:25px!important}
  .dashboard{grid-template-columns:minmax(0,1.05fr) minmax(300px,.95fr)!important;gap:10px!important}
  .status-grid{grid-template-columns:repeat(3,minmax(0,1fr))!important}

  .filters{grid-template-columns:repeat(3,minmax(0,1fr))!important}
  .table{min-width:1040px!important}
  .batch-layout{grid-template-columns:220px minmax(0,1fr)!important}
  .batch-list{display:block!important;overflow:visible!important;border-right:1px solid #d9e2e6!important;border-bottom:0!important}
  .batch-item{min-width:0!important}

  .facts{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  .date-grid{grid-template-columns:repeat(3,minmax(0,1fr))!important}
  .work-grid,.processing-body{grid-template-columns:repeat(2,minmax(0,1fr))!important}
}
