/* העיצוב מועתק מ-prototype.html: אותם צבעים, מרווחים, פינות וגדלים. */
:root {
  --outer: #021F1A;
  --bg: #04342C;
  --card: #085041;
  --line: #0F6E56;
  --line2: #1D9E75;
  --accent: #5DCAA5;
  --text: #E1F5EE;
  --text2: #9FE1CB;
  --error: #F09595;
  --serif: Georgia, 'Times New Roman', serif;
  color-scheme: dark;
}

html, body {
  margin: 0;
  background: var(--outer);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

#wrap {
  max-width: 420px;
  margin: 0 auto;
  padding: 12px;
  padding-top: max(12px, env(safe-area-inset-top));
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  padding-left: max(12px, env(safe-area-inset-left));
  padding-right: max(12px, env(safe-area-inset-right));
  box-sizing: border-box;
}

#app {
  background: var(--bg);
  color: var(--text);
  border-radius: 16px;
  padding: 18px;
  font-size: 14px;
  min-height: 560px;
  min-height: max(560px, calc(100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom)));
  box-sizing: border-box;
  overflow-wrap: anywhere;
}

input, select, textarea, button {
  font-family: inherit;
  font-size: 14px;
  padding: 8px 10px;
  box-sizing: border-box;
  margin: 0;
}

/* --- שדות --- */
.field {
  background: var(--card) !important;
  color: var(--text) !important;
  border: 0.5px solid var(--line2) !important;
  border-radius: 8px;
  color-scheme: dark;
  width: 100%;
  font-size: 16px; /* 16px ומעלה: מונע זום אוטומטי באייפון בזמן הקלדה */
  min-height: 40px;
  -webkit-appearance: none;
  appearance: none;
}
.field::placeholder { color: var(--text2); opacity: .75; }
.field:focus { outline: 2px solid var(--accent); outline-offset: 0; }
select.field {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239FE1CB' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6l6 -6'/%3E%3C/svg%3E") !important;
  background-position: 8px 50% !important;
  background-size: 16px 16px !important;
  background-repeat: no-repeat !important;
  padding-left: 30px;
}
textarea.field { resize: vertical; line-height: 1.45; }
input[type="date"].field { text-align: right; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace !important; font-size: 12px !important; direction: ltr; text-align: left; }
.mb10 { margin-bottom: 10px; }
.mb16 { margin-bottom: 16px; }

.fl { display: block; min-width: 0; }
.fl > span { display: block; font-size: 11px; color: var(--text2); margin: 0 2px 3px; }

/* --- כפתורים --- */
/* הכפתור הראשי: תמיד לבן עם טקסט ירוק כהה, גם במצב כהה של המכשיר */
.btn-primary {
  background: #FFFFFF !important;
  color: #04342C !important;
  border: none !important;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 500;
  font-size: 15px;
  padding: 13px;
  width: 100%;
  display: block;
}
.btn-primary:disabled { opacity: .55; cursor: default; }
.btn-primary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn {
  background: transparent !important;
  color: var(--text) !important;
  border: 0.5px solid var(--line2) !important;
  border-radius: 8px;
  cursor: pointer;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.btn:disabled { opacity: .5; cursor: default; }
.btn-sm { padding: 6px 10px; }
.btn-wide { width: 100%; padding: 12px; }
.btn-dashed { border-style: dashed !important; }

.link {
  background: transparent !important;
  color: var(--text2) !important;
  border: none !important;
  cursor: pointer;
  font-size: 12px;
  text-decoration: none;
}
.link-u { text-decoration: underline; text-underline-offset: 3px; }

.ic { width: 1.15em; height: 1.15em; flex: none; }

/* --- כללי --- */
.serif { font-family: var(--serif); color: var(--text); }
.center { text-align: center; }
.sub { font-size: 12px; color: var(--text2); }
.note { font-size: 13px; color: var(--text2); line-height: 1.6; margin-bottom: 10px; }
.msg { font-size: 13px; color: var(--text2); line-height: 1.6; min-height: 0; }
.msg:not(:empty) { margin: 10px 0; }
.msg.err { color: var(--error); }

/* --- כניסה --- */
.brand { text-align: center; margin: 30px 0 26px; }
.logo {
  width: 56px; height: 56px; border-radius: 16px; background: var(--line);
  display: flex; align-items: center; justify-content: center; margin: 0 auto 14px; color: var(--text2);
}
.logo .ic { width: 28px; height: 28px; }
.title-xl { font-size: 30px; font-weight: 500; }
.brand .sub { margin-top: 6px; font-size: 13px; }

.code {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  direction: ltr;
  text-align: center;
  font-size: 24px;
  letter-spacing: 2px;
  background: var(--card);
  border: 0.5px solid var(--line2);
  border-radius: 12px;
  padding: 16px 8px;
  margin: 14px 0 10px;
  user-select: all;
  -webkit-user-select: all;
}
.check { display: flex; align-items: center; gap: 10px; margin: 16px 0; font-size: 15px; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--accent); }

/* --- בית --- */
.top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 14px; gap: 8px; }
.title-lg { font-size: 26px; font-weight: 500; line-height: 1.2; }
.top-btns { display: flex; gap: 6px; flex: none; }
.progress { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.bar { flex: 1; height: 6px; border-radius: 3px; background: var(--card); overflow: hidden; }
.bar > div { height: 100%; width: 0; background: var(--accent); }

.tcard {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: right;
  background: var(--card); color: var(--text); border: 0.5px solid var(--line);
  border-radius: 14px; padding: 12px 14px; margin-bottom: 10px; cursor: pointer; font-size: 14px;
}
.tcard:focus-visible { outline: 2px solid var(--accent); }
.tnum { font-family: var(--serif); font-size: 34px; line-height: 1; min-width: 34px; text-align: center; color: var(--accent); }
.tbody { flex: 1; min-width: 0; }
.ttitle { font-weight: 500; }
.tmeta { font-size: 12px; color: var(--text2); margin-top: 2px; }
.badge { font-size: 12px; padding: 3px 10px; border-radius: 20px; flex: none; white-space: nowrap; }
.s0 { background: #0F6E56 !important; color: #9FE1CB !important; }
.s1 { background: #854F0B !important; color: #FAEEDA !important; }
.s2 { background: #5DCAA5 !important; color: #04342C !important; }

/* --- כותרת עם חזרה --- */
.hdr { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.hdr .btn { padding: 4px 10px; min-height: 32px; }
.title-md { font-size: 24px; font-weight: 500; }

/* --- עמוד אימון --- */
.status-row { display: flex; gap: 6px; margin-bottom: 14px; }
.status-row .btn { flex: 1; padding: 8px 0; }
.status-row .btn.on { border-color: transparent !important; }
.panel { background: var(--card); border: 0.5px solid var(--line); border-radius: 14px; padding: 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.counters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0 10px; }
.counter { background: var(--bg); border-radius: 12px; padding: 10px; text-align: center; }
.counter .row { display: flex; justify-content: center; align-items: center; gap: 14px; margin-top: 4px; }
.counter .btn { padding: 2px 10px; min-width: 36px; min-height: 32px; font-size: 18px; }
.counter .val { font-family: var(--serif); font-size: 26px; min-width: 28px; }
.slots { font-size: 13px; color: var(--text2); margin-bottom: 10px; }
.slots b { color: var(--text); font-weight: 500; }
.mt14 { margin-top: 14px; }

/* --- ייצוא ועדכון --- */
.stack > * + * { margin-top: 10px; }
.filepick { position: relative; overflow: hidden; }
.filepick input { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }
details summary { cursor: pointer; color: var(--text2); font-size: 13px; padding: 4px 0; }
details[open] summary { margin-bottom: 8px; }
.section-title { font-family: var(--serif); font-size: 18px; margin: 26px 0 8px; }
.backup { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 0; border-top: 0.5px solid var(--line); font-size: 13px; }
.row2 { display: flex; gap: 8px; }
.row2 > * { flex: 1; }

[hidden] { display: none !important; }

/* מחלקות עזר (במקום style בתוך התגיות, שנחסם ע"י מדיניות האבטחה) */
h1 { margin: 0; }
.brand-tight { margin-bottom: 18px; }
.foot { margin-top: 14px; line-height: 1.6; }
.codein { font-size: 16px !important; letter-spacing: 1px; }
.ttitle, .tmeta { display: block; }
.mb8 { margin-bottom: 8px; }
.m0 { margin: 0; }
.bnote { margin: 0 0 6px; line-height: 1.5; }
