:root {
  --navy: #0d2444;
  --blue: #0755db;
  --ink: #172d46;
  --muted: #51647a;
  --line: #dedbd4;
  --paper: #f6f2eb;
  --stitch: #b77844;
  --green: #176b45;
  --rust: #903b18;
  --radius: 13px;
}

.workspace { background: var(--paper); color: var(--ink); }
.workspace :focus-visible { outline: 3px solid #2379ff; outline-offset: 3px; }
.icon-library { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon {
  display: inline-block; width: 1.25em; height: 1.25em; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round; vertical-align: -.2em;
}

.workspace-header { position: sticky; top: 0; z-index: 40; background: #fffefa; }
.workspace-header::after {
  content: ""; display: block; height: 6px;
  background:
    repeating-linear-gradient(35deg, transparent 0 4px, #bd845d7a 4px 5px, transparent 5px 8px) top / 100% 3px no-repeat,
    repeating-linear-gradient(-35deg, transparent 0 4px, #bd845d7a 4px 5px, transparent 5px 8px) bottom / 100% 3px no-repeat,
    #f1e4d4;
}
.workspace-header-inner {
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  min-height: 82px; max-width: 1460px; margin: auto; padding: 0 34px;
}
.workspace-logo { display: grid; place-items: center; flex: none; }
.workspace-logo img { display: block; width: 112px; height: 68px; object-fit: contain; }
.workspace-nav { display: flex; align-items: stretch; gap: 8px; align-self: stretch; }
.workspace-tab {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  height: 100%; min-height: 44px; padding: 0 15px; color: var(--navy);
  border: 0; border-bottom: 3px solid transparent; background: transparent;
  text-decoration: none; font-size: 15px; font-weight: 700; cursor: pointer;
}
.workspace-tab:hover, .workspace-tab.current, .workspace-tab[aria-current="page"] {
  background: #f0f5fe; border-color: var(--blue); color: var(--blue); text-decoration: none;
}
.workspace-more { position: relative; margin: 0; }
.workspace-more summary { list-style: none; }
.workspace-more summary::-webkit-details-marker { display: none; }
.workspace-menu {
  position: absolute; right: 0; top: calc(100% + 8px); width: 238px;
  padding: 8px; border: 1px solid var(--line); border-radius: 12px;
  background: #fffefa; box-shadow: 0 12px 30px #112a4425;
}
.workspace-menu a, .workspace-menu button {
  display: flex; align-items: center; gap: 10px; min-height: 42px; width: 100%;
  padding: 8px 12px; border: 0; border-radius: 7px;
  background: transparent; text-align: left; color: var(--navy); font: inherit; font-size: 14px;
}
.workspace-menu a:hover, .workspace-menu a[aria-current="page"], .workspace-menu button:hover {
  background: #eaf2ff; color: var(--blue); text-decoration: none;
}
.workspace-menu form { margin-top: 5px; padding-top: 5px; border-top: 1px solid var(--line); }
.workspace-user { display: flex; align-items: center; gap: 9px; flex: none; }
.workspace-user strong, .workspace-user small { display: block; }
.workspace-user small { color: var(--muted); }
.workspace-user .avatar { background: #e4edfd; color: #0849b6; overflow: hidden; }
.workspace-user .avatar img {
  width: 100%; height: 100%; object-fit: cover;
  transform: scale(1.55); transform-origin: center 24%;
}
#network-state:not([hidden]) { display: block; padding: 8px 18px; background: #ffebc9; color: #783619; text-align: center; }
.workspace-content { max-width: 1460px; margin: auto; }
.workspace main { padding: 28px 34px 32px; }
.workspace footer { padding-inline: 34px; }
.workspace .page-heading { margin-bottom: 22px; }
.workspace h1 {
  font-family: Georgia, 'Times New Roman', serif; font-size: clamp(2rem, 4vw, 3.25rem);
  line-height: 1.07; letter-spacing: -.035em; color: var(--navy);
}
.workspace .eyebrow { color: #674b3d; }
.workspace .card, .workspace .metric { border-color: var(--line); box-shadow: 0 2px 4px #37271908; }
.workspace .card { background: #fffefa; }
.workspace .card h2 > .icon { margin-right: .2em; }
.workspace .button { gap: 8px; }
.workspace .button:not(.secondary):not(.danger) { background: #0755db; }
.workspace .button:not(.secondary):not(.danger):hover { background: #0648ba; }
.workspace .button.secondary { background: #fffefa; border-color: #c2c8d0; color: var(--navy); }
.workspace .button.secondary:hover { background: #eaf2ff; border-color: #8fb2ed; }
.workspace .section-title a { font-size: 13px; }
.workspace .local-preview-notice { padding-block: 7px; margin-bottom: 14px; }

.today-summary { display: flex; gap: 14px; margin-bottom: 20px; }
.today-totals {
  display: grid; grid-template-columns: 1fr 1fr; flex: 1;
  background: linear-gradient(115deg, #075be2, #0642b2); color: white;
  padding: 21px 25px; border-radius: 13px; box-shadow: 0 4px 11px #084cbd26;
}
.today-total { display: flex; gap: 16px; align-items: center; justify-content: center; }
.today-total + .today-total { border-left: 1px solid #ffffff65; }
.today-total > .icon { width: 39px; height: 39px; }
.today-total strong { font-size: 42px; line-height: 1; font-variant-numeric: tabular-nums; }
.today-total span { font-size: clamp(14px, 2vw, 22px); font-weight: 650; margin-left: 7px; }
.workspace .today-diary { padding-inline: 24px; font-size: 17px; }
.today-grid { display: grid; grid-template-columns: 1.34fr 1fr; gap: 16px; margin-bottom: 16px; }
.today-grid .card { margin: 0; }
.today-side { display: grid; gap: 12px; }
.workspace .today-attention { padding: 0; overflow: hidden; border-color: #dcb99e; }
.today-attention h2 {
  margin: 0; padding: 16px 20px; color: var(--rust);
  background: #f8e8dc; border-bottom: 1px solid #ebd0ba;
}
.attention-list { padding: 1px 18px; }
.today-row {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px;
  padding: 12px 0; text-decoration: none; color: var(--navy);
}
.today-row + .today-row, .attention-empty { border-top: 1px solid #eee2d8; }
.today-row small { display: block; color: var(--muted); font-size: 13px; }
.today-row:hover strong { color: var(--blue); }
.icon-tile {
  display: inline-grid; place-items: center; width: 39px; height: 39px; flex: none;
  border-radius: 9px; background: #f3e6d8; color: var(--rust); font-size: 19px;
}
.attention-empty { display: flex; gap: 8px; align-items: center; margin: 0; padding: 14px 0; color: var(--muted); font-size: 14px; }
.attention-empty .icon, .today-ready h2 { color: var(--green); }
.today-counts .section-title { margin-bottom: 8px; }
.today-count-pair {
  display: grid; grid-template-columns: 1fr 1fr; padding-top: 10px;
  border-top: 1px solid #e4d4c5; font-weight: 650;
}
.today-count-pair > div + div { border-left: 1px solid #e4d4c5; padding-left: 16px; }
.today-count-pair strong { color: var(--navy); font-size: 27px; font-variant-numeric: tabular-nums; }
.today-shortcuts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 24px; }

.diary-controls { display: flex; flex-wrap: wrap; gap: 13px; margin-bottom: 16px; }
.diary-search { position: relative; display: flex; gap: 7px; align-items: center; flex: 1 1 285px; }
.diary-search > .icon { position: absolute; left: 12px; color: var(--muted); pointer-events: none; }
.diary-search input[name="q"] { padding-left: 39px; min-width: 0; }
.diary-tabs { display: flex; flex-wrap: wrap; gap: 7px; align-items: stretch; }
.diary-tabs a {
  display: inline-flex; align-items: center; gap: 5px; min-height: 42px; padding: 6px 12px;
  border: 1px solid #c2c8d0; border-radius: 8px; background: #fffefa;
  color: var(--navy); font-size: 13px; font-weight: 650; text-decoration: none;
}
.diary-tabs a:hover { border-color: var(--blue); }
.diary-tabs a[aria-current="page"] { background: var(--blue); border-color: var(--blue); color: white; }
.diary-tabs strong { font-variant-numeric: tabular-nums; }
.workspace .diary-register { padding: 0; overflow: hidden; }
.diary-list { margin: 0; padding: 0; list-style: none; }
.diary-line {
  display: grid; grid-template-columns: minmax(min-content, 1.4fr) minmax(100px, .7fr) auto;
  gap: 13px; align-items: center; padding: 14px 16px;
}
.diary-line + .diary-line { border-top: 1px solid var(--line); }
.diary-identity { display: flex; align-items: center; gap: 11px; }
.diary-identity > div, .diary-piece { overflow-wrap: break-word; }  /* o nome do tapete quebra entre palavras, nunca dentro */
.diary-line small { display: block; color: var(--muted); font-size: 12px; }
.diary-identity strong { color: var(--navy); font-size: 17px; }
.diary-thumb { width: 52px; height: 52px; border-radius: 8px; object-fit: cover; flex: none; }
.rug-tile {
  display: grid; place-items: center; color: #804c2e; font-size: 24px;
  background: repeating-linear-gradient(45deg, #f0e0cc 0 4px, #eadaC5 4px 5px);
}
.diary-date { font-size: 13px; }
.diary-date small { display: none; }
.diary-date .deadline { display: block; }
.diary-date .deadline small { display: block; }
.diary-date .wash { font-weight: 750; color: var(--navy); }
.diary-date .forecast { font-size: 12px; color: var(--muted); }
.diary-date .late { color: #b3261e; font-weight: 750; }
.diary-date .today { color: #9b651a; font-weight: 750; }
.diary-status .awaiting { margin-top: 4px; }
.diary-search #diary-numeric[aria-pressed="true"] { background: var(--blue); border-color: var(--blue); color: white; }
.diary-status .badge { display: inline-flex; align-items: center; gap: 4px; }
.diary-line .piece-note { grid-column: 1 / -1; margin: 0; padding-left: 62px; }

.finance-metrics .metric { min-width: 0; }
.finance-metrics .money { overflow-wrap: anywhere; }
.finance-label { display: flex; align-items: center; gap: 8px; }
.finance-label > .icon { color: var(--blue); font-size: 20px; }
.finance-positive .finance-label > .icon, .finance-positive .money { color: var(--green); }
.finance-expenses .finance-label > .icon, .finance-expenses .money { color: var(--rust); }
.finance-note {
  display: flex; align-items: center; gap: 10px; padding: 11px 14px; margin-bottom: 16px;
  background: #fff1d7; border: 1px solid #ead4aa; color: #72441e; border-radius: 9px; font-size: 13px;
}
.finance-overview { display: grid; grid-template-columns: 1.25fr 1fr 1fr; gap: 14px; }
.finance-overview h2 { font-size: 18px; }
.finance-meter + .finance-meter { margin-top: 16px; }
.finance-meter > div { display: flex; justify-content: space-between; gap: 6px; font-size: 13px; }
.finance-meter progress { display: block; width: 100%; height: 13px; margin-top: 7px; accent-color: var(--blue); }
.finance-meter-paid progress { accent-color: #bd6b38; }
.finance-category-total { color: #103e80; }

.whatsapp-qr {
  display: block; max-width: 100%; height: auto; margin: 16px 0 8px;
  padding: 12px; background: white; border: 1px solid var(--line); border-radius: 10px;
}

.delivery-choices {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(250px, 100%), 1fr));
  gap: 8px; margin: 12px 0 18px;
}
.delivery-choice {
  display: flex; align-items: flex-start; gap: 10px; margin: 0;
  padding: 12px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer;
}
.delivery-choice:has(:checked) { background: var(--light); border-color: var(--blue); }
.delivery-choice input { flex: none; margin-top: 3px; width: 18px; height: 18px; }
#delivery-turn, #invoice-status { width: auto; min-width: 135px; }
.inbox-filters { display: flex; flex-wrap: wrap; gap: 7px; margin: 10px 0; }
.inbox-filters a { padding: 5px 9px; border-radius: 7px; font-size: 12px; font-weight: 650; }
.inbox-filters a[aria-current] { background: var(--light); color: var(--blue); }
.diary-piece-actions { display: grid; justify-items: end; gap: 6px; }
.diary-piece-actions .button { min-height: 38px; padding: 6px 9px; font-size: 12px; }
.diary-piece-actions .diary-open { white-space: nowrap; }

@media (max-width: 640px) {
  .diary-piece-actions { grid-column: 1 / -1; justify-items: start; grid-auto-flow: column; justify-content: start; align-items: center; }
}

@media (max-width: 880px) {
  .workspace-header-inner { min-height: 65px; padding-inline: 19px; }
  .workspace-logo img { width: 88px; height: 57px; }
  .workspace-nav {
    position: fixed; inset: auto 0 0; display: flex; justify-content: center; gap: 0;
    padding: 0 5px env(safe-area-inset-bottom); background: #fffefa; border-top: 1px solid var(--line);
    box-shadow: 0 -4px 16px #1c2f4614;
  }
  .workspace-tab { flex: 1 1 0; flex-direction: column; gap: 4px; font-size: 11px; min-height: 60px; padding: 6px 4px; }
  .workspace-tab > .icon { font-size: 17px; }
  .workspace-more { flex: 1 1 0; position: static; }
  .workspace-menu { top: auto; bottom: calc(100% + 7px); right: 10px; max-width: calc(100vw - 20px); max-height: calc(100dvh - 150px); overflow: auto; }
  .workspace-content { padding-bottom: calc(65px + env(safe-area-inset-bottom)); }
  .workspace main { padding-inline: 20px; }
  .finance-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .finance-overview { grid-template-columns: 1fr 1fr; }
  .finance-flow { grid-column: 1 / -1; }
  .diary-line { gap: 8px; padding-inline: 11px; }
}

@media (max-width: 640px) {
  .workspace main { padding: 18px 14px 24px; }
  .workspace .page-heading { align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 15px; }
  .workspace .page-heading > div { width: auto; }
  .workspace .page-heading h1 { margin-bottom: 4px; }
  .workspace .page-heading > .button { width: auto; padding-inline: 11px; font-size: 12px; min-height: 39px; }
  .workspace .page-heading > .actions { flex-wrap: wrap; }
  .workspace .eyebrow { font-size: 10px; }
  .workspace .card { padding: 13px; }
  .workspace footer { padding-inline: 14px; }
  .workspace .today-attention { padding: 0; }
  .today-summary { flex-direction: column; gap: 8px; margin-bottom: 12px; }
  .today-totals { padding: 13px 7px; }
  .today-total { gap: 8px; }
  .today-total > .icon { width: 25px; height: 25px; }
  .today-total strong { font-size: 29px; }
  .today-total span { display: block; margin-left: 0; font-size: 12px; }
  .workspace .today-diary { min-height: 43px; font-size: 14px; }
  .today-grid { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .today-side { gap: 8px; }
  .today-attention h2 { padding: 11px 13px; font-size: 19px; }
  .attention-list { padding-inline: 12px; }
  .today-row { font-size: 13px; gap: 8px; }
  .today-row small { font-size: 12px; }
  .today-counts h2 { font-size: 17px; }
  .today-count-pair strong { font-size: 22px; }
  .today-shortcuts { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  .today-shortcuts .button { font-size: 12px; padding-inline: 8px; }
  .diary-controls { gap: 8px; }
  .diary-tabs { gap: 5px; }
  .diary-tabs a { font-size: 12px; padding-inline: 8px; }
  .workspace .diary-register { background: transparent; border: 0; box-shadow: none; padding: 0; }
  .diary-line {
    grid-template-columns: 1fr auto; gap: 8px; margin-bottom: 8px; padding: 11px;
    border: 1px solid var(--line); border-radius: 10px; background: #fffefa;
  }
  .diary-identity { grid-area: 1 / 1; }
  .diary-status { grid-area: 1 / 2; justify-self: end; }
  .diary-date { grid-area: 2 / 2; justify-self: end; text-align: right; }
  .diary-date small { display: block; }
  .diary-line .piece-note { grid-column: 1 / -1; }
  .diary-line .piece-note { padding-left: 0; }
  .finance-overview { grid-template-columns: 1fr; gap: 0; }
  .finance-metrics .metric { padding: 12px; }
  .finance-metrics .money { font-size: 20px; }
  .finance-label { font-size: 12px; }
  .finance-filter { display: grid; grid-template-columns: auto minmax(0, 1fr); }
  .finance-filter .button { grid-column: 1 / -1; }
}

/* Etapas da lavação no Diário (tablet da lavação, reunião de 05/11): botões grandes, um toque por etapa. */
.stage-actions { display: grid; gap: 8px; justify-items: end; }
.stage-buttons { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.diary-piece-actions .stage-button { min-height: 52px; min-width: 112px; padding: 10px 16px; font-size: 15px; }
.stage-button.current { background: var(--light); border-color: var(--blue); color: var(--blue); opacity: 1; cursor: default; }
.diary-piece-actions .stage-button.ready { background: var(--green); border-color: var(--green); color: #fff; }
.stage-hint { font-size: 12px; color: var(--muted); }
.badge.stage-lavando { background: #e7f1ff; color: #0054bd; }
.badge.stage-secando { background: #fff1de; color: #9b651a; }
.badge.stage-embalado { background: #e7f4ed; color: #247657; }
@media (max-width: 900px) { .stage-actions { justify-items: start; } .stage-buttons { justify-content: flex-start; } }
/* Nome do tapete inteiro (revisão final): no computador a coluna do nome guarda 180 px; até 900 px (tablet em pé e
   celular) as ações descem para baixo do nome e da situação em vez de espremer o nome. */
@media (min-width: 901px) { .diary-identity { min-width: 180px; } }
@media (max-width: 900px) {
  .diary-line { grid-template-columns: minmax(0, 1fr) auto; }
  .diary-piece-actions { grid-column: 1 / -1; justify-items: start; }
}
/* Etapa sem recarregar (8.14.2): a âncora #p<pk> para um pouco abaixo do cabeçalho fixo (o html já desconta o
   cabeçalho em scroll-padding-top), a linha fica apagada enquanto envia e o aviso fica preso no pé da tela. */
.diary-line { scroll-margin-top: 12px; }
.diary-line[aria-busy="true"] { opacity: .55; pointer-events: none; }
.diary-notice {
  position: fixed; z-index: 45; left: 50%; bottom: 24px; transform: translateX(-50%);
  width: max-content; max-width: calc(100vw - 32px); margin: 0; box-shadow: 0 8px 24px #12334b29;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.diary-notice.visible { opacity: 1; pointer-events: none; }  /* o aviso não tem nada clicável: o toque passa para a linha embaixo */
@media (max-width: 880px) { .diary-notice { bottom: calc(76px + env(safe-area-inset-bottom)); } }

/* Diário por OS (8.15.1): cabeçalho da OS com o cliente, "N tapetes" e os prazos; embaixo, um tapete por linha. Na
   linha que vai para "Embalado", a medida em dois campos grandes, com teclado numérico. */
.diary-order + .diary-order { border-top: 2px solid #d9d2c5; }
.diary-order-head {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; padding: 12px 16px; background: #f0ece5;
}
.diary-order-id strong { color: var(--navy); font-size: 17px; }
.diary-order-id small { display: block; color: var(--muted); font-size: 12px; }
.diary-order-count { font-weight: 750; color: var(--navy); }
.diary-order-head .diary-date { display: flex; gap: 14px; }
.diary-order-head .diary-open { margin-left: auto; white-space: nowrap; }
.diary-continues { flex-basis: 100%; color: var(--muted); font-size: 12px; font-style: italic; }
.diary-order-pieces { margin: 0; padding: 0; list-style: none; }
.pack-size { flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: flex-end; gap: 8px; margin: 0; padding: 0; border: 0; min-width: 0; }
.pack-size legend { float: left; width: 100%; padding: 0; margin-bottom: 2px; font-size: 12px; font-weight: 750; color: var(--muted); text-align: right; }
.pack-size label { margin: 0; font-size: 12px; color: var(--muted); }
.pack-size label input:not([type=checkbox]) { display: block; width: 96px; min-height: 52px; font-size: 20px; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; }
.pack-size > span { align-self: center; padding-top: 16px; font-size: 18px; color: var(--muted); }
.pack-size .pack-large { flex-basis: 100%; justify-content: flex-end; color: #9b651a; font-weight: 700; }
.pack-size .pack-large[hidden] { display: none; }
@media (max-width: 900px) { .pack-size { justify-content: flex-start; } .pack-size legend { text-align: left; } .pack-size .pack-large { justify-content: flex-start; } }
@media (max-width: 640px) {
  .workspace .diary-register .diary-order { margin-bottom: 14px; border: 0; }
  .diary-order-head { border-radius: 10px; margin-bottom: 8px; padding: 10px 11px; }
  .diary-order-head .diary-date { flex-basis: 100%; justify-content: flex-start; }
  .diary-order-head .diary-date, .diary-order-head .diary-date .deadline { text-align: left; }
}

/* Contador de conversas esperando a equipe no menu Atendimento. */
.tab-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; margin-left: 6px; border-radius: 10px; background: #c2412d; color: #fff; font-size: 11px; font-weight: 700; line-height: 1; }
.tab-badge[hidden] { display: none; }

/* OS do papel numa tela só (8.14.1) e o número grande da etiqueta na OS. */
.paper-order .paper-group { border: 0; padding: 0; margin: 0 0 24px; min-width: 0; }
.paper-order legend { padding: 0; margin-bottom: 12px; font-size: 17px; font-weight: 750; color: var(--navy); }
.paper-field { margin-bottom: 20px; }
.paper-entry { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.paper-entry input { width: auto; min-width: 180px; }
.paper-open-orders ul { margin: 8px 0 12px; padding-left: 20px; }
.paper-client-search { margin-bottom: 16px; }
.paper-client-search[hidden], .paper-piece[hidden], #paper-add-piece[hidden] { display: none; }
.paper-client-results { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.paper-client-results .button { width: 100%; justify-content: flex-start; }
.paper-new-client { margin-top: 4px; }
.paper-new-client .actions { margin-bottom: 12px; }
.paper-piece-head, .paper-piece { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.paper-piece-head { margin-bottom: 6px; font-size: 12px; font-weight: 650; color: var(--muted); }
.paper-piece + .paper-piece { margin-top: 8px; }
.paper-piece-errors { grid-column: 1 / -1; }
#paper-add-piece { margin-top: 12px; }
.tag-number { margin-top: 12px; font-size: 13px; }
.tag-number-value { display: block; color: var(--navy); font-size: 64px; line-height: 1; letter-spacing: 4px; font-variant-numeric: tabular-nums; }
@media (max-width: 680px) { .tag-number-value { font-size: 48px; } }

/* Diário: sub-navegação e aba Entrada e Saída */
.diary-subnav { display: flex; gap: 7px; margin-bottom: 14px; }
.diary-subnav a {
  min-height: 42px; display: inline-flex; align-items: center; padding: 6px 14px; border-radius: 8px;
  border: 1px solid #c2c8d0; background: #fffefa; color: var(--navy); font-weight: 700; text-decoration: none;
}
.diary-subnav a[aria-current="page"] { background: var(--navy); border-color: var(--navy); color: white; }
.entry-notice { margin-bottom: 14px; }
.entry-head, .entry-line {
  display: grid; grid-template-columns: minmax(0, .6fr) minmax(0, 1fr) minmax(0, 1.3fr) 60px minmax(0, .9fr) minmax(0, .9fr);
  gap: 13px; align-items: center; padding: 14px 16px;
}
/* Trilhas com mínimo zero (revisão final): a grade nunca passa da largura do cartão, que corta o que sobra; o texto
   quebra dentro da célula. Até 960 px a linha vira duas colunas. */
.entry-head > *, .entry-line > * { min-width: 0; overflow-wrap: break-word; }
.entry-head.with-value, .entry-line.with-value { grid-template-columns: minmax(0, .6fr) minmax(0, 1fr) minmax(0, 1.3fr) 60px minmax(0, .9fr) minmax(0, .9fr) minmax(0, .6fr); }
.entry-head { background: #f0ece5; font-weight: 750; font-size: 12px; color: var(--muted); }
.entry-line + .entry-line { border-top: 1px solid var(--line); }
.entry-line small { display: none; color: var(--muted); font-size: 12px; }
.entry-line .entry-who small, .entry-line .diary-date small, .entry-line .diary-status small { display: block; }
.entry-line .diary-status .late { color: #b3261e; font-weight: 750; }
.entry-line .deadline em { font-style: normal; font-size: 12px; }
.entry-line .entry-value { font-variant-numeric: tabular-nums; font-weight: 700; }
.entry-who strong { color: var(--navy); font-size: 17px; }
@media (max-width: 960px) {
  .entry-head { display: none; }
  .entry-line, .entry-line.with-value { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .entry-line small { display: block; }
}
/* Resumo do valor (8.4): tabela, texto pronto e impressão só do cartão */
.value-summary-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.value-summary-table th, .value-summary-table td { padding: 6px 4px; text-align: left; border-bottom: 1px solid var(--line, #e2e6ee); }
.value-summary-table td:last-child, .value-summary-table tfoot td { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }
/* Cartão estreito (coluna lateral da OS, cerca de 270 px): medida e valor numa linha só, sem rolagem lateral. Na tela o
   cartão mostra tapete, medidas e valor (m² e R$/m² estão no texto logo abaixo); a impressão mostra as cinco colunas. */
.value-summary-table td { white-space: nowrap; }
.value-summary-table tbody td:first-child { white-space: normal; overflow-wrap: anywhere; }
@media screen {
  .value-summary-table .value-summary-extra { display: none; }
}
@media screen and (min-width: 681px) {
  .order-aside .value-summary-table th, .order-aside .value-summary-table td { padding: 6px 3px; font-size: 11px; }
}
.value-summary-text { white-space: pre-wrap; font: inherit; font-size: 14px; background: #f6f8fb; border-radius: 8px; padding: 10px; margin: 12px 0; }
.value-summary-actions { display: flex; gap: 8px; flex-wrap: wrap; }
#print-area { display: none; }
@media print {
  html.printing-summary body > * { display: none !important; }
  html.printing-summary body > #print-area { display: block !important; width: 100%; margin: 0; padding: 0; }
  #print-area .value-summary { width: 100%; box-shadow: none; border: 0; padding: 0; margin: 0; }
  #print-area .value-summary-table { font-size: 13pt; }
  #print-area .value-summary-text { background: none; padding: 0; font-size: 12pt; }
  @page { size: A4; margin: 15mm; }
}

/* P2 da Camila (11/11): folha da OS como a do papel, observação da OS e origem. */
.os-sheet { border: 1.5px solid #c9c2b6; }
.os-sheet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; border-bottom: 2px solid var(--navy); padding-bottom: 10px; margin-bottom: 12px; }
.os-sheet-brand { display: flex; align-items: center; gap: 10px; }
.os-sheet-brand img { width: 44px; height: 44px; object-fit: contain; }
.os-sheet-brand strong { display: block; color: var(--navy); letter-spacing: .04em; }
.os-sheet-brand small { color: var(--muted); font-size: 12px; }
.os-sheet-number { text-align: right; }
.os-sheet-number span { display: block; font-size: 11px; font-weight: 800; letter-spacing: .08em; color: var(--navy); }
.os-sheet-number strong { display: block; font-size: 28px; color: #b3261e; font-variant-numeric: tabular-nums; line-height: 1.1; }
.os-sheet-number small { color: var(--muted); font-size: 12px; }
.os-sheet-client { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px 14px; margin: 0 0 12px; }
.os-sheet-client > div { border-bottom: 1px solid var(--line); padding: 2px 0 4px; min-width: 0; }
.os-sheet-client .wide { grid-column: span 2; }
.os-sheet-client dt { font-size: 11px; color: var(--muted); font-weight: 700; }
.os-sheet-client dd { margin: 0; font-weight: 650; overflow-wrap: anywhere; }
.os-sheet-origin dd { color: var(--navy); font-weight: 800; }
.os-sheet-scroll { overflow-x: auto; }
.os-sheet-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.os-sheet-table th, .os-sheet-table td { border: 1px solid #c9c2b6; padding: 6px 8px; text-align: left; }
.os-sheet-table thead th { background: #2f3a4a; color: #fff; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
.os-sheet-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.os-sheet-table tfoot th { text-align: right; }
.os-sheet-sign { margin: 18px 0 6px; padding-top: 24px; border-bottom: 1px solid #8d8578; max-width: 320px; color: var(--muted); font-size: 12px; }
.os-sheet-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-start; margin-top: 10px; }
.os-sheet-actions details { flex: 1 1 260px; }
.os-sheet-actions summary { cursor: pointer; font-weight: 650; }
.os-sheet-actions form { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
@media (max-width: 640px) { .os-sheet-client { grid-template-columns: repeat(2, minmax(0, 1fr)); } .os-sheet-table { font-size: 13px; } }
.order-notes-text { background: #fff8e6; border-left: 4px solid #e0a800; padding: 8px 12px; border-radius: 6px; }
.order-notes-form { display: grid; gap: 8px; margin-top: 10px; }
.order-notes-form .button { justify-self: start; }
.entry-note { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; padding-top: 4px; }
.entry-note-label { font-size: 12px; font-weight: 750; color: var(--muted); }
.entry-note p { margin: 0; flex: 1 1 240px; background: #fff8e6; border-radius: 6px; padding: 4px 8px; }
.entry-note details { flex: 1 1 100%; }
.entry-note summary { cursor: pointer; font-weight: 650; font-size: 13px; }
.entry-note form { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.entry-note textarea { flex: 1 1 280px; min-height: 44px; }
.diary-order-note { flex-basis: 100%; margin: 0; font-size: 13px; background: #fff8e6; border-radius: 6px; padding: 4px 8px; }
.diary-order-note span { font-weight: 750; color: var(--muted); }
.paper-origin select { max-width: 360px; }
@media print { .os-sheet { border: 0; box-shadow: none; } .os-sheet-table thead th { -webkit-print-color-adjust: exact; print-color-adjust: exact; } }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* P3: cores das etiquetas por dia (11/11). Só classes: a chave do banco escolhe a classe, nenhum hex vem do banco. */
.etq { display: inline-flex; align-items: center; gap: 6px; vertical-align: middle; margin-left: 6px; padding: 2px 8px; border: 2px solid var(--ink); border-radius: 999px; background: #fff; color: var(--ink); font-size: 12px; line-height: 1.3; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.etq b { font-weight: 800; letter-spacing: .02em; }
.etq small { color: var(--muted); font-size: 12px; }
.etq-cor { display: inline-block; flex: none; width: 14px; height: 14px; border: 1.5px solid var(--ink); border-radius: 3px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.etq-branca .etq-cor { background: #fff; border-color: #172d46; }
.etq-verde { border-color: #1e8e4a; } .etq-verde .etq-cor { background: #1e8e4a; border-color: #176b45; }
.etq-azul { border-color: #1d5fd1; } .etq-azul .etq-cor { background: #1d5fd1; border-color: #0d3f94; }
.etq-amarela { border-color: #d9a400; } .etq-amarela .etq-cor { background: #f5c400; border-color: #a67e00; }
.etq-vermelha { border-color: #c62828; } .etq-vermelha .etq-cor { background: #d32f2f; border-color: #8f1d1d; }
.etq-laranja { border-color: #e66a00; } .etq-laranja .etq-cor { background: #f57c00; border-color: #a85100; }
.etq-rosa { border-color: #d6338a; } .etq-rosa .etq-cor { background: #ec5aa8; border-color: #a82066; }
.etq-roxa { border-color: #6a3fc4; } .etq-roxa .etq-cor { background: #7b4fd6; border-color: #4b2a96; }
.etq-sem { border-style: dashed; border-color: var(--muted); color: var(--muted); }
.etq-lg { display: flex; width: fit-content; margin: 8px 0; padding: 6px 14px; font-size: 16px; }
.etq-lg .etq-cor { width: 22px; height: 22px; }
.etq-sheet { display: flex; width: auto; margin: 10px 0; padding: 8px 16px; border-radius: 8px; font-size: 20px; }
.etq-sheet .etq-cor { width: 32px; height: 32px; }
.etq-sheet small { font-size: 15px; }
.etq-aviso { font-weight: 700; }
.etq-config .etq { margin-left: 10px; }

/* P3 legenda (11/11, decisão 798): legenda das cores. Compacta = uma linha que quebra; página = linhas grandes para imprimir. */
.etq-legenda-compacta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin: 0 0 10px; font-size: 12px; }
.etq-legenda-compacta .etq { margin: 0; padding: 1px 7px; font-size: 11px; }
.etq-legenda-compacta .etq small { font-size: 11px; }
.etq-legenda-compacta .etq-cor { width: 12px; height: 12px; }
.etq-leg-titulo { font-size: 12px; font-weight: 800; }
.etq-leg-status { color: var(--muted); font-size: 12px; }
.etq-linhas { list-style: none; margin: 14px 0; padding: 0; display: grid; gap: 10px; }
.etq-linha { display: flex; align-items: center; gap: 14px; padding: 12px 16px; border: 3px solid var(--ink); border-radius: 10px; background: #fff; color: var(--ink); font-size: 20px; line-height: 1.3; }
.etq-linhas > li, .etq-linha { min-width: 0; }
.etq-linha span { min-width: 0; overflow-wrap: anywhere; }
.etq-linha b { font-weight: 800; letter-spacing: .03em; min-width: 7.5em; }
.etq-linha .etq-cor { width: 40px; height: 40px; border-width: 2px; border-radius: 6px; }
@media (max-width: 480px) { .etq-linha { font-size: 17px; padding: 10px 12px; gap: 10px; flex-wrap: wrap; } .etq-linha b { min-width: 0; } .etq-linha .etq-cor { width: 32px; height: 32px; } }
.etq-linha.etq-sem { border-style: dashed; color: var(--muted); }
.etq-leg-acoes { margin-top: 8px; }
@media print {
  #print-area .etq-legenda-pagina { width: 100%; border: 0; box-shadow: none; padding: 0; margin: 0; }
  #print-area .etq-legenda-pagina h2 { font-size: 22pt; margin: 0 0 6pt; }
  #print-area .etq-linha { font-size: 22pt; padding: 10pt 14pt; break-inside: avoid; border-color: #000; }
  #print-area .etq-linha .etq-cor { width: 36pt; height: 36pt; border: 2pt solid #000; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  #print-area .etq-leg-status { display: none; }
}
