/* Standpoint Agri — design tokens: Standpoint system, veld-green sector accent */
:root {
  --ink: #13202f;
  --veld: #4d7c43;
  --veld-deep: #3d6335;
  --paper: #fdfcfa;
  --paper-2: #f6f4ef;
  --line: #e8e4db;
  --red: #b23b3b;
  --amber: #b8863a;
  --ink-soft: #4a5568;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(19,32,47,0.06), 0 4px 16px rgba(19,32,47,0.05);
  --font-display: "Schibsted Grotesk", ui-sans-serif, system-ui, sans-serif;
  --font-body: "Hanken Grotesk", ui-sans-serif, system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--paper-2);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, .brand-word { font-family: var(--font-display); font-weight: 600; letter-spacing: -0.01em; }
a { color: var(--veld-deep); }
button, input, select, textarea { font-family: inherit; font-size: inherit; }

/* ---------- App shell ---------- */
#app-shell { display: flex; min-height: 100vh; }
#sidebar {
  width: 232px; flex-shrink: 0; background: var(--ink); color: #eef1f4;
  display: flex; flex-direction: column; padding: 18px 12px;
}
#sidebar .brand { display: flex; align-items: center; gap: 8px; padding: 8px 10px 20px; }
#sidebar .brand .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--veld); }
#sidebar .brand-word { color: #fff; font-size: 17px; }
#sidebar .brand-sub { color: #9aa7b4; font-size: 11px; margin-top: -4px; padding-left: 10px; }
#nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; }
#nav a {
  display: flex; align-items: center; gap: 10px; color: #c7d0d8; text-decoration: none;
  padding: 9px 10px; border-radius: 8px; font-size: 13.5px;
}
#nav a:hover { background: rgba(255,255,255,0.06); color: #fff; }
#nav a.active { background: var(--veld); color: #fff; }
#nav .nav-hero { border: 1px solid rgba(77,124,67,0.55); }
#nav .section-label { color: #6b7783; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em; padding: 14px 10px 4px; }

#main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
#topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 24px; background: var(--paper); border-bottom: 1px solid var(--line);
}
#topbar .farm-name { font-family: var(--font-display); font-weight: 600; font-size: 15px; }
#topbar .farm-sub { color: var(--ink-soft); font-size: 12px; }
#content { flex: 1; padding: 24px; max-width: 1180px; width: 100%; margin: 0 auto; }

/* ---------- Primitives ---------- */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.card + .card { margin-top: 14px; }
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-5 { grid-template-columns: repeat(5, 1fr); }
@media (max-width: 980px) { .grid-3, .grid-5 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .grid-2, .grid-3, .grid-5 { grid-template-columns: 1fr; } }

.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 4px 0 12px; }
.section-head h2 { margin: 0; font-size: 17px; }
.muted { color: var(--ink-soft); }
.small { font-size: 12.5px; }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
th { color: var(--ink-soft); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.04em; }
tr:last-child td { border-bottom: none; }
.table-wrap { overflow-x: auto; }

.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; }
.pill-held, .pill-compliant, .pill-cleared, .pill-eligible { background: #e7f0e4; color: var(--veld-deep); }
.pill-outstanding, .pill-not-cleared, .pill-overdue, .pill-red { background: #fbe9e9; color: var(--red); }
.pill-due-soon, .pill-amber, .pill-possible { background: #f8f0dc; color: var(--amber); }
.pill-info, .pill-neutral { background: var(--paper-2); color: var(--ink-soft); border: 1px solid var(--line); }
.pill-draft { background: #eef1f4; color: var(--ink-soft); border: 1px dashed #b7c0c9; }

.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); border-radius: 8px; padding: 8px 14px; font-size: 13.5px; cursor: pointer; }
.btn:hover { border-color: var(--veld); }
.btn-primary { background: var(--veld); border-color: var(--veld); color: #fff; }
.btn-primary:hover { background: var(--veld-deep); }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

input[type=text], input[type=date], input[type=number], input[type=password], input[type=tel], select, textarea {
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: var(--paper); color: var(--ink); width: 100%;
}
label { font-size: 12.5px; color: var(--ink-soft); display: block; margin-bottom: 4px; }
.field { margin-bottom: 12px; }

.ring-wrap { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.ring-label { font-size: 12px; text-align: center; color: var(--ink-soft); }
.ring-value { font-family: var(--font-display); font-size: 15px; font-weight: 700; }

.empty-state { text-align: center; padding: 28px 16px; color: var(--ink-soft); }
.banner { border-radius: 8px; padding: 10px 14px; font-size: 13px; }
.banner-draft { background: #fff7e6; border: 1px solid #eacf8f; color: #6b5211; }
.banner-outstanding { background: #fbe9e9; border: 1px solid #edb9b9; color: #7a2323; }

/* ---------- Auth gate ---------- */
#auth-gate { position: fixed; inset: 0; background: var(--ink); display: flex; align-items: center; justify-content: center; z-index: 100; }
#auth-gate[hidden] { display: none; }
#auth-gate .box { background: var(--paper); border-radius: 14px; padding: 32px 30px; width: 320px; box-shadow: 0 20px 60px rgba(0,0,0,0.35); }
#auth-gate .brand { display:flex; align-items:center; gap:8px; margin-bottom: 4px; }
#auth-gate .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--veld); }
#auth-gate p.tag { color: var(--ink-soft); font-size: 12.5px; margin: 0 0 18px; }
#auth-gate .err { color: var(--red); font-size: 12.5px; min-height: 16px; margin-top: 4px; }
#auth-gate .demo-tap { width: 100%; justify-content: center; margin-bottom: 16px; }
#auth-gate .divider { display: flex; align-items: center; gap: 10px; margin: 4px 0 16px; color: var(--ink-soft); font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; }
#auth-gate .divider::before, #auth-gate .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
#auth-gate .creds-hint { color: var(--ink-soft); font-size: 12px; margin-top: 14px; text-align: center; }
#auth-gate .creds-hint b { color: var(--ink); font-weight: 600; }

/* ---------- Emergency button ---------- */
#knoppie-btn {
  position: fixed; right: 20px; bottom: 20px; width: 58px; height: 58px; border-radius: 50%;
  background: var(--red); color: #fff; border: none; box-shadow: 0 6px 20px rgba(178,59,59,0.5);
  font-size: 22px; cursor: pointer; z-index: 40;
}
#knoppie-modal, #knoppie-modal .backdrop { position: fixed; inset: 0; z-index: 90; }
#knoppie-modal .backdrop { background: rgba(19,32,47,0.55); }
#knoppie-modal .box { position: relative; z-index: 91; max-width: 380px; margin: 12vh auto 0; background: var(--paper); border-radius: 14px; padding: 22px; }
.slider-track { background: var(--paper-2); border-radius: 999px; height: 46px; position: relative; margin-top: 14px; border: 1px solid var(--line); }
.slider-thumb { position: absolute; left: 3px; top: 3px; width: 40px; height: 40px; border-radius: 50%; background: var(--red); color: #fff; display:flex; align-items:center; justify-content:center; cursor: grab; }
.slider-label { position: absolute; inset: 0; display:flex; align-items:center; justify-content:center; color: var(--ink-soft); font-size: 12.5px; pointer-events:none; }

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  #sidebar { position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-100%); transition: transform 0.2s; z-index: 60; }
  #sidebar.open { transform: translateX(0); }
  #menu-btn { display: inline-flex; }
  #content { padding: 16px; }
}
#menu-btn { display: none; border: none; background: none; font-size: 20px; cursor: pointer; color: var(--ink); }

.chip-row { display: flex; gap: 8px; flex-wrap: wrap; }
.stat-tile { display: flex; flex-direction: column; gap: 2px; }
.stat-tile .num { font-family: var(--font-display); font-size: 26px; font-weight: 700; }
.stat-tile .label { color: var(--ink-soft); font-size: 12px; }

.list-row { display: flex; align-items: center; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--line); gap: 10px; }
.list-row:last-child { border-bottom: none; }
.clickable { cursor: pointer; }
.clickable:hover { background: var(--paper-2); }

.badge-concept { background: var(--ink); color: #fff; font-size: 10.5px; padding: 2px 8px; border-radius: 999px; letter-spacing: 0.05em; }

/* ---------- F3 compliance calendar: tabs + month grid ---------- */
.tab-btn.active { background: var(--veld); border-color: var(--veld); color: #fff; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-top: 8px; }
.cal-dow-row { margin-top: 0; }
.cal-dow { text-align: center; font-size: 11px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.04em; padding: 4px 0; }
.cal-cell { min-height: 62px; border: 1px solid var(--line); border-radius: 8px; padding: 5px; background: var(--paper); }
.cal-cell-empty { border-color: transparent; background: transparent; }
.cal-cell-today { border-color: var(--veld); }
.cal-cell-selected { background: var(--paper-2); border-color: var(--ink); }
.cal-daynum { font-size: 12px; font-weight: 600; }
.cal-dots { display: flex; align-items: center; gap: 3px; flex-wrap: wrap; margin-top: 4px; }
.cal-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.cal-dot-overdue { background: var(--red); }
.cal-dot-due_soon { background: var(--amber); }
.cal-dot-ok { background: var(--veld); }
@media (max-width: 620px) { .cal-cell { min-height: 46px; } }
