/* ==========================================================================
   Components — כפתורים, טפסים, טבלאות, פאנלים, תוויות
   ========================================================================== */

/* ---------------- כפתורים ---------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  min-height: 44px;
  padding: 10px var(--sp-5);
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: none;
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.btn:hover { text-decoration: none; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-ink); }

.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { background: #000; }

.btn-outline { border-color: var(--accent); color: var(--accent-ink); background: transparent; }
.btn-outline:hover { background: var(--accent-soft); }

.btn-light { background: var(--paper); border-color: var(--line); color: var(--ink); }
.btn-light:hover { background: var(--bg-2); border-color: var(--ink-3); }

.btn-ghost { color: var(--ink-2); background: transparent; }
.btn-ghost:hover { background: var(--bg-3); }

.btn-danger { background: var(--sale); color: #fff; }
.btn-danger:hover { background: #000; }

.btn-sm { min-height: 36px; padding: 6px var(--sp-3); font-size: .875rem; }
.btn-lg { min-height: 52px; padding: 14px var(--sp-6); font-size: 1.05rem; }
.btn-block { display: flex; width: 100%; }

.icon-btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px;
  border: 0; border-radius: var(--radius);
  background: transparent; color: var(--ink);
  cursor: pointer;
}
.icon-btn:hover { background: var(--bg-3); }

.badge-count {
  position: absolute; top: 4px; inset-inline-end: 2px;
  min-width: 18px; height: 18px; padding: 0 4px;
  display: grid; place-items: center;
  background: var(--sale); color: #fff;
  font-size: .7rem; font-weight: 700; line-height: 1;
  border-radius: 9px;
}

/* ---------------- טפסים ---------------- */

.form { margin: 0; }
.field { margin-bottom: var(--sp-4); }
.field > label,
.field-label {
  display: block; margin-bottom: 6px;
  font-size: .875rem; font-weight: 700; color: var(--ink-2);
}

.input, .select, textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px var(--sp-3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;            /* מונע זום אוטומטי ב-iOS */
  line-height: 1.5;
}
textarea { min-height: 120px; resize: vertical; }

.input::placeholder, textarea::placeholder { color: var(--ink-3); }

.input:focus, .select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.select {
  appearance: none;
  padding-inline-end: var(--sp-6);
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%237b8089' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left var(--sp-3) center;
}

.field-hint { margin-top: 4px; font-size: .8rem; color: var(--ink-3); }

.check { display: flex; align-items: flex-start; gap: var(--sp-2); cursor: pointer; font-size: .925rem; }
.check input { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--accent); flex: none; }

.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 var(--sp-4); }
@media (max-width: 560px) { .field-grid { grid-template-columns: 1fr; } }

/* ---------------- פאנלים ---------------- */

.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
  margin-bottom: var(--sp-5);
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}
.panel-title { margin: 0; font-size: 1.1rem; }
.panel-danger { border-color: var(--ink); background: var(--bg-2); }

.panel-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--sp-4); }
.panel-grid-wide { display: grid; grid-template-columns: 2fr 1fr; gap: var(--sp-5); align-items: start; }
@media (max-width: 900px) { .panel-grid-wide { grid-template-columns: 1fr; } }

.link-sm { font-size: .875rem; font-weight: 500; }

/* ---------------- טבלאות ---------------- */

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.table { width: 100%; border-collapse: collapse; font-size: .925rem; }
.table th, .table td {
  padding: var(--sp-3);
  text-align: right;
  border-bottom: 1px solid var(--line-2);
  vertical-align: middle;
}
.table th {
  font-weight: 700; font-size: .8rem; color: var(--ink-3);
  border-bottom-color: var(--line);
  white-space: nowrap;
}
.table tbody tr:hover { background: var(--bg-2); }
.table tbody tr:last-child td { border-bottom: 0; }

.row-actions { display: flex; gap: var(--sp-2); justify-content: flex-start; }

/* ---------------- תוויות ---------------- */

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px var(--sp-2);
  border-radius: var(--radius-sm);
  font-size: .75rem; font-weight: 700; line-height: 1.5;
  background: var(--bg-3); color: var(--ink-2);
}
.badge-new    { background: var(--accent); color: #fff; }
.badge-sale   { background: var(--sale); color: #fff; }
.badge-out    { background: var(--ink-2); color: #fff; }
.badge-muted  { background: var(--bg-3); color: var(--ink-3); }
.badge-status { background: var(--brass-soft); color: var(--brass-ink); }

/* שבב מצב מוצר — נראה כמו תווית תפורה */
.condition-chip {
  display: inline-flex; align-items: center;
  padding: 4px var(--sp-3);
  border: 1px dashed var(--brass);
  border-radius: var(--radius-sm);
  background: var(--brass-soft);
  color: var(--brass-ink);
  font-size: .8rem; font-weight: 700;
}

.chip-row { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px var(--sp-3);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  font-size: .85rem; color: var(--ink-2);
  cursor: pointer;
}
.chip:hover { border-color: var(--accent); }
.chip.is-current,
.chip.is-active { background: var(--accent); border-color: var(--accent); color: #fff; }

.color-dot { width: 14px; height: 14px; border-radius: 50%; border: 1px solid rgba(0,0,0,.15); flex: none; }

/* ---------------- התראות ---------------- */

.flash-wrap { max-width: var(--container); margin: var(--sp-4) auto 0; padding-inline: var(--sp-4); }

.alert {
  display: flex; align-items: flex-start; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--line);
  border-inline-start: 4px solid var(--ink-3);
  border-radius: var(--radius);
  background: var(--paper);
  margin-bottom: var(--sp-4);
  font-size: .925rem;
}
.alert-success { border-inline-start-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }
.alert-error   { border-inline-start-color: var(--ink);   background: var(--bg-2);      color: var(--ink); }
.alert-warning { border-inline-start-color: var(--ink-2); background: var(--bg-2);      color: var(--ink); }

.alert-list { margin: 0; padding-inline-start: var(--sp-4); }
.alert-close {
  margin-inline-start: auto; border: 0; background: none;
  font-size: 1.2rem; line-height: 1; cursor: pointer; color: inherit; opacity: .6;
}
.alert-close:hover { opacity: 1; }

/* ---------------- עימוד ---------------- */

.pagination { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: var(--sp-6) 0 0; }
.page-link {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 42px; height: 42px; padding: 0 var(--sp-2);
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--paper); color: var(--ink-2);
  font-size: .925rem; font-weight: 500; text-decoration: none;
}
.page-link:hover { border-color: var(--accent); text-decoration: none; }
.page-link.is-current,
.page-link.is-active { background: var(--accent); border-color: var(--accent); color: #fff; }
.page-dots { display: inline-flex; align-items: center; padding: 0 4px; color: var(--ink-3); }

/* ---------------- לשוניות ---------------- */

.tabs { display: flex; gap: var(--sp-4); border-bottom: 1px solid var(--line); margin-bottom: var(--sp-5); }
.tab {
  padding: var(--sp-3) 0;
  border: 0; border-bottom: 2px solid transparent;
  background: none; cursor: pointer;
  font-family: var(--font); font-size: .95rem; font-weight: 700; color: var(--ink-3);
}
.tab:hover { color: var(--ink); }
.tab.is-current,
.tab.is-active { color: var(--accent-ink); border-bottom-color: var(--brass); }

/* ---------------- מדדים ---------------- */

.stat-row  { display: flex; flex-wrap: wrap; gap: var(--sp-3); margin-bottom: var(--sp-5); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: var(--sp-3); margin-bottom: var(--sp-5); }
.stat-card {
  display: flex; flex-direction: column; gap: 2px;
  padding: var(--sp-4);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  min-width: 140px;
}
.stat-value { font-family: var(--font-display); font-size: 1.7rem; font-weight: 700; line-height: 1.1; }
.stat-label { font-size: .8rem; color: var(--ink-3); }

/* ---------------- מצב ריק ---------------- */

.empty-state { text-align: center; padding: var(--sp-8) var(--sp-4); }
.empty-icon  { margin: 0 auto var(--sp-4); color: var(--ink-3); opacity: .7; }
.empty-title { margin-bottom: var(--sp-2); font-size: 1.25rem; }
.empty-text  { margin: 0 auto var(--sp-5); max-width: 46ch; color: var(--ink-2); }

/* ---------------- שונות ---------------- */

.rich-text { line-height: 1.85; }
.rich-text ul, .rich-text ol { padding-inline-start: var(--sp-5); margin: 0 0 var(--sp-4); }
.rich-text li { margin-bottom: 6px; }

.breadcrumbs {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  margin-bottom: var(--sp-4);
  font-size: .85rem; color: var(--ink-3);
}
.breadcrumbs a { color: var(--ink-3); }
.breadcrumbs a:hover { color: var(--accent-ink); }


/* ==========================================================================
   התאמות לכיוון "ארכיון": פקדים חדים, בלי רדיוס ובלי צל.
   ========================================================================== */

.btn {
  border-radius: 0;
  font-weight: 500;
  letter-spacing: .04em;
  font-size: .9rem;
}
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover { background: var(--accent); }
.btn-dark { background: transparent; color: var(--ink); border-color: var(--ink); }
.btn-dark:hover { background: var(--ink); color: #fff; }
.btn-outline { border-color: var(--ink); color: var(--ink); }
.btn-outline:hover { background: var(--ink); color: #fff; }
.btn-light { background: transparent; border-color: var(--line-ink); color: var(--ink); }
.btn-light:hover { background: var(--bg-2); }
.btn-danger { background: var(--accent); }

.icon-btn { border-radius: 0; }
.badge-count { border-radius: 0; background: var(--accent); min-width: 16px; height: 16px; font-size: .62rem; }

/* שדות: קו תחתון בלבד. מסגרת מלאה סביב כל שדה יצרה רשת קופסאות. */
.input, .select, textarea {
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  padding-inline: 0;
}
.input:focus, .select:focus, textarea:focus {
  outline: none;
  border-bottom-color: var(--ink);
  box-shadow: none;
  background: transparent;
}
.select { padding-inline-end: var(--sp-5); background-position: left 0 center; }

.field > label, .field-label {
  font-size: .68rem;
  font-weight: 500;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.panel {
  background: transparent;
  border: 0;
  border-top: 1px solid var(--line-ink);
  border-radius: 0;
  padding: var(--sp-4) 0 var(--sp-5);
}
.panel-title { font-family: var(--font); font-size: .72rem; font-weight: 500; letter-spacing: .13em; text-transform: uppercase; color: var(--ink-3); }
.panel-danger { border-top-color: var(--accent); background: transparent; }

.badge { border-radius: 0; letter-spacing: .06em; }
.badge-new { background: var(--ink); color: #fff; }
.badge-sale { background: var(--accent); color: #fff; }
.badge-status { background: var(--bg-2); color: var(--ink-2); }

.alert { border-radius: 0; border: 0; border-inline-start: 2px solid var(--ink-3); background: var(--bg-2); }
.alert-success { border-inline-start-color: var(--ok); background: var(--ok-soft); }
.alert-error { border-inline-start-color: var(--accent); background: var(--sale-soft); }
.alert-warning { border-inline-start-color: var(--brass); background: var(--warn-soft); }

.page-link { border-radius: 0; border-color: var(--line); }
.page-link.is-current, .page-link.is-active { background: var(--ink); border-color: var(--ink); }

.tab { letter-spacing: .1em; text-transform: uppercase; font-size: .74rem; font-weight: 500; }
.tab.is-current, .tab.is-active { color: var(--accent); border-bottom-color: var(--accent); }

.stat-card { background: var(--bg-2); border: 0; border-radius: 0; }
.stat-value { font-family: var(--font-display); }
.stat-label { letter-spacing: .06em; }

.chip { border-radius: 0; border-color: var(--line-ink); }
.chip.is-current, .chip.is-active { background: var(--ink); border-color: var(--ink); }

.table th { letter-spacing: .1em; text-transform: uppercase; font-size: .68rem; }
.table thead th { border-bottom-color: var(--line-ink); }

.empty-state { padding-block: var(--sp-8); }
.empty-title { font-family: var(--font-display); }

.breadcrumbs { font-size: .74rem; letter-spacing: .06em; }

/* ==========================================================================
   שדות טופס — גודל תקין
   --------------------------------------------------------------------------
   המעבר לקו תחתון בלבד הוריד גם את הריפוד והגובה, והשדות נראו
   קטנים וצרים מול כפתור בגובה מלא. כאן מוחזר להם נפח.
   ========================================================================== */

.input, .select, textarea {
  width: 100%;
  min-height: 46px;
  padding: 11px var(--sp-3);
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 16px;            /* מונע זום אוטומטי ב-iOS */
}
.input:focus, .select:focus, textarea:focus {
  background: var(--paper);
  border-color: var(--ink);
  box-shadow: none;
}
textarea { min-height: 110px; padding-block: var(--sp-3); }

.select { padding-inline-end: var(--sp-6); background-position: left var(--sp-3) center; }

.field { margin-bottom: var(--sp-4); }
.field > label, .field-label { margin-bottom: 6px; font-size: .72rem; }
.field-hint { margin-top: 5px; font-size: .78rem; }

/* כפתור ראשי בטופס — באותו גובה כמו השדות שמעליו */
.auth-card .btn,
.form .btn-block,
.btn-block { min-height: 46px; }

/* בעמודי התחברות והרשמה הטופס צר מדי בלי תקרה ברורה */
.auth-card { width: 100%; max-width: 420px; }
.auth-card-wide { max-width: 640px; }
.auth-card .field-grid { gap: 0 var(--sp-4); }

/* צ׳קבוקסים — אזור מגע נוח */
.check { align-items: center; gap: var(--sp-3); font-size: .9rem; }
.check input { width: 20px; height: 20px; margin: 0; }

/* ==========================================================================
   שדות ללא מחלקה
   --------------------------------------------------------------------------
   חלק מהטפסים (התחברות, הרשמה, איפוס סיסמה) נכתבו עם <input> חשוף
   בלי class="input", ולכן נראו כשדות ברירת המחדל של הדפדפן —
   קטנים וצרים מול כפתור בגובה מלא.
   כאן מוחל אותו עיצוב לפי סוג האלמנט, כך שאין תלות במחלקה.
   ========================================================================== */

.field input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
.field select,
.field textarea,
.form input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]),
.form select,
.form textarea {
  width: 100%;
  min-height: 46px;
  padding: 11px var(--sp-3);
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
}

.field input:focus, .field select:focus, .field textarea:focus,
.form input:focus, .form select:focus, .form textarea:focus {
  outline: none;
  background: var(--paper);
  border-color: var(--ink);
  box-shadow: none;
}

.field textarea, .form textarea { min-height: 110px; }

.form-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--sp-4); }

/* מסך התחברות מרווח יותר */
.auth-page { padding-block: var(--sp-7) var(--sp-8); }
.auth-title { margin-bottom: var(--sp-2); }
.auth-sub { margin-bottom: var(--sp-6); }
