*{box-sizing:border-box}
:root{
    --bg:#f5f6f8;
    --ink:#20242a;
    --muted:#6b7280;
    --border:#e5e7eb;
    --nav:#1f2937;
    --blue:#2563eb;
}
body{margin:0;font-family:Arial,Helvetica,sans-serif;background:var(--bg);color:var(--ink)}
a{color:inherit}
.topbar{background:var(--nav);color:#fff}
.topbar-inner{max-width:1580px;margin:auto;min-height:62px;display:flex;align-items:center;gap:30px;padding:0 18px}
.brand{font-size:21px;font-weight:700;color:#fff;text-decoration:none}
.nav{display:flex;gap:22px;flex:1}
.nav a,.user a{color:#fff;text-decoration:none}
.container{max-width:1580px;margin:auto;padding:28px 18px 50px}
h1{margin:0 0 7px;font-size:32px}
h2{margin:0 0 18px;font-size:20px}
.muted{color:var(--muted)}
.hint{display:block;color:var(--muted);font-size:12px;margin-top:6px}
.page-head{display:flex;justify-content:space-between;align-items:center;gap:20px;margin-bottom:18px}
.actions{display:flex;gap:10px}
.btn{display:inline-block;border:0;border-radius:8px;padding:10px 15px;background:#e5e7eb;text-decoration:none;color:#111827;cursor:pointer;font-size:14px}
.btn-primary{background:var(--blue);color:#fff}
.btn-danger{background:#fee2e2;color:#991b1b}
.btn-small{padding:7px 10px;font-size:13px}
.filters{display:flex;flex-wrap:wrap;gap:7px;margin-bottom:14px}
.filter{padding:8px 13px;border:1px solid #d1d5db;border-radius:999px;text-decoration:none;background:#fff;font-size:14px}
.filter.active{background:#1f2937;color:#fff;border-color:#1f2937}
.card,.table-wrap,.form-section{background:#fff;border-radius:12px;box-shadow:0 1px 4px rgba(0,0,0,.10)}
.card{padding:22px}
.section-card{margin-top:18px}
.form-section{padding:22px;margin-bottom:18px}
.form-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px}
.full{grid-column:1/-1}
.section-head{display:flex;align-items:center;justify-content:space-between;gap:20px}
label{display:block;font-weight:600;margin-bottom:7px}
input,select,textarea{width:100%;padding:10px 12px;border:1px solid #d1d5db;border-radius:8px;background:#fff;font:inherit;color:#111827}
textarea{resize:vertical}
.table-wrap{overflow:auto}
.table-wrap.flat{box-shadow:none;border-radius:0}
table{width:100%;border-collapse:collapse}
.orders-table{min-width:1250px}
th,td{padding:13px 12px;border-bottom:1px solid var(--border);text-align:left;vertical-align:top}
th{background:#f9fafb;color:#374151;font-size:13px}
tr.row-new{background:#fff}
tr.row-waiting{background:rgba(250,204,21,.20)}
tr.row-pay-supplier{background:rgba(249,115,22,.20)}
tr.row-problem{background:rgba(239,68,68,.19)}
tr.row-completed{background:rgba(34,197,94,.15);opacity:.60}
.order-link{font-weight:700;text-decoration:none}
.order-link:hover{text-decoration:underline}
.type-badge{display:inline-block;padding:5px 9px;border-radius:999px;font-size:12px;font-weight:700;white-space:nowrap}
.inline-status select{min-width:170px;padding:7px 9px;font-size:13px}
.problem-note{color:#b91c1c;font-weight:700;font-size:12px;margin-top:5px}
.clamp{display:block;max-width:310px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-top:5px}
.empty{text-align:center!important;padding:35px!important;color:var(--muted)}
.alert{padding:12px 14px;border-radius:8px;margin-bottom:18px}
.alert-danger{background:#fee2e2;color:#991b1b}
.items{display:flex;flex-direction:column;gap:10px}
.item-row{display:grid;grid-template-columns:minmax(260px,1fr) 110px 140px 130px 44px;gap:10px;align-items:end;padding:12px;border:1px solid var(--border);border-radius:9px}
.item-remove-wrap{display:flex;align-items:end;padding-bottom:1px}
.line-total{height:41px;display:flex;align-items:center;font-weight:700}
.grand-total{text-align:right;margin-top:16px;font-size:18px}
.form-actions{display:flex;gap:10px;margin-top:18px}
.details-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px}
.details{display:grid;grid-template-columns:150px 1fr;gap:10px 14px;margin:0}
.details dt{color:var(--muted)}
.details dd{margin:0;font-weight:600}
.items-table{min-width:650px}
.view-total{text-align:right;font-size:18px;margin-top:16px}
.comment{line-height:1.55}
.history{display:flex;flex-direction:column}
.history-row{display:grid;grid-template-columns:135px 150px 1fr;gap:10px;padding:10px 0;border-bottom:1px solid var(--border)}
.history-row:last-child{border-bottom:0}
.history-date{color:var(--muted);font-size:13px}
@media(max-width:900px){
    .form-grid,.details-grid{grid-template-columns:1fr}
    .item-row{grid-template-columns:1fr 90px 120px}
    .item-name{grid-column:1/-1}
    .item-remove-wrap{grid-column:3}
    .topbar-inner{flex-wrap:wrap;padding-top:12px;padding-bottom:12px}
    .nav{order:3;width:100%}
}

/* v3 additions */
.items-preview{margin-top:6px;line-height:1.45;color:#374151;font-size:13px}
.list-comment{margin-top:8px;padding:7px 9px;border-radius:7px;background:rgba(59,130,246,.08);font-size:12px;line-height:1.4;color:#374151}
.payment-balance{display:block;margin-top:5px;color:#92400e;font-size:11px;line-height:1.35}
.np-status{display:block;margin-top:5px;color:#2563eb;font-size:11px;line-height:1.35}
.partial-payment-box{display:none}
.alert-success{background:#dcfce7;color:#166534}
.internal-title{margin:20px 0 8px;font-size:15px;color:#6b7280}.internal-comment{background:#f8fafc;border:1px dashed #cbd5e1;padding:10px;border-radius:8px}

/* smartphone-first refinements */
@media(max-width:760px){
 body{font-size:14px}.container{padding:16px 10px 35px}.topbar-inner{gap:10px;padding:10px 12px;min-height:auto}.brand{font-size:19px}.nav{order:3;width:100%;gap:8px;overflow-x:auto;padding-bottom:2px}.nav a{white-space:nowrap;background:rgba(255,255,255,.08);padding:7px 10px;border-radius:7px}.user{margin-left:auto;font-size:12px;white-space:nowrap}
 h1{font-size:25px}.page-head{align-items:flex-start;gap:10px}.page-head .actions{flex-direction:column}.page-head>.btn{white-space:nowrap;padding:9px 11px}.filters{overflow-x:auto;flex-wrap:nowrap;padding-bottom:4px}.filter{white-space:nowrap}
 .form-section,.card{padding:15px;border-radius:10px}.form-grid,.details-grid{grid-template-columns:1fr;gap:13px}.section-head{align-items:center}.section-head h2{margin-bottom:0}.item-row{display:grid;grid-template-columns:1fr 1fr;gap:9px}.item-name{grid-column:1/-1}.item-row>div:nth-child(4){grid-column:1}.item-remove-wrap{grid-column:2;justify-content:flex-end;align-self:end}.line-total{height:auto;min-height:38px}.grand-total{font-size:16px}.form-actions{position:sticky;bottom:0;background:rgba(245,246,248,.96);padding:10px 0;z-index:5}.form-actions .btn{flex:1;text-align:center}
 .table-wrap{background:transparent;box-shadow:none;overflow:visible}.orders-table,.items-table{min-width:0}.orders-table thead,.items-table thead{display:none}.orders-table,.orders-table tbody,.orders-table tr,.orders-table td,.items-table,.items-table tbody,.items-table tr,.items-table td{display:block;width:100%}.orders-table tr{background:#fff!important;opacity:1!important;margin-bottom:12px;border-radius:12px;box-shadow:0 1px 4px rgba(0,0,0,.10);overflow:hidden;border-left:5px solid #cbd5e1}.orders-table tr.row-problem{border-left-color:#ef4444}.orders-table tr.row-waiting{border-left-color:#eab308}.orders-table tr.row-pay-supplier{border-left-color:#f97316}.orders-table tr.row-completed{border-left-color:#22c55e;opacity:.65!important}.orders-table tr.row-new{border-left-color:#94a3b8}.orders-table td{border:0;border-bottom:1px solid #f1f5f9;padding:9px 12px 9px 42%;position:relative;min-height:36px}.orders-table td:last-child{border-bottom:0}.orders-table td::before{content:attr(data-label);position:absolute;left:12px;top:9px;width:36%;color:#6b7280;font-size:11px;font-weight:600}.orders-table td:nth-child(2){padding-left:12px}.orders-table td:nth-child(2)::before{display:none}.items-preview{font-size:12px}.list-comment{font-size:12px}.inline-status select{min-width:0;width:100%}
 .items-table tr{background:#fff;margin-bottom:9px;border:1px solid #e5e7eb;border-radius:9px;padding:4px 0}.items-table td{border:0;padding:7px 10px 7px 40%;position:relative}.items-table td::before{content:attr(data-label);position:absolute;left:10px;color:#6b7280;font-size:11px}.details{grid-template-columns:110px 1fr;gap:8px 10px}.history-row{grid-template-columns:1fr;gap:3px;padding:10px 0}.history-date{font-size:11px}.view-total{font-size:16px}
 input,select,textarea{font-size:16px} /* prevents iOS zoom */
}


/* v3.0.1 — list readability fixes */
.orders-table td > small.muted,
.orders-table td > small.np-status {
    display:block;
    margin-top:4px;
}
.orders-table td[data-label="№ / дата"] .order-link {
    display:block;
    margin-bottom:3px;
}
.orders-table td[data-label="Доставка"] {
    line-height:1.35;
}
@media(max-width:760px){
    .orders-table td[data-label="№ / дата"] .order-link {
        display:inline-block;
        margin-right:0;
        margin-bottom:3px;
        overflow-wrap:anywhere;
    }
    .orders-table td[data-label="№ / дата"] small,
    .orders-table td[data-label="Доставка"] small {
        display:block;
        margin-top:3px;
    }
}


/* v3.0.2 — Nova Poshta refresh controls */
.alert-success{background:#dcfce7;color:#166534;border:1px solid #bbf7d0}
.page-head .actions{display:flex;gap:8px;flex-wrap:wrap;justify-content:flex-end}
@media(max-width:760px){
  .page-head{align-items:flex-start}
  .page-head .actions{width:100%;display:grid;grid-template-columns:1fr 1fr}
  .page-head .actions .btn{text-align:center;white-space:nowrap}
}


/* v3.1 */
.search-bar{display:flex;gap:8px;margin:14px 0}.search-bar input{flex:1}
.dashboard{display:grid;grid-template-columns:1fr 1fr 2fr;gap:14px;margin:12px 0 18px}
.dash-group{background:#fff;border-radius:12px;padding:14px;box-shadow:0 1px 4px rgba(0,0,0,.08)}
.dash-group h3{margin:0 0 10px;font-size:15px;color:#475569}
.dash-cards{display:flex;gap:8px;flex-wrap:wrap}
.dash-card{min-width:110px;flex:1;background:#f8fafc;border:1px solid #e2e8f0;border-radius:10px;padding:10px;text-decoration:none}
.dash-card span{display:block;color:#64748b;font-size:12px}.dash-card strong{display:block;font-size:24px;margin-top:4px}
.dash-yellow{background:#fefce8}.dash-red{background:#fff1f2}.dash-green{background:#f0fdf4}
.type-totals{display:flex;gap:8px;flex-wrap:wrap}.type-total{display:flex;align-items:center;gap:8px;background:#f8fafc;border-radius:9px;padding:7px 9px}.type-total.small{font-size:12px}
.previous-month{margin-top:12px;padding-top:10px;border-top:1px solid #e2e8f0;opacity:.55;font-size:12px}.previous-title{font-weight:700;margin-bottom:6px}
.client-link{font-weight:700;text-decoration:none}.client-link:hover{text-decoration:underline}.order-count-badge{display:inline-block;margin-left:8px;padding:3px 7px;border-radius:999px;background:#eef2ff;color:#3730a3;font-size:11px}
.autocomplete-wrap,.client-autocomplete-wrap{position:relative}.autocomplete-list{position:absolute;left:0;right:0;top:100%;z-index:20;background:#fff;border:1px solid #cbd5e1;border-radius:8px;box-shadow:0 8px 24px rgba(0,0,0,.12);overflow:hidden}.autocomplete-list:empty{display:none}.autocomplete-item{display:flex;flex-direction:column;gap:2px;width:100%;text-align:left;background:#fff;border:0;border-bottom:1px solid #eef2f7;padding:9px 11px;cursor:pointer}.autocomplete-item:hover{background:#f8fafc}.autocomplete-item span{font-size:12px;color:#64748b}
.directory-list,.users-list{display:flex;flex-direction:column;gap:10px}.directory-row,.user-card{display:grid;grid-template-columns:minmax(220px,1fr) auto auto auto auto;gap:10px;align-items:center;background:#fff;border-radius:10px;padding:12px;box-shadow:0 1px 3px rgba(0,0,0,.08)}.type-edit-row{grid-template-columns:minmax(180px,1fr) 130px 130px auto auto auto}.color-control{display:flex;align-items:center;gap:6px;margin:0;font-size:12px}.color-control input{width:48px;padding:2px;height:36px}.user-card{grid-template-columns:1fr 1fr 160px 1fr 110px 110px}.user-active label{margin:0}
.danger-zone{margin-top:20px;padding:14px;border:1px solid #fecaca;background:#fff7f7;border-radius:10px}
.history-orders{min-width:700px}
.problem-note{margin-top:6px}
.alert-success{border:1px solid #bbf7d0}
.page-head .actions{display:flex;gap:8px;flex-wrap:wrap;justify-content:flex-end}

@media(max-width:1100px){
 .dashboard{grid-template-columns:1fr 1fr}.dash-money{grid-column:1/-1}
 .user-card{grid-template-columns:1fr 1fr}.directory-row,.type-edit-row{grid-template-columns:1fr 1fr}
}
@media(max-width:760px){
 .dashboard{grid-template-columns:1fr}.dash-money{grid-column:auto}.dash-cards{display:grid;grid-template-columns:repeat(3,1fr)}.dash-card{min-width:0}.dash-card strong{font-size:20px}
 .search-bar{display:grid;grid-template-columns:1fr auto}.search-bar .btn:last-child{grid-column:1/-1;text-align:center}
 .directory-row,.type-edit-row,.user-card{grid-template-columns:1fr}.directory-row .btn,.type-edit-row .btn,.user-card .btn{width:100%}
 .history-orders,.history-orders tbody,.history-orders tr,.history-orders td{display:block;width:100%}.history-orders thead{display:none}.history-orders tr{background:#fff;margin-bottom:10px;padding:10px;border-radius:9px}.history-orders td{border:0;padding:5px 0}
 .page-head .actions{width:100%;display:grid;grid-template-columns:1fr 1fr}.page-head .actions .btn{text-align:center}
}


/* v3.2 */
.source-add-card{margin-bottom:12px}
.source-add-card h2{margin-bottom:10px}
.source-add-form{display:grid;grid-template-columns:minmax(220px,1fr) auto;gap:10px}
.status-auto-note{font-size:11px;color:#64748b;margin-top:4px}
@media(max-width:760px){
  .source-add-form{grid-template-columns:1fr}
}

/* v3.3.1 — iPhone / mobile layout fixes */
html,body{max-width:100%;overflow-x:hidden}
.topbar{padding-top:env(safe-area-inset-top,0px)}
@media(max-width:760px){
  .topbar-inner{display:grid;grid-template-columns:auto 1fr;grid-template-areas:"brand user" "nav nav";align-items:center;gap:8px 10px;padding:9px 10px 10px;width:100%}
  .brand{grid-area:brand;white-space:nowrap;font-size:19px}
  .user{grid-area:user;justify-self:end;margin:0;min-width:0;font-size:12px;white-space:nowrap}
  .nav{grid-area:nav;width:100%;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;overflow:visible;padding:0}
  .nav a{display:block;min-width:0;padding:7px 5px;text-align:center;font-size:12px;line-height:1.15;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;background:rgba(255,255,255,.08);border-radius:7px}
  .container{width:100%;max-width:100%;padding:16px 10px 35px}
  .page-head{width:100%;display:flex;flex-direction:column;align-items:stretch;gap:12px}
  .page-head>div:first-child{min-width:0}
  .page-head .actions{width:100%;display:grid;grid-template-columns:1fr 1fr;gap:8px}
  .page-head .actions .btn{width:100%;min-width:0;padding:10px 8px;text-align:center;white-space:normal;line-height:1.15}
  .dashboard{width:100%;min-width:0}
  .dash-group,.dash-card{min-width:0}
  .search-bar{width:100%;min-width:0}
  .search-bar input{min-width:0}
  .orders-table td{overflow-wrap:anywhere}
}
@media(max-width:390px){.user{font-size:11px}.nav a{font-size:11px;padding:7px 3px}.page-head .actions{grid-template-columns:1fr}}


/* v3.4 */
.source-badge{
  display:inline-block;padding:5px 9px;border-radius:999px;
  font-size:12px;font-weight:700;white-space:nowrap;
}
.type-filter-link{text-decoration:none}
.active-type-filter{
  display:flex;align-items:center;gap:8px;flex-wrap:wrap;
  margin:0 0 12px;padding:9px 12px;background:#fff;
  border-radius:10px;box-shadow:0 1px 4px rgba(0,0,0,.06);
}
.active-type-filter a{font-size:12px}
.notify-btn{
  appearance:none;border:0;background:rgba(255,255,255,.10);
  color:#fff;border-radius:7px;padding:5px 7px;margin-right:5px;
  cursor:pointer;font-size:14px;line-height:1;
}
.archive-button-wrap{text-align:center;margin:18px 0 8px}
.archive-btn{min-width:180px}
.type-total small{color:#64748b;font-size:11px;white-space:nowrap}
.dash-top-products{min-width:0}
.top-products{display:grid;gap:6px}
.top-product{
  display:grid;grid-template-columns:24px minmax(0,1fr) auto auto;
  align-items:center;gap:7px;padding:6px 8px;border-radius:8px;background:#f8fafc;
}
.top-place{
  width:22px;height:22px;border-radius:999px;background:#e2e8f0;
  display:grid;place-items:center;font-weight:700;font-size:11px;
}
.top-name{font-size:12px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.top-product strong{font-size:13px}
.top-product small{font-size:10px;color:#64748b;white-space:nowrap}

@media(min-width:1101px){
  .dashboard{grid-template-columns:1fr 1fr 2fr 1.35fr}
}

@media(max-width:760px){
  /* Compact dashboard: target roughly half a phone screen instead of a full screen. */
  .dashboard{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:7px;
    margin:8px 0 12px;
  }
  .dash-group{
    padding:7px;
    border-radius:9px;
  }
  .dash-group h3{
    font-size:11px;
    line-height:1.15;
    margin:0 0 5px;
  }
  .dash-cards{gap:4px}
  .dash-card{
    padding:5px 4px;
    border-radius:7px;
    min-height:44px;
  }
  .dash-card span{font-size:9px;line-height:1.05}
  .dash-card strong{font-size:16px;line-height:1;margin-top:3px}
  .dash-money,.dash-top-products{grid-column:1/-1}
  .type-totals{
    display:flex;gap:5px;flex-wrap:wrap;
  }
  .type-total{
    padding:3px 5px;
    gap:4px;
  }
  .type-total .type-badge,.source-badge{
    padding:3px 6px;font-size:10px;
  }
  .type-total strong{font-size:11px}
  .type-total small{font-size:9px}
  .previous-month{
    margin-top:5px;padding-top:5px;
  }
  .previous-title{font-size:9px;margin-bottom:3px}
  .previous-month .type-total{
    display:inline-flex;margin-right:5px;
  }
  .top-products{
    grid-template-columns:repeat(3,minmax(0,1fr));
    gap:4px;
  }
  .top-product{
    display:grid;
    grid-template-columns:18px minmax(0,1fr);
    gap:3px 5px;
    padding:4px;
  }
  .top-place{width:18px;height:18px;font-size:9px}
  .top-name{
    grid-column:2;
    font-size:9px;
  }
  .top-product strong{
    grid-column:1;
    font-size:10px;
  }
  .top-product small{
    grid-column:2;
    font-size:8px;
  }
  .active-type-filter{padding:6px 8px;margin-bottom:8px;font-size:11px}
}

@media(max-width:390px){
  .dashboard{gap:5px}
  .dash-group{padding:6px}
  .dash-card strong{font-size:15px}
}


/* v3.5 integrations */
.integration-card{max-width:980px}
.integration-head{
  display:flex;align-items:center;justify-content:space-between;
  gap:16px;margin-bottom:18px
}
.integration-head h2{margin:0 0 5px}
.integration-status{font-size:13px;font-weight:700}
.integration-status.is-ok{color:#166534}
.integration-status.is-off{color:#991b1b}
.integration-grid{
  display:grid;grid-template-columns:repeat(5,minmax(0,1fr));
  gap:8px;margin-bottom:14px
}
.integration-grid>div{
  padding:10px;border-radius:9px;background:#f8fafc;
  border:1px solid #e2e8f0
}
.integration-grid span{
  display:block;color:#64748b;font-size:11px;margin-bottom:4px
}
.integration-grid strong{font-size:13px}
.integration-help,.integration-note{
  margin-top:12px;padding:11px 12px;border-radius:9px;background:#f8fafc;
  font-size:13px;line-height:1.45
}
.integration-error{margin-top:12px}
.integration-help code{font-size:12px}

@media(max-width:760px){
  .integration-head{align-items:flex-start;flex-direction:column}
  .integration-head form,.integration-head .btn{width:100%}
  .integration-grid{grid-template-columns:1fr 1fr;gap:6px}
  .integration-grid>div{padding:7px}
  .integration-grid strong{font-size:11px}
}

.integration-card-spaced{margin-top:16px}


/* v3.6.2 supplier filter */
.supplier-badge{
  display:inline-block;
  padding:5px 9px;
  border-radius:999px;
  background:#f1f5f9;
  color:#334155;
  font-size:12px;
  font-weight:700;
  white-space:nowrap;
  text-decoration:none;
}
.supplier-badge:hover,
.supplier-badge:focus{
  background:#e2e8f0;
  text-decoration:none;
}


/* v3.6.3 quick filters, branch age, copy/call */
.quick-filter-badge{
  display:inline-block;
  padding:5px 9px;
  border-radius:999px;
  background:#fff7ed;
  color:#9a3412;
  font-size:12px;
  font-weight:700;
}
.branch-days{
  display:block;
  margin-top:4px;
  width:max-content;
  max-width:100%;
  padding:3px 7px;
  border-radius:7px;
  background:#eff6ff;
  color:#1d4ed8;
  font-size:11px;
  font-weight:700;
}
.branch-days-overdue{
  background:#fee2e2;
  color:#b91c1c;
}
.copy-line{
  display:inline-flex;
  align-items:center;
  gap:7px;
  flex-wrap:wrap;
}
.phone-link{
  color:inherit;
  font-weight:700;
  text-decoration:none;
  border-bottom:1px dashed #94a3b8;
}
.phone-link:hover,
.phone-link:focus{
  color:#2563eb;
  border-bottom-color:#2563eb;
}
.copy-btn{
  border:1px solid #cbd5e1;
  background:#fff;
  color:#475569;
  border-radius:7px;
  min-width:30px;
  height:28px;
  padding:0 7px;
  cursor:pointer;
  font-size:15px;
  line-height:1;
}
.copy-btn:hover{background:#f8fafc}
.copy-btn.copied{
  background:#dcfce7;
  color:#166534;
  border-color:#86efac;
}

/* v3.6.5 */
.dash-card.dash-orange{background:#fff7ed;border-color:#fdba74}
.dash-card.dash-orange strong{color:#ea580c}


/* v3.6.6 dashboard / inline TTN */
.dash-label-mobile{display:none!important}
.dash-card.dash-blue{background:#eff6ff;border-color:#93c5fd}
.dash-card.dash-blue strong{color:#1d4ed8}
.dash-card.dash-purple{background:#faf5ff;border-color:#d8b4fe}
.dash-card.dash-purple strong{color:#7e22ce}
.inline-ttn{display:flex;align-items:center;gap:4px;margin-top:5px;max-width:190px}
.inline-ttn input{min-width:0;width:145px;padding:5px 6px;font-size:11px;border:1px solid #cbd5e1;border-radius:6px;background:#fff}
.inline-ttn-btn{flex:0 0 28px;width:28px;height:28px;border:1px solid #86efac;border-radius:6px;background:#dcfce7;color:#166534;font-weight:700;cursor:pointer;padding:0}
.inline-ttn-btn:hover{background:#bbf7d0}

@media(max-width:760px){
  .dash-label-desktop{display:none!important}
  .dash-label-mobile{display:block!important}
  .dashboard .dash-money,
  .dashboard .dash-top-products{display:none!important}
  .inline-ttn{max-width:100%;margin-top:6px}
  .inline-ttn input{width:100%;font-size:12px;padding:7px 8px}
  .inline-ttn-btn{height:32px;width:32px;flex-basis:32px}
}


/* v3.6.7.1 — mobile order cards hotfix */
@media (max-width:760px) {
  /*
   * Important: the original mobile table uses absolute ::before labels and
   * 42% left padding. v3.6.7 removed that padding, so labels overlapped data.
   * This layout deliberately replaces that mechanism instead of fighting it.
   */
  .orders-table tbody tr{
    display:grid !important;
    grid-template-columns:1fr 1fr;
    column-gap:8px;
    row-gap:0;
    width:100%;
    padding:7px 10px !important;
    margin:0 0 9px !important;
    border-radius:14px;
    box-shadow:0 2px 8px rgba(15,23,42,.10);
    overflow:hidden;
  }

  .orders-table tbody tr td{
    width:auto !important;
    min-height:0 !important;
    padding:5px 2px !important;
    position:relative;
    border:0 !important;
    border-bottom:1px solid #eef2f7 !important;
  }

  /* Default: do not show the old absolute labels. */
  .orders-table tbody tr td::before{
    display:none !important;
  }

  /* Order number + date: one compact line. */
  .orders-table .mobile-order-meta{
    grid-column:1 / -1;
    display:flex !important;
    align-items:baseline;
    gap:9px;
    padding-top:2px !important;
    padding-bottom:5px !important;
  }
  .orders-table .mobile-order-meta .order-link{
    font-size:15px;
    line-height:1.15;
  }
  .orders-table .mobile-order-meta small{
    display:inline !important;
    margin:0 !important;
    font-size:11px;
    line-height:1.15;
  }

  /* Client + ALL products/comments stay fully visible. */
  .orders-table .mobile-client-product-cell{
    grid-column:1 / -1;
    display:block !important;
    padding:6px 2px !important;
  }
  .orders-table .mobile-client-product-cell .order-link{
    font-size:15px;
    line-height:1.2;
  }
  .orders-table .mobile-client-product-cell .items-preview,
  .orders-table .mobile-client-product-cell .list-comment{
    margin-top:3px !important;
    line-height:1.25;
    white-space:normal !important;
    overflow:visible !important;
    max-height:none !important;
    -webkit-line-clamp:unset !important;
    line-clamp:unset !important;
  }

  /* Type and source share one row. Their badges already explain themselves. */
  .orders-table .mobile-type-cell,
  .orders-table .mobile-source-cell{
    display:flex !important;
    align-items:center;
    padding:5px 2px !important;
  }
  .orders-table .mobile-type-cell{grid-column:1}
  .orders-table .mobile-source-cell{grid-column:2}

  .orders-table .type-badge,
  .orders-table .source-badge{
    padding:3px 7px !important;
    font-size:11px !important;
    line-height:1.15;
  }

  /* Total stays prominent; prepayment and balance stay visible. */
  .orders-table .mobile-total-cell{
    grid-column:1 / -1;
    display:flex !important;
    align-items:baseline;
    flex-wrap:wrap;
    gap:4px 8px;
    padding:6px 2px !important;
  }
  .orders-table .mobile-total-cell strong{
    font-size:17px !important;
    line-height:1.1;
  }
  .orders-table .mobile-total-cell .payment-balance,
  .orders-table .mobile-total-cell small{
    display:inline !important;
    margin:0 !important;
    line-height:1.15;
  }

  /* Status: compact labeled row. */
  .orders-table .mobile-status-cell{
    grid-column:1 / -1;
    display:grid !important;
    grid-template-columns:62px minmax(0,1fr);
    align-items:center;
    column-gap:8px;
    padding:5px 2px !important;
  }
  .orders-table .mobile-status-cell::before{
    content:"Статус";
    display:block !important;
    position:static !important;
    width:auto !important;
    color:#64748b;
    font-size:11px;
    font-weight:700;
  }
  .orders-table .mobile-status-cell .inline-status{
    min-width:0;
  }
  .orders-table .mobile-status-cell select{
    width:100%;
    min-height:34px !important;
    height:34px !important;
    padding:3px 8px !important;
  }
  .orders-table .mobile-status-cell .problem-note{
    grid-column:1 / -1;
    margin-top:4px;
  }

  /* Delivery + TTN: compact labeled row without hiding any useful data. */
  .orders-table .mobile-delivery-cell{
    grid-column:1 / -1;
    display:grid !important;
    grid-template-columns:62px minmax(0,1fr);
    align-items:start;
    column-gap:8px;
    padding:5px 2px 2px !important;
    border-bottom:0 !important;
  }
  .orders-table .mobile-delivery-cell::before{
    content:"Доставка";
    display:block !important;
    position:static !important;
    width:auto !important;
    color:#64748b;
    font-size:11px;
    font-weight:700;
    padding-top:3px;
  }

  /* Everything after the service text stays in the right column. */
  .orders-table .mobile-delivery-cell > small,
  .orders-table .mobile-delivery-cell > form{
    grid-column:2;
  }
  .orders-table .mobile-delivery-cell .inline-ttn{
    width:100%;
    max-width:none;
    margin-top:4px;
    gap:5px;
  }
  .orders-table .mobile-delivery-cell .inline-ttn input{
    width:100%;
    min-height:34px !important;
    height:34px !important;
    padding:4px 8px !important;
  }
  .orders-table .mobile-delivery-cell .inline-ttn-btn{
    width:34px;
    height:34px !important;
    min-height:34px !important;
    flex:0 0 34px;
  }
  .orders-table .mobile-delivery-cell .np-status,
  .orders-table .mobile-delivery-cell .branch-days{
    margin-top:3px;
  }

  /* Supplier is still visible in the full order page, not in mobile list. */
  .orders-table .mobile-supplier-cell{
    display:none !important;
  }
}

/* v3.6.9 Notification Center */
.notification-center-link{position:relative;text-decoration:none;display:inline-flex;align-items:center;justify-content:center}
.notification-badge{position:absolute;top:-7px;right:-9px;min-width:17px;height:17px;padding:0 4px;border-radius:10px;background:#dc2626;color:#fff;font-size:10px;font-weight:700;line-height:17px;text-align:center;box-sizing:border-box}
.notification-actions{display:flex;gap:8px;flex-wrap:wrap}
.notification-list{display:flex;flex-direction:column;gap:8px}
.notification-item{display:flex;gap:12px;padding:15px 16px;border:1px solid #e2e8f0;border-radius:12px;background:#fff;color:inherit;text-decoration:none}
.notification-item:hover{border-color:#94a3b8}
.notification-item.is-unread{background:#eff6ff;border-color:#bfdbfe}
.notification-dot{width:9px;height:9px;border-radius:50%;background:#cbd5e1;margin-top:6px;flex:0 0 auto}
.notification-item.is-unread .notification-dot{background:#2563eb}
.notification-main{min-width:0}.notification-title{font-weight:700;margin-bottom:4px}.notification-body{line-height:1.35}.notification-meta{font-size:12px;color:#64748b;margin-top:7px}
@media(max-width:700px){.notification-actions{width:100%}.notification-actions .btn{flex:1}.notification-item{padding:13px}}


/* v3.6.13 — Tasks / development board */
.task-board{display:grid;grid-template-columns:repeat(4,minmax(250px,1fr));gap:14px;align-items:start}
.task-column{background:#eef2f7;border:1px solid #dbe3ed;border-radius:14px;padding:10px;min-height:320px}
.task-column-head{display:flex;justify-content:space-between;align-items:center;padding:4px 4px 10px;font-weight:700}
.task-count{background:#fff;border-radius:999px;padding:3px 8px;font-size:12px;color:#64748b}
.task-dropzone{min-height:250px;display:flex;flex-direction:column;gap:10px}
.task-card{display:block;background:#fff;border:1px solid #dfe5ec;border-radius:11px;padding:12px;text-decoration:none;box-shadow:0 1px 3px rgba(0,0,0,.07);cursor:grab}
.task-card.dragging{opacity:.45}.task-column.drag-over{outline:2px dashed #2563eb;outline-offset:-5px}
.task-card-title{font-weight:700;line-height:1.3;margin-bottom:8px}
.task-card-note{font-size:12px;line-height:1.35;padding:6px 8px;border-radius:7px;background:#fff7ed;color:#9a3412;margin:7px 0}
.task-card-history{font-size:12px;color:#64748b;line-height:1.4;border-top:1px solid #eef2f7;padding-top:8px;margin-top:8px}
.task-labels{display:flex;gap:5px;flex-wrap:wrap;margin:6px 0}
.task-label{display:inline-block;padding:3px 7px;border-radius:999px;font-size:11px;font-weight:700}
.task-mobile-status{display:none;margin-top:8px;font-size:12px}
.task-form-grid{display:grid;grid-template-columns:2fr 1fr;gap:18px}
.task-history-list{display:flex;flex-direction:column;gap:9px}
.task-history-item{background:#f8fafc;border:1px solid #e5e7eb;border-radius:9px;padding:10px 12px}
.task-history-meta{font-size:11px;color:#64748b;margin-bottom:4px}
.task-label-editor{display:flex;flex-direction:column;gap:8px}
.task-label-row{display:grid;grid-template-columns:46px 1fr auto;gap:8px;align-items:center}
.task-label-row input[type=color]{width:46px;height:38px;padding:2px}
@media(max-width:1100px){.task-board{grid-template-columns:repeat(2,minmax(250px,1fr))}}
@media(max-width:760px){
 .task-board{grid-template-columns:1fr}.task-column{min-height:0}.task-dropzone{min-height:80px}
 .task-card{cursor:default}.task-mobile-status{display:block}.task-form-grid{grid-template-columns:1fr}
}


/* v3.6.14 — quick messenger buttons beside client phone */
.messenger-links{
  display:inline-flex;
  align-items:center;
  gap:5px;
  margin-left:2px;
}
.messenger-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  height:28px;
  min-width:28px;
  padding:0 6px;
  border:1px solid #cbd5e1;
  border-radius:7px;
  background:#fff;
  color:#334155;
  text-decoration:none;
  font-size:10px;
  font-weight:800;
  line-height:1;
  box-sizing:border-box;
  transition:transform .12s ease,box-shadow .12s ease,border-color .12s ease;
}
.messenger-btn:hover,
.messenger-btn:focus{
  transform:translateY(-1px);
  border-color:#94a3b8;
  box-shadow:0 2px 5px rgba(15,23,42,.12);
}
.messenger-viber{color:#665cac}
.messenger-telegram{color:#229ed9}
.messenger-whatsapp{color:#128c7e}
.messenger-signal{color:#3a76f0}
.client-contact-head{
  display:flex;
  align-items:center;
  gap:7px;
  flex-wrap:wrap;
}
@media(max-width:700px){
 .messenger-links{gap:4px}
 .messenger-btn{height:32px;min-width:32px}
}

/* v3.6.14.1 — messenger SVG icons */
.messenger-btn{padding:0;width:36px;min-width:36px;height:36px}
.messenger-btn svg{width:23px;height:23px;display:block;fill:currentColor}
.messenger-viber{color:#7360f2}
.messenger-telegram{color:#229ed9}
.messenger-whatsapp{color:#25d366}
.messenger-signal{color:#3a76f0}
@media(max-width:700px){
 .messenger-btn{width:34px;min-width:34px}
 .messenger-btn svg{width:20px;height:20px}
}


/* Customer message templates */
.product-url-form{display:flex;gap:6px;margin-top:8px;max-width:720px;align-items:center}
.product-url-form input{min-width:260px;flex:1;height:34px;padding:5px 8px;border:1px solid #cbd5e1;border-radius:7px;background:#fff}
.customer-message-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
.customer-message-card{border:1px solid #e2e8f0;border-radius:11px;background:#f8fafc;padding:12px}
.customer-message-head{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:9px}
.customer-message-text{width:100%;min-height:220px;resize:vertical;background:#fff;border:1px solid #dbe3ed;border-radius:8px;padding:10px;line-height:1.45;font:inherit;box-sizing:border-box}
.item-url{min-width:240px}
@media(max-width:800px){.customer-message-grid{grid-template-columns:1fr}.product-url-form{flex-wrap:wrap}.product-url-form input{min-width:0;width:100%}.customer-message-text{min-height:240px}}

/* Customer messages v1.1 — compact UI */
.product-link-cell{width:150px;white-space:nowrap}
.product-link-view{display:flex;align-items:center;gap:6px}
.product-link-view a{font-weight:600;text-decoration:none}
.link-add-btn,.link-edit-btn{border:0;background:transparent;color:#2563eb;cursor:pointer;padding:4px 2px;font:inherit}
.link-edit-btn{color:#64748b;font-size:15px}
.product-url-editor{display:flex;align-items:center;gap:5px;margin-top:5px}
.product-url-editor.is-hidden{display:none}
.product-url-editor input{width:210px;max-width:32vw;height:32px;padding:5px 7px;border:1px solid #cbd5e1;border-radius:7px}
.customer-messages{padding-bottom:18px}
.customer-message-actions{display:flex;flex-wrap:wrap;gap:9px;margin-top:8px}
.customer-message-open{appearance:none;border:1px solid #cbd5e1;background:#fff;border-radius:9px;padding:9px 12px;font:inherit;font-weight:600;color:#1e293b;cursor:pointer;box-shadow:0 1px 2px rgba(15,23,42,.04)}
.customer-message-open:hover{border-color:#94a3b8;background:#f8fafc}
.customer-message-source{display:none}
.message-modal{display:none;position:fixed;inset:0;z-index:10000;align-items:center;justify-content:center;padding:20px}
.message-modal.is-open{display:flex}
.message-modal-backdrop{position:absolute;inset:0;background:rgba(15,23,42,.52)}
.message-modal-dialog{position:relative;width:min(720px,100%);max-height:90vh;background:#fff;border-radius:14px;box-shadow:0 20px 60px rgba(15,23,42,.28);padding:18px;display:flex;flex-direction:column;gap:14px}
.message-modal-head{display:flex;align-items:center;justify-content:space-between;gap:12px}
.message-modal-head h3{margin:0;font-size:19px}
.message-modal-x{border:0;background:transparent;font-size:28px;line-height:1;color:#64748b;cursor:pointer;padding:2px 5px}
.message-modal-text{width:100%;min-height:330px;max-height:60vh;resize:vertical;border:1px solid #cbd5e1;border-radius:9px;padding:12px;font:inherit;line-height:1.5;box-sizing:border-box;background:#fff}
.message-modal-actions{display:flex;justify-content:flex-end;gap:8px}
body.modal-open{overflow:hidden}
@media(max-width:700px){
 .product-link-cell{width:auto;white-space:normal}.product-url-editor input{width:100%;max-width:none;min-width:0}.product-url-editor{width:100%}
 .customer-message-actions{display:grid;grid-template-columns:1fr}.customer-message-open{text-align:left}
 .message-modal{padding:10px}.message-modal-dialog{max-height:94vh;padding:14px}.message-modal-text{min-height:55vh}.message-modal-actions .btn{flex:1}
}


/* Customer messages v1.2 — polished desktop UI */
@media(min-width:701px){
  .product-link-cell{width:138px;min-width:138px;vertical-align:middle}
  .product-link-view{gap:7px}
  .link-add-btn,.product-link-view a,.link-edit-btn{
    display:inline-flex;align-items:center;justify-content:center;min-height:32px;
    border:1px solid #d7dee8;border-radius:8px;background:#fff;color:#334155;
    padding:5px 9px;text-decoration:none;font-size:13px;font-weight:650;
    box-shadow:0 1px 2px rgba(15,23,42,.04);transition:.15s ease;
  }
  .link-add-btn:hover,.product-link-view a:hover,.link-edit-btn:hover{background:#f8fafc;border-color:#aeb9c8;color:#1d4ed8;transform:translateY(-1px)}
  .link-edit-btn{width:32px;padding:5px;color:#64748b}
  .product-url-editor{position:absolute;z-index:20;margin-top:6px;width:330px;padding:8px;background:#fff;border:1px solid #d7dee8;border-radius:10px;box-shadow:0 10px 30px rgba(15,23,42,.14)}
  .product-url-editor input{width:270px;max-width:none;height:34px}
  .product-url-editor .btn{height:34px;min-width:42px;border-radius:7px}

  .customer-messages{padding:18px 20px 20px}
  .customer-messages h2{margin-bottom:4px}
  .customer-message-actions{gap:10px;margin-top:12px}
  .customer-message-open{
    min-height:42px;padding:9px 14px;border:1px solid #dbe2ea;border-radius:10px;
    background:#f8fafc;color:#243244;font-size:14px;font-weight:700;
    box-shadow:0 1px 2px rgba(15,23,42,.04);transition:.15s ease;
  }
  .customer-message-open:before{content:'📋';margin-right:7px;font-size:14px}
  .customer-message-open:hover{background:#fff;border-color:#9eb0c5;box-shadow:0 4px 12px rgba(15,23,42,.08);transform:translateY(-1px)}

  .message-modal-dialog{width:min(760px,calc(100vw - 60px));border:1px solid #e2e8f0;padding:0;gap:0;overflow:hidden}
  .message-modal-head{padding:16px 20px;border-bottom:1px solid #e5e7eb;background:#f8fafc}
  .message-modal-head h3{font-size:18px;color:#172033}
  .message-modal-x{width:34px;height:34px;border-radius:8px;display:flex;align-items:center;justify-content:center}
  .message-modal-x:hover{background:#e9eef5;color:#0f172a}
  .message-modal-text{margin:18px 20px;width:calc(100% - 40px);min-height:360px;max-height:56vh;border-color:#d8e0e9;border-radius:10px;padding:14px 16px;line-height:1.55;box-shadow:inset 0 1px 2px rgba(15,23,42,.03)}
  .message-modal-actions{padding:12px 20px 16px;border-top:1px solid #e5e7eb;background:#f8fafc}
  .message-modal-actions .btn{min-height:38px;border-radius:9px;padding:8px 14px}
  .message-modal-actions .btn-primary{min-width:145px}
}
```

/* LL-CRM v1.2.2 — desktop spacing fix */
@media (min-width: 701px) {

    /* Товари -> Доставка й оплата / Коментарі */
    .section-card + .details-grid {
        margin-top: 18px !important;
    }

    /* Доставка/Коментарі -> Повідомлення клієнту */
    .details-grid + .customer-messages {
        margin-top: 18px !important;
    }

    /* Повідомлення клієнту -> Історія */
    .customer-messages + .section-card {
        margin-top: 18px !important;
    }
}

/* Order view desktop vertical spacing */
@media (min-width: 701px) {
    .order-products-card {
        margin-bottom: 18px !important;
    }

    .order-delivery-grid {
        margin-top: 0 !important;
        margin-bottom: 18px !important;
    }

    .order-delivery-grid + .customer-messages {
        margin-top: 0 !important;
    }

    .customer-messages {
        margin-bottom: 18px !important;
    }
}
/* Direct link to marketplace order */
.source-direct-wrap,
.source-list-wrap {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.source-direct-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 28px;
    height: 28px;

    border: 1px solid #cbd5e1;
    border-radius: 7px;

    background: #fff;
    color: #2563eb;

    text-decoration: none;
    font-weight: 800;
    line-height: 1;

    box-sizing: border-box;
}

.source-direct-link:hover {
    background: #eff6ff;
    border-color: #93c5fd;
}

@media(max-width:760px) {
    .source-direct-link {
        width: 30px;
        height: 30px;
        flex: 0 0 30px;
    }
}
/* v3.6.15 — task assignees */
.task-assignee{display:inline-flex;align-items:center;gap:4px;margin:1px 0 7px;padding:4px 8px;border-radius:999px;background:#eef2ff;color:#3730a3;font-size:11px;font-weight:700}
.task-card-mine{border:2px solid #60a5fa;background:#eff6ff;box-shadow:0 2px 8px rgba(37,99,235,.15)}
.task-card-mine .task-assignee{background:#dbeafe;color:#1d4ed8}

/* LL-CRM v3.6.16 — notification colors by event type */
.notification-item{position:relative;border-left-width:5px!important;transition:border-color .15s ease,background .15s ease,box-shadow .15s ease}
.notification-item.notification-type-new{border-left-color:#3b82f6;background:#f5f9ff}
.notification-item.notification-type-new .notification-dot{background:#3b82f6}
.notification-item.notification-type-task{border-left-color:#8b5cf6;background:#faf7ff}
.notification-item.notification-type-task .notification-dot{background:#8b5cf6}
.notification-item.notification-type-warning{border-left-color:#f59e0b;background:#fffbf2}
.notification-item.notification-type-warning .notification-dot{background:#f59e0b}
.notification-item.notification-type-success{border-left-color:#22c55e;background:#f4fcf7}
.notification-item.notification-type-success .notification-dot{background:#22c55e}
.notification-item.notification-type-danger{border-left-color:#ef4444;background:#fff6f6}
.notification-item.notification-type-danger .notification-dot{background:#ef4444}
.notification-item.notification-type-neutral{border-left-color:#94a3b8;background:#fff}
.notification-item.notification-type-neutral .notification-dot{background:#94a3b8}
.notification-item.is-unread{box-shadow:0 0 0 1px rgba(37,99,235,.08),0 3px 10px rgba(15,23,42,.06)}
.notification-item.is-unread .notification-title{font-weight:800}
.notification-item:hover{filter:brightness(.985);box-shadow:0 4px 14px rgba(15,23,42,.08)}

/* v3.6.17 — order item editor: product URL no longer overlaps quantity/price */
.item-row{grid-template-columns:minmax(300px,1.7fr) minmax(230px,1fr) 100px 120px 100px 44px!important;align-items:end}
.item-url{min-width:0!important}.item-url input{width:100%;min-width:0}.item-row>.hint{grid-column:2/5;margin-top:-4px}
@media(max-width:1050px){.item-row{grid-template-columns:minmax(240px,1fr) minmax(200px,1fr) 90px 110px!important}.item-row .item-remove-wrap{grid-column:auto}.item-row>div:has(.line-total){grid-column:auto}}
@media(max-width:700px){.item-row{grid-template-columns:1fr 1fr!important}.item-name,.item-url{grid-column:1/-1}.item-row>.hint{grid-column:1/-1}.item-remove-wrap{grid-column:2!important}}

/* v3.6.17 — unified chats */
.chat-page{max-width:1500px;margin:0 auto}.chat-head{display:flex;justify-content:space-between;gap:16px;align-items:center;margin-bottom:16px}.chat-head h1{margin:0}.chat-actions,.chat-actions form{display:flex;gap:8px;align-items:center}.chat-actions select{min-width:190px}.chat-shell{display:grid;grid-template-columns:340px minmax(0,1fr);height:calc(100vh - 180px);min-height:560px;background:#fff;border:1px solid var(--border);border-radius:14px;overflow:hidden}.chat-list{border-right:1px solid var(--border);overflow-y:auto;background:#f8fafc}.chat-tabs{display:flex;gap:6px;padding:10px;border-bottom:1px solid var(--border);position:sticky;top:0;background:#f8fafc;z-index:2}.chat-tabs span{font-size:12px;padding:5px 8px;border-radius:999px;background:#eef2f7}.chat-thread{display:block;padding:13px 14px;border-bottom:1px solid #e5e7eb;color:inherit;text-decoration:none}.chat-thread:hover,.chat-thread.active{background:#eaf2ff}.chat-thread>div{display:flex;justify-content:space-between;gap:8px}.chat-thread i{font-style:normal;background:#2563eb;color:#fff;min-width:20px;height:20px;border-radius:10px;text-align:center;font-size:12px;line-height:20px}.chat-thread small{display:block;color:#64748b;margin-top:5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.chat-dialog{min-width:0;display:flex;flex-direction:column;background:#f4f6f8}.chat-dialog-head{height:64px;flex:0 0 64px;padding:10px 16px;background:#fff;border-bottom:1px solid var(--border);display:flex;justify-content:space-between;align-items:center}.chat-dialog-head small{display:block;color:#64748b;margin-top:3px}.chat-messages{flex:1;overflow-y:auto;padding:18px;display:flex;flex-direction:column;gap:9px}.chat-bubble{max-width:72%;padding:9px 12px;border-radius:13px;background:#fff;border:1px solid #e2e8f0;box-shadow:0 1px 2px rgba(0,0,0,.04)}.chat-bubble.mine{align-self:flex-end;background:#dbeafe;border-color:#bfdbfe}.chat-bubble.theirs{align-self:flex-start}.chat-bubble small{display:block;margin-top:5px;color:#64748b;font-size:11px}.chat-compose{display:grid;grid-template-columns:1fr auto;gap:10px;padding:12px;background:#fff;border-top:1px solid var(--border)}.chat-compose textarea{resize:none}.chat-empty{margin:auto;color:#64748b}.muted{color:#64748b;font-size:13px}
@media(max-width:800px){.chat-head{align-items:flex-start;flex-direction:column}.chat-actions{width:100%;flex-wrap:wrap}.chat-actions form{flex:1}.chat-actions select{min-width:0;flex:1}.chat-shell{grid-template-columns:125px minmax(0,1fr);height:calc(100vh - 220px);min-height:500px}.chat-tabs{display:none}.chat-thread{padding:10px 8px}.chat-thread b{font-size:12px}.chat-thread small{font-size:10px}.chat-bubble{max-width:88%}.chat-compose{grid-template-columns:1fr}.chat-compose .btn{width:100%}}


/* v3.6.32 — actionable morning strip */
.morning-screen{display:flex;align-items:stretch;gap:12px;margin:0 0 16px;padding:12px;background:#fff;border:1px solid var(--border);border-radius:14px;box-shadow:0 1px 2px rgba(15,23,42,.03)}
.morning-title{display:flex;min-width:115px;flex-direction:column;justify-content:center;padding:4px 10px;border-right:1px solid #e5e7eb}.morning-title strong{font-size:16px}.morning-title span{font-size:12px;color:#64748b;margin-top:3px}
.morning-actions{display:grid;grid-template-columns:repeat(8,minmax(82px,1fr));gap:8px;flex:1}.morning-actions a{display:flex;align-items:center;gap:7px;min-width:0;padding:9px 10px;border:1px solid #e2e8f0;border-radius:10px;background:#f8fafc;color:#243244;text-decoration:none}.morning-actions a:hover{background:#fff;border-color:#a9b8ca}.morning-actions strong{font-size:18px;color:#0f172a}.morning-actions span{font-size:12px;line-height:1.15}

/* v3.6.32 — quick order from text */
.quick-order-parser{margin:0 0 16px;padding:14px;border:1px solid #bfdbfe;border-radius:12px;background:#eff6ff}.quick-order-parser-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:9px}.quick-order-parser-head strong{display:block;font-size:15px}.quick-order-parser-head small{display:block;margin-top:3px;color:#64748b}.quick-order-parser textarea{width:100%;box-sizing:border-box;resize:vertical;background:#fff}.quick-order-result{margin-top:7px;font-size:12px;color:#166534;font-weight:600}

/* v3.6.32 — mobile PWA navigation */
.mobile-app-nav,.mobile-more-menu{display:none}
@media(max-width:800px){
 body{padding-bottom:calc(68px + env(safe-area-inset-bottom))}.container{padding-bottom:12px}
 .topbar .nav{display:none}.topbar-inner{min-height:54px}.topbar .brand{font-size:18px}.topbar .user{margin-left:auto;font-size:0}.topbar .user>a{font-size:13px}.topbar .user>a:last-child{display:none}
 .mobile-app-nav{position:fixed;display:grid;grid-template-columns:repeat(5,1fr);left:0;right:0;bottom:0;z-index:1000;padding:5px 5px calc(5px + env(safe-area-inset-bottom));background:rgba(255,255,255,.97);border-top:1px solid #dbe2ea;box-shadow:0 -4px 18px rgba(15,23,42,.08);backdrop-filter:blur(10px)}
 .mobile-app-nav-item{position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;min-width:0;height:52px;padding:2px;border:0;background:transparent;color:#475569;text-decoration:none;font:inherit;font-size:10px;font-weight:700;cursor:pointer}.mobile-app-nav-icon{font-size:20px;line-height:22px;color:#334155}.mobile-app-nav-add .mobile-app-nav-icon{display:flex;align-items:center;justify-content:center;width:31px;height:31px;border-radius:50%;background:#2563eb;color:#fff;font-size:24px;line-height:31px}.mobile-app-nav-add span:last-child{margin-top:-4px}
 .mobile-nav-badge,.mobile-more-menu .notification-badge-sync{display:inline-flex;align-items:center;justify-content:center;min-width:17px;height:17px;padding:0 4px;border-radius:9px;background:#ef4444;color:#fff;font-size:10px;font-style:normal}.mobile-nav-badge{position:absolute;top:1px;right:17%}.mobile-nav-badge[hidden],.mobile-more-menu .notification-badge-sync[hidden]{display:none!important}
 .mobile-more-menu{position:fixed;display:grid;right:10px;bottom:calc(68px + env(safe-area-inset-bottom));z-index:1001;width:min(260px,calc(100vw - 20px));padding:8px;background:#fff;border:1px solid #dbe2ea;border-radius:14px;box-shadow:0 16px 40px rgba(15,23,42,.18)}.mobile-more-menu[hidden]{display:none}.mobile-more-menu a{display:flex;align-items:center;justify-content:space-between;padding:11px 12px;border-radius:9px;color:#243244;text-decoration:none;font-weight:600}.mobile-more-menu a:hover{background:#f1f5f9}
 .morning-screen{display:block;padding:10px}.morning-title{display:flex;flex-direction:row;justify-content:space-between;min-width:0;padding:0 2px 8px;border-right:0;border-bottom:1px solid #e5e7eb}.morning-title span{margin:0}.morning-actions{grid-template-columns:repeat(4,1fr);gap:5px;padding-top:8px}.morning-actions a{display:block;text-align:center;padding:7px 3px}.morning-actions strong{display:block;font-size:18px}.morning-actions span{display:block;margin-top:2px;font-size:9px;line-height:1.05;overflow-wrap:anywhere}
 .quick-order-parser-head{align-items:flex-start}.quick-order-parser-head .btn{flex:0 0 auto}.quick-order-parser-head small{font-size:11px}
}

/* v3.6.35 — compact single-row work dashboard + mobile fixes */
/* Desktop: every dashboard group occupies the same row without dead space. */
.dashboard{
  display:grid!important;
  grid-template-columns:minmax(210px,.75fr) minmax(320px,1.05fr) minmax(360px,1.35fr)!important;
  align-items:stretch;
  gap:10px!important;
}
.dashboard .dash-group{min-width:0;height:100%}
.dashboard .dash-money,.dashboard .dash-top-products{grid-column:auto!important}

/* Date/time must never force the mobile form outside the viewport. */
input[type="datetime-local"]{
  display:block;width:100%!important;max-width:100%!important;min-width:0!important;
  box-sizing:border-box!important;
}

@media(max-width:800px){
  /* One compact horizontal line. Swipe sideways only when the screen is too narrow. */
  .morning-screen{
    display:flex!important;align-items:center!important;gap:6px!important;
    margin:0 0 8px!important;padding:6px!important;overflow-x:auto!important;
    overflow-y:hidden!important;scrollbar-width:none;-webkit-overflow-scrolling:touch;
  }
  .morning-screen::-webkit-scrollbar,.dashboard::-webkit-scrollbar{display:none}
  .morning-title{
    position:sticky;left:0;z-index:2;display:flex!important;flex:0 0 72px!important;
    min-width:72px!important;align-self:stretch;flex-direction:column!important;
    justify-content:center!important;padding:3px 6px!important;border:0!important;
    border-right:1px solid #e5e7eb!important;background:#fff!important;
  }
  .morning-title strong{font-size:12px!important;white-space:nowrap}
  .morning-title span{font-size:9px!important;margin-top:1px!important}
  .morning-actions{
    display:flex!important;flex:0 0 auto!important;gap:5px!important;padding:0!important;
  }
  .morning-actions a{
    display:flex!important;flex-direction:column!important;justify-content:center!important;
    flex:0 0 88px!important;width:88px!important;min-height:47px!important;
    padding:4px 5px!important;text-align:center!important;gap:1px!important;
  }
  .morning-actions strong{font-size:16px!important;line-height:1!important}
  .morning-actions span{font-size:8px!important;line-height:1.05!important;margin:1px 0 0!important}

  .dashboard{
    display:flex!important;width:100%!important;gap:6px!important;margin:6px 0 10px!important;
    overflow-x:auto!important;overflow-y:hidden!important;scrollbar-width:none;
    -webkit-overflow-scrolling:touch;align-items:stretch!important;
  }
  .dashboard .dash-group{
    display:block!important;flex:0 0 auto!important;width:auto!important;min-width:0!important;
    padding:6px!important;border-radius:9px!important;
  }
  .dashboard .dash-group:first-child{width:250px!important}
  .dashboard .dash-money{display:block!important;width:330px!important}
  .dashboard .dash-top-products{display:block!important;width:330px!important}
  .dashboard .dash-group h3{font-size:10px!important;margin:0 0 4px!important;white-space:nowrap}
  .dashboard .dash-cards{display:flex!important;gap:4px!important}
  .dashboard .dash-card{flex:1 1 0!important;min-width:55px!important;min-height:39px!important;padding:4px!important}
  .dashboard .dash-card span{font-size:8px!important}
  .dashboard .dash-card strong{font-size:14px!important}
  .dashboard .type-totals{display:flex!important;flex-wrap:nowrap!important;gap:4px!important}
  .dashboard .type-total{flex:0 0 auto!important;padding:3px 4px!important}
  .dashboard .top-products{display:flex!important;gap:4px!important}
  .dashboard .top-product{flex:1 1 0!important;min-width:0!important;padding:4px!important}

  /* Native iOS date control can otherwise keep its intrinsic desktop width. */
  input[type="datetime-local"]{-webkit-appearance:none;appearance:none;font-size:16px!important}

  /* In an opened chat the app bar must not cover the composer or jump with the keyboard. */
  body.chat-dialog-open-page{padding-bottom:0!important}
  body.chat-dialog-open-page .mobile-app-nav,
  body.chat-dialog-open-page .mobile-more-menu{display:none!important}
  body.chat-dialog-open-page .container{padding-bottom:0!important}
}


/* v3.6.36 — mobile dashboard: everything visible, no horizontal scrolling */
@media(max-width:800px){
  /* "На сьогодні": title + all 7 actions fit into the viewport. */
  .morning-screen{
    display:grid!important;
    grid-template-columns:68px minmax(0,1fr)!important;
    width:100%!important;max-width:100%!important;
    overflow:hidden!important;
    gap:4px!important;padding:5px!important;
  }
  .morning-title{
    position:static!important;
    min-width:0!important;width:auto!important;flex:none!important;
    padding:2px 4px!important;
  }
  .morning-title strong{font-size:10px!important;white-space:nowrap!important}
  .morning-title span{font-size:8px!important}
  .morning-actions{
    display:grid!important;
    grid-template-columns:repeat(7,minmax(0,1fr))!important;
    width:100%!important;min-width:0!important;
    gap:2px!important;overflow:hidden!important;
  }
  .morning-actions a{
    width:auto!important;min-width:0!important;max-width:none!important;
    min-height:39px!important;padding:3px 1px!important;
    overflow:hidden!important;
  }
  .morning-actions strong{font-size:13px!important;line-height:1!important}
  .morning-actions span{
    font-size:6.5px!important;line-height:1.02!important;
    overflow-wrap:anywhere!important;word-break:normal!important;
  }

  /* Mobile: only the useful Orders dashboard remains. */
  .dashboard{
    display:block!important;width:100%!important;
    overflow:visible!important;margin:5px 0 9px!important;
  }
  .dashboard .dash-money,
  .dashboard .dash-top-products{display:none!important}
  .dashboard .dash-group:first-child{
    display:block!important;width:100%!important;max-width:100%!important;
    padding:5px!important;
  }
  .dashboard .dash-group:first-child h3{font-size:10px!important;margin:0 0 4px!important}
  .dashboard .dash-group:first-child .dash-cards{
    display:grid!important;
    grid-template-columns:repeat(5,minmax(0,1fr))!important;
    width:100%!important;gap:3px!important;
  }
  .dashboard .dash-group:first-child .dash-card{
    width:auto!important;min-width:0!important;min-height:42px!important;
    padding:3px 1px!important;overflow:hidden!important;
  }
  .dashboard .dash-group:first-child .dash-card span{
    font-size:7px!important;line-height:1.02!important;
    overflow-wrap:anywhere!important;
  }
  .dashboard .dash-group:first-child .dash-card strong{
    font-size:14px!important;line-height:1!important;
  }
}


/* v3.6.37 — small mobile typography/alignment polish */
@media(max-width:800px){
  .morning-title strong{
    font-size:8.5px!important;
    line-height:1!important;
  }
  .morning-title span{
    font-size:6.5px!important;
    line-height:1!important;
  }

  .dashboard .dash-group:first-child .dash-card{
    display:flex!important;
    flex-direction:column!important;
    align-items:center!important;
    justify-content:center!important;
    text-align:center!important;
  }
  .dashboard .dash-group:first-child .dash-card span,
  .dashboard .dash-group:first-child .dash-card strong{
    width:100%!important;
    text-align:center!important;
  }
}

/* v3.6.39 Nova Poshta compact EN */
.np-shipping-box{border:1px solid #dbe4ee;background:#fbfdff}.np-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px 12px;margin-top:10px}.np-grid .np-wide{grid-column:span 2}.np-grid label{display:block;font-size:12px;color:#64748b;margin-bottom:4px}.np-grid input,.np-grid select{width:100%;min-width:0}.np-inline{display:flex;gap:6px}.np-inline input{flex:1}.np-dims{display:grid;grid-template-columns:repeat(3,1fr);gap:4px}.np-control{display:grid;grid-template-columns:1fr 120px;align-items:end;gap:6px}.np-control label{font-size:14px;color:inherit}.np-results{position:relative;z-index:4;max-height:190px;overflow:auto;background:#fff;border:1px solid #dbe4ee;border-radius:8px;margin-top:4px}.np-results:empty{display:none}.np-result{display:block;width:100%;text-align:left;border:0;border-bottom:1px solid #eef2f7;background:#fff;padding:8px;cursor:pointer}.np-result:hover{background:#f5f8fc}.np-volume{margin-top:7px}.np-create-row{display:flex;align-items:center;gap:10px;margin-top:10px}
@media(max-width:760px){.np-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}.np-grid .np-wide{grid-column:span 2}.np-control{grid-template-columns:1fr}.np-create-row{align-items:flex-start;flex-direction:column}.np-shipping-box .section-head{align-items:center}}

/* v3.6.40 NP profile place picker */
.np-prof summary{cursor:pointer;font-weight:700}.np-prof form{margin-top:14px}.np-place-head{display:flex;align-items:center;justify-content:space-between;margin-top:14px}.np-place-head h3{margin:0}.np-profile-places{display:flex;flex-direction:column;gap:7px;margin-top:8px}.np-place-card{position:relative;display:grid;grid-template-columns:auto 1fr auto auto;gap:10px;align-items:center;padding:9px 12px;border:1px solid #dbe4ee;border-radius:9px;background:#fff}.np-place-card .np-main{white-space:nowrap;margin:0}.np-remove-place{border:0;background:transparent;font-size:22px;line-height:1;cursor:pointer}.np-place-picker{margin-top:9px;padding:10px;border:1px dashed #b9c6d6;border-radius:9px;background:#f8fafc}.np-place-tabs{display:flex;gap:6px;margin-bottom:8px}.np-place-tabs .active{font-weight:700;border-color:#2563eb}.np-door-grid{display:grid;grid-template-columns:1fr 1.4fr .6fr .7fr 1.5fr;gap:6px;margin-bottom:8px}
@media(max-width:760px){.np-place-card{grid-template-columns:auto 1fr auto}.np-place-card .muted{grid-column:2}.np-door-grid{grid-template-columns:1fr 1fr}.np-door-comment{grid-column:span 2}}

/* v3.6.41 NP profile layout fixes */
.np-place-card{display:flex!important;align-items:center;gap:10px;min-width:0}
.np-place-card .np-main{flex:0 0 auto}
.np-place-card strong{flex:1 1 auto;min-width:0;white-space:normal;overflow-wrap:anywhere;line-height:1.3}
.np-place-card .muted{flex:0 0 auto;white-space:nowrap}
.np-place-card .np-remove-place{flex:0 0 auto}
.np-saved-picker{padding-bottom:10px;margin-bottom:10px;border-bottom:1px solid #dbe4ee}
.np-saved-picker label{display:block;font-weight:700;margin-bottom:5px}
.np-saved-picker select{min-width:0;flex:1}
@media(max-width:760px){
 .np-place-card{display:grid!important;grid-template-columns:auto 1fr auto;gap:5px 8px}
 .np-place-card strong{grid-column:2;grid-row:1}
 .np-place-card .np-main{grid-column:1;grid-row:1}
 .np-place-card .muted{grid-column:2;grid-row:2;white-space:normal}
 .np-place-card .np-remove-place{grid-column:3;grid-row:1 / span 2}
 .np-saved-picker .np-inline{align-items:stretch}
}

/* v3.6.42 separate recipient city and warehouse/postomat search */
#np-city-results,#np-recipient-results{max-height:180px}
@media(max-width:760px){
 #np-shipping-box .np-inline .btn{flex:0 0 auto;padding-left:10px;padding-right:10px}
}

/* v3.6.72 compact desktop dashboard only */
@media(min-width:801px){
.dashboard{grid-template-columns:minmax(250px,.8fr) minmax(430px,1.35fr) minmax(390px,1.25fr)!important;gap:8px!important;margin:8px 0 11px!important}
.dashboard .dash-group{padding:9px 10px!important;border-radius:10px!important}.dashboard .dash-group h3{font-size:12px!important;margin:0 0 6px!important}
.dashboard .dash-cards{display:grid!important;grid-template-columns:repeat(5,minmax(0,1fr))!important;gap:5px!important}.dashboard .dash-card{min-width:0!important;padding:6px 5px!important;border-radius:8px!important}.dashboard .dash-card span{font-size:9px!important;line-height:1.05!important}.dashboard .dash-card strong{font-size:18px!important;line-height:1!important;margin-top:3px!important}
.dashboard .type-totals{gap:5px!important}.dashboard .type-total{padding:4px 6px!important;gap:5px!important;font-size:11px!important}.dashboard .type-total small{font-size:9px!important}
.dashboard .previous-month{display:flex!important;align-items:center!important;gap:5px!important;flex-wrap:wrap!important;margin-top:6px!important;padding-top:5px!important}.dashboard .previous-title{margin:0 2px 0 0!important;font-size:10px!important;white-space:nowrap!important}.dashboard .previous-month .type-total.small{padding:2px 5px!important;font-size:9px!important}
.dashboard .top-products{gap:3px!important}.dashboard .top-product{padding:4px 5px!important;min-height:0!important}.dashboard .top-product .top-name{font-size:10px!important;line-height:1.1!important}.dashboard .top-product strong{font-size:11px!important}.dashboard .top-product small{font-size:8px!important}.search-bar{margin-top:10px!important}
.telegram-integration-card .integration-note{margin-top:8px!important;padding:9px 11px!important}
}
/* LL-CRM mobile bottom navigation: stable viewport anchor on iOS Safari/Chrome. */
@media(max-width:800px){
 html,body{overflow-x:clip}
 .mobile-app-nav{position:fixed!important;bottom:0!important;top:auto!important;transform:none!important;-webkit-transform:none!important;will-change:auto!important;isolation:isolate}
 .mobile-more-menu{transform:none!important;-webkit-transform:none!important}
 .ll-order-back{white-space:nowrap}
}
