*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: system-ui, -apple-system, sans-serif;
  background: #f4f6f8;
  color: #1a1a2e;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  background: #1a1a2e;
  color: #fff;
  padding: 12px 24px;
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 16px;
}
.logo {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.tagline {
  font-size: 0.85rem;
  opacity: 0.65;
  flex: 1;
}
.logout-link {
  color: #aac4ff;
  font-size: 0.85rem;
  text-decoration: none;
}
.logout-link:hover { text-decoration: underline; }

main {
  flex: 1;
  padding: 24px;
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
}

footer {
  text-align: center;
  font-size: 0.75rem;
  color: #888;
  padding: 16px;
  border-top: 1px solid #e0e0e0;
}

/* Login */
body.login-page {
  justify-content: center;
  align-items: center;
  background: #1a1a2e;
}
.login-box {
  background: #fff;
  border-radius: 10px;
  padding: 40px 36px;
  width: 340px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.25);
}
.login-box h1 {
  font-size: 1.8rem;
  margin-bottom: 6px;
}
.login-sub {
  color: #666;
  font-size: 0.85rem;
  margin-bottom: 24px;
}
.login-box label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 6px;
}
.login-box input[type='password'] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 1rem;
  margin-bottom: 12px;
}
.login-box button {
  width: 100%;
  padding: 11px;
  background: #1a1a2e;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  cursor: pointer;
}
.login-box button:hover { background: #2d2d4e; }
.error {
  color: #c0392b;
  font-size: 0.85rem;
  margin-bottom: 10px;
}

/* Cards */
.card {
  background: #fff;
  border-radius: 10px;
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.07);
}
.card h2 {
  font-size: 1.1rem;
  margin-bottom: 10px;
  color: #1a1a2e;
}
.card p {
  font-size: 0.9rem;
  color: #555;
  margin-bottom: 12px;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 9px 18px;
  background: #1a1a2e;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 0.88rem;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { background: #2d2d4e; }
.btn-secondary { background: #6c757d; }
.btn-secondary:hover { background: #565e64; }
.btn-sm { padding: 6px 12px; font-size: 0.82rem; }
.btn-warn { background: #f39c12; }
.btn-warn:hover { background: #d68910; }
.btn-danger { background: #c0392b; }
.btn-danger:hover { background: #a93226; }

.image-controls { display: flex; gap: 10px; flex-wrap: wrap; }

/* Canvas */
.canvas-toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.canvas-wrap {
  border: 2px dashed #ccc;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 14px;
  background: #e8ecf0;
  display: flex;
  justify-content: center;
}
canvas { display: block; cursor: crosshair; max-width: 100%; }

.calibration-row, .manual-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
  font-size: 0.88rem;
}
.calibration-row input, .manual-row input {
  width: 100px;
  padding: 6px 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
}
.status-badge {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.78rem;
  background: #f0f0f0;
  color: #666;
}
.status-badge.calibrated { background: #d4edda; color: #155724; }

.lf-display { font-size: 1rem; margin-top: 10px; color: #1a1a2e; }

/* Quote */
.fence-type-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  font-size: 0.9rem;
}
.fence-type-row select {
  padding: 8px 12px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 0.9rem;
}

.quote-output { margin-top: 8px; }
.quote-output h3 { margin-bottom: 12px; }
.quote-table { width: 100%; border-collapse: collapse; margin-bottom: 16px; }
.quote-table td { padding: 8px 12px; border-bottom: 1px solid #eee; font-size: 0.9rem; }
.quote-table td:first-child { color: #666; width: 40%; }
.quote-table td:last-child { font-weight: 600; }

.disclaimer {
  font-size: 0.82rem;
  color: #666;
  background: #fff8e1;
  border-left: 3px solid #f39c12;
  padding: 10px 14px;
  border-radius: 4px;
  margin-bottom: 16px;
}
.export-row { display: flex; gap: 10px; flex-wrap: wrap; }
