/**
 * K697-Saas UX polish — today card, tips, filters, quick invoice, touch.
 * Complements k697-phone.css / k697-saas-mobile.css (not k697-system.css).
 */

.login-remember {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0 12px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-muted, #8a9aaa);
  cursor: pointer;
  user-select: none;
}
.login-remember input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent, #f0a030);
}

.k697-today-card {
  margin: 0 0 16px;
  padding: 14px 14px 10px;
  border-radius: 14px;
  border: 1px solid var(--border, #243040);
  background:
    linear-gradient(135deg, rgba(64, 224, 160, .08), transparent 55%),
    var(--bg-card, #121a22);
}
.k697-today-card__title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 900;
}
.k697-today-card__sub {
  margin: 4px 0 0;
  font-size: 12.5px;
  color: var(--text-muted, #8a9aaa);
  font-weight: 600;
}
.k697-today-card__list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
@media (min-width: 700px) {
  .k697-today-card__list { grid-template-columns: 1fr 1fr; }
}
.k697-today-card__item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 14px;
  min-height: 48px;
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
  border: 1px solid var(--border, #243040);
  background: rgba(255, 255, 255, .03);
  -webkit-tap-highlight-color: transparent;
}
.k697-today-card__label { font-weight: 800; font-size: 14px; }
.k697-today-card__hint { font-size: 12px; color: var(--text-muted, #8a9aaa); font-weight: 600; }
.k697-today-card__item.is-warn { border-color: rgba(245, 158, 11, .45); }
.k697-today-card__item.is-ok { border-color: rgba(34, 197, 94, .35); }
.k697-today-card__item.is-done { opacity: .72; }

.k697-tip {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px dashed color-mix(in srgb, var(--accent, #f0a030) 45%, var(--border, #243040));
  background: rgba(240, 160, 48, .08);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.55;
  position: relative;
}
.k697-tip[hidden] { display: none !important; }
.k697-tip__text { flex: 1; min-width: 0; }
.k697-tip__dismiss {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: inherit;
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
}
/* Long instructional banners promoted from .alert or k697_tip(..., html) */
.k697-tip--banner,
.alert.k697-tip {
  line-height: 1.8;
  font-weight: 600;
  border-style: solid;
}
.alert.k697-tip .k697-tip__dismiss,
.k697-tip--banner .k697-tip__dismiss {
  margin-inline-start: 4px;
}

.k697-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-end;
  margin-bottom: 12px;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid var(--border, #e2e8f0);
  background: var(--bg-soft, #f8fafc);
}
.k697-filter-bar .field { margin: 0; }
.k697-filter-bar .k697-filter-bar__search {
  flex: 1 1 180px;
  min-width: 0;
}
.k697-filter-bar .k697-filter-bar__search input.field {
  min-height: 44px;
  font-size: 16px;
  font-weight: 700;
}
.k697-filter-bar .btn { min-height: 44px; }

/* Search clear + wrap (shared) */
.k697-search-wrap {
  position: relative;
  display: block;
  width: 100%;
}
.k697-search-wrap input.field,
.k697-search-wrap input[type="search"] {
  width: 100%;
  padding-inline-end: 42px;
}
.topbar-search .k697-search-wrap {
  display: block;
  width: 100%;
}
.topbar-search .k697-search-wrap input {
  padding-inline-end: 40px;
}
.k697-search-clear {
  position: absolute;
  inset-inline-end: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  min-width: 32px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text-muted, #64748b);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.75;
}
.k697-search-clear:hover,
.k697-search-clear:focus-visible {
  opacity: 1;
  background: color-mix(in srgb, var(--border, #e2e8f0) 55%, transparent);
  outline: 2px solid var(--accent, #0f8a7a);
  outline-offset: 1px;
}
.k697-search-wrap.has-value input {
  font-weight: 700;
}

/* Flash / save feedback */
.k697-flash-banner {
  position: relative;
  padding-inline-end: 44px;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.k697-flash-banner.is-out {
  opacity: 0;
  transform: translateY(-6px);
}
.k697-flash-banner__x {
  position: absolute;
  inset-inline-end: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  min-width: 36px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: inherit;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.7;
}
.k697-flash-banner__x:hover,
.k697-flash-banner__x:focus-visible {
  opacity: 1;
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

/* Focus / touch targets (لا تمس safe-area) */
:focus-visible {
  outline: 2px solid var(--accent, #0f8a7a);
  outline-offset: 2px;
}
.btn:focus:not(:focus-visible),
a:focus:not(:focus-visible),
button:focus:not(:focus-visible) {
  outline: none;
}
.btn.btn-primary,
.btn.btn-success,
.btn.btn-pdf,
.btn.btn-wa,
a.btn.btn-primary,
a.btn.btn-success {
  min-height: 44px;
}

@media (max-width: 900px) {
  /* Sticky day/search bars — تحت الهيدر مع احترام النوتش */
  .k697-filter-bar {
    position: sticky;
    top: calc(56px + env(safe-area-inset-top, 0px));
    z-index: 35;
    margin-inline: -2px;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
    backdrop-filter: blur(8px);
    background: color-mix(in srgb, var(--bg-soft, #f8fafc) 92%, transparent);
  }
  html[data-theme="dark"] .k697-filter-bar,
  body.theme-dark .k697-filter-bar {
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.35);
  }
}

.misc-helper {
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid #fdba74;
  background: #fff7ed;
  color: #9a3412;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.65;
}
.misc-helper strong { font-weight: 900; }

.k697-share-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.k697-share-actions .btn { min-height: 44px; font-weight: 800; }
.btn-wa { background: #16a34a !important; color: #fff !important; }
.btn-pdf { background: #0ea5e9 !important; color: #fff !important; }

.inv-quick-toggle {
  display: none;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border, #cbd5e1);
  background: var(--bg-card, #fff);
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
}
.inv-quick-toggle[aria-pressed="true"] {
  border-color: #0f8a7a;
  background: #ecfdf5;
  color: #0f8a7a;
}

/* Anchor / restore target — leave room for sticky topbar */
html {
  scroll-padding-top: calc(64px + env(safe-area-inset-top, 0px));
}
@media (max-width: 900px) {
  html {
    scroll-padding-top: calc(56px + env(safe-area-inset-top, 0px));
  }
}
tr.k697-scroll-flash,
[data-restore-id].k697-scroll-flash,
.k697-scroll-flash {
  outline: 2px solid rgba(37, 99, 235, 0.45);
  outline-offset: 2px;
  transition: outline-color 0.8s ease;
}

@media (max-width: 900px) {
  .inv-quick-toggle { display: inline-flex; }

  body.inv-quick .invoices-form-panel .adv-toggle,
  body.inv-quick .invoices-form-panel #invKindBreakdown,
  body.inv-quick .invoices-form-panel > .card > p {
    display: none !important;
  }
  body.inv-quick #buyAdv:not(.open) { display: none !important; }

  .btn, button.btn, a.btn, .phone-nav-item, .meal-tab {
    min-height: 44px;
  }
  .btn-sm { min-height: 40px; padding-inline: 12px; }
  input.field:not([type="checkbox"]):not([type="radio"]),
  select.field,
  textarea.field {
    min-height: 44px;
    font-size: 16px;
  }

  /* Fewer columns on narrow lists */
  table.data-table td.hide-narrow,
  table.data-table th.hide-narrow {
    display: none !important;
  }

  .ms-toolbar .actions .btn,
  .k697-share-actions .btn {
    flex: 1 1 140px;
    justify-content: center;
    text-align: center;
  }

  .phone-nav-item span:last-child {
    font-size: 10px;
    font-weight: 800;
  }
}
