/* Operational UI: readable information, visible workflow and comfortable controls. */
[hidden] { display: none !important; }
.document-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.document-actions .text-button { padding: 10px; font-size: 12px; }
.document-totals { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 16px; padding: 18px; border: 1px solid #dce7df; background: #f3f7f0; border-radius: 7px; margin-bottom: 20px; }
.document-totals span { display: block; font-size: 12px; color: #54715d; margin-bottom: 8px; }
.document-totals strong { font-size: 21px; font-weight: 500; overflow-wrap: anywhere; }
.delivery-preview { width: 100%; max-height: 600px; overflow: auto; border: 1px solid #dae4d9; border-radius: 6px; margin-top: 20px; background: #edf1eb; }
.delivery-preview svg { width: 100%; height: auto; display: block; border-bottom: 12px solid #edf1eb; }
.delivery-card { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 24px; border-bottom: 1px solid var(--border); }
.delivery-card:last-child { border-bottom: 0; }
.delivery-card h2 { margin: 12px 0 6px; }
.delivery-card p { font-size: 13px; color: #5c715f; line-height: 1.7; margin: 6px 0; }
.delivery-card > div:last-child { display: flex; flex-direction: column; align-items: flex-end; gap: 16px; }
.delivery-card strong { font-size: 20px; font-weight: 500; white-space: nowrap; }
.stock-alert { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; padding: 15px 18px; background: #fff3e4; border: 1px solid #e9d1b2; color: #80581e; border-radius: 7px; font-size: 13px; margin-bottom: 24px; line-height: 1.6; }
.stock-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 22px; padding: 24px; }
.stock-card { border: 1px solid var(--border); border-radius: 9px; padding: 22px; min-width: 0; }
.stock-card-header { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.stock-card .client-code { color: #536e5b; font-size: 12px; letter-spacing: 1px; }
.stock-card h2 { margin: 20px 0; font-size: 18px; line-height: 1.5; overflow-wrap: anywhere; }
.stock-badge { font-size: 11px; color: #3c6e54; background: #eaf3e9; padding: 6px 8px; border-radius: 5px; white-space: nowrap; }
.stock-low { color: #8b581d; background: #fff1dd; }
.stock-quantities { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; margin: 0; }
.stock-quantities dt { font-size: 12px; color: #536c5b; margin-bottom: 10px; }
.stock-quantities dd { margin: 0; font-size: 29px; font-weight: 500; overflow-wrap: anywhere; }
.stock-quantities .available { color: #215846; }
.stock-card-actions { display: flex; gap: 10px; flex-wrap: wrap; border-top: 1px solid var(--border); padding-top: 16px; margin-top: 20px; }
.stock-card-actions .text-button { flex-basis: 100%; font-size: 12px; }
.stock-history { margin-top: 26px; }
.stock-movement { display: flex; justify-content: space-between; gap: 24px; padding: 20px 24px; border-top: 1px solid var(--border); }
.stock-movement > div:first-child { min-width: 0; }
.stock-movement strong { font-size: 14px; }
.stock-movement p { font-size: 12px; color: #5d715f; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; }
.stock-movement .text-button { font-size: 12px; }
.movement-deltas { display: grid; align-content: start; grid-template-columns: 1fr 1fr; gap: 10px 16px; font-size: 12px; flex-shrink: 0; }
.movement-deltas b { margin-left: 6px; }
.movement-deltas time { grid-column: 1/-1; font-size: 11px; color: #62745e; text-align: right; }
.history-limit { padding: 0 24px 18px; }
.stock-policy { padding: 14px 16px; border: 1px solid #dce7df; border-radius: 7px; background: #f3f7f0; margin-bottom: 24px; }
.stock-policy p { font-size: 12px; line-height: 1.7; margin: 0 0 6px; color: #4d6955; }
input[readonly] { background: #f4f7f0; color: #5b715f; }
.topbar-actions { display: flex; align-items: center; gap: 24px; }
.topbar-actions .text-button { font-size: 12px; }
.brand-strip { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-top: 26px; border: 1px solid #e0e5d9; background: #edf1e6; border-radius: 10px; overflow: hidden; }
.brand-strip > div { padding: 22px 26px; }
.brand-strip h2 { font-size: 23px; font-weight: 500; letter-spacing: -.5px; margin: 0 0 8px; }
.brand-strip p:not(.eyebrow) { font-size: 12px; line-height: 1.6; color: #556b52; margin: 0; }
.brand-strip .eyebrow { margin-bottom: 8px; }
.brand-strip img { display: block; width: 34%; height: 137px; object-fit: cover; }
.backup-export { padding: 20px; background: #f2f7ef; border: 1px solid #e0e8dd; border-radius: 8px; margin-bottom: 28px; }
.backup-export h3 { font-size: 16px; margin: 0; }
.backup-export p { font-size: 13px; line-height: 1.7; color: #56704e; }
:root { --muted: #586c61; }
.subtitle { font-size: 14px; }
.eyebrow, .nav-label { font-size: 10px; color: #5c7362; }
.demo-note { font-size: 12px; color: #626546; }
.stat { text-align: left; width: 100%; }
.stat:hover { border-color: #82a393; background: #f8fbf7; }
.stat > span { color: #51695a; font-size: 13px; }
.stat small { color: #536b5c; font-size: 11px; line-height: 1.5; }
.stat.rose i { background: #fae9e5; color: #a44c3f; }
.operational-summary { display: flex; flex-wrap: wrap; gap: 12px 28px; margin: -10px 0 28px; font-size: 12px; color: #536b5c; }
.operational-summary strong { color: #254c3d; }
table { font-size: 13px; }
th { color: #526b59; font-size: 10px; }
.cell-sub { font-size: 12px; color: #5d7166; }
.order-link { font-size: 13px; }
.nowrap { color: #526c5d; font-size: 12px; }
.status { font-size: 12px; padding: 10px 8px; width: auto; min-height: 44px; }
.pending, .pendiente { color: #806319; }
.preparando { color: #386344; }
.enviado { color: #3d668b; }
.entregado { color: #4e6350; }
.primary, .secondary { font-size: 13px; min-height: 44px; }
.icon-button { min-width: 44px; min-height: 44px; color: #526b5b; }
.text-button { min-height: 32px; }
.subtle-link { color: #3b624d; font-size: 12px; padding: 8px 0; }
input, select, textarea { font-size: 14px; min-height: 44px; }
input::placeholder, textarea::placeholder { color: #718075; }
.toolbar { flex-wrap: wrap; align-items: end; gap: 16px; }
.toolbar .search-wrap { min-width: 200px; max-width: none; }
.toolbar .filter-label { flex: 0 1 160px; }
.toolbar select { width: 100%; max-width: none; }
.filter-label { display: flex; flex-direction: column; font-size: 12px; gap: 8px; color: #4e6857; }
.list-summary { display: flex; align-items: center; justify-content: space-between; padding: 8px 20px; gap: 16px; background: #fafbf8; font-size: 12px; color: #536b5d; border-bottom: 1px solid var(--border); }
.list-summary .text-button { font-size: 12px; }
.delivery-label { display: block; font-size: 11px; color: #627665; line-height: 1.6; margin-top: 4px; white-space: normal; }
.delivery-label.overdue { color: #a43d30; font-weight: 600; }
.client-card h2 { font-size: 17px; }
.client-card p { color: #596f60; font-size: 13px; }
.client-card .client-code { font-size: 11px; color: #596f60; letter-spacing: 1px; margin-bottom: 5px; }
.client-card-bottom { align-items: center; color: #596f60; font-size: 12px; }
.client-card-bottom button { font-size: 12px; min-height: 44px; }
.type-tag { color: #506647; font-size: 11px; }
.record-summary { display: grid; grid-template-columns: 1fr 1fr 2fr; gap: 12px; padding: 18px; border: 1px solid #e0e8dd; border-radius: 8px; background: #f5f8f1; margin-bottom: 26px; }
.record-summary span { display: block; color: #53694e; font-size: 11px; margin-bottom: 8px; }
.record-summary strong { font-size: 23px; font-weight: 500; }
.detail-grid dt { font-size: 12px; color: #546b57; }
.detail-grid dd { font-size: 14px; }
.order-data { margin-top: 22px; }
fieldset { border: 0; border-top: 1px solid var(--border); margin: 0 0 22px; padding: 20px 0 0; min-width: 0; }
legend { padding-right: 15px; font-size: 13px; font-weight: 600; color: #365b46; }
.form-grid label { color: #4e6856; font-size: 12px; }
.form-hint { color: #596c5c; font-size: 12px; }
.form-error { background: #fff0eb; color: #9a3025; border-left: 3px solid #ae4f40; border-radius: 4px; padding: 13px; line-height: 1.6; }
.order-total { padding: 18px; gap: 9px; }
.order-total span { color: #506747; font-size: 12px; }
.order-total strong { font-size: 27px; }
.order-total small { color: #506747; font-size: 12px; }
.form-actions { position: sticky; bottom: -30px; background: white; padding-bottom: 12px; z-index: 1; }
.repeat-note { background: #eaf3f0; color: #355f53; border-radius: 6px; padding: 14px; margin-bottom: 24px; font-size: 13px; line-height: 1.6; }
.process { display: grid; grid-template-columns: repeat(4,1fr); margin: 12px 0 28px; padding: 0; list-style: none; }
.process li { position: relative; text-align: center; font-size: 12px; color: #6d7d72; padding: 0 3px; }
.process li::before { content: ''; position: absolute; height: 2px; background: #e4e9e1; top: 15px; left: -50%; width: 100%; z-index: 0; }
.process li:first-child::before { display: none; }
.process li > span { display: grid; place-items: center; position: relative; width: 32px; height: 32px; border-radius: 50%; margin: 0 auto 10px; background: #f0f3ed; border: 1px solid #dce4d5; z-index: 1; }
.process li.complete::before { background: #65a28b; }
.process li.complete > span { background: #dceee5; border-color: #65a28b; color: #2a604b; }
.process li.current { color: #214c45; font-weight: 700; }
.process li.current > span { background: #214c45; color: white; border-color: #214c45; }
.order-detail-status { margin-bottom: 18px; font-size: 13px; }
.detail-actions { flex-wrap: wrap; align-items: center; }
.detail-actions .text-button { padding: 6px 10px; font-size: 12px; }
.delivered-note { color: #3e7554; font-size: 14px; padding: 10px 0; }
.timeline { list-style: none; padding: 0; margin: 16px 0; }
.timeline li { border-left: 2px solid #d9e7dc; margin-left: 4px; padding: 0 0 22px 18px; position: relative; }
.timeline li::before { content: ''; position: absolute; width: 8px; height: 8px; border-radius: 50%; left: -5px; top: 5px; background: #5c9580; }
.timeline li > div { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 6px 12px; }
.timeline strong { font-size: 13px; font-weight: 600; }
.timeline time { font-size: 11px; color: #627460; }
.timeline p { font-size: 12px; color: #5b705d; line-height: 1.6; margin: 8px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
@media(max-width:1150px) { .toolbar .search-wrap { flex-basis: 100%; } .toolbar .filter-label { flex: 1 1 150px; } }
@media(max-width:760px) {
  nav { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); }
  nav a { flex-wrap: wrap; gap: 2px; font-size: 10px; }
  nav a > span { display: none; }
  nav b { font-size: 9px; }
  .document-totals { gap: 8px; padding: 13px; }
  .document-totals strong { font-size: 17px; }
  .document-totals span { font-size: 11px; }
  .document-actions { gap: 10px; }
  .document-actions .secondary { flex: 1; }
  .delivery-preview { max-height: 450px; }
  .delivery-card { padding: 18px; gap: 14px; align-items: flex-start; }
  .delivery-card strong { font-size: 16px; }
  nav { gap: 3px; }
  nav a { font-size: 11px; gap: 4px; padding: 10px 4px; }
  nav b { padding: 3px 5px; }
  .stock-grid { grid-template-columns: 1fr; padding: 15px; gap: 16px; }
  .stock-card { padding: 18px; }
  .stock-quantities dd { font-size: 26px; }
  .stock-card-actions .primary, .stock-card-actions .secondary { flex: 1; padding: 12px; }
  .stock-movement { flex-direction: column; padding: 18px; gap: 12px; }
  .movement-deltas { grid-template-columns: 1fr 1fr; }
  .movement-deltas time { text-align: left; }
  .topbar-actions { gap: 12px; }
  .topbar-actions .environment { display: none; }
  .brand-strip { gap: 0; }
  .brand-strip > div { padding: 18px; }
  .brand-strip h2 { font-size: 19px; }
  .brand-strip img { width: 28%; height: 155px; }
  .brand-strip .eyebrow { font-size: 8px; }
  input, select, textarea { font-size: 16px; }
  .toolbar .filter-label { flex-basis: calc(50% - 16px); }
  .search-wrap { min-width: 0 !important; }
  .operational-summary { font-size: 12px; margin-top: -5px; flex-direction: column; gap: 10px; line-height: 1.6; }
  .stat { padding: 16px; }
  .stat > span { font-size: 12px; }
  .stat small { font-size: 11px; }
  .demo-note { font-size: 11px; }
  .list-summary { padding: 10px 15px; font-size: 11px; }
  .table-wrap td:nth-child(3) { white-space: normal; }
  .table-wrap .status { min-height: 44px; font-size: 14px; }
  .table-wrap .cell-sub { font-size: 12px; }
  .table-wrap td:nth-child(3)::before { content: 'FECHAS'; }
  .record-summary { grid-template-columns: 1fr 1fr; }
  .record-summary > div:last-child { grid-column: 1/-1; }
  .process li { font-size: 11px; }
  .detail-actions .primary { flex: 1 1 100%; }
  .form-actions { bottom: -22px; }
  .detail-grid { grid-template-columns: 1fr; }
  .order-detail-status { gap: 15px; }
  .order-total strong { font-size: 26px; }
}

.quick-preset-btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.quick-qty-btn {
  background: #f0f7f4;
  border: 1px solid #c2ded3;
  color: #1a5649;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.15s ease;
}
.quick-qty-btn:hover, .quick-qty-btn:focus {
  background: #14666c;
  color: #ffffff;
  border-color: #14666c;
}
.quick-reason-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.chip-btn {
  background: #f6f7f5;
  border: 1px solid #dbe2dc;
  color: #446156;
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}
.chip-btn:hover, .chip-btn:focus {
  background: #214c45;
  color: #ffffff;
  border-color: #214c45;
}
.live-pulse {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #52a58a;
  box-shadow: 0 0 0 rgba(82, 165, 138, 0.4);
  animation: pulse-dot 2s infinite;
  margin-right: 6px;
}
@keyframes pulse-dot {
  0% { box-shadow: 0 0 0 0 rgba(82, 165, 138, 0.7); }
  70% { box-shadow: 0 0 0 8px rgba(82, 165, 138, 0); }
  100% { box-shadow: 0 0 0 0 rgba(82, 165, 138, 0); }
}

.stock-box-count {
  display: block;
  font-size: 11px;
  color: #557065;
  margin-top: 3px;
  font-weight: 500;
  line-height: 1.2;
}

/* User Session & Topbar Greetings */
.topbar-user-area {
  display: flex;
  align-items: center;
  gap: 12px;
}
.greeting-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f0f7f4;
  border: 1px solid #d0e4dc;
  color: #174e47;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.user-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: #ffffff;
  border: 1px solid #cfe0d8;
  border-radius: 20px;
  padding: 4px 12px 4px 5px;
  font-size: 12px;
  font-weight: 600;
  color: #1a423d;
  cursor: pointer;
  transition: all 0.15s ease;
}
.user-pill-btn:hover {
  background: #f4faf7;
  border-color: #214c45;
}
.user-avatar-badge {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  font-size: 14px;
  background: #e8f3ef;
}
.user-caret {
  font-size: 9px;
  color: #79978f;
  margin-left: 2px;
}

/* Login Modal / Screen */
.auth-overlay {
  position: fixed;
  inset: 0;
  background: rgba(14, 38, 35, 0.78);
  backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.auth-card {
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
  width: 100%;
  max-width: 440px;
  padding: 32px 28px;
  text-align: center;
  border: 1px solid #e1ece7;
  animation: auth-appear 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes auth-appear {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.auth-card-brand img {
  height: 48px;
  width: auto;
  margin-bottom: 6px;
}
.auth-card-brand span {
  display: block;
  font-size: 10px;
  letter-spacing: 2px;
  color: #73948b;
  font-weight: 700;
  margin-bottom: 18px;
}
.auth-users-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 16px 0;
}
.auth-user-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  background: #f7faf8;
  border: 2px solid #e2ece7;
  border-radius: 10px;
  padding: 12px 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.auth-user-btn:hover {
  background: #edf6f2;
  border-color: #52a58a;
}
.auth-user-btn.active {
  background: #e8f5f0;
  border-color: #1b5e54;
  box-shadow: 0 4px 12px rgba(27, 94, 84, 0.15);
}
.auth-user-avatar {
  font-size: 24px;
}
.auth-user-name {
  font-size: 13px;
  font-weight: 700;
  color: #17433c;
}
.auth-user-role {
  font-size: 9px;
  color: #6d8e85;
}
.auth-input-wrap {
  text-align: left;
  margin-top: 14px;
}
.auth-input-wrap label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: #3b5f56;
  margin-bottom: 6px;
}
.auth-input-wrap input {
  padding: 12px 14px;
  font-size: 14px;
  border-radius: 8px;
}
.auth-btn-submit {
  width: 100%;
  margin-top: 16px;
  padding: 13px;
  font-size: 13.5px;
  font-weight: 600;
  border-radius: 8px;
  background: #1b5e54;
  color: #ffffff;
  border: 0;
  cursor: pointer;
  transition: background 0.15s;
}
.auth-btn-submit:hover {
  background: #144941;
}

/* User Profile & Menu Dialog */
.user-profile-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #f0f7f4;
  border: 1px solid #c9e0d6;
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 16px;
}
.user-profile-avatar {
  font-size: 32px;
}
.user-profile-info strong {
  display: block;
  font-size: 16px;
  color: #164941;
}
.user-profile-info span {
  font-size: 12px;
  color: #557970;
}
.user-menu-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.user-menu-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  font-size: 13px;
  background: #ffffff;
  border: 1px solid #d5e3dc;
  border-radius: 8px;
  text-align: left;
  font-weight: 600;
  color: #1c4b44;
  cursor: pointer;
  transition: all 0.15s ease;
}
.user-menu-btn:hover {
  background: #f5f9f7;
  border-color: #1b5e54;
}
.user-menu-btn.danger {
  color: #a33838;
}
.user-menu-btn.danger:hover {
  background: #fef4f4;
  border-color: #d78888;
}

/* Team Notes */
.team-note-item:hover {
  border-color: #9cbdb1 !important;
}
.team-note-item.is-done {
  opacity: 0.72;
}

