/* Easy Accurate Mobile Office — phone-first field hub */
:root {
  --ea-mo-accent: #16a34a;
  --ea-mo-bg: #f4f6f8;
  --ea-mo-card: #ffffff;
  --ea-mo-text: #0f172a;
  --ea-mo-muted: #64748b;
  --ea-mo-border: #e2e8f0;
  --ea-mo-danger: #dc2626;
  --ea-mo-radius: 12px;
  --ea-mo-shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 4px 12px rgba(15, 23, 42, 0.04);
}

.ea-mo-hub,
.ea-mo-admin {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ea-mo-text);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

.ea-mo-hub {
  max-width: 920px;
  margin: 0 auto;
  padding: 12px;
  background: var(--ea-mo-bg);
  border-radius: var(--ea-mo-radius);
}

.ea-mo-header {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--ea-mo-card);
  border: 1px solid var(--ea-mo-border);
  border-radius: var(--ea-mo-radius);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--ea-mo-shadow);
}

.ea-mo-logo,
.ea-mo-doc-logo {
  width: 56px;
  height: 56px;
  object-fit: contain;
  border-radius: 8px;
  flex-shrink: 0;
}

.ea-mo-header h2 {
  margin: 0 0 4px;
  font-size: 1.25rem;
  font-weight: 700;
}

.ea-mo-header p {
  margin: 0;
  color: var(--ea-mo-muted);
  font-size: 0.9rem;
}

.ea-mo-form,
.ea-mo-print-setup,
.ea-mo-ai-output,
.ea-mo-preview,
.ea-mo-receipt,
.ea-mo-media-panel {
  background: var(--ea-mo-card);
  border: 1px solid var(--ea-mo-border);
  border-radius: var(--ea-mo-radius);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--ea-mo-shadow);
}

.ea-mo-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

.ea-mo-form label,
.ea-mo-print-row label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ea-mo-muted);
}

.ea-mo-form input,
.ea-mo-form select,
.ea-mo-form textarea,
.ea-mo-print-method {
  font: inherit;
  font-weight: 400;
  color: var(--ea-mo-text);
  border: 1px solid var(--ea-mo-border);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
  width: 100%;
  box-sizing: border-box;
}

.ea-mo-form input:focus,
.ea-mo-form select:focus,
.ea-mo-form textarea:focus,
.ea-mo-print-method:focus {
  outline: 2px solid color-mix(in srgb, var(--ea-mo-accent) 40%, transparent);
  border-color: var(--ea-mo-accent);
}

.ea-mo-form textarea {
  resize: vertical;
  min-height: 80px;
}

.ea-mo-muted {
  font-weight: 400;
  color: var(--ea-mo-muted);
  font-size: 0.75rem;
}

.ea-mo-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.ea-mo-btn {
  appearance: none;
  border: none;
  background: var(--ea-mo-accent);
  color: #fff;
  font: inherit;
  font-weight: 600;
  font-size: 0.92rem;
  padding: 11px 16px;
  border-radius: 10px;
  cursor: pointer;
  transition: filter 0.15s, transform 0.1s;
}

.ea-mo-btn:hover { filter: brightness(1.05); }
.ea-mo-btn:active { transform: scale(0.98); }
.ea-mo-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.ea-mo-btn-light {
  background: #f1f5f9;
  color: var(--ea-mo-text);
  border: 1px solid var(--ea-mo-border);
}

.ea-mo-btn-danger {
  background: var(--ea-mo-danger);
  color: #fff;
}

/* Media panel */
.ea-mo-media-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}

.ea-mo-media-head h3 {
  margin: 0 0 4px;
  font-size: 1rem;
}

.ea-mo-media-head p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--ea-mo-muted);
}

.ea-mo-upload-limit {
  font-size: 0.75rem;
  color: var(--ea-mo-muted);
  white-space: nowrap;
}

.ea-mo-media-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.ea-mo-media-status {
  font-size: 0.85rem;
  color: var(--ea-mo-muted);
  min-height: 1.2em;
  margin-bottom: 8px;
}

.ea-mo-media-status.is-error { color: var(--ea-mo-danger); }
.ea-mo-media-status.is-ok { color: var(--ea-mo-accent); }

.ea-mo-media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
}

.ea-mo-media-item {
  position: relative;
  border: 1px solid var(--ea-mo-border);
  border-radius: 10px;
  overflow: hidden;
  background: #f8fafc;
  aspect-ratio: 1;
}

.ea-mo-media-item img,
.ea-mo-media-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ea-mo-media-item .ea-mo-media-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.75);
  color: #fff;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ea-mo-media-item .ea-mo-media-label {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 4px 6px;
  font-size: 0.68rem;
  background: rgba(15, 23, 42, 0.7);
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* AI output */
.ea-mo-ai-output h3 {
  margin: 0 0 10px;
  font-size: 1.05rem;
}

.ea-mo-ai-body {
  white-space: pre-wrap;
  font-size: 0.92rem;
  line-height: 1.55;
}

.ea-mo-ai-body .ea-mo-ai-loading {
  color: var(--ea-mo-muted);
  font-style: italic;
}

/* Proposal preview */
.ea-mo-document {
  border: 1px solid var(--ea-mo-border);
  border-radius: 8px;
  padding: 20px;
  background: #fff;
}

.ea-mo-doc-head {
  display: flex;
  gap: 14px;
  align-items: center;
  border-bottom: 2px solid var(--ea-mo-accent);
  padding-bottom: 12px;
  margin-bottom: 16px;
}

.ea-mo-doc-head h2 {
  margin: 0 0 2px;
  font-size: 1.2rem;
}

.ea-mo-doc-head p {
  margin: 0;
  color: var(--ea-mo-muted);
  font-size: 0.85rem;
}

.ea-mo-preview-body h3 {
  margin: 16px 0 6px;
  font-size: 1rem;
  color: var(--ea-mo-accent);
}

.ea-mo-preview-body p,
.ea-mo-preview-body li {
  font-size: 0.92rem;
}

.ea-mo-terms {
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px dashed var(--ea-mo-border);
  font-size: 0.8rem;
  color: var(--ea-mo-muted);
}

.ea-mo-doc-bold .ea-mo-doc-head {
  border-bottom-width: 4px;
}

.ea-mo-doc-classic .ea-mo-doc-head {
  border-bottom-style: double;
  border-bottom-width: 3px;
}

/* Receipt */
.ea-mo-receipt-paper {
  font-family: "Courier New", Courier, monospace;
  font-size: 12px;
  line-height: 1.35;
  white-space: pre-wrap;
  background: #fff;
  border: 1px dashed #94a3b8;
  padding: 12px;
  margin: 0 0 12px;
  max-width: 100%;
  overflow-x: auto;
}

.ea-mo-receipt[data-width="58mm"] .ea-mo-receipt-paper {
  max-width: 240px;
}

.ea-mo-receipt[data-width="80mm"] .ea-mo-receipt-paper {
  max-width: 320px;
}

/* Printer setup */
.ea-mo-print-setup h3 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.ea-mo-print-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
}

.ea-mo-print-row label {
  flex: 1 1 200px;
}

.ea-mo-printer-status {
  font-size: 0.85rem;
  color: var(--ea-mo-muted);
}

.ea-mo-printer-status.is-ok { color: var(--ea-mo-accent); }
.ea-mo-printer-status.is-error { color: var(--ea-mo-danger); }

/* Admin */
.ea-mo-admin .ea-mo-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 20px;
  align-items: start;
}

.ea-mo-admin .ea-mo-card {
  background: #fff;
  border: 1px solid #c3c4c7;
  border-radius: 4px;
  padding: 16px 20px 20px;
  box-shadow: 0 1px 1px rgba(0,0,0,.04);
}

.ea-mo-admin .ea-mo-logo-preview img {
  max-width: 120px;
  margin-top: 8px;
  display: block;
}

.ea-mo-admin .ea-mo-keyrow {
  margin: 0 0 8px;
}

.ea-mo-admin .ea-mo-test-result {
  margin-left: 8px;
  font-weight: 600;
}

.ea-mo-admin .ea-mo-test-result.is-ok { color: #16a34a; }
.ea-mo-admin .ea-mo-test-result.is-error { color: #dc2626; }

/* Print */
@media print {
  body * { visibility: hidden; }
  .ea-mo-preview,
  .ea-mo-preview * {
    visibility: visible;
  }
  .ea-mo-preview {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    box-shadow: none;
    border: none;
  }
  .ea-mo-preview .ea-mo-actions { display: none; }
}

/* Mobile */
@media (max-width: 640px) {
  .ea-mo-form-grid {
    grid-template-columns: 1fr;
  }
  .ea-mo-admin .ea-mo-grid {
    grid-template-columns: 1fr;
  }
  .ea-mo-header {
    flex-direction: column;
    text-align: center;
  }
  .ea-mo-media-actions .ea-mo-btn {
    flex: 1 1 auto;
  }
}

/* Proposal pricing table (from v0.4) */
.ea-mo-preview-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
}
.ea-mo-preview-body td,
.ea-mo-preview-body th {
  border-bottom: 1px solid var(--ea-mo-border);
  padding: 10px;
  text-align: left;
}
.ea-mo-error {
  color: var(--ea-mo-danger);
  font-weight: 700;
}
.ea-mo-ai-body pre {
  white-space: pre-wrap;
  font-family: inherit;
  margin: 0;
}

/* Measurements & Materials panels */
.ea-mo-measure-panel,
.ea-mo-materials-panel {
  background: var(--ea-mo-card);
  border: 1px solid var(--ea-mo-border);
  border-radius: var(--ea-mo-radius);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--ea-mo-shadow);
}

.ea-mo-measure-form {
  margin-bottom: 10px;
}

.ea-mo-actions-tight {
  margin-bottom: 10px;
  gap: 8px;
}

.ea-mo-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.ea-mo-data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.ea-mo-data-table th,
.ea-mo-data-table td {
  border-bottom: 1px solid var(--ea-mo-border);
  padding: 8px 6px;
  text-align: left;
  vertical-align: top;
}

.ea-mo-data-table th {
  color: var(--ea-mo-muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.ea-mo-data-table tfoot th {
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.85rem;
  color: var(--ea-mo-text);
}

.ea-mo-link-btn {
  background: none;
  border: none;
  color: var(--ea-mo-danger);
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}

.ea-mo-search-row {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.ea-mo-search-row input[type="search"] {
  flex: 1;
  font: inherit;
  border: 1px solid var(--ea-mo-border);
  border-radius: 8px;
  padding: 10px 12px;
}

.ea-mo-product-results {
  border: 1px solid var(--ea-mo-border);
  border-radius: 10px;
  background: #f8fafc;
  max-height: 240px;
  overflow-y: auto;
  margin-bottom: 10px;
  padding: 6px;
}

.ea-mo-product-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
}

.ea-mo-product-row:hover {
  background: #fff;
}

.ea-mo-btn-sm {
  padding: 6px 10px !important;
  font-size: 0.8rem !important;
  white-space: nowrap;
}

.ea-mo-compare-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  margin-bottom: 12px;
  font-size: 0.85rem;
}

.ea-mo-compare-links a {
  color: var(--ea-mo-accent);
  font-weight: 600;
  text-decoration: none;
}

.ea-mo-compare-links a:hover {
  text-decoration: underline;
}

/* Professional proposal extras */
.ea-mo-prop-table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0 14px;
  font-size: 0.9rem;
}

.ea-mo-prop-table th,
.ea-mo-prop-table td {
  border-bottom: 1px solid var(--ea-mo-border);
  padding: 8px 10px;
  text-align: left;
}

.ea-mo-prop-table th {
  background: #f8fafc;
}

.ea-mo-prop-media {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin: 10px 0 16px;
}

.ea-mo-prop-media figure {
  margin: 0;
  border: 1px solid var(--ea-mo-border);
  border-radius: 8px;
  overflow: hidden;
  background: #f8fafc;
}

.ea-mo-prop-media img,
.ea-mo-prop-media video {
  width: 100%;
  height: 120px;
  object-fit: cover;
  display: block;
}

.ea-mo-prop-media figcaption {
  font-size: 0.72rem;
  padding: 4px 6px;
  color: var(--ea-mo-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ea-mo-doc-meta {
  font-size: 0.85rem;
  color: var(--ea-mo-muted);
  margin: 0 0 8px;
}

@media print {
  .ea-mo-measure-panel,
  .ea-mo-materials-panel,
  .ea-mo-media-panel,
  .ea-mo-print-setup,
  .ea-mo-form,
  .ea-mo-ai-output {
    display: none !important;
  }
  .ea-mo-preview {
    display: block !important;
  }
  .ea-mo-prop-media img,
  .ea-mo-prop-media video {
    height: 100px;
  }
}

/* Live pricing */
.ea-mo-live-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #065f46;
  background: #d1fae5;
  border-radius: 999px;
  padding: 4px 10px;
  margin-bottom: 8px;
}

.ea-mo-tag-live {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #065f46;
  background: #a7f3d0;
  border-radius: 4px;
  padding: 1px 5px;
  vertical-align: middle;
}

.ea-mo-product-link {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ea-mo-accent);
  margin-left: 6px;
  text-decoration: none;
}

.ea-mo-product-link:hover {
  text-decoration: underline;
}

.ea-mo-live-badge.is-cached {
  color: #1e3a8a;
  background: #dbeafe;
}

/* Native app chrome */
.ea-mo-hub.ea-mo-native-app .ea-mo-media-actions {
  flex-wrap: wrap;
}
