/* ============================================================
   מערכת הצעות מחיר — גיליון סגנון ראשי (RTL)
   ============================================================ */

:root{
  --ink:        #14202e;
  --ink-soft:   #4a5768;
  --muted:      #77839553;
  --paper:      #eceff4;
  --card:       #ffffff;
  --line:       #d5dce6;
  --line-soft:  #e7ecf2;
  --accent:     #0f6e5c;
  --accent-ink: #0a4b3f;
  --accent-bg:  #e3f0ec;
  --amber:      #9a5c06;
  --amber-bg:   #fbefdc;
  --red:        #9c2b2b;
  --red-bg:     #f9e5e5;
  --blue:       #1d4d8f;
  --blue-bg:    #e4ecf8;
  --radius:     6px;
  --rail-w:     232px;
}

*{ box-sizing:border-box; }

html,body{ margin:0; padding:0; }

body{
  background:var(--paper);
  color:var(--ink);
  font-family:'Assistant', 'Segoe UI', Arial, sans-serif;
  font-size:15px;
  line-height:1.55;
  -webkit-font-smoothing:antialiased;
}

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

:focus-visible{ outline:2px solid var(--accent); outline-offset:2px; }

/* ---------------- מבנה ---------------- */

.shell{ display:flex; min-height:100vh; }

.rail{
  width:var(--rail-w); flex:0 0 var(--rail-w);
  background:var(--ink); color:#c9d3e0;
  display:flex; flex-direction:column;
  position:sticky; top:0; height:100vh;
}
.rail-brand{ padding:22px 20px 18px; border-bottom:1px solid #24344a; }
.rail-brand-name{ display:block; font-weight:700; font-size:17px; color:#fff; }
.rail-brand-id{ display:block; font-size:12.5px; color:#8395ab; margin-top:2px; }

.rail-nav{ padding:12px 0; flex:1; }
.rail-link{
  display:block; padding:9px 20px; color:#c9d3e0; font-size:15px;
  border-right:3px solid transparent;
}
.rail-link:hover{ background:#1c2c3f; color:#fff; text-decoration:none; }
.rail-link.is-current{ background:#1c2c3f; color:#fff; border-right-color:#3fb59a; font-weight:600; }

.rail-foot{ padding:14px 20px; border-top:1px solid #24344a; font-size:13.5px; }
.rail-user{ color:#9fb0c4; }
.rail-logout{ color:#7fcbb8; }

.main{ flex:1; padding:26px 30px 60px; max-width:1180px; }

/* ---------------- כותרת עמוד ---------------- */

.page-head{
  display:flex; align-items:flex-end; justify-content:space-between;
  gap:16px; margin-bottom:20px; padding-bottom:14px;
  border-bottom:1px solid var(--line);
}
.page-title{ font-size:25px; margin:0; font-weight:700; letter-spacing:-.01em; }
.page-sub{ margin:3px 0 0; color:var(--ink-soft); font-size:14px; }
.page-actions{ display:flex; gap:8px; flex-shrink:0; }

/* ---------------- כרטיסים ---------------- */

.card{ background:var(--card); border:1px solid var(--line); border-radius:var(--radius); }
.card + .card{ margin-top:18px; }
.card-head{ padding:13px 18px; border-bottom:1px solid var(--line-soft); font-weight:600; }
.card-body{ padding:18px; }

.grid{ display:grid; gap:18px; }
.grid-4{ grid-template-columns:repeat(4,1fr); }
.grid-3{ grid-template-columns:repeat(3,1fr); }
.grid-2{ grid-template-columns:repeat(2,1fr); }

/* לוח מחוונים */
.stat{ background:var(--card); border:1px solid var(--line); border-radius:var(--radius); padding:16px 18px; }
.stat-val{ font-size:27px; font-weight:700; font-variant-numeric:tabular-nums; line-height:1.2; }
.stat-lbl{ color:var(--ink-soft); font-size:14px; margin-top:2px; }
.stat--accent .stat-val{ color:var(--accent); }

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

.table{ width:100%; border-collapse:collapse; background:var(--card); }
.table th{
  text-align:right; font-weight:600; font-size:13.5px; color:var(--ink-soft);
  padding:10px 14px; border-bottom:1px solid var(--line); white-space:nowrap;
}
.table td{ padding:11px 14px; border-bottom:1px solid var(--line-soft); vertical-align:middle; }
.table tbody tr:last-child td{ border-bottom:none; }
.table tbody tr:hover{ background:#f7f9fc; }
.table .num{ text-align:left; font-variant-numeric:tabular-nums; white-space:nowrap; }
.table .actions{ text-align:left; white-space:nowrap; }
.table-wrap{ border:1px solid var(--line); border-radius:var(--radius); overflow:hidden; }

.empty{ padding:38px 20px; text-align:center; color:var(--ink-soft); background:var(--card); }
.empty strong{ display:block; color:var(--ink); font-size:16px; margin-bottom:4px; }

/* ---------------- תגיות סטטוס ---------------- */

.tag{ display:inline-block; padding:2px 9px; border-radius:20px; font-size:12.5px; font-weight:600; }
.tag--draft{    background:#eceff4; color:#54616f; }
.tag--sent{     background:var(--blue-bg);  color:var(--blue); }
.tag--accepted{ background:var(--accent-bg); color:var(--accent-ink); }
.tag--rejected{ background:var(--red-bg);   color:var(--red); }
.tag--expired{  background:var(--amber-bg); color:var(--amber); }

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

.field{ margin-bottom:15px; }
.field label{ display:block; font-size:13.5px; font-weight:600; margin-bottom:5px; color:var(--ink-soft); }
.field .hint{ font-size:12.5px; color:var(--ink-soft); margin-top:4px; font-weight:400; }

input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=search], select, textarea{
  width:100%; padding:8px 11px; font:inherit; color:var(--ink);
  background:#fff; border:1px solid var(--line); border-radius:5px;
}
input:focus, select:focus, textarea:focus{ border-color:var(--accent); outline:none; box-shadow:0 0 0 3px #0f6e5c1f; }
input[readonly]{ background:#f4f6f9; color:var(--ink-soft); }
textarea{ resize:vertical; min-height:78px; }
input.num, td input.num{ text-align:left; font-variant-numeric:tabular-nums; }

.row{ display:flex; gap:14px; }
.row > *{ flex:1; }

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

.btn{
  display:inline-block; padding:8px 16px; font:inherit; font-weight:600;
  border:1px solid var(--line); background:#fff; color:var(--ink);
  border-radius:5px; cursor:pointer; text-decoration:none; line-height:1.4;
}
.btn:hover{ background:#f3f6fa; text-decoration:none; }
.btn--primary{ background:var(--accent); border-color:var(--accent); color:#fff; }
.btn--primary:hover{ background:var(--accent-ink); }
.btn--danger{ color:var(--red); border-color:#e8c9c9; }
.btn--danger:hover{ background:var(--red-bg); }
.btn--sm{ padding:4px 10px; font-size:13.5px; }
.btn--link{ border:none; background:none; color:var(--accent-ink); padding:4px 6px; }

/* ---------------- הודעות ---------------- */

.note{ padding:11px 15px; border-radius:5px; margin-bottom:16px; border:1px solid; font-size:14.5px; }
.note--ok{    background:var(--accent-bg); border-color:#bcdcd3; color:var(--accent-ink); }
.note--err{   background:var(--red-bg);    border-color:#e8c9c9; color:var(--red); }
.note--info{  background:var(--blue-bg);   border-color:#c9d9ef; color:var(--blue); }

/* ---------------- כניסה / הרשמה ---------------- */

.auth{ min-height:100vh; display:flex; align-items:center; justify-content:center; padding:30px; }
.auth-box{ width:100%; max-width:430px; background:var(--card); border:1px solid var(--line); border-radius:8px; padding:30px 32px; }
.auth-box h1{ font-family:'Frank Ruhl Libre', serif; font-size:26px; margin:0 0 4px; }
.auth-box p.lead{ color:var(--ink-soft); margin:0 0 22px; }
.auth-alt{ margin-top:18px; padding-top:16px; border-top:1px solid var(--line-soft); font-size:14px; color:var(--ink-soft); }

/* ---------------- עורך הצעת מחיר ---------------- */

.items-table{ width:100%; border-collapse:collapse; }
.items-table th{ font-size:13px; color:var(--ink-soft); text-align:right; padding:8px 8px; border-bottom:1px solid var(--line); }
.items-table td{ padding:6px 8px; border-bottom:1px solid var(--line-soft); vertical-align:top; }
.items-table input, .items-table select{ padding:6px 9px; }
.items-table .col-qty{ width:88px; }
.items-table .col-price{ width:118px; }
.items-table .col-disc{ width:80px; }
.items-table .col-total{ width:118px; text-align:left; font-variant-numeric:tabular-nums; font-weight:600; padding-top:13px; }
.items-table .col-del{ width:40px; }
.items-table .desc-input{ margin-top:5px; font-size:13.5px; color:var(--ink-soft); }

.totals{ margin-right:auto; width:340px; }
.totals-row{ display:flex; justify-content:space-between; padding:7px 0; font-variant-numeric:tabular-nums; }
.totals-row + .totals-row{ border-top:1px solid var(--line-soft); }
.totals-row--grand{
  border-top:2px solid var(--ink); margin-top:4px; padding-top:11px;
  font-size:19px; font-weight:700;
}
.totals-row--vat span:first-child{ color:var(--ink-soft); }

/* ============================================================
   מסמך ההצעה — תצוגה והדפסה
   ============================================================ */

.doc-bar{
  background:var(--ink); color:#fff; padding:11px 22px;
  display:flex; justify-content:space-between; align-items:center; gap:12px;
}
.doc-bar a, .doc-bar button{ font-size:14px; }
.doc-bar .btn{ background:#22344a; border-color:#33465f; color:#fff; }
.doc-bar .btn:hover{ background:#2c4059; }
.doc-bar .btn--primary{ background:var(--accent); border-color:var(--accent); }

/* ---------------- הדפסה ---------------- */

@media print{
  body{ background:#fff; }
  .shell, .rail, .doc-bar, .no-print{ display:none !important; }
  a{ color:#000; text-decoration:none; }
}

/* ---------------- רספונסיבי ---------------- */

@media (max-width:900px){
  .shell{ flex-direction:column; }
  .rail{ width:auto; height:auto; position:static; flex:none; }
  .rail-nav{ display:flex; overflow-x:auto; padding:0; }
  .rail-link{ border-right:none; border-bottom:3px solid transparent; white-space:nowrap; }
  .rail-link.is-current{ border-right-color:transparent; border-bottom-color:#3fb59a; }
  .rail-foot{ display:flex; justify-content:space-between; }
  .main{ padding:18px 14px 40px; }
  .grid-4, .grid-3, .grid-2{ grid-template-columns:1fr 1fr; }
  .row{ flex-direction:column; gap:0; }
  .totals{ width:100%; }
  .table-wrap{ overflow-x:auto; }
}

@media (prefers-reduced-motion:reduce){
  *{ animation:none !important; transition:none !important; }
}
