/* מערכת כרטיסי תיקון — עיצוב רספונסיבי, ימין-לשמאל */
:root {
  --bg: #f4f6f9;
  --card: #ffffff;
  --ink: #1f2a37;
  --muted: #6b7280;
  --line: #e5e7eb;
  --brand: #1f6feb;
  --brand-dark: #1857c0;
  --ok-bg: #e7f6ec; --ok-ink: #176c34;
  --err-bg: #fde8e8; --err-ink: #b42318;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(16,24,40,.08), 0 1px 2px rgba(16,24,40,.06);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", "Rubik", "Arial", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== סרגל עליון ===== */
.topbar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  background: var(--card); border-bottom: 1px solid var(--line);
  padding: 10px 18px; box-shadow: var(--shadow); position: sticky; top: 0; z-index: 10;
}
.topbar .brand { font-weight: 700; font-size: 18px; color: var(--ink); }
.topbar nav { display: flex; gap: 14px; align-items: center; }
.topbar .user { margin-inline-start: auto; display: flex; gap: 12px; align-items: center; color: var(--muted); font-size: 14px; }
.btn-new { background: var(--brand); color: #fff !important; padding: 6px 12px; border-radius: 8px; }
.btn-new:hover { background: var(--brand-dark); text-decoration: none; }

/* ===== מבנה ===== */
.container { max-width: 1080px; margin: 0 auto; padding: 18px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.page-head h1 { font-size: 22px; margin: 0; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px; margin-bottom: 16px;
}

/* ===== כפתורים ===== */
.btn {
  display: inline-block; cursor: pointer; font: inherit;
  background: #eef1f5; color: var(--ink); border: 1px solid var(--line);
  padding: 8px 14px; border-radius: 8px; transition: .15s;
}
.btn:hover { background: #e3e8ef; text-decoration: none; }
.btn.primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn.primary:hover { background: var(--brand-dark); }
.btn.ghost { background: transparent; }
.btn.small { padding: 5px 10px; font-size: 13px; }

/* ===== הודעות מערכת ===== */
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; font-size: 14px; }
.flash.ok { background: var(--ok-bg); color: var(--ok-ink); }
.flash.error { background: var(--err-bg); color: var(--err-ink); }

/* ===== חיפוש וסינון ===== */
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.filters input[type=search] { flex: 1; min-width: 220px; }

/* ===== טפסים ===== */
input, select, textarea {
  width: 100%; font: inherit; color: var(--ink);
  padding: 9px 11px; border: 1px solid #cbd2dc; border-radius: 8px; background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 0; border-color: var(--brand); }
textarea { resize: vertical; }
label { display: block; font-size: 14px; color: var(--muted); margin-bottom: 2px; }
label input, label select, label textarea { margin-top: 4px; color: var(--ink); }
.req { color: var(--err-ink); }

fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; margin: 0 0 16px; }
legend { font-weight: 700; padding: 0 6px; color: var(--ink); }
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 16px; }
.grid .wide { grid-column: 1 / -1; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.actions { display: flex; gap: 10px; margin-top: 8px; }
.form.narrow, .narrow { max-width: 420px; }

/* ===== טבלת כרטיסים ===== */
.table-wrap { overflow-x: auto; }
table.tickets { width: 100%; border-collapse: collapse; background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
table.tickets th, table.tickets td { padding: 11px 12px; text-align: start; border-bottom: 1px solid var(--line); font-size: 14px; }
table.tickets th { background: #f8fafc; color: var(--muted); font-weight: 600; }
table.tickets tbody tr { cursor: pointer; }
table.tickets tbody tr:hover { background: #f5f8ff; }

/* ===== תוויות סטטוס ===== */
.status { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; background: #eef1f5; color: var(--ink); white-space: nowrap; }
.status.big { font-size: 15px; padding: 5px 14px; }
.status[data-status="התקבל"]      { background:#e8eefc; color:#1d4ed8; }
.status[data-status="בבדיקה"]      { background:#fef3c7; color:#92580a; }
.status[data-status="בטיפול"]      { background:#e0f2fe; color:#0369a1; }
.status[data-status="ממתין לחלק"]  { background:#fee2e2; color:#b42318; }
.status[data-status="מוכן"]         { background:#dcfce7; color:#15803d; }
.status[data-status="נמסר"]         { background:#e5e7eb; color:#6b7280; }

/* ===== צפייה בכרטיס ===== */
.cols { display: grid; grid-template-columns: 1.3fr 1fr; gap: 16px; align-items: start; }
.status-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.status-form { display: flex; gap: 8px; margin-inline-start: auto; }
.status-form select { width: auto; }
.card h3 { font-size: 15px; margin: 16px 0 8px; color: var(--brand-dark); }
.card h3:first-of-type { margin-top: 0; }

dl.details { margin: 0; display: grid; gap: 6px; }
dl.details > div { display: grid; grid-template-columns: 130px 1fr; gap: 8px; padding: 4px 0; border-bottom: 1px dashed var(--line); }
dl.details dt { color: var(--muted); font-size: 13px; }
dl.details dd { margin: 0; }

/* ===== ציר זמן היסטוריה ===== */
.history-form .grid2 { margin: 6px 0; }
ol.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.tl-item { border-inline-start: 3px solid var(--brand); padding: 8px 12px; margin-bottom: 10px; background: #f8fafc; border-radius: 0 8px 8px 0; }
.tl-item.tl-status { border-inline-start-color: #9ca3af; }
.tl-meta { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.tl-tech { font-weight: 600; color: var(--ink); }
.tl-action { margin-top: 4px; white-space: pre-wrap; }
.tl-extra { margin-top: 3px; font-size: 13px; color: var(--muted); }

/* ===== כניסה ===== */
.login-wrap { min-height: 70vh; display: flex; align-items: center; justify-content: center; }
.login-card { width: 100%; max-width: 360px; text-align: center; }
.login-card h1 { margin: 0 0 4px; font-size: 22px; }
.login-card form { margin-top: 14px; text-align: start; display: grid; gap: 12px; }

/* ===== שונות ===== */
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: "Consolas", "Courier New", monospace; direction: ltr; unicode-bidi: plaintext; }
.empty { text-align: center; padding: 40px; color: var(--muted); }
.empty .btn { margin-top: 10px; }

/* ===== תג זמן עבודה ===== */
.time-badge { background:#eef6ff; color:#1857c0; border:1px solid #d4e6ff; padding:4px 12px; border-radius:999px; font-size:13px; }
.time-badge strong { font-weight:700; }

/* ===== שעון עצר ברישום טיפול ===== */
.timer-row { display:flex; gap:8px; align-items:center; margin: 4px 0 12px; }
.timer-row input[type=number] { width:90px; }
.timer-display { background:#111827; color:#fff; padding:5px 12px; border-radius:8px; font-size:15px; min-width:62px; text-align:center; }
#timerToggle.running { background:#fee2e2; color:#b42318; border-color:#fca5a5; }

/* ===== חלקי חילוף ===== */
.part-row { display:grid; grid-template-columns: 1fr 90px; gap:12px; }
.part-form { margin-bottom: 14px; }
.part-form button { margin-top: 8px; }
.parts-table { width:100%; border-collapse:collapse; margin-top:6px; }
.parts-table th, .parts-table td { padding:7px 8px; border-bottom:1px solid var(--line); text-align:start; font-size:13px; vertical-align:top; }
.parts-table th { color:var(--muted); font-weight:600; background:#f8fafc; }
.parts-table tr.cancelled td { color:#9ca3af; text-decoration:line-through; }
.parts-table tr.cancelled td:last-child { text-decoration:none; }
.parts-table form { display:inline; }

/* ===== ניהול טכנאים ===== */
.check { display:flex; align-items:center; gap:8px; }
.check input { width:auto; }
.tech-actions { display:flex; flex-direction:column; gap:6px; align-items:flex-start; }
.tech-actions form { display:flex; gap:6px; align-items:center; }
.reset-form input { width:130px; padding:5px 8px; }
table.tickets tr.cancelled td { color:#9ca3af; }

/* ===== רספונסיבי — טלפון נייד ===== */
@media (max-width: 760px) {
  .cols { grid-template-columns: 1fr; }
  .grid { grid-template-columns: 1fr; }
  .topbar { gap: 10px; padding: 10px 12px; }
  .topbar nav { width: 100%; order: 3; }
  .topbar .user { margin-inline-start: 0; }
  .container { padding: 12px; }
  table.tickets th:nth-child(4), table.tickets td:nth-child(4) { display: none; }
}
