/* Sherwood Toolbox - static layout mockup
   Shared chrome (sidebar + topbar) and form sketches for all pages.
   No framework, no CDN. Opens directly via file://. */

:root {
  --green-900: #16291a;
  --green-800: #203c23;
  --green-700: #2c5130;
  --green-500: #4a7c52;
  --sage-100: #e0e5d5;
  --sage-50: #eef1e6;
  --ink: #1c241c;
  --muted: #5d6b5a;
  --line: #cdd6c2;
  --card: #ffffff;
  --accent: #c98a2b;
  --danger: #9a3b2f;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.08);
  --sidebar-w: 248px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--sage-100);
  line-height: 1.5;
}

/* Layout shell */
.shell {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--green-800);
  color: #f3f6ee;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.sidebar-brand img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  background: transparent;
}

.sidebar-brand .brand-text {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.2px;
}

.sidebar-brand .brand-sub {
  display: block;
  font-weight: 400;
  font-size: 0.72rem;
  color: #c4d2bb;
}

.nav {
  list-style: none;
  margin: 0;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: 8px;
  color: #dce5d2;
  text-decoration: none;
  font-size: 0.92rem;
  transition: background 0.12s ease, color 0.12s ease;
}

.nav a svg { flex: 0 0 18px; width: 18px; height: 18px; }

.nav a:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }

.nav a.is-active {
  background: var(--sage-100);
  color: var(--green-900);
  font-weight: 600;
}

.nav-secondary {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}
.nav-secondary a { font-size: 0.85rem; opacity: 0.9; }

.sidebar-foot {
  margin-top: auto;
  padding: 14px 18px;
  font-size: 0.72rem;
  color: #aebda4;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

/* Main column */
.main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 28px;
  background: var(--sage-50);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 5;
}

.topbar h1 {
  margin: 0;
  font-size: 1.25rem;
  color: var(--green-900);
}

.topbar .subtitle {
  display: block;
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 400;
}

.badge {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--green-800);
  background: #fff;
  border: 1px solid var(--line);
  padding: 5px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.content {
  padding: 28px;
  max-width: 1040px;
  width: 100%;
}

/* Hub tile grid */
.tile-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.tile {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tile-icon {
  width: 46px;
  height: 46px;
  border-radius: 10px;
  background: var(--sage-50);
  color: var(--green-700);
  display: flex;
  align-items: center;
  justify-content: center;
}

.tile-icon svg { width: 26px; height: 26px; }

.tile h2 {
  margin: 0;
  font-size: 1.08rem;
  color: var(--green-900);
}

.tile p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  flex: 1 1 auto;
}

.tile .open-link {
  align-self: flex-start;
  margin-top: 4px;
}

/* Cards / panels for tool pages */
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 20px;
}

.panel h2 {
  margin: 0 0 4px;
  font-size: 1.05rem;
  color: var(--green-900);
}

.panel .panel-hint {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 0.86rem;
}

/* Forms */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.field { display: flex; flex-direction: column; gap: 6px; }
.field.full { grid-column: 1 / -1; }

.field label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--green-800);
}

.field .with-unit { position: relative; display: flex; align-items: center; }
.field .with-unit .unit {
  position: absolute;
  right: 12px;
  font-size: 0.78rem;
  color: var(--muted);
}

input[type="text"],
input[type="number"],
input[type="date"],
input[type="url"],
input[type="file"],
select,
textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.9rem;
  background: #fff;
  color: var(--ink);
  font-family: inherit;
}

textarea { resize: vertical; min-height: 70px; }

input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--green-500);
  outline-offset: 1px;
}

.checks { display: flex; flex-direction: column; gap: 9px; }
.checks label,
.radios label {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 0.9rem;
  color: var(--ink);
}
.radios { display: flex; gap: 22px; }

.inline-row { display: flex; gap: 10px; align-items: flex-end; }
.inline-row .field { flex: 1 1 auto; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
}

.btn-primary { background: var(--green-700); color: #fff; }
.btn-primary:hover { background: var(--green-800); }

.btn-secondary { background: #fff; color: var(--green-800); border-color: var(--line); }
.btn-secondary:hover { background: var(--sage-50); }

.btn-accent { background: var(--accent); color: #fff; }

.btn:disabled,
.btn.is-disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.button-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 6px;
}

/* Drop zone */
.dropzone {
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  background: var(--sage-50);
  padding: 34px;
  text-align: center;
  color: var(--muted);
}
.dropzone strong { color: var(--green-800); display: block; margin-bottom: 4px; }

/* Result placeholder */
.result-slot {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--sage-50);
  padding: 18px;
  color: var(--muted);
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
.result-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: var(--sage-50);
}
.result-card .rc-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}
.result-card .rc-head h3 { margin: 0; font-size: 0.96rem; color: var(--green-900); }
.result-card .rc-total { font-weight: 700; color: var(--green-700); }
.result-card .calc-line { font-size: 0.82rem; color: var(--muted); margin: 4px 0; }

/* Line items table */
.lineitems { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.lineitems th, .lineitems td {
  text-align: left;
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
}
.lineitems th { color: var(--green-800); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.4px; }
.lineitems td input { padding: 6px 8px; }
.lineitems .num { text-align: right; }
.lineitems tfoot td { font-weight: 700; color: var(--green-900); border-bottom: none; }

/* Thumbnail grid placeholder */
.thumb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 10px;
}
.thumb {
  aspect-ratio: 4 / 3;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--sage-50);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.74rem;
}

.signature-preview {
  height: 70px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--sage-50);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.8rem;
  font-style: italic;
}

.note {
  font-size: 0.8rem;
  color: var(--muted);
  background: var(--sage-50);
  border-left: 3px solid var(--green-500);
  padding: 10px 12px;
  border-radius: 0 8px 8px 0;
  margin-top: 16px;
}

/* Mobile: sidebar collapses to top nav */
@media (max-width: 820px) {
  .shell { flex-direction: column; }
  .sidebar {
    width: 100%;
    flex-basis: auto;
    height: auto;
    position: static;
    flex-direction: column;
  }
  .nav {
    flex-direction: row;
    flex-wrap: wrap;
    padding: 8px;
  }
  .nav a { font-size: 0.84rem; padding: 8px 10px; }
  .sidebar-foot { display: none; }
  .tile-grid, .form-grid, .results-grid { grid-template-columns: 1fr; }
  .content { padding: 18px; }
}

/* === SECTION: app utilities (added for the running app) === */
.hidden { display: none !important; }

/* Capability / status notice (offline, CRM not configured, etc.) */
.notice-bar {
  font-size: 0.84rem;
  color: var(--green-900);
  background: #fbf3e2;
  border: 1px solid #e8d9b5;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 18px;
}
.notice-bar.offline { background: #fbecec; border-color: #e6c4c0; }

/* Active sidebar link set server-side via request.blueprint */
.nav a.is-active { background: var(--sage-100); color: var(--green-900); font-weight: 600; }

/* CRM credential entry (shown when this machine has no saved CRM login) */
.crm-creds {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}
