/* ipso — mobile-portrait first, no media queries needed for the operator's
   phone. Big touch targets (>= 48 dp = 48 px CSS), high contrast, dark green
   accent matching abies. Flat, no shadows, no gradients. */

:root {
  --green-dark:  #1f5b1a;
  --green:       #2e8b27;
  --green-light: #d6e8d4;
  --red:         #c52727;
  --yellow:      #d6a02a;
  --grey-1:      #222;
  --grey-2:      #555;
  --grey-3:      #888;
  --grey-4:      #ddd;
  --grey-5:      #f4f4f4;
  --bg:          #ffffff;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--grey-1);
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 18px;
  line-height: 1.3;
}

/* Lock to portrait visually even if the OS doesn't honour the manifest. */
body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ----------------------------------------------------------------------- */
/* App bar / header                                                        */
/* ----------------------------------------------------------------------- */

.app-bar {
  background: var(--green-dark);
  color: white;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.app-title { font-weight: 600; font-size: 18px; letter-spacing: 0.5px; }
.app-sub   { font-size: 13px; opacity: 0.85; }
.app-logo  {
  margin-left: auto;     /* push to far right */
  height: 28px;
  width: 28px;           /* explicit so the box is reserved even pre-load */
  display: block;
  object-fit: contain;
}

/* ----------------------------------------------------------------------- */
/* Main + screen layout                                                    */
/* ----------------------------------------------------------------------- */

main {
  flex: 1;
  padding: 12px;
  display: flex;
  flex-direction: column;
}

.screen { display: flex; flex-direction: column; gap: 12px; flex: 1; }

/* Forms inside a screen don't get the screen's gap because their children
   are nested one level deeper. Restore the same 12 px rhythm on the form
   itself so e.g. pre-session field-to-field and Particella → Inizia
   spacing matches the recording screen. */
.screen form { display: flex; flex-direction: column; gap: 12px; }

h1 { font-size: 22px; margin: 6px 0 8px 0; }

/* ----------------------------------------------------------------------- */
/* Inputs and labels                                                       */
/* ----------------------------------------------------------------------- */

.field { display: flex; flex-direction: column; gap: 4px; }
.lbl { font-size: 13px; color: var(--grey-2); }

/* Checkbox row: big touch target, label flush left of the box. */
.check {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 4px;
  cursor: pointer;
}
.check input[type="checkbox"] {
  width: 24px;
  height: 24px;
  margin: 0;
  accent-color: var(--green);
  -webkit-appearance: auto;
  appearance: auto;
}
.check-lbl {
  font-size: 17px;
  color: var(--grey-1);
}

input[type="text"], input[type="date"], select {
  width: 100%;
  height: 48px;
  padding: 0 12px;
  font-size: 20px;
  border: 1px solid var(--grey-4);
  border-radius: 4px;
  background: white;
  color: var(--grey-1);
  -webkit-appearance: none;
  appearance: none;
}

select.big-select {
  height: 56px;
  font-size: 24px;
  font-weight: 500;
}

input.focus, input:focus, select:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 2px var(--green-light);
}

/* D and h side by side */
.dh-row { display: flex; gap: 10px; }
.dh-row .field.dh { flex: 1; }
.dh-row input {
  height: 64px;
  font-size: 32px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.hint {
  font-size: 13px;
  color: var(--grey-2);
  background: var(--grey-5);
  padding: 6px 10px;
  border-radius: 4px;
}

/* ----------------------------------------------------------------------- */
/* Buttons                                                                 */
/* ----------------------------------------------------------------------- */

button {
  font-family: inherit;
  font-size: 18px;
  cursor: pointer;
  border-radius: 4px;
  border: 0;
  padding: 12px 18px;
}

.btn-primary {
  background: var(--green);
  color: white;
}
.btn-primary:disabled {
  background: var(--grey-4);
  color: var(--grey-3);
  cursor: not-allowed;
}
.btn-primary:not(:disabled):active { background: var(--green-dark); }

.btn-secondary {
  background: white;
  color: var(--grey-2);
  border: 1px solid var(--grey-4);
}
.btn-secondary:active { background: var(--grey-5); }

.btn-danger {
  background: var(--red);
  color: white;
}

.btn-big {
  height: 64px;
  font-size: 22px;
  font-weight: 600;
  width: 100%;
}

/* ----------------------------------------------------------------------- */
/* Recording — header (GPS + parcel)                                       */
/* ----------------------------------------------------------------------- */

.rec-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--grey-2);
  border-bottom: 1px solid var(--grey-4);
  padding-bottom: 6px;
}
.rec-where {
  font-weight: 600;
  color: var(--green-dark);
}

.gps { display: flex; align-items: center; gap: 6px; font-family: ui-monospace, Menlo, Consolas, monospace; }
.gps-text { white-space: nowrap; }
.gps-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--red);
  display: inline-block;
}
.gps-dot.green  { background: var(--green); }
.gps-dot.yellow { background: var(--yellow); }
.gps-dot.red    { background: var(--red); }

/* ----------------------------------------------------------------------- */
/* "Ultimo" pill                                                            */
/* ----------------------------------------------------------------------- */

.pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  font-size: 14px;
  background: var(--grey-5);
  border: 1px solid var(--grey-4);
  border-radius: 24px;
  color: var(--grey-2);
}
.pill-text { flex: 1; }
.pill-btn {
  background: transparent;
  border: 1px solid var(--grey-4);
  padding: 4px 10px;
  font-size: 13px;
  color: var(--grey-2);
  border-radius: 14px;
}

/* ----------------------------------------------------------------------- */
/* Numpad                                                                  */
/* ----------------------------------------------------------------------- */

.numpad { width: 100%; }
.np-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.np-key {
  height: 60px;
  font-size: 26px;
  background: white;
  border: 1px solid var(--grey-4);
  color: var(--grey-1);
}
.np-key:active { background: var(--grey-5); }
.np-key.np-back  { background: var(--grey-5); }
.np-key.np-clear { background: var(--grey-5); color: var(--grey-2); font-size: 22px; }

/* ----------------------------------------------------------------------- */
/* Banners and toasts                                                      */
/* ----------------------------------------------------------------------- */

.banner {
  background: #fff3cd;
  color: #8a6d3b;
  padding: 8px 12px;
  font-size: 14px;
  border-bottom: 1px solid #f0e0a8;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.85);
  color: white;
  padding: 10px 16px;
  border-radius: 24px;
  font-size: 14px;
  z-index: 100;
}

/* ----------------------------------------------------------------------- */
/* Modals                                                                  */
/* ----------------------------------------------------------------------- */

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 16px;
}
.modal-card {
  background: white;
  border: 1px solid var(--green-dark);
  border-radius: 6px;
  padding: 16px;
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.modal-card h2 { margin: 0; font-size: 18px; color: var(--green-dark); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

#resume-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.resume-item {
  border: 1px solid var(--grey-4);
  border-radius: 4px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.resume-meta { font-size: 13px; color: var(--grey-2); }
.resume-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.resume-actions button { flex: 1; font-size: 14px; padding: 8px 6px; }

/* ----------------------------------------------------------------------- */
/* Misc                                                                    */
/* ----------------------------------------------------------------------- */

.footer {
  font-size: 11px;
  color: var(--grey-3);
  text-align: center;
  padding: 6px;
}

.hidden { display: none !important; }

[hidden] { display: none !important; }
