/*
 * Valenzo POS v271 — one coherent desktop/tablet command surface.
 *
 * Earlier feature layers intentionally remain isolated. This final layer only
 * resolves places where two valid controls were competing for the same job,
 * and restores explicit contrast after theme changes.
 */

@media screen and (min-width: 700px) {
  /* Every workspace already owns a contextual search. Do not repeat it in the
     command bar, where it crowds the operator and security controls. */
  .pos-v247-shell.pos-v220-shell .pos-v247-global-search {
    display: none !important;
  }

  /* Table search was explicitly removed from the product brief. Keep the area
     switcher, but let it use the whole row instead of leaving an empty column. */
  .pos-v247-shell.pos-v220-shell:is(
    [data-pos-v220-view="hybrid"],
    [data-pos-v220-view="tables"]
  ) .table-workspace-v173 .tv173-search {
    display: none !important;
  }

  .pos-v247-shell.pos-v220-shell:is(
    [data-pos-v220-view="hybrid"],
    [data-pos-v220-view="tables"]
  ) .table-workspace-v173 .tv173-zonebar {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  /* Product search is the single search for Hızlı Satış. v257 collapsed this
     toolbar; bring it back as a compact, usable strip. */
  .pos-v247-shell.pos-v220-shell[data-pos-v220-view="quick"] .pos-v247-catalog-toolbar {
    display: grid !important;
    width: 100% !important;
    height: auto !important;
    min-height: 64px !important;
    overflow: visible !important;
    grid-template-columns: minmax(220px, 620px) auto !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 10px !important;
    padding: 7px 14px !important;
    border: 0 !important;
    border-bottom: 1px solid var(--v257-line) !important;
    background: var(--v257-surface) !important;
  }

  body.pos-active .pos-v247-shell.pos-v220-shell[data-pos-v220-view="quick"]
    .pos-v247-catalog-toolbar .resto-search-wrap {
    display: flex !important;
    width: 100% !important;
    max-width: 620px !important;
    height: 48px !important;
    min-height: 48px !important;
    visibility: visible !important;
  }

  /* The package screen uses the canonical Yönetim action from the header. */
  .pos-v247-shell.pos-v220-shell[data-pos-v220-view="package"] .pk253-manage {
    display: none !important;
  }

  /* Never inherit body.text-white into light-mode command actions. */
  .pos-v247-shell.pos-v220-shell .pos-v257-menu-button,
  .pos-v247-shell.pos-v220-shell .pos-v257-menu-button::after {
    color: var(--v257-text) !important;
    -webkit-text-fill-color: var(--v257-text) !important;
  }

  .pos-v247-shell.pos-v220-shell .pos-v247-utility > [data-pos-secure-logout="true"],
  .pos-v247-shell.pos-v220-shell .pos-v247-utility > [data-pos-secure-logout="true"]::before {
    color: var(--v257-red) !important;
    -webkit-text-fill-color: var(--v257-red) !important;
  }

  .pos-v247-shell.pos-v220-shell .pos-v247-user-copy small {
    -webkit-text-fill-color: var(--v257-gold-bright, var(--v257-gold)) !important;
  }

  /* Older compact rules hid the operator name at tablet widths. The global
     search is gone now, so the signed-in role has room to remain explicit. */
  .pos-v247-shell.pos-v220-shell .pos-v247-user-copy {
    display: block !important;
    min-width: 64px !important;
  }

  .pos-v247-shell.pos-v220-shell .pos-v220-nav-copy b {
    font-size: 11px !important;
    line-height: 1.1 !important;
  }

  /* Product and payment rows must grow with the name. Ellipsis made similarly
     named products impossible to distinguish at the till. */
  body.pos-active .pos-v247-shell.pos-v220-shell .pos-v247-product-card.resto-product {
    height: auto !important;
    min-height: 88px !important;
  }

  body.pos-active .pos-v247-shell.pos-v220-shell
    .pos-v247-product-card .resto-product-name,
  body.pos-active .pos-v247-shell.pos-v220-shell .pos-v247-cart-name,
  .checkout-v261 .checkout-product-name b,
  .pos-v220-shell[data-pos-v220-view="package"] .pk253-detail-main .package-item-row div b,
  .pos-v220-shell[data-pos-v220-view="radar"] .tv252-card-items > li > span {
    min-width: 0 !important;
    overflow: visible !important;
    text-overflow: clip !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    word-break: normal !important;
  }

  .pos-v220-shell[data-pos-v220-view="radar"] .tv252-card-items > li {
    align-items: flex-start !important;
  }

  .checkout-v261 .checkout-cart-row {
    height: auto !important;
  }
}

html[data-valenzo-theme="light"] .pos-v247-shell.pos-v220-shell .pos-v247-user-copy small {
  border-color: #9a6700 !important;
  background: #fff7df !important;
  color: #704700 !important;
  -webkit-text-fill-color: #704700 !important;
}

html[data-valenzo-theme="light"] .pos-v247-shell.pos-v220-shell
  .pos-v247-utility > [data-pos-secure-logout="true"],
html[data-valenzo-theme="light"] .pos-v247-shell.pos-v220-shell
  .pos-v247-utility > [data-pos-secure-logout="true"]::before {
  color: #922f2f !important;
  -webkit-text-fill-color: #922f2f !important;
}

html[data-valenzo-theme="light"] .pos-v247-shell.pos-v220-shell .pos-v247-user::after {
  border-color: #08728a !important;
  background-color: #e9f8fb !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23005f73' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 15a4 4 0 0 1-4 4H8l-5 3V7a4 4 0 0 1 4-4h9a4 4 0 0 1 4 4z'/%3E%3Cpath d='M8 9h8M8 13h5'/%3E%3C/svg%3E") !important;
  box-shadow: 0 0 0 2px rgba(0, 95, 115, .08) !important;
}

/* High-value action labels keep a guaranteed foreground in both themes. */
.pos-v220-shell[data-pos-v220-view="radar"] .tv252-radar-refresh, .pos-v220-shell[data-pos-v220-view="radar"] .tv252-radar-refresh > :is(span), .pos-v220-shell[data-pos-v220-view="radar"] .tv252-radar-refresh > :is(b), .pos-v220-shell[data-pos-v220-view="radar"] .tv252-card-pay, .pos-v220-shell[data-pos-v220-view="radar"] .tv252-card-pay * {
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
}

.pos-v220-shell[data-pos-v220-view="package"] .pk253-tool-button, .pos-v220-shell[data-pos-v220-view="package"] .pk253-tool-button :is(span), .pos-v220-shell[data-pos-v220-view="package"] .pk253-tool-button :is(b) {
  -webkit-text-fill-color: currentColor !important;
}

@media screen and (min-width: 700px) and (max-width: 1180px) {
  /* Tablet keeps the same two-line business identity as desktop. Compact the
     neighbouring controls instead of collapsing the brand to a logo. */
  .pos-v247-shell.pos-v220-shell .pos-v220-rail {
    grid-template-columns: 122px minmax(0, 1fr) auto !important;
  }

  .pos-v247-shell.pos-v220-shell .pos-v220-brand {
    display: flex !important;
  }

  .pos-v247-shell.pos-v220-shell .pos-v220-brand-mark {
    width: 38px !important;
    height: 38px !important;
    flex-basis: 38px !important;
  }

  .pos-v247-shell.pos-v220-shell .pos-v220-brand-copy {
    display: block !important;
  }

  .pos-v247-shell.pos-v220-shell .pos-v220-brand-copy b {
    font-size: 9px !important;
    letter-spacing: 0.06em !important;
  }

  .pos-v247-shell.pos-v220-shell .pos-v220-brand-copy small {
    margin-top: 2px !important;
    font-size: 6.5px !important;
    letter-spacing: 0.08em !important;
  }

  /* Five destinations share the tablet command bar. Allow each label to use a
     second line instead of clipping the final word. */
  .pos-v247-shell.pos-v220-shell .pos-v220-nav {
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
  }

  .pos-v247-shell.pos-v220-shell .pos-v220-nav [data-pos-v220-target] {
    min-width: 0 !important;
    gap: 3px !important;
    padding-inline: 4px !important;
  }

  .pos-v247-shell.pos-v220-shell .pos-v220-nav-copy {
    min-width: 0 !important;
    max-width: 100% !important;
  }

  .pos-v247-shell.pos-v220-shell .pos-v220-nav-copy b {
    display: block !important;
    min-width: 0 !important;
    overflow: visible !important;
    font-size: 11px !important;
    line-height: 1.08 !important;
    text-align: center !important;
    text-overflow: clip !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    word-break: normal !important;
  }

  .pos-v247-shell.pos-v220-shell .pos-v220-nav-icon {
    width: 18px !important;
    height: 18px !important;
    flex-basis: 18px !important;
  }

  .pos-v247-shell.pos-v220-shell .pos-v247-utility {
    gap: 3px !important;
  }

  .pos-v247-shell.pos-v220-shell .pos-v247-user {
    gap: 3px !important;
  }

  .pos-v247-shell.pos-v220-shell .pos-v247-user-avatar {
    width: 24px !important;
    height: 24px !important;
    flex-basis: 24px !important;
  }

  .pos-v247-shell.pos-v220-shell .pos-v247-user-copy {
    min-width: 54px !important;
  }

  .pos-v247-shell.pos-v220-shell .pos-v247-user-copy small {
    min-width: 54px !important;
    min-height: 28px !important;
  }

  .pos-v220-shell .pos-v247-user::after {
    width: 28px !important;
    height: 28px !important;
    flex-basis: 28px !important;
    background-size: 15px 15px !important;
  }

  .pos-v247-shell.pos-v220-shell .pos-v257-menu-button,
  .pos-v247-shell.pos-v220-shell .pos-v247-utility > [data-pos-secure-logout="true"] {
    padding-inline: 4px !important;
    font-size: 9px !important;
  }

  .pos-v247-shell.pos-v220-shell .pos-v257-menu-button {
    width: 68px !important;
    min-width: 68px !important;
    flex-basis: 68px !important;
  }

  .pos-v247-shell.pos-v220-shell .pos-v247-utility > [data-pos-secure-logout="true"] {
    width: 86px !important;
    min-width: 86px !important;
    flex-basis: 86px !important;
  }

  .pos-v220-shell .pos-v257-menu-button::after {
    font-size: 9px !important;
  }

  .pos-v247-shell.pos-v220-shell[data-pos-v220-view="quick"] .pos-v247-catalog-toolbar {
    grid-template-columns: minmax(0, 1fr) auto !important;
    padding-inline: 10px !important;
  }

  /* The order-type and customer selects share a deliberately narrow tablet
     rail. Preserve their full native option text by spending less space on
     decoration, without changing the desktop composition. */
  .pos-v247-shell.pos-v220-shell .pos-v247-order-selectors {
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr) !important;
    padding-inline: 6px !important;
  }

  .pos-v247-shell.pos-v220-shell .pos-v247-order-selectors > label {
    grid-template-columns: 18px minmax(0, 1fr) !important;
    padding-inline: 3px !important;
  }


  body.pos-active .pos-v247-shell.pos-v220-shell .pos-v247-order-selectors select {
    padding: 0 12px 0 0 !important;
    font-size: 10px !important;
  }

  /* Keep all four sale-action captions as real, measurable text in the narrow
     order rail. Giving the flex child an explicit width avoids a transient
     min-content collapse while light/dark theme styles are being swapped. */
  .pos-v247-shell.pos-v220-shell .pos-v247-actions > button {
    min-width: 0 !important;
    padding-inline: 3px !important;
    font-size: 10px !important;
    transition: none !important;
  }

  .pos-v247-shell.pos-v220-shell .pos-v247-actions .pos-v247-action-label {
    display: block !important;
    position: static !important;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    min-width: 0 !important;
    min-height: 0 !important;
    flex: 0 0 auto !important;
    clip: auto !important;
    clip-path: none !important;
    overflow: visible !important;
    line-height: 1.15 !important;
    text-align: center !important;
    text-overflow: clip !important;
    white-space: normal !important;
    overflow-wrap: normal !important;
    word-break: normal !important;
    transition: none !important;
    animation: none !important;
  }

  /* v220 fixes this legacy header to a 62px flex basis. At tablet width the
     v252 filter toolbar becomes a second row, so let the header grow with it
     and keep the controls entirely above the service cards. */
  .pos-v220-shell[data-pos-v220-view="radar"] .table-workspace-v173 .tv252-radar-priority-head {
    height: auto !important;
    min-height: 0 !important;
    flex-basis: auto !important;
    grid-template-rows: auto auto !important;
  }
}

@media screen and (min-width: 700px) and (max-width: 899px) {
  .pos-v247-shell.pos-v220-shell .pos-v220-nav-copy b {
    font-size: 11px !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pos-v247-shell.pos-v220-shell .pos-v247-catalog-toolbar .resto-search-wrap {
    transition: none !important;
  }
}

@media (forced-colors: active) {
  .pos-v247-shell.pos-v220-shell :is(.pos-v257-menu-button), .pos-v247-shell.pos-v220-shell :is([data-pos-secure-logout="true"]), .pos-v247-shell.pos-v220-shell :is(.tv252-radar-refresh), .pos-v247-shell.pos-v220-shell :is(.tv252-card-pay) {
    border: 1px solid ButtonText !important;
    background: ButtonFace !important;
    color: ButtonText !important;
    -webkit-text-fill-color: ButtonText !important;
  }
}
