/* Shared styles for all pages. Ported from the artifact CSS with light
   additions for the multi-page web app (topbar with user info, landing
   page cards). */

:root { color-scheme: light; }
* { box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #1a1a1a;
  background: #fafafa;
  margin: 0;
  padding: 0;
}
.page {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 24px 40px;
}
.page.narrow { max-width: 760px; }

/* Top bar */
.appbar {
  background: white;
  border-bottom: 1px solid #e5e5e5;
  padding: 12px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}
.appbar .brand { font-weight: 700; font-size: 15px; color: #1a1a1a; text-decoration: none; }
.appbar .brand small { font-weight: 400; color: #888; margin-left: 8px; }
.appbar nav { display: flex; gap: 14px; align-items: center; font-size: 13px; }
.appbar nav a { color: #444; text-decoration: none; padding: 4px 8px; border-radius: 6px; }
.appbar nav a:hover { background: #f3f3f3; }
.appbar .user { color: #666; font-size: 13px; }
.appbar .user .name { color: #1a1a1a; font-weight: 600; margin-right: 6px; }

/* Headings */
h1 { font-size: 22px; margin: 0 0 4px; }
.subtitle { color: #666; font-size: 13px; margin-bottom: 20px; }

/* Cards */
.card {
  background: white;
  border: 1px solid #e5e5e5;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
}
.card h2 {
  font-size: 15px;
  margin: 0 0 14px;
  color: #333;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Info boxes (status banners that aren't transient) */
.infobox {
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 13px;
  line-height: 1.5;
  color: #1a1a1a;
}
.infobox.blue { background: #f0f6ff; border: 1px solid #cfe3ff; }
.infobox.orange { background: #fff3e0; border: 1px solid #ffd699; }

/* Layout */
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 10px; }
.row.three { grid-template-columns: 1fr 1fr 1fr; }
.row.single { grid-template-columns: 1fr; }

label { display: block; font-size: 12px; font-weight: 600; color: #555; margin-bottom: 4px; }
label .req { color: #d33; margin-left: 2px; }
label .hint { font-weight: 400; color: #999; margin-left: 6px; }

input[type=text], input[type=email], input[type=tel], input[type=number],
input[type=date], textarea, select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #d0d0d0;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  background: white;
}
textarea { min-height: 60px; resize: vertical; }
input:focus, textarea:focus, select:focus {
  outline: 2px solid #5b9bff;
  outline-offset: -1px;
  border-color: #5b9bff;
}
.checkbox-row { display: flex; align-items: center; gap: 6px; padding-top: 22px; }
.checkbox-row input { width: auto; }

/* Buttons */
.btn {
  background: #1a1a1a;
  color: white;
  border: none;
  padding: 10px 18px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
}
.btn:hover { background: #333; }
.btn:disabled { background: #ccc; cursor: not-allowed; }
.btn-secondary {
  background: white;
  color: #333;
  border: 1px solid #d0d0d0;
  padding: 10px 18px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
}
.btn-secondary:hover { background: #f3f3f3; }
.btn-primary-warn { background: #c5552b; color: white; }
.btn-primary-warn:hover { background: #a64422; }
.btn-danger-text { background: transparent; color: #c33; border: none; cursor: pointer; font-size: 12px; padding: 4px 8px; }
.btn-add {
  background: white;
  color: #5b9bff;
  border: 1px dashed #5b9bff;
  padding: 12px;
  width: 100%;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  margin-top: 4px;
}
.btn-add:hover { background: #f0f6ff; }
.btn-inline {
  background: transparent;
  border: 1px solid #d0d0d0;
  color: #1a1a1a;
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 6px;
  cursor: pointer;
}
.btn-inline:hover { background: #f0f6ff; }

.footer-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 8px;
}

/* Status banners (transient) */
.status { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.status.loading { background: #fff8e1; color: #6b5500; border: 1px solid #ffe082; }
.status.error { background: #fdecea; color: #b3261e; border: 1px solid #f5c6cb; }
.status.success { background: #e8f5e9; color: #1b5e20; border: 1px solid #a5d6a7; }

.success-list { margin-top: 10px; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 13px; }
.success-list a { color: #1b5e20; text-decoration: underline; }

.hidden { display: none !important; }
.field-with-button { display: flex; gap: 6px; align-items: stretch; }
.field-with-button select { flex: 1; }

/* Modals */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,0.4); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal { background: white; border-radius: 12px; padding: 24px; max-width: 480px; width: 90%; box-shadow: 0 20px 60px rgba(0,0,0,0.2); }
.modal h3 { margin: 0 0 12px; font-size: 17px; }
.modal .row { grid-template-columns: 1fr; }
.modal .footer-actions { padding-top: 16px; }

/* Unit cards (intake) */
.unit-card { background: #f9fafb; border: 1px solid #e5e5e5; border-radius: 10px; padding: 16px; margin-bottom: 12px; position: relative; }
.unit-card .unit-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.unit-card .unit-num { font-weight: 700; font-size: 14px; color: #5b9bff; }

/* Type toggle (intake) */
.type-toggle { display: inline-flex; gap: 0; background: #eee; padding: 3px; border-radius: 8px; }
.type-toggle label { display: flex; align-items: center; gap: 5px; padding: 5px 10px; margin: 0; cursor: pointer; border-radius: 6px; font-size: 13px; font-weight: 500; color: #555; }
.type-toggle label:has(input:checked) { background: white; color: #1a1a1a; box-shadow: 0 1px 2px rgba(0,0,0,0.08); }
.type-toggle input { margin: 0; width: auto; }

/* Repair preview (convert form) */
.repair-summary { background: #f7f9fc; border: 1px solid #e1e7ef; border-radius: 8px; padding: 14px 16px; font-size: 13px; line-height: 1.7; }
.repair-summary .label { color: #666; font-weight: 600; }
.repair-summary .value { color: #1a1a1a; }
.repair-summary .grid { display: grid; grid-template-columns: 130px 1fr; gap: 4px 14px; }
.arrow { color: #c5552b; font-weight: 700; }
.preview-table { width: 100%; margin-top: 12px; font-size: 13px; border-collapse: collapse; }
.preview-table th { text-align: left; padding: 6px 8px; background: #f3f3f3; color: #555; font-weight: 600; font-size: 11px; text-transform: uppercase; }
.preview-table td { padding: 8px; border-top: 1px solid #eee; vertical-align: top; }
.preview-table .before { color: #888; }
.preview-table .after { color: #1a1a1a; font-weight: 500; }

/* Landing page tiles */
.tile-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin-top: 20px; }
.tile {
  display: block;
  background: white;
  border: 1px solid #e5e5e5;
  border-radius: 12px;
  padding: 20px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, transform 0.15s;
}
.tile:hover { border-color: #5b9bff; transform: translateY(-1px); }
.tile h3 { margin: 0 0 6px; font-size: 16px; color: #1a1a1a; }
.tile p { margin: 0; font-size: 13px; color: #666; line-height: 1.5; }
