/* ============================================================
   DAILY LOG — field UI
   Palette: rig-site industrial. Dark steel base, safety-orange
   primary action, hazard-yellow for warnings/edit states.
   ============================================================ */

:root {
  /* Deep-water navy base, echoing Seabrine's offshore/marine branding */
  --ink-0: #0A1420;      /* deepest background — deep water */
  --ink-1: #101E30;      /* panel background */
  --ink-2: #16283D;      /* raised panel / card */
  --ink-3: #22384F;      /* borders, dividers */
  --steel-1: #7E93A8;    /* secondary text — misty steel-blue */
  --paper: #ECF1F5;      /* primary text */
  --paper-dim: #C4D1DC;

  --safety: #1FADA6;     /* primary action — Seabrine teal/cyan */
  --safety-dim: #16847F;
  --hazard: #F2B705;     /* warnings / edit / in-progress — kept high-vis amber */
  --go: #3FA34D;         /* success / closed entries */
  --stop: #E1594B;       /* delete / danger */

  --radius: 3px;
  --mono: "SF Mono", "Roboto Mono", "Courier New", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--ink-0);
  color: var(--paper);
  font-family: var(--sans);
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: contain;
}
body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom);
}

button { font-family: inherit; }

/* ---------- top status bar ---------- */
#topbar {
  background: var(--ink-1);
  border-bottom: 3px solid var(--safety);
  padding: 10px 16px calc(10px + env(safe-area-inset-top));
  padding-top: max(10px, env(safe-area-inset-top));
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
#topbar .brand {
  font-weight: 800;
  letter-spacing: -0.02em;
  font-size: 17px;
}
#topbar .brand small {
  display: block;
  font-weight: 500;
  color: var(--steel-1);
  font-size: 11px;
  letter-spacing: 0.02em;
}
.brand-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
#brand-logo {
  height: 22px;
  width: auto;
  flex-shrink: 0;
}
#syncstate {
  font-size: 11px;
  color: var(--steel-1);
  font-family: var(--mono);
}

/* ---------- current-activity strip ---------- */
#current-strip {
  background: var(--ink-2);
  border-bottom: 1px solid var(--ink-3);
  padding: 14px 16px;
  display: none;
  flex-shrink: 0;
}
#current-strip.show { display: block; }
#current-strip .label {
  font-size: 11px;
  color: var(--steel-1);
  margin-bottom: 2px;
}
#current-strip .row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}
#current-strip .name {
  font-size: 20px;
  font-weight: 800;
  color: var(--hazard);
}
#current-strip .since {
  font-family: var(--mono);
  font-size: 15px;
  color: var(--paper-dim);
}

/* ---------- main scroll area ---------- */
main {
  flex: 1;
  overflow-y: auto;
  padding: 16px 16px 24px;
}
.view { display: none; }
.view.active { display: block; }

h1 {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin: 4px 0 4px;
}
.subtitle {
  color: var(--steel-1);
  font-size: 13px;
  margin: 0 0 18px;
}

/* ---------- activity grid ---------- */
#activity-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 20px;
}
.act-btn {
  background: var(--ink-2);
  border: 2px solid var(--ink-3);
  border-radius: var(--radius);
  color: var(--paper);
  font-size: 16px;
  font-weight: 700;
  padding: 20px 10px;
  min-height: 76px;
  text-align: left;
  line-height: 1.25;
  display: flex;
  align-items: flex-end;
}
.act-btn:active {
  border-color: var(--safety);
  background: var(--ink-1);
}
.act-btn.is-current {
  border-color: var(--hazard);
  background: #2A2410;
  color: var(--hazard);
}
.act-btn.manage-add {
  border-style: dashed;
  color: var(--steel-1);
  font-weight: 600;
  align-items: center;
  justify-content: center;
}

/* ---------- entries log ---------- */
#entries-list { margin-top: 6px; }
.entry-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--ink-3);
}
.entry-row .times {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--steel-1);
  width: 92px;
  flex-shrink: 0;
}
.entry-row .times .end.open { color: var(--hazard); }
.entry-row .info { flex: 1; min-width: 0; }
.entry-row .aname { font-weight: 700; font-size: 14.5px; }
.entry-row .comment { color: var(--steel-1); font-size: 12.5px; margin-top: 1px; }
.entry-row .edit-btn {
  background: none;
  border: 1px solid var(--ink-3);
  color: var(--steel-1);
  border-radius: var(--radius);
  padding: 6px 10px;
  font-size: 12px;
}

/* ---------- buttons ---------- */
.btn {
  display: block;
  width: 100%;
  border: none;
  border-radius: var(--radius);
  padding: 15px 16px;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
}
.btn-primary { background: var(--safety); color: #1A0D04; }
.btn-primary:active { background: var(--safety-dim); }
.btn-secondary { background: var(--ink-2); color: var(--paper); border: 1px solid var(--ink-3); }
.btn-danger { background: transparent; color: var(--stop); border: 1px solid var(--stop); }
.btn-block-row { display: flex; gap: 10px; }
.btn-block-row .btn { flex: 1; }

#end-day-bar {
  position: sticky;
  bottom: 0;
  padding-top: 14px;
  background: linear-gradient(to top, var(--ink-0) 60%, transparent);
}

/* ---------- forms ---------- */
.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 12px;
  color: var(--steel-1);
  margin-bottom: 5px;
  font-weight: 600;
}
.field input, .field textarea, .field select {
  width: 100%;
  background: var(--ink-2);
  border: 1px solid var(--ink-3);
  color: var(--paper);
  border-radius: var(--radius);
  padding: 12px 12px;
  font-size: 15px;
  font-family: inherit;
}
.field textarea { resize: vertical; min-height: 60px; }
.field input:focus, .field textarea:focus, .field select:focus {
  outline: 2px solid var(--safety);
  outline-offset: -1px;
}

/* ---------- project cards ---------- */
.proj-card {
  background: var(--ink-2);
  border: 1px solid var(--ink-3);
  border-left: 4px solid var(--steel-1);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
}
.proj-card.is-active { border-left-color: var(--go); }
.proj-card .pname { font-weight: 800; font-size: 15.5px; }
.proj-card .pmeta { color: var(--steel-1); font-size: 12.5px; margin-top: 2px; }
.proj-card .pactions { display: flex; gap: 8px; margin-top: 10px; }
.proj-card .pactions button {
  background: none; border: 1px solid var(--ink-3); color: var(--paper-dim);
  border-radius: var(--radius); padding: 7px 10px; font-size: 12.5px;
}

/* ---------- history ---------- */
.hist-row {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--ink-2); border: 1px solid var(--ink-3);
  border-radius: var(--radius); padding: 12px 14px; margin-bottom: 8px;
}
.hist-row .date { font-weight: 700; font-size: 14.5px; }
.hist-row .hours { font-family: var(--mono); color: var(--steel-1); font-size: 13px; }
.hist-row button {
  background: none; border: 1px solid var(--ink-3); color: var(--paper-dim);
  border-radius: var(--radius); padding: 7px 10px; font-size: 12.5px;
}

.week-total {
  background: var(--ink-2); border: 1px solid var(--ink-3);
  border-radius: var(--radius); padding: 14px; margin-bottom: 14px;
  display: flex; justify-content: space-between; align-items: baseline;
}
.week-total .num { font-family: var(--mono); font-size: 22px; font-weight: 800; color: var(--hazard); }

/* ---------- bottom nav ---------- */
nav#bottomnav {
  flex-shrink: 0;
  display: flex;
  background: var(--ink-1);
  border-top: 1px solid var(--ink-3);
  padding-bottom: env(safe-area-inset-bottom);
}
nav#bottomnav button {
  flex: 1;
  background: none;
  border: none;
  color: var(--steel-1);
  padding: 10px 4px 12px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
nav#bottomnav button.active { color: var(--safety); }
nav#bottomnav button .icn { display: block; font-size: 19px; margin-bottom: 2px; }

/* ---------- modal ---------- */
#modal-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 50;
  align-items: flex-end;
}
#modal-backdrop.show { display: flex; }
#modal {
  background: var(--ink-1);
  border-top: 3px solid var(--safety);
  border-radius: 10px 10px 0 0;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
}
#modal h2 { font-size: 16px; margin: 0 0 14px; }

.empty-state {
  text-align: center;
  color: var(--steel-1);
  padding: 40px 20px;
  font-size: 14px;
}
.empty-state .btn { margin-top: 16px; }

.toast {
  position: fixed; left: 16px; right: 16px; bottom: 76px;
  background: var(--go); color: #06210B;
  padding: 12px 16px; border-radius: var(--radius);
  font-weight: 700; font-size: 14px;
  text-align: center;
  z-index: 60;
  animation: toastin 0.15s ease-out;
}
@keyframes toastin { from { opacity:0; transform: translateY(6px);} to { opacity:1; transform: translateY(0);} }

.chip-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip {
  background: var(--ink-2); border: 1px solid var(--ink-3);
  padding: 6px 10px; border-radius: 20px; font-size: 12.5px;
  display: flex; align-items: center; gap: 6px;
}
.chip button { background:none; border:none; color: var(--stop); font-weight: 800; padding: 0; font-size: 14px; }
