/* Herne screens — adapted from app/ios.css (the demo stylesheet, removed in
   6a-ii). Kept: the iOS-style tokens, nav, cards, form controls, buttons,
   grouped table, messages, badges, switch. Dropped: map toolbars, account
   gear menu, bottom sheets, segmented control, toggle buttons, filter chips —
   none of the 6a pages use them. Classes only: the CSP forbids inline style. */

:root {
  --ios-blue: #007AFF;
  --ios-blue-tap: #0051D5;
  --ios-gray-bg: #f2f2f7;
  --ios-gray-group: #e5e5ea;
  --ios-separator: rgba(60, 60, 67, 0.12);
  --ios-label: rgba(60, 60, 67, 0.6);
  --ios-red: #ff3b30;
  --ios-green: #34c759;
  --ios-orange: #ff9500;
  --ios-indigo: #5856d6;
  --ios-radius: 12px;
  --ios-radius-sm: 10px;
  --ios-shadow-card: 0 2px 12px rgba(0, 0, 0, 0.08);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", sans-serif;
  margin: 0;
  background: var(--ios-gray-bg);
  color: #1c1c1e;
  -webkit-font-smoothing: antialiased;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  min-height: 100vh;
}

/* ── Nav ── */
.ios-nav {
  background: rgba(242, 242, 247, 0.92);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--ios-separator);
  padding: max(12px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 12px max(16px, env(safe-area-inset-left));
}

.ios-nav-inner { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }

.ios-title { font-size: 28px; font-weight: 700; letter-spacing: -0.5px; margin: 0; }

.ios-nav-links { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }

.ios-nav-links a,
.ios-nav-links button {
  color: var(--ios-blue);
  background: none;
  border: none;
  font: inherit;
  text-decoration: none;
  font-size: 17px;
  padding: 8px 12px;
  border-radius: var(--ios-radius-sm);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.ios-nav-links a:active,
.ios-nav-links button:active { background: var(--ios-gray-group); }

.ios-nav-links a[aria-current="page"] { font-weight: 600; }

.ios-nav-links .logout { color: var(--ios-red); }

/* Signed-in identity strip (AD-088): email · organisation · role hint */
.ios-identity {
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px;
  margin-top: 6px; font-size: 13px; color: #3c3c43;
  overflow-wrap: anywhere; min-width: 0;
}
.ios-identity-who { font-weight: 600; }
.ios-identity-sep { color: var(--ios-label); }
.ios-identity-switch {
  background: none; border: none; font: inherit; color: var(--ios-blue);
  padding: 2px 4px; cursor: pointer;
}
.ios-readonly { margin: 4px 0 0; font-size: 17px; overflow-wrap: anywhere; }

/* ── Content ── */
.ios-content {
  padding: 16px;
  max-width: 900px;
  margin: 0 auto;
  padding-bottom: max(16px, env(safe-area-inset-bottom));
}

.ios-content-narrow { max-width: 420px; padding-top: 48px; }

.ios-group { margin-bottom: 24px; }

.ios-group-title {
  font-size: 13px; font-weight: 400; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--ios-label); padding: 8px 16px 6px; margin: 0;
}

.ios-card {
  background: #fff;
  border-radius: var(--ios-radius);
  box-shadow: var(--ios-shadow-card);
  overflow: hidden;
  margin-bottom: 16px;
}

.ios-card-section { padding: 16px; border-bottom: 1px solid var(--ios-separator); }

.ios-card-section:last-child { border-bottom: none; }

.ios-card h2, .ios-card h3 { margin: 0 0 12px; font-size: 17px; font-weight: 600; }

.brand { text-align: center; margin-bottom: 24px; }

.brand-mark { width: 56px; height: 56px; }

/* ── Forms ── */
.ios-field { margin-bottom: 12px; }

.ios-label { display: block; font-size: 13px; color: var(--ios-label); margin-bottom: 4px; }

.ios-input, .ios-select, .ios-textarea {
  width: 100%;
  padding: 12px 14px;
  font-size: 17px;
  font-family: inherit;
  border: none;
  border-radius: var(--ios-radius-sm);
  background: var(--ios-gray-bg);
  -webkit-appearance: none;
  appearance: none;
  color: inherit;
}

.ios-textarea { min-height: 88px; resize: vertical; }

.ios-input:focus, .ios-select:focus, .ios-textarea:focus {
  outline: none;
  box-shadow: 0 0 0 2px var(--ios-blue);
}

.ios-input::placeholder, .ios-textarea::placeholder { color: var(--ios-label); }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 12px; }

.form-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }

.location-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }

.hint { font-size: 13px; color: var(--ios-label); margin: 4px 0 12px; }

/* ── Buttons ── */
.ios-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 20px;
  font-size: 17px;
  font-weight: 600;
  font-family: inherit;
  border: none;
  border-radius: var(--ios-radius-sm);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.15s, background 0.15s;
}

.ios-btn:active { opacity: 0.85; }

.ios-btn:disabled { opacity: 0.5; cursor: default; }

.ios-btn-primary { background: var(--ios-blue); color: #fff; }

.ios-btn-primary:active { background: var(--ios-blue-tap); }

.ios-btn-secondary { background: var(--ios-gray-group); color: var(--ios-blue); }

.ios-btn-danger { background: var(--ios-red); color: #fff; }

.ios-btn-sm { padding: 6px 12px; font-size: 14px; }

.ios-btn-block { width: 100%; }

.org-list { display: flex; flex-direction: column; gap: 8px; }

/* ── Table ── */
.table-wrap { overflow-x: auto; }

/* Cull map (AD-068). Leaflet sets inline geometry via the CSSOM; size comes from here. */
.map { width: 100%; height: 320px; margin-bottom: 12px; border-radius: 12px; overflow: hidden; }

.ios-table { width: 100%; border-collapse: collapse; font-size: 15px; }

.ios-table th, .ios-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--ios-separator);
  vertical-align: middle;
}

.ios-table th {
  font-weight: 600;
  color: var(--ios-label);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.ios-table tr:last-child td { border-bottom: none; }

.ios-table tbody tr { background: #fff; }

.ios-table td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }

.row-actions { display: flex; gap: 6px; white-space: nowrap; }

/* Inline carcass editor (AD-071): compact controls inside one table cell. */
.carcass-editor .ios-input, .carcass-editor .ios-select { width: auto; max-width: 8.5rem; margin: 2px 4px 2px 0; display: inline-block; }

/* Inline editors on the admin screens (8c): rename, lease edit, reason forms. */
.inline-editor .ios-input, .inline-editor .ios-select { width: auto; max-width: 12rem; margin: 2px 4px 2px 0; display: inline-block; }

/* The lease form's requiresCullApproval radio pair (AD-019: no default). */
.radio-row { border: none; padding: 0; margin: 0 0 12px; }

.radio-row label { display: block; padding: 6px 0; font-size: 17px; }

.empty { color: var(--ios-label); padding: 16px; text-align: center; }

/* ── Messages ── */
.ios-message { font-size: 14px; margin: 8px 0 0; min-height: 1em; }

.ios-message.error { color: var(--ios-red); }

.ios-message.success { color: var(--ios-green); }

.ios-message.info { color: var(--ios-label); }

/* ── Badges ── */
.ios-badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--ios-blue);
  color: #fff;
  margin-right: 4px;
  white-space: nowrap;
}

.ios-badge.status-pending { background: var(--ios-orange); }

.ios-badge.status-approved { background: var(--ios-green); }

.ios-badge.status-rejected { background: var(--ios-red); }

.ios-badge.out-of-season { background: var(--ios-red); }

.ios-badge.night { background: var(--ios-indigo); }

/* ── Switch ── */
.ios-switch-wrap { display: flex; align-items: center; gap: 8px; cursor: pointer; margin-bottom: 12px; }

.ios-switch-wrap input[type="checkbox"] { width: 22px; height: 22px; accent-color: var(--ios-green); cursor: pointer; }
