:root {
  color-scheme: light;
  --ink: #27322f;
  --muted: #68736f;
  --paper: #fffdf8;
  --canvas: #fff;
  --line: #dedbd1;
  --brand: #17685c;
  --brand-dark: #0c5147;
  --accent: #eab75a;
  --danger: #a53e3e;
  --shadow: 0 18px 55px rgba(30, 54, 48, .12);
  font-family: Arial, "Noto Sans Hebrew", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--canvas); color: var(--ink); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
#app { width: min(100%, 760px); margin-inline: auto; min-height: 100vh; padding: clamp(18px, 4vw, 38px); }

.hero { padding: 12px 2px 24px; }
.eyebrow { margin: 0 0 7px; color: var(--brand); font-weight: 800; font-size: .82rem; letter-spacing: .06em; }
h1 { margin: 0; font-size: clamp(1.75rem, 5vw, 2.7rem); line-height: 1.1; }
.subtitle { margin: 10px 0 0; color: var(--muted); line-height: 1.5; }
.card, .status-card { background: var(--paper); border: 1px solid rgba(255,255,255,.8); border-radius: 24px; box-shadow: var(--shadow); }
.card { padding: clamp(20px, 5vw, 34px); }
.status-card { margin-top: 18vh; padding: 36px; text-align: center; }
.status-card h1 { margin-top: 16px; font-size: 1.45rem; }
.status-card p { color: var(--muted); }
.spinner { display: inline-block; width: 34px; height: 34px; border: 3px solid #c7d9d4; border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.field { margin-bottom: 25px; }
.field-label, label { display: block; margin-bottom: 9px; font-weight: 800; }
.hint { margin: -3px 0 12px; color: var(--muted); font-size: .9rem; }
select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 13px; background: #fff; color: var(--ink); padding: 13px 14px; outline: none; }
select:focus, textarea:focus, .upload:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(23,104,92,.13); }
textarea { min-height: 132px; resize: vertical; line-height: 1.55; }
.counter { display: block; margin-top: 6px; color: var(--muted); font-size: .8rem; text-align: end; }

.category-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(112px, 1fr)); gap: 11px; }
.category { position: relative; border: 1px solid var(--line); border-radius: 16px; background: #fff; min-height: 106px; padding: 14px 9px; color: var(--ink); }
.category:hover { border-color: #8db4aa; transform: translateY(-1px); }
.category.selected { border: 2px solid var(--brand); background: #edf7f3; }
.category-icon { display: block; margin-bottom: 9px; font-size: 1.9rem; line-height: 1; }
.category-name { display: block; font-weight: 700; overflow-wrap: anywhere; }
.empty { border: 1px dashed var(--line); border-radius: 13px; color: var(--muted); padding: 18px; text-align: center; }

.upload { display: block; border: 1px dashed #9daaa5; border-radius: 14px; padding: 17px; background: #fafbf8; }
.upload input { width: 100%; margin-top: 10px; }
.file-name { display: block; margin-top: 8px; color: var(--brand); font-size: .9rem; overflow-wrap: anywhere; }
.actions { display: flex; gap: 12px; align-items: center; margin-top: 30px; }
.primary, .secondary { border-radius: 13px; min-height: 48px; padding: 0 22px; font-weight: 800; }
.primary { flex: 1; border: 0; color: #fff; background: var(--brand); box-shadow: 0 8px 20px rgba(23,104,92,.22); }
.primary:hover { background: var(--brand-dark); }
.primary:disabled { cursor: not-allowed; opacity: .58; }
.secondary { border: 1px solid var(--line); background: #fff; color: var(--ink); }
.error-box { margin: 0 0 18px; padding: 13px 15px; border-radius: 12px; background: #fbeaea; color: var(--danger); line-height: 1.45; }
.success-mark { width: 62px; height: 62px; margin: auto; border-radius: 50%; background: #dff2e9; color: var(--brand); display: grid; place-items: center; font-size: 2rem; font-weight: 900; }
.no-script { padding: 20px; text-align: center; }

[dir="ltr"] .category-grid { direction: ltr; }
@media (max-width: 520px) {
  #app { padding: 16px; }
  .card { border-radius: 19px; }
  .actions { flex-direction: column; }
  .primary, .secondary { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
