:root {
  --bg: #faf9f6;
  --surface: #ffffff;
  --border: #e5e1d8;
  --ink: #1c1b18;
  --ink-soft: #6b675e;
  --placeholder: #a6a196;
  --accent: #0e7490;
  --accent-dark: #0b5d74;
  --accent-soft: #e3f2f5;
  --success: #15803d;
  --success-soft: #e7f5ec;
  --danger: #b42318;
  --danger-soft: #fdeceb;
  --radius: 12px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: #ece8de;
  color: var(--ink);
  font-family: 'Work Sans', system-ui, sans-serif;
}

h1,
h2,
h3 {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  margin: 0;
}

a {
  color: var(--accent);
}

button {
  font-family: inherit;
}

input,
textarea {
  font-family: inherit;
}

::placeholder {
  color: var(--placeholder);
}

/* A phone-width card centered in the browser window, so a wide desktop
   window still shows the technician's actual (phone) experience. On a
   narrow/mobile viewport it just fills the screen. */
#frame {
  min-height: 100%;
  display: flex;
  justify-content: center;
  align-items: stretch;
}

#app {
  width: 100%;
  max-width: 430px;
  min-height: 100vh;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}

@media (min-width: 480px) {
  #frame {
    align-items: center;
    padding: 40px 16px;
  }

  #app {
    min-height: 844px;
    max-height: 90vh;
    border-radius: 28px;
    box-shadow: 0 20px 60px rgba(28, 27, 24, 0.18);
    overflow: hidden;
  }
}

.screen {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  padding: 28px 24px 24px;
  overflow-y: auto;
}

.spacer {
  flex-grow: 1;
}

/* Top bar shown on every screen once logged in */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 0;
}

.top-bar .greeting {
  font-size: 13px;
  color: var(--ink-soft);
}

.top-bar .logout {
  background: none;
  border: none;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 0;
}

.top-bar .logout:hover {
  color: var(--ink);
}

/* Login logo block */
.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-top: 40px;
}

.brand-icon {
  width: 56px;
  height: 56px;
  border-radius: 999px;
  background: var(--accent-soft);
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-kicker {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 2px;
  color: var(--ink-soft);
}

.brand h1 {
  font-size: 28px;
  font-weight: 700;
}

.subtitle {
  margin-top: 8px;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink-soft);
}

.pill {
  display: inline-flex;
  align-self: flex-start;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 600;
}

.pill.success {
  background: var(--success-soft);
  color: var(--success);
}

.pill .dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: currentColor;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
}

.field input,
.field textarea {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 16px;
  background: var(--surface);
  color: var(--ink);
}

.field textarea {
  resize: none;
}

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: 32px;
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 16px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 16px;
  border: none;
  cursor: pointer;
  text-align: center;
}

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

.btn-primary:hover {
  background: var(--accent-dark);
}

.btn-primary:disabled,
.btn-primary.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-ghost {
  background: transparent;
  color: var(--ink-soft);
  border: 1px solid var(--border);
}

.footer-note {
  text-align: center;
  font-size: 13px;
  color: var(--ink-soft);
}

.error-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 14px;
  margin-bottom: 16px;
}

/* Machine search + selectable cards (Start Job screen) */
.section {
  margin-bottom: 28px;
}

.section-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 10px;
}

.search-wrap {
  position: relative;
  margin-bottom: 12px;
}

.search-wrap svg {
  position: absolute;
  left: 14px;
  top: 13px;
  pointer-events: none;
}

.search-wrap input {
  padding-left: 40px;
}

.card-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.card-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 14px;
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  background: var(--surface);
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.card-btn.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.card-btn .title {
  font-size: 14px;
  font-weight: 600;
}

.card-btn .sub {
  font-size: 13px;
  color: var(--ink-soft);
}

.card-btn .grow {
  flex-grow: 1;
}

.card-btn .check {
  color: var(--accent);
}

.empty-state {
  font-size: 14px;
  color: var(--ink-soft);
  padding: 16px 0;
}

/* Sticky action bar at the bottom of Start Job / Finish screens */
.action-bar {
  padding: 16px 24px 28px;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

/* In-progress timer */
.timer-wrap {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.timer-label {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 1.5px;
  color: var(--ink-soft);
}

.timer-value {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: 60px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* Photo upload */
.upload-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 160px;
  border: 1.5px dashed #c9c4b8;
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 600;
}

.photo-preview-wrap {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
}

.photo-preview-wrap img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  display: block;
}

.retake-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 6px 12px;
  border-radius: 999px;
  border: none;
  background: rgba(28, 27, 24, 0.7);
  color: #ffffff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

/* Success summary */
.success-icon {
  width: 72px;
  height: 72px;
  border-radius: 999px;
  background: var(--success-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
}

.summary-card {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 24px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
}

.summary-row .k {
  color: var(--ink-soft);
}

.summary-row .v {
  font-weight: 600;
  text-align: right;
}

.zoho-note {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  line-height: 1.5;
}

.zoho-note.mock {
  background: #fdf6e9;
  color: #8a5a00;
}

.zoho-note.error {
  background: var(--danger-soft);
  color: var(--danger);
}

.loading {
  text-align: center;
  color: var(--ink-soft);
  font-size: 14px;
  padding: 40px 0;
}
